hbmap: fix iterator truncation when size_t < 32bit
[rofl0r-agsutils.git] / File.h
blobc57e6e45889b1aacfc16dbe93715d4f19211be62
1 #ifndef FILE_H
2 #define FILE_H
3 #include <stddef.h>
4 #include <stdio.h>
5 #include "ByteArray.h"
7 typedef struct AFile {
8 struct ByteArray b_b;
9 struct ByteArray *b;
10 } AF;
12 /* 0: error, 1: success */
13 int AF_open(AF *f, const char* fn);
14 void AF_close(AF* f);
16 off_t AF_get_pos(AF* f);
17 int AF_set_pos(AF* f, off_t x);
19 ssize_t AF_read(AF* f, void* buf, size_t len);
20 long long AF_read_longlong(AF* f);
21 int AF_read_int(AF* f);
22 unsigned AF_read_uint(AF* f);
23 short AF_read_short(AF* f);
24 unsigned short AF_read_ushort(AF* f);
25 int AF_read_string(AF* a, char* buf, size_t max);
26 int AF_read_uchar(AF *f);
28 /* dumps file contents between start and start+len into fn */
29 int AF_dump_chunk(AF* a, size_t start, size_t len, char* fn);
30 int AF_dump_chunk_stream(AF* a, size_t start, size_t len, FILE* out);
31 /* "swallows" or skips l bytes, i.e. advances the offset */
32 int AF_read_junk(AF* a, size_t l);
34 #pragma RcB2 DEP "File.c"
36 #endif