MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / MappedFileRead

Function MappedFileRead

util/memmap.c:81–89  ·  view source on GitHub ↗

/ * MappedFileRead: Copy num bytes from the memory-mapped file to buf. * Increments the file pointer. * Returns num on success, or -1 on failure. */

Source from the content-addressed store, hash-verified

79 * Returns num on success, or -1 on failure.
80 */
81int MappedFileRead(file_node *f, void *buf, int num)
82{
83 if ((f->ptr - f->mem) + num > f->length || f->ptr < f->mem || num <= 0)
84 return -1;
85
86 memcpy(buf, f->ptr, num);
87 f->ptr += num;
88 return num;
89}
90/***************************************************************************/
91/*
92 * MappedFileWrite: Write num bytes from buf to f, and increment the file pointer.

Callers 2

DumpPaletteFunction · 0.70
ComparePaletteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected