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

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-05-01 15:54:40
[Download RAW message or body]

CVS commit by waba: 

Don't try to print (QString::null).latin1()


  M +19 -12    kde-config.cpp.in   1.8


--- kdelibs/kdecore/kde-config.cpp.in  #1.7:1.8
@@ -63,4 +63,12 @@
 }
 
+void printResult(const QString &s)
+{
+    if (s.isEmpty())
+        printf("\n");
+    else
+        printf("%s\n", s.local8Bit().data());
+}
+
 int main(int argc, char **argv)
 {
@@ -82,5 +90,5 @@
     if (args->isSet("prefix"))
     {
-        printf("%s\n", expandvars("@prefix@").latin1());
+        printResult(expandvars("@prefix@"));
         return 0;
     }
@@ -88,5 +96,5 @@
     if (args->isSet("exec-prefix"))
     {
-        printf("%s\n", expandvars("@exec_prefix@").latin1());
+        printResult(expandvars("@exec_prefix@"));
         return 0;
     }
@@ -94,5 +102,5 @@
     if (args->isSet("localprefix"))
     {
-        printf("%s\n", KGlobal::dirs()->localkdedir().latin1());
+        printResult(KGlobal::dirs()->localkdedir());
         return 0;
     }
@@ -146,6 +154,5 @@
     if (!type.isEmpty())
     {
-        printf("%s\n", KGlobal::dirs()->resourceDirs(type.latin1()).
-               join(":").latin1());
+        printResult(KGlobal::dirs()->resourceDirs(type.latin1()).join(":"));
         return 0;
     }
@@ -155,13 +162,13 @@
     {
         if ( type == "desktop" )
-            printf("%s\n", KGlobalSettings::desktopPath().local8Bit().data() );
+            printResult(KGlobalSettings::desktopPath());
         else if ( type == "autostart" )
-            printf("%s\n", KGlobalSettings::autostartPath().local8Bit().data() );
+            printResult(KGlobalSettings::autostartPath());
         else if ( type == "trash" )
-            printf("%s\n", KGlobalSettings::trashPath().local8Bit().data() );
+            printResult(KGlobalSettings::trashPath());
         else if ( type == "document" )
-            printf("%s\n", KGlobalSettings::documentPath().local8Bit().data() );
+            printResult(KGlobalSettings::documentPath());
         else
-            printf("%s", i18n("%1 - unknown type of \
userpath\n").arg(type).local8Bit().data() ); +            fprintf(stderr, "%s", \
i18n("%1 - unknown type of userpath\n").arg(type).local8Bit().data() );  return 0;
     }
@@ -192,7 +199,7 @@
         }
         if (installprefixes[index]) {
-            printf("%s\n", expandvars(installprefixes[index+1]).latin1());
+            printResult(expandvars(installprefixes[index+1]));
         } else {
-            printf("NONE\n"); // no i18n here as for scripts
+            printResult("NONE"); // no i18n here as for scripts
         }
     }


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

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