We don't care about end-of-line, generally, because we * separate words by any white-space character. * Unfortunately, in binary mode, right after 'end_header', * we have to know *exactly* how many characters to skip */ We use the end-of-line marker after the 'ply' magic * number to figure out what to do */
| 328 | /* We use the end-of-line marker after the 'ply' magic |
| 329 | * number to figure out what to do */ |
| 330 | static int ply_read_header_magic(p_ply ply) { |
| 331 | char *magic = ply->buffer; |
| 332 | if (!BREFILL(ply)) { |
| 333 | ply->error_cb(ply, "Unable to read magic number from file"); |
| 334 | return 0; |
| 335 | } |
| 336 | /* check if it is ply */ |
| 337 | if (magic[0] != 'p' || magic[1] != 'l' || magic[2] != 'y' |
| 338 | || !isspace(magic[3])) { |
| 339 | ply->error_cb(ply, "Wrong magic number. Expected 'ply'"); |
| 340 | return 0; |
| 341 | } |
| 342 | /* figure out if we have to skip the extra character |
| 343 | * after header when we reach the binary part of file */ |
| 344 | ply->rn = magic[3] == '\r' && magic[4] == '\n'; |
| 345 | BSKIP(ply, 3); |
| 346 | return 1; |
| 347 | } |
| 348 | |
| 349 | /* ---------------------------------------------------------------------- |
| 350 | * Exported functions |
no test coverage detected