Mercurial > hg > dmlib
view src/dmresw.c @ 1088:9f06f6661cdf
Cleanups for file endianess read/write helper functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 02 Mar 2015 20:16:43 +0200 |
parents | b01d04e44b6f |
children | 0cac3360a0aa |
line wrap: on
line source
/* * DMLib * -- Resource management * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2011-2015 Tecnic Software productions (TNSP) */ #include "dmresw.h" int dmf_write_str(DMResource *f, const void *s, const size_t l) { return dmfwrite(s, 1, l, f) == l; } BOOL dmf_write_byte(DMResource *f, const Uint8 val) { return dmfputc(val, f) == val; } #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ BOOL dmf_write_ ## xname (DMResource *f, const xtype v) { \ xtype result = DM_NATIVE_TO_ ## xmacro (v); \ if (dmfwrite(&result, sizeof( xtype ), 1, f) != 1) \ return FALSE; \ return TRUE; \ } #include "dmfiletmpl.h" #undef DM_DEFINE_FFUNC