------------------------------------------------------------------------------------------------
| 181 | |
| 182 | // ------------------------------------------------------------------------------------------------ |
| 183 | void ReadData(const char*& sbegin_out, const char*& send_out, const char* input, const char*& cursor, const char* end) { |
| 184 | if(Offset(cursor, end) < 1) { |
| 185 | TokenizeError("cannot ReadData, out of bounds reading length",input, cursor); |
| 186 | } |
| 187 | |
| 188 | const char type = *cursor; |
| 189 | sbegin_out = cursor++; |
| 190 | |
| 191 | switch(type) |
| 192 | { |
| 193 | // 16 bit int |
| 194 | case 'Y': |
| 195 | cursor += 2; |
| 196 | break; |
| 197 | |
| 198 | // 1 bit bool flag (yes/no) |
| 199 | case 'C': |
| 200 | cursor += 1; |
| 201 | break; |
| 202 | |
| 203 | // 32 bit int |
| 204 | case 'I': |
| 205 | // <- fall through |
| 206 | |
| 207 | // float |
| 208 | case 'F': |
| 209 | cursor += 4; |
| 210 | break; |
| 211 | |
| 212 | // double |
| 213 | case 'D': |
| 214 | cursor += 8; |
| 215 | break; |
| 216 | |
| 217 | // 64 bit int |
| 218 | case 'L': |
| 219 | cursor += 8; |
| 220 | break; |
| 221 | |
| 222 | // note: do not write cursor += ReadWord(...cursor) as this would be UB |
| 223 | |
| 224 | // raw binary data |
| 225 | case 'R': |
| 226 | { |
| 227 | const uint32_t length = ReadWord(input, cursor, end); |
| 228 | cursor += length; |
| 229 | break; |
| 230 | } |
| 231 | |
| 232 | case 'b': |
| 233 | // TODO: what is the 'b' type code? Right now we just skip over it / |
| 234 | // take the full range we could get |
| 235 | cursor = end; |
| 236 | break; |
| 237 | |
| 238 | // array of * |
| 239 | case 'f': |
| 240 | case 'd': |
no test coverage detected