Fix for strings containing spaces.
authorGavin Lambert <uecasm@users.sourceforge.net>
Sat, 31 May 2014 17:21:53 +1200
changeset 2621 a26dee45c467
parent 2620 0e4d098db815
child 2622 1aee02c1e294
Fix for strings containing spaces.
[04-string-download]
tool/DataTypeHandler.cpp
--- a/tool/DataTypeHandler.cpp	Tue Apr 14 09:35:15 2015 -0400
+++ b/tool/DataTypeHandler.cpp	Sat May 31 17:21:53 2014 +1200
@@ -33,6 +33,7 @@
 #include <iostream>
 #endif
 
+#include <string.h>
 #include <iomanip>
 #include <sstream>
 using namespace std;
@@ -106,6 +107,8 @@
     stringstream str;
     size_t dataSize = type->byteSize;
 
+    memset(target, 0, targetSize);
+
 #if DEBUG
 	cerr << __func__ << "(targetSize=" << targetSize << ")" << endl;
 #endif
@@ -192,7 +195,7 @@
                     << dataSize << " > " << targetSize << ")";
                 throw SizeException(err.str());
             }
-            str >> (char *) target;
+            str.read((char *) target, dataSize);
             break;
         case 0x0011: // double
             {