-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Adam Johnson <[email protected]>
- Loading branch information
Showing
1 changed file
with
8 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,8 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#include "HeadSpin.h" | ||
|
||
#include <string> | ||
|
||
template<typename CharT> | ||
class hsBasicStringTokenizer | ||
{ | ||
|
@@ -132,18 +134,20 @@ class hsBasicStringTokenizer | |
{ | ||
delete[] fString; | ||
if (string) { | ||
size_t count = StrLen(string); | ||
size_t count = std::char_traits<CharT>::length(string); | ||
fString = new CharT[count + 1]; | ||
memcpy(fString, string, sizeof(CharT) * (count + 1)); | ||
std::char_traits<CharT>::copy(fString, string, count); | ||
fString[count] = 0; | ||
} else { | ||
fString = nullptr; | ||
} | ||
|
||
delete[] fSeps; | ||
if (seps) { | ||
fNumSeps = StrLen(seps); | ||
fNumSeps = std::char_traits<CharT>::length(seps); | ||
fSeps = new CharT[fNumSeps + 1]; | ||
memcpy(fSeps, seps, sizeof(CharT) * (fNumSeps + 1)); | ||
std::char_traits<CharT>::copy(fSeps, seps, fNumSeps); | ||
fSeps[fNumSeps] = 0; | ||
} else { | ||
fNumSeps = 0; | ||
fSeps = nullptr; | ||
|
@@ -174,15 +178,6 @@ class hsBasicStringTokenizer | |
CharT* fString; | ||
|
||
private: | ||
static size_t StrLen(const CharT* str) | ||
{ | ||
size_t i = 0; | ||
while (str[i] != 0) { | ||
i++; | ||
} | ||
return i; | ||
} | ||
|
||
bool IsSep(CharT c) | ||
{ | ||
if (!fQAsTok || !fInQuote) { | ||
|