[Kst] branches/work/kst/portto4/kst/src/d2asc

Peter Kümmel syntheticpp at gmx.net
Fri Jan 14 15:56:21 CET 2011


SVN commit 1214402 by kuemmel:

remove msvc warnings by not using plain C functions

 M  +7 -6      d2asc.cpp  


--- branches/work/kst/portto4/kst/src/d2asc/d2asc.cpp #1214401:1214402
@@ -45,7 +45,8 @@
 
   Kst::DataSourcePluginManager::init();
 
-  char field_list[40][120], filename[180];
+  QString filename;
+  QString field_list[40];
   bool do_hex[40];
   int n_field=0;
   int start_frame=0, n_frames=2000000;
@@ -61,7 +62,7 @@
   for (i = 0; i < 40; i++)
     do_hex[i] = false;
 
-  strcpy(filename, argv[1]);
+  filename = QString::fromLocal8Bit(argv[1]);
   for (i = 2; i < argc; i++) {
     if (argv[i][0] == '-') {
       if (argv[i][1] == 'f') {
@@ -78,14 +79,14 @@
         do_ave = true;
       } else if (argv[i][1] == 'x') {
         i++;
-        strcpy(field_list[n_field], argv[i]);
+        field_list[n_field] = QString::fromLocal8Bit(argv[i]);
         do_hex[n_field] = true;
         n_field++;
       } else {
         Usage();
       }
     } else {
-      strcpy(field_list[n_field], argv[i]);
+      field_list[n_field] = QString::fromLocal8Bit(argv[i]);
       n_field++;
     }
   }
@@ -94,7 +95,7 @@
 
   file = Kst::DataSourcePluginManager::loadSource(_document.objectStore(), filename);
   if (!file || !file->isValid() || file->isEmpty()) {
-    fprintf(stderr, "d2asc error: file %s has no data\n", filename);
+    fprintf(stderr, "d2asc error: file %s has no data\n", qPrintable(filename));
     return -2;
   }
   /** make vectors and fill the list **/
@@ -103,7 +104,7 @@
   for (i=0; i<n_field; i++) {
     if (!file->vector().isValid(field_list[i])) {
       fprintf(stderr, "d2asc error: field %s in file %s is not valid\n",
-              field_list[i], filename);
+              qPrintable(field_list[i]), qPrintable(filename));
       return -3;
     }
     Kst::DataVectorPtr v = _document.objectStore()->createObject<Kst::DataVector>();


More information about the Kst mailing list