Luma: Version of StringBuffer that doesn't convert to UTF16 for performance reasons
| 157 | |
| 158 | //Luma: Version of StringBuffer that doesn't convert to UTF16 for performance reasons |
| 159 | void StringBuffer::setNoConvert(const UTF8 *in) |
| 160 | { |
| 161 | incRequestCount8(); |
| 162 | |
| 163 | //just do straight copy without conversion |
| 164 | FrameTemp<UTF16> tmpBuff(dStrlen(in)+1); |
| 165 | if(!in || in[0] == 0) |
| 166 | { |
| 167 | // Easy out, it's a blank string, or a bad string. |
| 168 | mBuffer.clear(); |
| 169 | mBuffer.push_back(0); |
| 170 | AssertFatal(mBuffer.last() == 0, "StringBuffer::set UTF8 - not a null terminated string!"); |
| 171 | return; |
| 172 | } |
| 173 | |
| 174 | // Otherwise, we've a copy to do. (This might not be strictly necessary.) |
| 175 | mBuffer.setSize(dStrlen(in)+1); |
| 176 | U32 i; |
| 177 | for(i=0;i<dStrlen(in);i++) |
| 178 | { |
| 179 | mBuffer[i] = (UTF16)in[i]; |
| 180 | } |
| 181 | mBuffer[i] = (UTF16)'\0'; |
| 182 | mDirty8 = true; |
| 183 | } |
| 184 | |
| 185 | |
| 186 |