MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / cfseek

Function cfseek

cfile/cfile.cpp:604–623  ·  view source on GitHub ↗

Just like stdio fseek(), except works on a CFILE

Source from the content-addressed store, hash-verified

602}
603// Just like stdio fseek(), except works on a CFILE
604int cfseek(CFILE *cfp, long offset, int where) {
605 int c;
606 long goal_position;
607 switch (where) {
608 case SEEK_SET:
609 goal_position = offset;
610 break;
611 case SEEK_CUR:
612 goal_position = cfp->position + offset;
613 break;
614 case SEEK_END:
615 goal_position = cfp->size + offset;
616 break;
617 default:
618 return 1;
619 }
620 c = fseek(cfp->file, cfp->lib_offset + goal_position, SEEK_SET);
621 cfp->position = ftell(cfp->file) - cfp->lib_offset;
622 return c;
623}
624
625// Just like stdio ftell(), except works on a CFILE
626long cftell(CFILE *cfp) { return cfp->position; }

Callers 15

mng_FindSpecificShipPageFunction · 0.85
mng_LoadNetPagesFunction · 0.85
ReorderPagesFunction · 0.85
EndManagePageFunction · 0.85
mng_CompileAddonPagesFunction · 0.85
mng_FindSpecificDoorPageFunction · 0.85
mng_FindSpecificTexPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected