diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pm.h | 20 | ||||
-rw-r--r-- | lib/pmfileio.c | 35 |
2 files changed, 55 insertions, 0 deletions
diff --git a/lib/pm.h b/lib/pm.h index 644e2670..7870e1c7 100644 --- a/lib/pm.h +++ b/lib/pm.h @@ -273,6 +273,16 @@ pm_readbiglongu(FILE * const ifP, } int +pm_readbiglong2(FILE * const ifP, + int32_t * const lP); + +static __inline__ int +pm_readbiglongu2(FILE * const ifP, + uint32_t * const lP) { + return pm_readbiglong2(ifP, (int32_t *) lP); +} + +int pm_writebiglong(FILE * const ofP, long const l); @@ -313,6 +323,16 @@ pm_readlittlelongu(FILE * const ifP, } int +pm_readlittlelong2(FILE * const ifP, + int32_t * const lP); + +static __inline__ int +pm_readlittlelong2u(FILE * const ifP, + uint32_t * const lP) { + return pm_readlittlelong2(ifP, (int32_t *) lP); +} + +int pm_writelittlelong(FILE * const ofP, long const l); diff --git a/lib/pmfileio.c b/lib/pmfileio.c index 819a0343..dd7e617e 100644 --- a/lib/pmfileio.c +++ b/lib/pmfileio.c @@ -29,6 +29,7 @@ /* This makes the the x64() functions available on AIX */ #include <unistd.h> +#include <assert.h> #include <stdio.h> #include <fcntl.h> #include <stdarg.h> @@ -524,6 +525,23 @@ pm_readbiglong(FILE * const ifP, int +pm_readbiglong2(FILE * const ifP, + int32_t * const lP) { + int rc; + long l; + + rc = pm_readbiglong(ifP, &l); + + assert((int32_t)l == l); + + *lP = (int32_t)l; + + return rc; +} + + + +int pm_writebiglong(FILE * const ofP, long const l) { @@ -582,6 +600,23 @@ pm_readlittlelong(FILE * const ifP, int +pm_readlittlelong2(FILE * const ifP, + int32_t * const lP) { + int rc; + long l; + + rc = pm_readlittlelong(ifP, &l); + + assert((int32_t)l == l); + + *lP = (int32_t)l; + + return rc; +} + + + +int pm_writelittlelong(FILE * const ofP, long const l) { |