# HG changeset patch # User Matti Hamalainen # Date 1455219532 -7200 # Node ID e6a278f140c44b1f6c77f98aa2ef33ddea6fccc3 # Parent d80916aada78a34acac2a40f12ed6263b58f9612 Remove file helper functions, they will be reintroduced in another form in new I/O contexts. diff -r d80916aada78 -r e6a278f140c4 th_endian.c --- a/th_endian.c Thu Feb 11 21:24:05 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Endianess handling - * Programmed and designed by Matti 'ccr' Hamalainen - * (C) Copyright 2002-2015 Tecnic Software productions (TNSP) - * - * Please read file 'COPYING' for information on license and distribution. - */ -#include "th_endian.h" - - -/* File routines for endian-dependant data - */ -#define TH_DEFINE_FUNC(xname, xtype, xmacro) \ -BOOL th_fread_ ## xname (FILE *f, xtype *v) { \ - xtype result; \ - if (fread(&result, sizeof( xtype ), 1, f) != 1) \ - return FALSE; \ - *v = TH_ ## xmacro ## _TO_NATIVE (result); \ - return TRUE; \ -} \ - \ -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; \ - return TRUE; \ -} - -TH_DEFINE_FUNC(le16, uint16_t, LE16) -TH_DEFINE_FUNC(le32, uint32_t, LE32) - -TH_DEFINE_FUNC(be16, uint16_t, BE16) -TH_DEFINE_FUNC(be32, uint32_t, BE32) - -#ifdef TH_HAVE_64BIT -TH_DEFINE_FUNC(le64, uint64_t, LE64) -TH_DEFINE_FUNC(be64, uint64_t, BE64) -#endif - -#undef TH_DEFINE_FUNC diff -r d80916aada78 -r e6a278f140c4 th_endian.h --- a/th_endian.h Thu Feb 11 21:24:05 2016 +0200 +++ b/th_endian.h Thu Feb 11 21:38:52 2016 +0200 @@ -12,7 +12,6 @@ # include "config.h" #endif #include "th_types.h" -#include #ifdef __cplusplus extern "C" { @@ -99,23 +98,6 @@ #endif -/* Endian-handling file read/write routines - */ -#define TH_DEFINE_HEADER(xname, xtype) \ -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) - -TH_DEFINE_HEADER(be16, uint16_t) -TH_DEFINE_HEADER(be32, uint32_t) - -TH_DEFINE_HEADER(be64, uint64_t) -TH_DEFINE_HEADER(le64, uint64_t) - -#undef TH_DEFINE_HEADER - #ifdef __cplusplus } #endif diff -r d80916aada78 -r e6a278f140c4 th_file.c --- a/th_file.c Thu Feb 11 21:24:05 2016 +0200 +++ b/th_file.c Thu Feb 11 21:38:52 2016 +0200 @@ -141,29 +141,3 @@ th_free(path); return res; } - - -BOOL th_fread_str(FILE *f, uint8_t *s, size_t l) -{ - return (fread(s, sizeof(uint8_t), l, f) == l); -} - - -BOOL th_fwrite_str(FILE * f, uint8_t * s, size_t l) -{ - return (fwrite(s, sizeof(uint8_t), l, f) == l); -} - - -BOOL th_fread_byte(FILE *f, uint8_t *v) -{ - return (fread(v, sizeof(uint8_t), 1, f) == 1); -} - - -BOOL th_fwrite_byte(FILE * f, uint8_t v) -{ - return (fputc(v, f) != EOF); -} - - diff -r d80916aada78 -r e6a278f140c4 th_file.h --- a/th_file.h Thu Feb 11 21:24:05 2016 +0200 +++ b/th_file.h Thu Feb 11 21:38:52 2016 +0200 @@ -40,10 +40,6 @@ BOOL th_stat_path(const char *path, int *flags); BOOL th_mkdir_path(const char *cpath, int mode); -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); #ifdef __cplusplus }