From 29e0bfea5be6194f5889740639da0cf7e6ab253e Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Wed, 1 Sep 2004 19:48:51 +0000 Subject: [PATCH] Added CStr constructor for non-NULL-terminated char*s This was SVN commit r1095. --- source/ps/CStr.cpp | 8 +++++++- source/ps/CStr.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/ps/CStr.cpp b/source/ps/CStr.cpp index ac8c6e27a3..f0b30817f5 100755 --- a/source/ps/CStr.cpp +++ b/source/ps/CStr.cpp @@ -29,10 +29,16 @@ CStr::CStr(const CStr& Str) CStr::CStr(const TCHAR* String) { - // Creates CStr from C-Style TCHAR string + // Creates CStr from null-terminated C-Style TCHAR string m_String = String; } +CStr::CStr(const TCHAR* String, size_t Length) +{ + // Creates CStr from TCHAR string of specified length + m_String = tstring(String, Length); +} + CStr::CStr(tstring String) { m_String = String; diff --git a/source/ps/CStr.h b/source/ps/CStr.h index 5aa48458f7..2c69b44e16 100755 --- a/source/ps/CStr.h +++ b/source/ps/CStr.h @@ -120,7 +120,8 @@ public: #if !(defined(_MSC_VER) && defined(_UNICODE)) CStr(utf16string String); // Creates CStr from UTF16 string, potentially losing data in UTF16->ASCII conversions #endif - CStr(const TCHAR* String); // Creates CStr from C-Style TCHAR string + CStr(const TCHAR* String); // Creates CStr from null-terminated C-Style TCHAR string + CStr(const TCHAR* String, size_t Length); // Creates CStr from TCHAR string of specified length CStr(TCHAR Char); // Creates CStr from a TCHAR CStr(int Number); // Creates CStr from a int CStr(unsigned int Number); // Creates CStr from a uint