void show_hexified(char *from, int hlen, int flag) { static char _s_hex_pad[16 * 5]; static char _s_asc_pad[32]; int i, c, off; char *ph = _s_hex_pad; char *pa = _s_asc_pad; *ph = 0; off = 0; for (i = 0; i < hlen; i++) { c = ( from[i] & 0xff ); sprintf(EndBuf(ph),"%02x ", c); if ((c < ' ')||(c >= 0x7f)) c = '.'; pa[off++] = (char)c; if (off == 16) { pa[off] = 0; SPRTF("%s %s\n", ph, pa); off = 0; *ph = 0; } } if (off) { pa[off] = 0; while(off < 16) { strcat(ph," "); off++; } SPRTF("%s %s\n", ph, pa); } }
static void messagePos( TidyDocImpl* doc, TidyReportLevel level, uint code, int line, int col, ctmbstr msg, va_list args ) { enum { sizeMessageBuf=2048 }; char *messageBuf = TidyDocAlloc(doc,sizeMessageBuf); Bool go = UpdateCount( doc, level ); if ( go ) { va_list args_copy; va_copy(args_copy, args); TY_(tmbvsnprintf)(messageBuf, sizeMessageBuf, msg, args); if ( doc->mssgFilt ) { TidyDoc tdoc = tidyImplToDoc( doc ); go = doc->mssgFilt( tdoc, level, line, col, messageBuf ); } if ( doc->mssgFilt2 ) { /* mssgFilt2 is intended to allow LibTidy users to localize messages via their own means by providing a key string and the parameters to fill it. For the key string to remain consistent, we have to ensure that we only ever return the built-in English version of this string. */ TidyDoc tdoc = tidyImplToDoc( doc ); go = go | doc->mssgFilt2( tdoc, level, line, col, tidyDefaultString(code), args_copy ); } if ( doc->mssgFilt3 ) { /* mssgFilt3 is intended to allow LibTidy users to localize messages via their own means by providing a key string and the parameters to fill it. */ TidyDoc tdoc = tidyImplToDoc( doc ); go = go | doc->mssgFilt3( tdoc, level, line, col, tidyErrorCodeAsString(code), args_copy ); } } if ( go ) { enum { sizeBuf=1024 }; char *buf = TidyDocAlloc(doc,sizeBuf); const char *cp; if ( line > 0 && col > 0 ) { ReportPosition(doc, line, col, buf, sizeBuf); #if !defined(NDEBUG) && defined(_MSC_VER) SPRTF("%s",buf); #endif for ( cp = buf; *cp; ++cp ) TY_(WriteChar)( *cp, doc->errout ); } LevelPrefix( level, buf, sizeBuf ); #if !defined(NDEBUG) && defined(_MSC_VER) SPRTF("%s",buf); SPRTF("%s\n",messageBuf); #else for ( cp = buf; *cp; ++cp ) TY_(WriteChar)( *cp, doc->errout ); for ( cp = messageBuf; *cp; ++cp ) TY_(WriteChar)( *cp, doc->errout ); TY_(WriteChar)( '\n', doc->errout ); #endif TidyDocFree(doc, buf); } TidyDocFree(doc, messageBuf); }