Mercurial > hg > th-libs
changeset 134:4094fcfd4783
Rename functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 24 Sep 2014 20:01:13 +0300 |
parents | 84182dab4fca |
children | 1b39682de64f |
files | th_endian.c th_endian.h |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/th_endian.c Fri Jul 11 18:22:52 2014 +0300 +++ b/th_endian.c Wed Sep 24 20:01:13 2014 +0300 @@ -8,25 +8,25 @@ #include "th_endian.h" -BOOL th_read_str(FILE *f, uint8_t *s, size_t l) +BOOL th_fread_str(FILE *f, uint8_t *s, size_t l) { return (fread(s, sizeof(uint8_t), l, f) == l); } -BOOL th_write_str(FILE * f, uint8_t * s, size_t l) +BOOL th_fwrite_str(FILE * f, uint8_t * s, size_t l) { return (fwrite(s, sizeof(uint8_t), l, f) == l); } -BOOL th_read_byte(FILE *f, uint8_t *v) +BOOL th_fread_byte(FILE *f, uint8_t *v) { return (fread(v, sizeof(uint8_t), 1, f) == 1); } -BOOL th_write_byte(FILE * f, uint8_t v) +BOOL th_fwrite_byte(FILE * f, uint8_t v) { return (fputc(v, f) != EOF); } @@ -35,7 +35,7 @@ /* File routines for endian-dependant data */ #define TH_DEFINE_FUNC(xname, xtype, xmacro) \ -BOOL th_read_ ## xname (FILE *f, xtype *v) { \ +BOOL th_fread_ ## xname (FILE *f, xtype *v) { \ xtype result; \ if (fread(&result, sizeof( xtype ), 1, f) != 1) \ return FALSE; \ @@ -43,7 +43,7 @@ return TRUE; \ } \ \ -BOOL th_write_ ## xname (FILE *f, xtype v) { \ +BOOL th_fwrite_ ## xname (FILE *f, xtype v) { \ xtype result = TH_NATIVE_TO_ ## xmacro (v); \ if (fwrite(&result, sizeof( xtype ), 1, f) != 1) \ return FALSE; \
--- a/th_endian.h Fri Jul 11 18:22:52 2014 +0300 +++ b/th_endian.h Wed Sep 24 20:01:13 2014 +0300 @@ -101,14 +101,14 @@ /* Endian-handling file read/write routines */ -BOOL th_read_str(FILE *f, uint8_t *s, size_t l); -BOOL th_write_str(FILE *f, uint8_t *s, size_t l); -BOOL th_read_byte(FILE *f, uint8_t *b); -BOOL th_write_byte(FILE *f, uint8_t b); +BOOL th_fread_str(FILE *f, uint8_t *s, size_t l); +BOOL th_fwrite_str(FILE *f, uint8_t *s, size_t l); +BOOL th_fread_byte(FILE *f, uint8_t *b); +BOOL th_fwrite_byte(FILE *f, uint8_t b); #define TH_DEFINE_HEADER(xname, xtype) \ -BOOL th_read_ ## xname (FILE *f, xtype *v); \ -BOOL th_write_ ## xname (FILE *f, xtype v); +BOOL th_fread_ ## xname (FILE *f, xtype *v); \ +BOOL th_fwrite_ ## xname (FILE *f, xtype v); TH_DEFINE_HEADER(le16, uint16_t) TH_DEFINE_HEADER(le32, uint32_t)