| 242 | } |
| 243 | |
| 244 | string OriginAnyParser::readObjectAsString(unsigned int size) |
| 245 | { |
| 246 | // read a size-byte blob of data followed by '\n' |
| 247 | if (size > 0) { |
| 248 | char c; |
| 249 | // get a string large enough to hold the result, initialize it to all 0's |
| 250 | string blob = string(size, '\0'); |
| 251 | // read data into that string |
| 252 | // cannot use '>>' operator because iendianfstream truncates it at first '\0' |
| 253 | file.read(&blob[0], size); |
| 254 | // read the '\n' |
| 255 | file >> c; |
| 256 | if (c != '\n') { |
| 257 | curpos = file.tellg(); |
| 258 | LOG_PRINT(logfile, "Wrong delimiter %c at %" PRId64 " [0x%" PRIx64 "]\n", c, curpos, |
| 259 | curpos) |
| 260 | parseError = 4; |
| 261 | return string(); |
| 262 | } |
| 263 | return blob; |
| 264 | } |
| 265 | return string(); |
| 266 | } |
| 267 | |
| 268 | void OriginAnyParser::readFileVersion() |
| 269 | { |