István,
.................................. and inserts the necessary CR/LF for windbg
AFAIK only need '\n', if you like to jump the line and with DebugView, OutputDebugString() always introduce a line/entry into the debugger displays for each call, ended or not with '\n'. If you insert '\n' in the middle of the string, this is divided into two lines/entries but you can not put two calls into the same line/entry. Now with your change this always happens.
Please check with the DebugView .- http://technet.microsoft.com/es-es/sysinternals/bb896647%28en-us%29.aspx IMO should be user of function who choose to do. In my case I prefer as it was before. :) -- Xavi El 27/12/2009 19:37, Bisz István escribió:
Hi Viktor, This solution strips the trailing isspace characters from the debug info and inserts the necessary CR/LF for windbg, not more. Maybe we can define here a lot of similar solutions for the same thing. Best regards, István -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Viktor Szakáts Sent: 2009. december 27. 19:27 To: Harbour Project Main Developer List. Subject: [Harbour] Re: SF.net SVN: harbour-project:[13399] trunk/harbour/src/common/hbtrace.c Hi Istvan,+ /* + * sizeof( buffer2 ) - 3 is room for CR/LF/NUL + */ if( proc ) - hb_snprintf( buffer2, sizeof( buffer2 ), "%s:%d:%s() %s %s", - file, line, proc, pszLevel, buffer1 ); + n = hb_snprintf( buffer2, sizeof( buffer2 ) - 3, "%s:%d:%s() %s%s",+ file, line, proc, pszLevel, buffer1 ); else - hb_snprintf( buffer2, sizeof( buffer2 ), "%s:%d: %s %s", - file, line, pszLevel, buffer1 ); + n = hb_snprintf( buffer2, sizeof( buffer2 ) - 3, "%s:%d: %s %s", + file, line, pszLevel, buffer1 ); + /* + * Normalize buffer2 with ending CR/LF/NUL + */ + p = buffer2; + p += (n< 0) ? sizeof( buffer2 ) - 3 : n; + while ( p> buffer2&& isspace( p[-1] ) ) + { + *--p = '\0'; + } + *p++ = '\r'; + *p++ = '\n'; + *p = '\0'; +Maybe I'm missing something but isn't hb_snprintf() _always_ closing string with a zero? If not, we have serious security problems in hundreds of places in Harbour. If this is the case, we should rather fix hb_snprintf(), than this one specific call of it. Also, shouldn't \r \n simply added to printf mask string? Brgds, Viktor
_______________________________________________ Harbour mailing list (attachment size limit: 40KB) [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour
