[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       David Faure <faure () kde ! org>
Date:       2007-04-03 10:35:43
Message-ID: 1175596543.869620.1125.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 649876 by dfaure:

It took char* or QString which it converted to QByteArray, but in fact \
KConfigSkeleton takes a QString! So sanitize this: take QByteArray and QString, and \
convert the QByteArray to QString.


 M  +6 -7      kconfig_compiler.cpp  


--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #649875:649876
@@ -1417,7 +1417,7 @@
     h << "    static " << className << " *self();" << endl;
     if (cfgFileNameArg)
     {
-      h << "    static void instance(const char * cfgfilename);" << endl;
+      h << "    static void instance(const QByteArray& cfgfilename);" << endl;
       h << "    static void instance(const QString& cfgfilename);" << endl;
     }
   }
@@ -1570,7 +1570,7 @@
   if ( singleton ) {
     h << "    " << className << "(";
     if ( cfgFileNameArg )
-      h << "const char *arg";
+      h << "const QString& arg";
     h << ");" << endl;
     h << "    static " << className << " *mSelf;" << endl << endl;
   }
@@ -1722,13 +1722,13 @@
     cpp << "}" << endl << endl;
 
     if ( cfgFileNameArg ) {
-      cpp << "void " << className << "::instance(const char *cfgfilename)" << endl;
+      cpp << "void " << className << "::instance(const QByteArray& cfgfilename)" << \
endl;  cpp << "{" << endl;
       cpp << "  if (mSelf) {" << endl;
       cpp << "     kDebug() << \"" << className << "::instance called after the \
first use - ignoring\" << endl;" << endl;  cpp << "     return;" << endl;
       cpp << "  }" << endl;
-      cpp << "  static" << className << "Deleter.setObject( mSelf, new " << \
className << "(cfgfilename) );" << endl; +      cpp << "  static" << className << \
"Deleter.setObject( mSelf, new " << className << "(QFile::decodeName(cfgfilename)) \
);" << endl;  cpp << "  mSelf->readConfig();" << endl;
       cpp << "}" << endl << endl;
       cpp << "void " << className << "::instance(const QString& cfgfilename)" << \
endl; @@ -1737,8 +1737,7 @@
       cpp << "     kDebug() << \"" << className << "::instance called after the \
first use - ignoring\" << endl;" << endl;  cpp << "     return;" << endl;
       cpp << "  }" << endl;
-      cpp << "  QByteArray filename = QFile::encodeName(cfgfilename);" << endl;
-      cpp << "  static" << className << "Deleter.setObject( mSelf, new " << \
className << "(filename.data()) );" << endl; +      cpp << "  static" << className << \
"Deleter.setObject( mSelf, new " << className << "(cfgfilename) );" << endl;  cpp << \
"  mSelf->readConfig();" << endl;  cpp << "}" << endl << endl;
     }
@@ -1753,7 +1752,7 @@
     if ( !singleton )
       cpp << " KSharedConfig::Ptr config";
     else
-      cpp << " const char *config";
+      cpp << " const QString& config";
     cpp << (parameters.isEmpty() ? " " : ", ");
   }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic