/ * MappedFileRead: Copy num bytes from the memory-mapped file to buf. * Increments the file pointer. * Returns num on success, or -1 on failure. */
| 79 | * Returns num on success, or -1 on failure. |
| 80 | */ |
| 81 | int 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. |
no outgoing calls
no test coverage detected