diff data/fft/FFTDataServer.cpp @ 986:e8e6c4e7437b

Correct some really stupid fixed-length string stuff, including a genuine stack overflow that causes a crash on OS/X for certain colour 3d plot data.
author Chris Cannam
date Mon, 29 Sep 2014 13:27:13 +0100
parents 59e7fe1b1003
children cc27f35aa75c
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp	Tue Sep 16 10:29:19 2014 +0100
+++ b/data/fft/FFTDataServer.cpp	Mon Sep 29 13:27:13 2014 +0100
@@ -1428,18 +1428,14 @@
                                     int fftSize,
                                     bool polar)
 {
-    char buffer[200];
-
-    sprintf(buffer, "%u-%u-%u-%u-%u-%u%s",
-            (unsigned int)XmlExportable::getObjectExportId(model),
-            (unsigned int)(channel + 1),
-            (unsigned int)windowType,
-            (unsigned int)windowSize,
-            (unsigned int)windowIncrement,
-            (unsigned int)fftSize,
-            polar ? "-p" : "-r");
-
-    return buffer;
+    return QString("%1-%2-%3-%4-%5-%6%7")
+        .arg(XmlExportable::getObjectExportId(model))
+        .arg(channel + 1)
+        .arg((int)windowType)
+        .arg(windowSize)
+        .arg(windowIncrement)
+        .arg(fftSize)
+        .arg(polar ? "-p" : "-r");
 }
 
 void