MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / setNoConvert

Method setNoConvert

engine/source/string/stringBuffer.cc:159–183  ·  view source on GitHub ↗

Luma: Version of StringBuffer that doesn't convert to UTF16 for performance reasons

Source from the content-addressed store, hash-verified

157
158//Luma: Version of StringBuffer that doesn't convert to UTF16 for performance reasons
159void 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

Callers

nothing calls this directly

Calls 5

dStrlenFunction · 0.70
clearMethod · 0.45
push_backMethod · 0.45
lastMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected