summaryrefslogtreecommitdiff
blob: 77322d00a074621008e560e889d62047beb500de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- src/magick_cl.cpp.orig	2013-01-02 13:39:02.387184167 -0800
+++ src/magick_cl.cpp	2013-01-02 13:40:14.876543262 -0800
@@ -30,6 +30,7 @@
 #include <string>
 #include <fstream>
 #include <memory>
+#include <sstream>
 //#include <Magick++.h>
 
 #include "datatypes.hpp"
@@ -57,25 +58,17 @@
 
   string GDLutos(unsigned int i)
   {
-    int mema=3;
-    char *n=new char(mema);
-    while (snprintf(n, sizeof n, "%u", i) >= sizeof n)
-      {			delete n;mema++; n=new char(mema);   }
-    string s=n;
-    delete n;
-    return s;
+    istringstream s;
+    s >> i;
+    return s.str();
   }
 
   
   string GDLitos(int i)
   {
-    int mema=3;
-    char *n=new char(mema);
-    while (snprintf(n, sizeof n, "%d", i) >= sizeof n)
-      {			delete n;mema++; n=new char(mema);   }
-    string s=n;
-    delete n;
-    return s;
+    istringstream s;
+    s >> i;
+    return s.str();
   }