mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:35:45 +00:00
- 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. svn path=/trunk/; revision=38087
This commit is contained in:
parent
39324400b9
commit
2f3c5f280b
1 changed files with 25 additions and 13 deletions
|
@ -317,7 +317,7 @@ OutputDebugStringA(LPCSTR _OutputString)
|
||||||
#if 0
|
#if 0
|
||||||
__try
|
__try
|
||||||
#else
|
#else
|
||||||
do
|
do
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* size of the current output block */
|
/* size of the current output block */
|
||||||
|
@ -326,17 +326,10 @@ OutputDebugStringA(LPCSTR _OutputString)
|
||||||
/* size of the remainder of the string */
|
/* size of the remainder of the string */
|
||||||
SIZE_T nOutputStringLen;
|
SIZE_T nOutputStringLen;
|
||||||
|
|
||||||
for
|
/* output the whole string */
|
||||||
(
|
nOutputStringLen = strlen(_OutputString);
|
||||||
/* output the whole string */
|
|
||||||
nOutputStringLen = strlen(_OutputString);
|
|
||||||
|
|
||||||
/* repeat until the string has been fully output */
|
do
|
||||||
nOutputStringLen > 0;
|
|
||||||
|
|
||||||
/* move to the next block */
|
|
||||||
_OutputString += nRoundLen, nOutputStringLen -= nRoundLen
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* we're connected to the debug monitor:
|
/* we're connected to the debug monitor:
|
||||||
write the current block to the shared buffer */
|
write the current block to the shared buffer */
|
||||||
|
@ -375,21 +368,40 @@ OutputDebugStringA(LPCSTR _OutputString)
|
||||||
CHAR a_cBuffer[512];
|
CHAR a_cBuffer[512];
|
||||||
|
|
||||||
/* write a maximum of 511 bytes */
|
/* write a maximum of 511 bytes */
|
||||||
if(nOutputStringLen > (sizeof(a_cBuffer) - 1))
|
if(nOutputStringLen > (sizeof(a_cBuffer) - 2))
|
||||||
nRoundLen = sizeof(a_cBuffer) - 1;
|
nRoundLen = sizeof(a_cBuffer) - 2;
|
||||||
else
|
else
|
||||||
nRoundLen = nOutputStringLen;
|
nRoundLen = nOutputStringLen;
|
||||||
|
|
||||||
/* copy the current block */
|
/* copy the current block */
|
||||||
memcpy(a_cBuffer, _OutputString, nRoundLen);
|
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 */
|
/* null-terminate the current block */
|
||||||
a_cBuffer[nRoundLen] = 0;
|
a_cBuffer[nRoundLen] = 0;
|
||||||
|
|
||||||
/* send the current block to the kernel debugger */
|
/* send the current block to the kernel debugger */
|
||||||
DbgPrint("%s", a_cBuffer);
|
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
|
#if 0
|
||||||
/* ignore access violations and let other exceptions fall through */
|
/* ignore access violations and let other exceptions fall through */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue