[ox/mc] Fix string allocation size
This commit is contained in:
		
							
								
								
									
										2
									
								
								deps/ox/src/ox/mc/test/tests.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								deps/ox/src/ox/mc/test/tests.cpp
									
									
									
									
										vendored
									
									
								
							| @@ -143,7 +143,7 @@ std::map<std::string, ox::Error(*)()> tests = { | ||||
| 				testIn.Struct.String = "Test String 2"; | ||||
|  | ||||
| 				oxAssert(ox::writeMC(buff, buffLen, &testIn), "writeMC failed"); | ||||
| 				oxAssert(ox::readMC(buff, buffLen, &testOut), "writeMC failed"); | ||||
| 				oxAssert(ox::readMC(buff, buffLen, &testOut), "readMC failed"); | ||||
| 				//std::cout << testIn.Union.Int << "|" << testOut.Union.Int << "|\n"; | ||||
|  | ||||
| 				oxAssert(testIn.Bool               == testOut.Bool, "Bool value mismatch"); | ||||
|   | ||||
							
								
								
									
										2
									
								
								deps/ox/src/ox/mc/write.hpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								deps/ox/src/ox/mc/write.hpp
									
									
									
									
										vendored
									
									
								
							| @@ -185,7 +185,7 @@ template<typename T> | ||||
| 		for (std::size_t i = 0; i < len; i++) { | ||||
| 			auto &key = keys[i]; | ||||
| 			const auto keyLen = ox_strlen(key); | ||||
| 			auto wkey = static_cast<char*>(ox_alloca(keyLen)); | ||||
| 			auto wkey = static_cast<char*>(ox_alloca(keyLen + 1)); | ||||
| 			memcpy(wkey, key.c_str(), keyLen + 1); | ||||
| 			oxReturnError(writer.field("", SerStr(&wkey, keyLen))); | ||||
| 			oxReturnError(writer.field("", &(*val)[key])); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user