Author: tkreuzer
Date: Sun Dec 14 17:18:59 2008
New Revision: 38087
URL:
http://svn.reactos.org/svn/reactos?rev=38087&view=rev
Log:
- Replace a 'for' with a 'do .. while '
- Make sure OutputDebugStringA terminates with a newline
Fixes winetest debug output. I wonder how it worked before. Dedicated to Stefan100.
Modified:
trunk/reactos/dll/win32/kernel32/debug/output.c
Modified: trunk/reactos/dll/win32/kernel32/debug/output.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/debug/o…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] Sun Dec 14 17:18:59 2008
@@ -317,7 +317,7 @@
#if 0
__try
#else
- do
+ do
#endif
{
/* size of the current output block */
@@ -326,17 +326,10 @@
/* size of the remainder of the string */
SIZE_T nOutputStringLen;
- for
- (
- /* output the whole string */
- nOutputStringLen = strlen(_OutputString);
-
- /* repeat until the string has been fully output */
- nOutputStringLen > 0;
-
- /* move to the next block */
- _OutputString += nRoundLen, nOutputStringLen -= nRoundLen
- )
+ /* output the whole string */
+ nOutputStringLen = strlen(_OutputString);
+
+ do
{
/* we're connected to the debug monitor:
write the current block to the shared buffer */
@@ -375,13 +368,25 @@
CHAR a_cBuffer[512];
/* write a maximum of 511 bytes */
- if(nOutputStringLen > (sizeof(a_cBuffer) - 1))
- nRoundLen = sizeof(a_cBuffer) - 1;
+ if(nOutputStringLen > (sizeof(a_cBuffer) - 2))
+ nRoundLen = sizeof(a_cBuffer) - 2;
else
nRoundLen = nOutputStringLen;
/* copy the current block */
memcpy(a_cBuffer, _OutputString, nRoundLen);
+
+ /* Have we reached the end of the string? */
+ if (nRoundLen == nOutputStringLen)
+ {
+ /* Make sure we terminate with a line break */
+ if (a_cBuffer[nRoundLen - 1] != '\n')
+ {
+ a_cBuffer[nRoundLen] = '\n';
+ nRoundLen++;
+ nOutputStringLen++;
+ }
+ }
/* null-terminate the current block */
a_cBuffer[nRoundLen] = 0;
@@ -389,7 +394,14 @@
/* send the current block to the kernel debugger */
DbgPrint("%s", a_cBuffer);
}
+
+ /* move to the next block */
+ _OutputString += nRoundLen;
+ nOutputStringLen -= nRoundLen;
}
+ /* repeat until the string has been fully output */
+ while (nOutputStringLen > 0);
+
}
#if 0
/* ignore access violations and let other exceptions fall through */