# HG changeset patch # User Matti Hamalainen # Date 1411578073 -10800 # Node ID 4094fcfd4783f75abfe05f541a006b0791421823 # Parent 84182dab4fca9452ab57140f7ea212b8fc35f993 Rename functions. diff -r 84182dab4fca -r 4094fcfd4783 th_endian.c --- 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; \ diff -r 84182dab4fca -r 4094fcfd4783 th_endian.h --- 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)