| 166 | } |
| 167 | |
| 168 | const char *CUnpacker::GetString(int SanitizeType) |
| 169 | { |
| 170 | if(m_Error) |
| 171 | return ""; |
| 172 | |
| 173 | if(m_pCurrent >= m_pEnd) |
| 174 | { |
| 175 | m_Error = true; |
| 176 | return ""; |
| 177 | } |
| 178 | |
| 179 | char *pPtr = (char *)m_pCurrent; |
| 180 | while(*m_pCurrent) // skip the string |
| 181 | { |
| 182 | m_pCurrent++; |
| 183 | if(m_pCurrent == m_pEnd) |
| 184 | { |
| 185 | m_Error = true; |
| 186 | return ""; |
| 187 | } |
| 188 | } |
| 189 | m_pCurrent++; |
| 190 | |
| 191 | if(!str_utf8_check(pPtr)) |
| 192 | { |
| 193 | m_Error = true; |
| 194 | return ""; |
| 195 | } |
| 196 | |
| 197 | // sanitize all strings |
| 198 | if(SanitizeType & SANITIZE) |
| 199 | str_sanitize(pPtr); |
| 200 | else if(SanitizeType & SANITIZE_CC) |
| 201 | str_sanitize_cc(pPtr); |
| 202 | return SanitizeType & SKIP_START_WHITESPACES ? str_utf8_skip_whitespaces(pPtr) : pPtr; |
| 203 | } |
| 204 | |
| 205 | const unsigned char *CUnpacker::GetRaw(int Size) |
| 206 | { |
no test coverage detected