Browse Source

Fix plString constructors from getting the wrong size when using a char

array on the stack.  They were incorrectly using the string literal
constructor.
Michael Hansen 10 years ago
parent
commit
09d4e5666f
  1. 8
      Sources/Plasma/CoreLib/plString.h

8
Sources/Plasma/CoreLib/plString.h

@ -281,6 +281,10 @@ public:
template <size_t _Sz> template <size_t _Sz>
plString(const char (&literal)[_Sz]) { IConvertFromUtf8(literal, _Sz - 1); } plString(const char (&literal)[_Sz]) { IConvertFromUtf8(literal, _Sz - 1); }
// Don't call the string literal constructor for stack arrays
template <size_t _Sz>
plString(char (&literal)[_Sz]) { IConvertFromUtf8(literal, STRLEN_AUTO); }
/** Copy constructor. */ /** Copy constructor. */
plString(const plString &copy) : fUtf8Buffer(copy.fUtf8Buffer) { } plString(const plString &copy) : fUtf8Buffer(copy.fUtf8Buffer) { }
@ -306,6 +310,10 @@ public:
template <size_t _Sz> template <size_t _Sz>
plString &operator=(const char (&literal)[_Sz]) { IConvertFromUtf8(literal, _Sz - 1); return *this; } plString &operator=(const char (&literal)[_Sz]) { IConvertFromUtf8(literal, _Sz - 1); return *this; }
// Don't call the string literal operator= for stack arrays
template <size_t _Sz>
plString &operator=(char (&literal)[_Sz]) { IConvertFromUtf8(literal, STRLEN_AUTO); return *this; }
/** Assignment operator. Same as plString(const plString &). */ /** Assignment operator. Same as plString(const plString &). */
plString &operator=(const plString &copy) { fUtf8Buffer = copy.fUtf8Buffer; return *this; } plString &operator=(const plString &copy) { fUtf8Buffer = copy.fUtf8Buffer; return *this; }

Loading…
Cancel
Save