| 232 | |
| 233 | |
| 234 | wxString CFileDataIO::ReadOnlyString(bool bOptUTF8, uint16 raw_len) const |
| 235 | { |
| 236 | // We only need to set the the NULL terminator, since we know that |
| 237 | // reads will either succeed or throw an exception, in which case |
| 238 | // we wont be returning anything |
| 239 | std::vector<char> val_array(raw_len + 1); |
| 240 | val_array[raw_len] = 0; |
| 241 | |
| 242 | char* val = &(val_array[0]); |
| 243 | |
| 244 | Read(val, raw_len); |
| 245 | wxString str; |
| 246 | |
| 247 | if (CHECK_BOM(raw_len, val)) { |
| 248 | // This is a UTF8 string with a BOM header, skip header. |
| 249 | str = UTF82unicode(val + 3); |
| 250 | } else if (bOptUTF8) { |
| 251 | str = UTF82unicode(val); |
| 252 | if (str.IsEmpty()) { |
| 253 | // Fallback to Latin-1 |
| 254 | str = wxString(val, wxConvISO8859_1, raw_len); |
| 255 | } |
| 256 | } else { |
| 257 | // Raw strings are written as Latin-1 (see CFileDataIO::WriteStringCore) |
| 258 | str = wxString(val, wxConvISO8859_1, raw_len); |
| 259 | } |
| 260 | |
| 261 | return str; |
| 262 | } |
| 263 | |
| 264 | |
| 265 | void CFileDataIO::WriteUInt8(uint8 value) |
no test coverage detected