Commit 9772d022 authored by Alexandre Julliard's avatar Alexandre Julliard

Make output line-buffered to avoid messing up log files.

parent e9d334d0
...@@ -92,8 +92,28 @@ static HANDLE dbg_houtput; ...@@ -92,8 +92,28 @@ static HANDLE dbg_houtput;
void dbg_outputA(const char* buffer, int len) void dbg_outputA(const char* buffer, int len)
{ {
DWORD w; static char line_buff[4096];
WriteFile(dbg_houtput, buffer, len, &w, NULL); static unsigned int line_pos;
DWORD w, i;
while (len > 0)
{
unsigned int count = min( len, sizeof(line_buff) - line_pos );
memcpy( line_buff + line_pos, buffer, count );
buffer += count;
len -= count;
line_pos += count;
for (i = line_pos; i > 0; i--) if (line_buff[i-1] == '\n') break;
if (!i) /* no newline found */
{
if (len > 0) i = line_pos; /* buffer is full, flush anyway */
else break;
}
WriteFile(dbg_houtput, line_buff, i, &w, NULL);
memmove( line_buff, line_buff + i, line_pos - i );
line_pos -= i;
}
} }
void dbg_outputW(const WCHAR* buffer, int len) void dbg_outputW(const WCHAR* buffer, int len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment