MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / ChunkFile_Open_Ex

Function ChunkFile_Open_Ex

src/file.c:983–1002  ·  view source on GitHub ↗

* Open a chunk file (starting with FORM) for reading. * * @param filename The name of the file to open. * @return An index value refering to the opened file, or FILE_INVALID. */

Source from the content-addressed store, hash-verified

981 * @return An index value refering to the opened file, or FILE_INVALID.
982 */
983uint8 ChunkFile_Open_Ex(enum SearchDirectory dir, const char *filename)
984{
985 uint8 index;
986 uint32 header;
987
988 index = File_Open_Ex(dir, filename, FILE_MODE_READ);
989
990 if(index == FILE_INVALID) return index;
991
992 File_Read(index, &header, 4);
993
994 if (header != HTOBE32(CC_FORM)) {
995 File_Close(index);
996 return FILE_INVALID;
997 }
998
999 File_Seek(index, 4, 1);
1000
1001 return index;
1002}
1003
1004/**
1005 * Close an opened chunk file.

Callers

nothing calls this directly

Calls 4

File_Open_ExFunction · 0.85
File_ReadFunction · 0.85
File_CloseFunction · 0.85
File_SeekFunction · 0.85

Tested by

no test coverage detected