diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2023-09-03 20:11:35 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2023-09-03 20:11:35 -0600 |
| commit | 063224c69d564d6e10dd4febf25caa9f59fccfda (patch) | |
| tree | c1edbd90c120d7b846490159540f68adfddfbb5a /lib/binarytools | |
| parent | 113472302904ac84d4ddf70df32ca245ad156bf2 (diff) | |
Fixed AIFC Extraction
Diffstat (limited to 'lib/binarytools')
| -rw-r--r-- | lib/binarytools/BinaryWriter.cpp | 13 | ||||
| -rw-r--r-- | lib/binarytools/BinaryWriter.h | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/binarytools/BinaryWriter.cpp b/lib/binarytools/BinaryWriter.cpp index 362824f..6e0140f 100644 --- a/lib/binarytools/BinaryWriter.cpp +++ b/lib/binarytools/BinaryWriter.cpp @@ -132,10 +132,11 @@ void LUS::BinaryWriter::Write(double value) { mStream->Write((char*)&value, sizeof(double)); } -void LUS::BinaryWriter::Write(const std::string& str) { - int strLen = str.size(); - Write(strLen); - +void LUS::BinaryWriter::Write(const std::string& str, bool writeLength) { + if(writeLength){ + int strLen = str.size(); + Write(strLen); + } for (char c : str) { mStream->WriteByte(c); } @@ -145,6 +146,10 @@ void LUS::BinaryWriter::Write(char* srcBuffer, size_t length) { mStream->Write(srcBuffer, length); } +void LUS::BinaryWriter::WriteByte(char value) { + mStream->WriteByte(value); +} + std::vector<char> LUS::BinaryWriter::ToVector() { return mStream->ToVector(); } diff --git a/lib/binarytools/BinaryWriter.h b/lib/binarytools/BinaryWriter.h index fbd4f65..dca683f 100644 --- a/lib/binarytools/BinaryWriter.h +++ b/lib/binarytools/BinaryWriter.h @@ -33,8 +33,9 @@ class BinaryWriter { void Write(uint64_t value); void Write(float value); void Write(double value); - void Write(const std::string& str); + void Write(const std::string& str, bool writeLength = true); void Write(char* srcBuffer, size_t length); + void WriteByte(char value); std::vector<char> ToVector(); |
