From 16f24a61f80fef5f29c81182a3bcf3906bdee7a7 Mon Sep 17 00:00:00 2001 From: Francois Andriot Date: Thu, 15 Aug 2013 21:03:13 +0200 Subject: [PATCH] Fix 'format not a string literal' error --- .../inputmethods/xim/qximinputcontext_x11.cpp | 2 +- src/3rdparty/sqlite/btree_rb.c | 2 +- src/3rdparty/sqlite/shell.c | 2 +- src/moc/moc.y | 4 ++-- src/moc/moc_yacc.cpp | 4 ++-- src/sql/drivers/odbc/qsql_odbc.cpp | 8 ++++---- tools/qvfb/qvfbview.cpp | 18 +++++++++--------- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp index a0438bc..bcdcd75 100644 --- a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp +++ b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp @@ -742,7 +742,7 @@ void QXIMInputContext::resetClientState() void QXIMInputContext::close( const QString &errMsg ) { - qDebug( errMsg ); + qDebug( "%s", errMsg.latin1() ); emit deletionRequested(); } diff --git a/src/3rdparty/sqlite/btree_rb.c b/src/3rdparty/sqlite/btree_rb.c index ea4b3dd..09d8e9a 100644 --- a/src/3rdparty/sqlite/btree_rb.c +++ b/src/3rdparty/sqlite/btree_rb.c @@ -311,7 +311,7 @@ static char *append_node(char * orig, BtRbNode *pNode, int indent) static void print_node(BtRbNode *pNode) { char * str = append_node(0, pNode, 0); - printf(str); + printf("%s", str); /* Suppress a warning message about print_node() being unused */ (void)print_node; diff --git a/src/3rdparty/sqlite/shell.c b/src/3rdparty/sqlite/shell.c index 58771aa..9321066 100644 --- a/src/3rdparty/sqlite/shell.c +++ b/src/3rdparty/sqlite/shell.c @@ -688,7 +688,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ }else if( c=='h' && strncmp(azArg[0], "help", n)==0 ){ - fprintf(stderr,zHelp); + fprintf(stderr,"%s",zHelp); }else if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg>1 ){ diff --git a/src/moc/moc.y b/src/moc/moc.y index a507126..90f72ab 100644 --- a/src/moc/moc.y +++ b/src/moc/moc.y @@ -2873,8 +2873,8 @@ void generateClass() // generate C++ source code for a class fn = &g->fileName[i]; fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); fprintf( out, hdr2, (const char*)dstr ); - fprintf( out, hdr3 ); - fprintf( out, hdr4 ); + fprintf( out, "%s", hdr3 ); + fprintf( out, "%s", hdr4 ); if ( !g->noInclude ) { /* diff --git a/src/moc/moc_yacc.cpp b/src/moc/moc_yacc.cpp index cb307e6..bf152b3 100644 --- a/src/moc/moc_yacc.cpp +++ b/src/moc/moc_yacc.cpp @@ -5699,8 +5699,8 @@ void generateClass() // generate C++ source code for a class fn = &g->fileName[i]; fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); fprintf( out, hdr2, (const char*)dstr ); - fprintf( out, hdr3 ); - fprintf( out, hdr4 ); + fprintf( out, "%s", hdr3 ); + fprintf( out, "%s", hdr4 ); if ( !g->noInclude ) { /* diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 8b0b58b..46c5a6c 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -539,7 +539,7 @@ bool QODBCPrivate::setConnectionOptions( const QString& connOpts ) } else if ( val == "SQL_MODE_READ_WRITE" ) { v = SQL_MODE_READ_WRITE; } else { - qWarning( QString( "QODBCDriver::open: Unknown option value '%1'" ).arg( *it ) ); + qWarning( "QODBCDriver::open: Unknown option value '%s'", (*it).latin1() ); break; } r = SQLSetConnectAttr( hDbc, SQL_ATTR_ACCESS_MODE, (SQLPOINTER) v, 0 ); @@ -564,7 +564,7 @@ bool QODBCPrivate::setConnectionOptions( const QString& connOpts ) } else if ( val == "SQL_FALSE" ) { v = SQL_FALSE; } else { - qWarning( QString( "QODBCDriver::open: Unknown option value '%1'" ).arg( *it ) ); + qWarning( "QODBCDriver::open: Unknown option value '%s'", (*it).latin1() ); break; } r = SQLSetConnectAttr( hDbc, SQL_ATTR_METADATA_ID, (SQLPOINTER) v, 0 ); @@ -586,14 +586,14 @@ bool QODBCPrivate::setConnectionOptions( const QString& connOpts ) } else if ( val == "SQL_OPT_TRACE_ON" ) { v = SQL_OPT_TRACE_ON; } else { - qWarning( QString( "QODBCDriver::open: Unknown option value '%1'" ).arg( *it ) ); + qWarning( "QODBCDriver::open: Unknown option value '%s'", (*it).latin1() ); break; } r = SQLSetConnectAttr( hDbc, SQL_ATTR_TRACE, (SQLPOINTER) v, 0 ); } #ifdef QT_CHECK_RANGE else { - qWarning( QString("QODBCDriver::open: Unknown connection attribute '%1'").arg( opt ) ); + qWarning( "QODBCDriver::open: Unknown connection attribute '%s'", opt.latin1() ); } #endif if ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) { diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp index 781cf78..32ac3d9 100644 --- a/tools/qvfb/qvfbview.cpp +++ b/tools/qvfb/qvfbview.cpp @@ -282,26 +282,26 @@ static QString qws_dataDir() QString dataDir = "/tmp/qtembedded-" + username; if ( mkdir( dataDir.latin1(), 0700 ) ) { if ( errno != EEXIST ) { - qFatal( QString("Cannot create Qt/Embedded data directory: %1") - .arg( dataDir ) ); + qFatal( "Cannot create Qt/Embedded data directory: %s", + dataDir.latin1() ); } } struct stat buf; if ( lstat( dataDir.latin1(), &buf ) ) - qFatal( QString( "stat failed for Qt/Embedded data directory: %1" ) - .arg( dataDir ) ); + qFatal( "stat failed for Qt/Embedded data directory: %s", + dataDir.latin1() ); if ( !S_ISDIR( buf.st_mode ) ) - qFatal( QString( "%1 is not a directory" ).arg( dataDir ) ); + qFatal( "%s is not a directory", dataDir.latin1() ); if ( buf.st_uid != getuid() ) - qFatal( QString( "Qt/Embedded data directory is not owned by user %1" ) - .arg( getuid() ) ); + qFatal( "Qt/Embedded data directory is not owned by user %u", + getuid() ); if ( (buf.st_mode & 0677) != 0600 ) - qFatal( QString( "Qt/Embedded data directory has incorrect permissions: %1" ) - .arg( dataDir ) ); + qFatal( "Qt/Embedded data directory has incorrect permissions: %s", + dataDir.latin1() ); dataDir += "/";