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