comparison th_ioctx.h @ 457:85fa3d333556

Actually, revert the boolean changes .. meh.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Jan 2018 23:09:29 +0200
parents 347bfd3e017e
children 96d137a6b392
comparison
equal deleted inserted replaced
456:1bf886fa9db5 457:85fa3d333556
52 int (*freset)(th_ioctx *ctx); 52 int (*freset)(th_ioctx *ctx);
53 int (*ferror)(th_ioctx *ctx); 53 int (*ferror)(th_ioctx *ctx);
54 int (*fseek)(th_ioctx *ctx, const off_t, const int whence); 54 int (*fseek)(th_ioctx *ctx, const off_t, const int whence);
55 off_t (*fsize)(th_ioctx *ctx); 55 off_t (*fsize)(th_ioctx *ctx);
56 off_t (*ftell)(th_ioctx *ctx); 56 off_t (*ftell)(th_ioctx *ctx);
57 bool (*feof)(th_ioctx *ctx); 57 BOOL (*feof)(th_ioctx *ctx);
58 int (*fgetc)(th_ioctx *ctx); 58 int (*fgetc)(th_ioctx *ctx);
59 int (*fputc)(int, th_ioctx *ctx); 59 int (*fputc)(int, th_ioctx *ctx);
60 size_t (*fread)(void *ptr, const size_t, const size_t, th_ioctx *ctx); 60 size_t (*fread)(void *ptr, const size_t, const size_t, th_ioctx *ctx);
61 size_t (*fwrite)(const void *ptr, const size_t, const size_t, th_ioctx *ctx); 61 size_t (*fwrite)(const void *ptr, const size_t, const size_t, th_ioctx *ctx);
62 62
81 int th_io_open(th_ioctx *ctx, const char *mode); 81 int th_io_open(th_ioctx *ctx, const char *mode);
82 th_ioctx * th_io_fopen(const th_ioctx_ops *fops, const char *filename, const char *mode); 82 th_ioctx * th_io_fopen(const th_ioctx_ops *fops, const char *filename, const char *mode);
83 void th_io_close(th_ioctx *ctx); 83 void th_io_close(th_ioctx *ctx);
84 void th_io_free(th_ioctx *ctx); 84 void th_io_free(th_ioctx *ctx);
85 85
86 bool th_io_set_handlers(th_ioctx *ctx, 86 BOOL th_io_set_handlers(th_ioctx *ctx,
87 void (*error)(th_ioctx *, const int, const char *msg), 87 void (*error)(th_ioctx *, const int, const char *msg),
88 void (*msg)(th_ioctx *, const int, const char *msg)); 88 void (*msg)(th_ioctx *, const int, const char *msg));
89 89
90 void th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap); 90 void th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap);
91 void th_io_msg_v(th_ioctx *ctx, const int level, const char *fmt, va_list ap); 91 void th_io_msg_v(th_ioctx *ctx, const int level, const char *fmt, va_list ap);
99 int thfreset(th_ioctx *ctx); 99 int thfreset(th_ioctx *ctx);
100 int thferror(th_ioctx *ctx); 100 int thferror(th_ioctx *ctx);
101 int thfseek(th_ioctx *ctx, const off_t, const int whence); 101 int thfseek(th_ioctx *ctx, const off_t, const int whence);
102 off_t thfsize(th_ioctx *ctx); 102 off_t thfsize(th_ioctx *ctx);
103 off_t thftell(th_ioctx *ctx); 103 off_t thftell(th_ioctx *ctx);
104 bool thfeof(th_ioctx *ctx); 104 BOOL thfeof(th_ioctx *ctx);
105 int thfgetc(th_ioctx *ctx); 105 int thfgetc(th_ioctx *ctx);
106 int thfputc(int ch, th_ioctx *ctx); 106 int thfputc(int ch, th_ioctx *ctx);
107 size_t thfread(void *ptr, const size_t, const size_t, th_ioctx *ctx); 107 size_t thfread(void *ptr, const size_t, const size_t, th_ioctx *ctx);
108 size_t thfwrite(const void *, const size_t, const size_t, th_ioctx *ctx); 108 size_t thfwrite(const void *, const size_t, const size_t, th_ioctx *ctx);
109 char * thfgets(char *ptr, int size, th_ioctx *ctx); 109 char * thfgets(char *ptr, int size, th_ioctx *ctx);
110 int thfputs(const char *ptr, th_ioctx *ctx); 110 int thfputs(const char *ptr, th_ioctx *ctx);
111 int thvfprintf(th_ioctx *ctx, const char *fmt, va_list ap); 111 int thvfprintf(th_ioctx *ctx, const char *fmt, va_list ap);
112 int thfprintf(th_ioctx *ctx, const char *fmt, ...); 112 int thfprintf(th_ioctx *ctx, const char *fmt, ...);
113 113
114 bool thfread_str(th_ioctx *ctx, void *ptr, const size_t len); 114 int thfread_str(th_ioctx *ctx, void *ptr, const size_t len);
115 bool thfread_u8(th_ioctx *ctx, uint8_t *); 115 BOOL thfread_u8(th_ioctx *ctx, uint8_t *);
116 bool thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len); 116 int thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len);
117 bool thfwrite_u8(th_ioctx *ctx, const uint8_t); 117 BOOL thfwrite_u8(th_ioctx *ctx, const uint8_t);
118 118
119 119
120 // 120 //
121 // Endian-handling file read/write routines 121 // Endian-handling file read/write routines
122 // 122 //
123 bool thfwrite_ne16(th_ioctx *ctx, const uint16_t v); 123 BOOL thfwrite_ne16(th_ioctx *ctx, const uint16_t v);
124 bool thfwrite_ne32(th_ioctx *ctx, const uint32_t v); 124 BOOL thfwrite_ne32(th_ioctx *ctx, const uint32_t v);
125 bool thfwrite_ne64(th_ioctx *ctx, const uint64_t v); 125 BOOL thfwrite_ne64(th_ioctx *ctx, const uint64_t v);
126 bool thfread_ne16(th_ioctx *ctx, uint16_t *v); 126 BOOL thfread_ne16(th_ioctx *ctx, uint16_t *v);
127 bool thfread_ne32(th_ioctx *ctx, uint32_t *v); 127 BOOL thfread_ne32(th_ioctx *ctx, uint32_t *v);
128 bool thfread_ne64(th_ioctx *ctx, uint64_t *v); 128 BOOL thfread_ne64(th_ioctx *ctx, uint64_t *v);
129 129
130 bool thfwrite_le16(th_ioctx *ctx, const uint16_t v); 130 BOOL thfwrite_le16(th_ioctx *ctx, const uint16_t v);
131 bool thfwrite_le32(th_ioctx *ctx, const uint32_t v); 131 BOOL thfwrite_le32(th_ioctx *ctx, const uint32_t v);
132 bool thfwrite_le64(th_ioctx *ctx, const uint64_t v); 132 BOOL thfwrite_le64(th_ioctx *ctx, const uint64_t v);
133 bool thfread_le16(th_ioctx *ctx, uint16_t *v); 133 BOOL thfread_le16(th_ioctx *ctx, uint16_t *v);
134 bool thfread_le32(th_ioctx *ctx, uint32_t *v); 134 BOOL thfread_le32(th_ioctx *ctx, uint32_t *v);
135 bool thfread_le64(th_ioctx *ctx, uint64_t *v); 135 BOOL thfread_le64(th_ioctx *ctx, uint64_t *v);
136 136
137 bool thfwrite_be16(th_ioctx *ctx, const uint16_t v); 137 BOOL thfwrite_be16(th_ioctx *ctx, const uint16_t v);
138 bool thfwrite_be32(th_ioctx *ctx, const uint32_t v); 138 BOOL thfwrite_be32(th_ioctx *ctx, const uint32_t v);
139 bool thfwrite_be64(th_ioctx *ctx, const uint64_t v); 139 BOOL thfwrite_be64(th_ioctx *ctx, const uint64_t v);
140 bool thfread_be16(th_ioctx *ctx, uint16_t *v); 140 BOOL thfread_be16(th_ioctx *ctx, uint16_t *v);
141 bool thfread_be32(th_ioctx *ctx, uint32_t *v); 141 BOOL thfread_be32(th_ioctx *ctx, uint32_t *v);
142 bool thfread_be64(th_ioctx *ctx, uint64_t *v); 142 BOOL thfread_be64(th_ioctx *ctx, uint64_t *v);
143 143
144 144
145 #ifdef __cplusplus 145 #ifdef __cplusplus
146 } 146 }
147 #endif 147 #endif