MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / ply_read_header

Function ply_read_header

src/IO/rply.c:384–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384int ply_read_header(p_ply ply) {
385 assert(ply && ply->fp && ply->io_mode == PLY_READ);
386 if (!ply_read_header_magic(ply)) return 0;
387 if (!ply_read_word(ply)) return 0;
388 /* parse file format */
389 if (!ply_read_header_format(ply)) {
390 ply_ferror(ply, "Invalid file format");
391 return 0;
392 }
393 /* parse elements, comments or obj_infos until the end of header */
394 while (strcmp(BWORD(ply), "end_header")) {
395 if (!ply_read_header_comment(ply) &&
396 !ply_read_header_element(ply) &&
397 !ply_read_header_obj_info(ply)) {
398 ply_ferror(ply, "Unexpected token '%s'", BWORD(ply));
399 return 0;
400 }
401 }
402 /* skip extra character? */
403 if (ply->rn) {
404 if (BSIZE(ply) < 1 && !BREFILL(ply)) {
405 ply_ferror(ply, "Unexpected end of file");
406 return 0;
407 }
408 BSKIP(ply, 1);
409 }
410 return 1;
411}
412
413long ply_set_read_cb(p_ply ply, const char *element_name,
414 const char* property_name, p_ply_read_cb read_cb,

Callers 1

parse_plyFunction · 0.85

Calls 8

ply_read_header_magicFunction · 0.85
ply_read_wordFunction · 0.85
ply_read_header_formatFunction · 0.85
ply_ferrorFunction · 0.85
ply_read_header_commentFunction · 0.85
ply_read_header_elementFunction · 0.85
ply_read_header_obj_infoFunction · 0.85
BREFILLFunction · 0.85

Tested by

no test coverage detected