Browse Source

Update MMDPmxParser.cpp

Fix encoding for readstrings.
Kim Kulling 7 years ago
parent
commit
56392cc02f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      code/MMDPmxParser.cpp

+ 2 - 1
code/MMDPmxParser.cpp

@@ -96,12 +96,13 @@ namespace pmx
 			// UTF16 to UTF8
 			// UTF16 to UTF8
 			const uint16_t* sourceStart = (uint16_t*)buffer.data();
 			const uint16_t* sourceStart = (uint16_t*)buffer.data();
 			const unsigned int targetSize = size * 3; // enough to encode
 			const unsigned int targetSize = size * 3; // enough to encode
-			char targetStart[targetSize];
+			char *targetStart = new char[targetSize];
             std::memset(targetStart, 0, targetSize * sizeof(char));
             std::memset(targetStart, 0, targetSize * sizeof(char));
             
             
             utf8::utf16to8( sourceStart, sourceStart + size/2, targetStart );
             utf8::utf16to8( sourceStart, sourceStart + size/2, targetStart );
 
 
 			std::string result(targetStart);
 			std::string result(targetStart);
+            delete [] targetStart;
 			return result;
 			return result;
 		}
 		}
 		else
 		else