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

List:       kde-commits
Subject:    KDE/kdelibs/kdoctools [POSSIBLY UNSAFE]
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2007-01-30 18:09:08
Message-ID: 1170180548.594860.30193.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 628625 by chehrlic:

':' as dir separator on win32 is not a good idea - use ';' instead
QFile::encodeName() -> QFile::encodeName().constData()
use QFileInfo::isExecutable() instead own implementation

 M  +5 -16     meinproc.cpp   [POSSIBLY UNSAFE: popen]
 M  +5 -1      xslt.cpp  


--- trunk/KDE/kdelibs/kdoctools/meinproc.cpp #628624:628625
@@ -90,17 +90,6 @@
 };
 
 
-static bool isExecutable(const QString &exe)
-{
-    if( exe.isEmpty() )
-        return false;
-#ifdef Q_OS_WIN
-    return ( exe.endsWith( ".exe" ) || exe.endsWith( ".bat" ) );
-#else
-    return (::access( QFile::encodeName( exe ), X_OK )==0);
-#endif
-}
-
 int main(int argc, char **argv) {
 
     // xsltSetGenericDebugFunc(stderr, NULL);
@@ -158,17 +147,17 @@
         catalogs += " ";
         catalogs += KStandardDirs::locate( "dtd", "docbook/xml-dtd-4.1.2/docbook.cat" );
 
-        setenv( "SGML_CATALOG_FILES", QFile::encodeName( catalogs ).data(), 1);
+        setenv( "SGML_CATALOG_FILES", QFile::encodeName( catalogs ).constData(), 1);
         QString exe;
 #if defined( XMLLINT )
         exe = XMLLINT;
 #endif
-        if ( !isExecutable( exe ) ) {
+        if ( !QFileInfo( exe ).isExecutable() ) {
             exe = KStandardDirs::findExe( "xmllint" );
             if (exe.isEmpty())
                 exe = KStandardDirs::locate( "exe", "xmllint" );
         }
-        if ( isExecutable( exe ) ) {
+        if ( QFileInfo( exe ).isExecutable() ) {
             QDir::setCurrent( file.absolutePath() );
             QString cmd = exe;
             cmd += " --catalogs --valid --noout ";
@@ -178,7 +167,7 @@
             cmd += KProcess::quote(file.fileName());
 #endif
             cmd += " 2>&1";
-            FILE *xmllint = popen( QFile::encodeName( cmd ), "r" );
+            FILE *xmllint = popen( QFile::encodeName( cmd ).constData(), "r" );
             char buf[ 512 ];
             bool noout = true;
             unsigned int n;
@@ -236,7 +225,7 @@
 
         if (style_sheet != NULL) {
 
-            xmlDocPtr doc = xmlParseFile( QFile::encodeName( args->arg( 0 ) ) );
+            xmlDocPtr doc = xmlParseFile( QFile::encodeName( args->arg( 0 ) ).constData() );
 
             xmlDocPtr res = xsltApplyStylesheet(style_sheet, doc, &params[0]);
 
--- trunk/KDE/kdelibs/kdoctools/xslt.cpp #628624:628625
@@ -186,7 +186,11 @@
 
     if ( srcdir.isEmpty() ) {
         catalogs += ins.dirs()->findResource("data", "ksgmltools2/customization/catalog");
+#ifdef Q_OS_WIN
+        catalogs += ';';
+#else
         catalogs += ':';
+#endif
         catalogs += ins.dirs()->findResource("data", "ksgmltools2/docbook/xml-dtd-4.2/docbook.cat");
         ins.dirs()->addResourceType("dtd", KStandardDirs::kde_default("data") + "ksgmltools2");
     } else {
@@ -194,7 +198,7 @@
         ins.dirs()->addResourceDir("dtd", srcdir);
     }
 
-    xmlLoadCatalogs(catalogs.toLatin1());
+    xmlLoadCatalogs(QFile::encodeName(catalogs).constData());
 }
 
 static QIODevice *getBZip2device(const QString &fileName )

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

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