-----------------------------------------------------------------------------
| 2145 | |
| 2146 | //----------------------------------------------------------------------------- |
| 2147 | char* GuiMLTextCtrl::stripControlChars(const char *inString) |
| 2148 | { |
| 2149 | if (! bool(inString)) |
| 2150 | return NULL; |
| 2151 | U32 maxBufLength = 64; |
| 2152 | char *strippedBuffer = Con::getReturnBuffer(maxBufLength); |
| 2153 | char *stripBufPtr = &strippedBuffer[0]; |
| 2154 | const char *bufPtr = (char *) inString; |
| 2155 | U32 idx, sizidx; |
| 2156 | |
| 2157 | for(;;) |
| 2158 | { |
| 2159 | //if we've reached the end of the string, or run out of room in the stripped Buffer... |
| 2160 | if(*bufPtr == '\0' || (U32(stripBufPtr - strippedBuffer) >= maxBufLength - 1)) |
| 2161 | break; |
| 2162 | |
| 2163 | if (*bufPtr == '\n') |
| 2164 | { |
| 2165 | U32 walked; |
| 2166 | oneUTF8toUTF32(bufPtr,&walked); |
| 2167 | bufPtr += walked; |
| 2168 | continue; |
| 2169 | } |
| 2170 | if(*bufPtr == '\t') |
| 2171 | { |
| 2172 | U32 walked; |
| 2173 | oneUTF8toUTF32(bufPtr,&walked); |
| 2174 | bufPtr += walked; |
| 2175 | continue; |
| 2176 | } |
| 2177 | if(*bufPtr < 0x20 && *bufPtr >= 0) |
| 2178 | { |
| 2179 | U32 walked; |
| 2180 | oneUTF8toUTF32(bufPtr,&walked); |
| 2181 | bufPtr += walked; |
| 2182 | continue; |
| 2183 | } |
| 2184 | |
| 2185 | if(*bufPtr == '<') |
| 2186 | { |
| 2187 | // it's probably some kind of tag: |
| 2188 | if(!dStrnicmp(bufPtr + 1, "font:", 5)) |
| 2189 | { |
| 2190 | // scan for the second colon... |
| 2191 | // at each level it should drop out to the text case below... |
| 2192 | idx = 6; |
| 2193 | if(!scanforchar((char*)bufPtr, idx, ':')) |
| 2194 | goto textemit; |
| 2195 | |
| 2196 | sizidx = idx + 1; |
| 2197 | if(!scanforchar((char*)bufPtr, sizidx, '>')) |
| 2198 | goto textemit; |
| 2199 | |
| 2200 | bufPtr += sizidx + 1; |
| 2201 | continue; |
| 2202 | } |
| 2203 | |
| 2204 | if (!dStrnicmp(bufPtr + 1, "tag:", 4 )) |
nothing calls this directly
no test coverage detected