Browse Source

Fixed 64bit bufferString bug

Thomas Buck 9 years ago
parent
commit
8f1eb21507
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/utils/strings.cpp

+ 6
- 1
src/utils/strings.cpp View File

41
 
41
 
42
     text = new char[sz];
42
     text = new char[sz];
43
 
43
 
44
+    va_list copy;
45
+    va_copy(copy, args);
46
+
44
     n = vsnprintf(text, sz, string, args);
47
     n = vsnprintf(text, sz, string, args);
45
 
48
 
46
     if (n < 0) {
49
     if (n < 0) {
50
         sz = n + 1; // buffer too small
53
         sz = n + 1; // buffer too small
51
         delete [] text;
54
         delete [] text;
52
         text = new char[sz];
55
         text = new char[sz];
53
-        n = vsnprintf(text, sz, string, args);
56
+        n = vsnprintf(text, sz, string, copy);
54
     }
57
     }
55
 
58
 
59
+    va_end(copy);
60
+
56
     return text;
61
     return text;
57
 }
62
 }
58
 
63
 

Loading…
Cancel
Save