Issue #383 - correct another byte-by-byte output to message file.

As in the previous case these messages are already valid utf-8 text, and
thus, if output on a byte-by-byte basis, must not use WriteChar, except
for the EOL char.

Of course this output can be to either a user ouput file, if configured,
otherwise stderr.
This commit is contained in:
Geoff McLane 2016-03-23 19:42:03 +01:00
parent ad7bdee3b9
commit 5feca8cfd6

View file

@ -368,23 +368,26 @@ void tidy_out( TidyDocImpl* doc, ctmbstr msg, ... )
{ {
if ( !cfgBool(doc, TidyQuiet) ) if ( !cfgBool(doc, TidyQuiet) )
{ {
TidyOutputSink *outp = &doc->errout->sink;
ctmbstr cp; ctmbstr cp;
enum { sizeBuf=2048 }; enum { sizeBuf=2048 };
char *buf = (char *)TidyDocAlloc(doc,sizeBuf); char *buf = (char *)TidyDocAlloc(doc,sizeBuf);
byte b;
va_list args; va_list args;
va_start( args, msg ); va_start( args, msg );
TY_(tmbvsnprintf)(buf, sizeBuf, msg, args); TY_(tmbvsnprintf)(buf, sizeBuf, msg, args);
va_end( args ); va_end( args );
#if !defined(NDEBUG) && defined(_MSC_VER)
add_std_out(0);
#endif
for ( cp=buf; *cp; ++cp ) for ( cp=buf; *cp; ++cp )
TY_(WriteChar)( *cp, doc->errout ); {
#if !defined(NDEBUG) && defined(_MSC_VER) b = (*cp & 0xff);
add_std_out(1); if (b == (byte)'\n')
#endif TY_(WriteChar)( b, doc->errout ); /* for EOL translation */
else
outp->putByte( outp->sinkData, b ); /* #383 - no encoding */
}
TidyDocFree(doc, buf); TidyDocFree(doc, buf);
} }
} }