i become ... now.......
### qt_libxml_error_handler ctx 0x0
### qt_libxml_error_handler msg "%s"
### qt_libxml_error_handler arg ?┐\♦
### qt_libxml_error_handler ctx 0x0
I/O warning : failed to load external entity "file:///C%3A/include/_header_page.
QString & QString::sprintf ( const char * cformat, ... )
char buffer [50];
QString message = QString::sprintf (buffer,msg,args); /* crach & qt frozen */
How to reformat this on QString::sprintf ??
the qt code ....
/* from class external function */
void qt_libxml_error_handler(void *ctx, const char *msg, ...)
{
char buffer [50];
va_list args;
va_start(args, msg);
/*sprintf (buffer,msg,args);*/
qDebug() << "### qt_libxml_error_handler arg " << msg;
qDebug() << "### qt_libxml_error_handler arg " << args;
qDebug() << "### qt_libxml_error_handler ctx " << ctx;
/*php_libxml_internal_error_handler(PHP_LIBXML_ERROR, ctx, &msg, args);*/
va_end(args);
}
/*class qt function */
xsltSetGenericErrorFunc(NULL, qt_libxml_error_handler); /* error callback */
cur = xsltParseStylesheetFile( (const xmlChar*)gocharxslt.data() );
doc
= xmlParseFile
( QFile::encodeName(DATA_FILE_XML
) );
outputDoc = xsltApplyStylesheet(cur, doc, params);
xmlFreeDoc( doc ); /* free ram from xml! */
doc = outputDoc; /* swap input and output */
FILE* outfile
= fopen( QFile::encodeName( SHORTFILE
),
"w" );
xsltSaveResultToFile( outfile, doc, cur );
fclose( outfile );
xsltFreeStylesheet(cur);
xmlFreeDoc( outputDoc );
xsltCleanupGlobals();
xmlCleanupParser();
/* from class external function */
void qt_libxml_error_handler(void *ctx, const char *msg, ...)
{
char buffer [50];
va_list args;
va_start(args, msg);
/*sprintf (buffer,msg,args);*/
qDebug() << "### qt_libxml_error_handler arg " << msg;
qDebug() << "### qt_libxml_error_handler arg " << args;
qDebug() << "### qt_libxml_error_handler ctx " << ctx;
/*php_libxml_internal_error_handler(PHP_LIBXML_ERROR, ctx, &msg, args);*/
va_end(args);
}
/*class qt function */
QByteArray gocharxslt = DATA_CONVERTER.toAscii();
xsltSetGenericErrorFunc(NULL, qt_libxml_error_handler); /* error callback */
cur = xsltParseStylesheetFile( (const xmlChar*)gocharxslt.data() );
doc = xmlParseFile( QFile::encodeName(DATA_FILE_XML) );
outputDoc = xsltApplyStylesheet(cur, doc, params);
xmlFreeDoc( doc ); /* free ram from xml! */
doc = outputDoc; /* swap input and output */
FILE* outfile = fopen( QFile::encodeName( SHORTFILE ), "w" );
xsltSaveResultToFile( outfile, doc, cur );
fclose( outfile );
xsltFreeStylesheet(cur);
xmlFreeDoc( outputDoc );
xsltCleanupGlobals();
xmlCleanupParser();
To copy to clipboard, switch view to plain text mode
php6 make so .... " grep -R "php_libxml_internal_error_handler" * " Tank to grep
static void php_libxml_internal_error_handler(int error_type, void *ctx, const char **msg, va_list ap)
{
char *buf;
int len, len_iter, output = 0;
TSRMLS_FETCH();
len = vspprintf(&buf, 0, *msg, ap);
len_iter = len;
/* remove any trailing \n */
while (len_iter && buf[--len_iter] == '\n') {
buf[len_iter] = '\0';
output = 1;
}
smart_str_appendl(&LIBXML(error_buffer), buf, len);
efree(buf);
if (output == 1) {
if (LIBXML(error_list)) {
_php_list_set_error_structure(NULL, LIBXML(error_buffer).c);
} else {
switch (error_type) {
case PHP_LIBXML_CTX_ERROR:
php_libxml_ctx_error_level(E_WARNING, ctx, LIBXML(error_buffer).c TSRMLS_CC);
break;
case PHP_LIBXML_CTX_WARNING:
php_libxml_ctx_error_level(E_NOTICE, ctx, LIBXML(error_buffer).c TSRMLS_CC);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", LIBXML(error_buffer).c);
}
}
smart_str_free(&LIBXML(error_buffer));
}
}
static void php_libxml_internal_error_handler(int error_type, void *ctx, const char **msg, va_list ap)
{
char *buf;
int len, len_iter, output = 0;
TSRMLS_FETCH();
len = vspprintf(&buf, 0, *msg, ap);
len_iter = len;
/* remove any trailing \n */
while (len_iter && buf[--len_iter] == '\n') {
buf[len_iter] = '\0';
output = 1;
}
smart_str_appendl(&LIBXML(error_buffer), buf, len);
efree(buf);
if (output == 1) {
if (LIBXML(error_list)) {
_php_list_set_error_structure(NULL, LIBXML(error_buffer).c);
} else {
switch (error_type) {
case PHP_LIBXML_CTX_ERROR:
php_libxml_ctx_error_level(E_WARNING, ctx, LIBXML(error_buffer).c TSRMLS_CC);
break;
case PHP_LIBXML_CTX_WARNING:
php_libxml_ctx_error_level(E_NOTICE, ctx, LIBXML(error_buffer).c TSRMLS_CC);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", LIBXML(error_buffer).c);
}
}
smart_str_free(&LIBXML(error_buffer));
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks