Mercurial > hg > th-libs
diff th_ioctx.h @ 735:31bc1ed07cf5
Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 07 Dec 2022 12:14:39 +0200 |
parents | 29e44a58bc73 |
children | 8eca15bde07d |
line wrap: on
line diff
--- a/th_ioctx.h Wed Dec 07 11:58:54 2022 +0200 +++ b/th_ioctx.h Wed Dec 07 12:14:39 2022 +0200 @@ -31,10 +31,10 @@ typedef struct th_ioctx { char *filename; ///< Context filename, if any. May be NULL. - BOOL fallocated; ///< TRUE if filename is allocated, FALSE if "const" + bool fallocated; ///< true if filename is allocated, false if "const" char *mode; ///< Context's stdio open "mode", may also be NULL. - BOOL mallocated; ///< TRUE if mode string is allocated, FALSE if "const" - BOOL allocated; ///< TRUE if this structure has been allocated + bool mallocated; ///< true if mode string is allocated, false if "const" + bool allocated; ///< true if this structure has been allocated void *data; ///< Internal data time_t atime; ///< Last access time @@ -49,8 +49,8 @@ size_t minAlloc; ///< Minimum allocation increase (0 = default) off_t memOffset; ///< Current offset in data uint8_t *memData; ///< Pointer to data - BOOL memFree; ///< TRUE = free the allocated memory on thfclose(), FALSE = no - BOOL memWrite; ///< TRUE = memory can be written to / expanded etc. FALSE = no + bool memFree; ///< true = free the allocated memory on thfclose(), false = no + bool memWrite; ///< true = memory can be written to / expanded etc. false = no // Message functions void (*error)(struct th_ioctx *ctx, const int err, const char *msg); @@ -72,7 +72,7 @@ int (*fseek)(th_ioctx *ctx, const off_t, const int whence); off_t (*fsize)(th_ioctx *ctx); off_t (*ftell)(th_ioctx *ctx); - BOOL (*feof)(th_ioctx *ctx); + bool (*feof)(th_ioctx *ctx); int (*fgetc)(th_ioctx *ctx); int (*fputc)(int, th_ioctx *ctx); size_t (*fread)(void *ptr, const size_t, const size_t, th_ioctx *ctx); @@ -102,7 +102,7 @@ void th_io_init_stdio(th_ioctx *ctx, FILE *fh); -BOOL th_io_set_handlers(th_ioctx *ctx, +bool th_io_set_handlers(th_ioctx *ctx, void (*error)(th_ioctx *, const int, const char *msg), void (*msg)(th_ioctx *, const int, const char *msg)); @@ -125,7 +125,7 @@ int thfseek(th_ioctx *ctx, const off_t, const int whence); off_t thfsize(th_ioctx *ctx); off_t thftell(th_ioctx *ctx); -BOOL thfeof(th_ioctx *ctx); +bool thfeof(th_ioctx *ctx); int thfgetc(th_ioctx *ctx); int thfputc(int ch, th_ioctx *ctx); size_t thfread(void *ptr, const size_t, const size_t, th_ioctx *ctx); @@ -136,35 +136,35 @@ int thfprintf(th_ioctx *ctx, const char *fmt, ...) TH_ATTR_PRINTF_FMT(2, 3); -BOOL thfread_str(th_ioctx *ctx, void *ptr, const size_t len); -BOOL thfread_u8(th_ioctx *ctx, uint8_t *); -BOOL thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len); -BOOL thfwrite_u8(th_ioctx *ctx, const uint8_t); +bool thfread_str(th_ioctx *ctx, void *ptr, const size_t len); +bool thfread_u8(th_ioctx *ctx, uint8_t *); +bool thfwrite_str(th_ioctx *ctx, const void *ptr, const size_t len); +bool thfwrite_u8(th_ioctx *ctx, const uint8_t); // // Endian-handling file read/write routines // -BOOL thfwrite_ne16(th_ioctx *ctx, const uint16_t v); -BOOL thfwrite_ne32(th_ioctx *ctx, const uint32_t v); -BOOL thfwrite_ne64(th_ioctx *ctx, const uint64_t v); -BOOL thfread_ne16(th_ioctx *ctx, uint16_t *v); -BOOL thfread_ne32(th_ioctx *ctx, uint32_t *v); -BOOL thfread_ne64(th_ioctx *ctx, uint64_t *v); +bool thfwrite_ne16(th_ioctx *ctx, const uint16_t v); +bool thfwrite_ne32(th_ioctx *ctx, const uint32_t v); +bool thfwrite_ne64(th_ioctx *ctx, const uint64_t v); +bool thfread_ne16(th_ioctx *ctx, uint16_t *v); +bool thfread_ne32(th_ioctx *ctx, uint32_t *v); +bool thfread_ne64(th_ioctx *ctx, uint64_t *v); -BOOL thfwrite_le16(th_ioctx *ctx, const uint16_t v); -BOOL thfwrite_le32(th_ioctx *ctx, const uint32_t v); -BOOL thfwrite_le64(th_ioctx *ctx, const uint64_t v); -BOOL thfread_le16(th_ioctx *ctx, uint16_t *v); -BOOL thfread_le32(th_ioctx *ctx, uint32_t *v); -BOOL thfread_le64(th_ioctx *ctx, uint64_t *v); +bool thfwrite_le16(th_ioctx *ctx, const uint16_t v); +bool thfwrite_le32(th_ioctx *ctx, const uint32_t v); +bool thfwrite_le64(th_ioctx *ctx, const uint64_t v); +bool thfread_le16(th_ioctx *ctx, uint16_t *v); +bool thfread_le32(th_ioctx *ctx, uint32_t *v); +bool thfread_le64(th_ioctx *ctx, uint64_t *v); -BOOL thfwrite_be16(th_ioctx *ctx, const uint16_t v); -BOOL thfwrite_be32(th_ioctx *ctx, const uint32_t v); -BOOL thfwrite_be64(th_ioctx *ctx, const uint64_t v); -BOOL thfread_be16(th_ioctx *ctx, uint16_t *v); -BOOL thfread_be32(th_ioctx *ctx, uint32_t *v); -BOOL thfread_be64(th_ioctx *ctx, uint64_t *v); +bool thfwrite_be16(th_ioctx *ctx, const uint16_t v); +bool thfwrite_be32(th_ioctx *ctx, const uint32_t v); +bool thfwrite_be64(th_ioctx *ctx, const uint64_t v); +bool thfread_be16(th_ioctx *ctx, uint16_t *v); +bool thfread_be32(th_ioctx *ctx, uint32_t *v); +bool thfread_be64(th_ioctx *ctx, uint64_t *v); #ifdef __cplusplus