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

Function cf_ReadInt

cfile/cfile.cpp:679–683  ·  view source on GitHub ↗

The following functions read numeric vales from a CFILE. All values are stored in the file in Intel (little-endian) format. These functions will convert to big-endian if required. These funtions will exit the program with an error if the value cannot be read, so do not call these if you don't require the data to be present. Read and return an integer (32 bits) Throws an exception of type (cfile_

Source from the content-addressed store, hash-verified

677// Read and return an integer (32 bits)
678// Throws an exception of type (cfile_error *) if the OS returns an error on read
679int32_t cf_ReadInt(CFILE *cfp, bool little_endian) {
680 int32_t i;
681 cf_ReadBytes((uint8_t *)&i, sizeof(i), cfp);
682 return little_endian ? D3::convert_le(i) : D3::convert_be(i);
683}
684// Read and return a int16_t (16 bits)
685// Throws an exception of type (cfile_error *) if the OS returns an error on read
686int16_t cf_ReadShort(CFILE *cfp, bool little_endian) {

Callers 15

mng_ReadNewShipPageFunction · 0.85
mng_ReadShipPageFunction · 0.85
mng_FindSpecificShipPageFunction · 0.85
mng_ReadNewSoundPageFunction · 0.85
mng_ReadSoundPageFunction · 0.85
TableVersionCurrentFunction · 0.85
mng_LoadNetPagesFunction · 0.85
mng_LoadLocalPagesFunction · 0.85
mng_TransferPagesFunction · 0.85
ReorderPagesFunction · 0.85

Calls 3

cf_ReadBytesFunction · 0.85
convert_leFunction · 0.85
convert_beFunction · 0.85

Tested by 1

TESTFunction · 0.68