This commit is contained in:
Jack Andersen 2015-12-06 10:53:14 -10:00
commit 27d9fbcad4
2 changed files with 92 additions and 54 deletions

View File

@ -883,6 +883,9 @@ public:
*/
inline std::string readWStringAsString(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::string();
std::string retval;
atUint16 chr = readUint16();
@ -921,6 +924,9 @@ public:
*/
inline std::string readWStringAsStringLittle(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::string();
std::string retval;
atUint16 chr = readUint16Little();
@ -959,6 +965,9 @@ public:
*/
inline std::string readWStringAsStringBig(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::string();
std::string retval;
atUint16 chr = readUint16Big();
@ -996,6 +1005,8 @@ public:
*/
inline std::string readString(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::string();
std::string ret;
atUint8 chr = readByte();
@ -1026,6 +1037,9 @@ public:
*/
inline std::wstring readWString(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::wstring();
std::wstring ret;
atUint16 chr = readUint16();
@ -1057,6 +1071,9 @@ public:
*/
inline std::wstring readWStringLittle(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::wstring();
std::wstring ret;
atUint16 chr = readUint16Little();
@ -1088,6 +1105,8 @@ public:
*/
inline std::wstring readWStringBig(atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return std::wstring();
std::wstring ret;
atUint16 chr = readUint16Big();

View File

@ -712,6 +712,8 @@ public:
*/
inline void writeStringAsWString(const std::string& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
std::string tmpStr = "\xEF\xBB\xBF" + str;
const utf8proc_uint8_t* buf = reinterpret_cast<const utf8proc_uint8_t*>(tmpStr.c_str());
if (fixedLen < 0)
@ -768,6 +770,8 @@ public:
*/
inline void writeStringAsWStringLittle(const std::string& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
std::string tmpStr = "\xEF\xBB\xBF" + str;
const utf8proc_uint8_t* buf = reinterpret_cast<const utf8proc_uint8_t*>(tmpStr.c_str());
if (fixedLen < 0)
@ -824,6 +828,9 @@ public:
*/
inline void writeStringAsWStringBig(const std::string& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
std::string tmpStr = "\xEF\xBB\xBF" + str;
const utf8proc_uint8_t* buf = reinterpret_cast<const utf8proc_uint8_t*>(tmpStr.c_str());
if (fixedLen < 0)
@ -877,6 +884,9 @@ public:
*/
inline void writeString(const std::string& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
if (fixedLen < 0)
{
for (atUint8 c : str)
@ -913,6 +923,9 @@ public:
*/
inline void writeWString(const std::wstring& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
if (fixedLen < 0)
{
for (atUint16 c : str)
@ -949,6 +962,9 @@ public:
*/
inline void writeWStringLittle(const std::wstring& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
if (fixedLen < 0)
{
for (atUint16 c : str)
@ -985,6 +1001,9 @@ public:
*/
inline void writeWStringBig(const std::wstring& str, atInt32 fixedLen = -1)
{
if (fixedLen == 0)
return;
if (fixedLen < 0)
{
for (atUint16 c : str)