diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-09-17 02:18:06 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-09-17 02:18:06 +0000 |
commit | fc9c45188e769615b5aa686d159a8ae6bd90c081 (patch) | |
tree | 698bff69817125916e265c24002cf3943b5f8026 /converter/pbm/pbmtoicon.c | |
parent | 44da3a9e0f979bab9e60e75b3435c7dacff97dfe (diff) | |
download | netpbm-mirror-fc9c45188e769615b5aa686d159a8ae6bd90c081.tar.gz netpbm-mirror-fc9c45188e769615b5aa686d159a8ae6bd90c081.tar.xz netpbm-mirror-fc9c45188e769615b5aa686d159a8ae6bd90c081.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1283 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/pbm/pbmtoicon.c')
-rw-r--r-- | converter/pbm/pbmtoicon.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/converter/pbm/pbmtoicon.c b/converter/pbm/pbmtoicon.c index 9514a244..43c39725 100644 --- a/converter/pbm/pbmtoicon.c +++ b/converter/pbm/pbmtoicon.c @@ -17,18 +17,21 @@ Retired bitwise transformation functions. */ +#include "pm_config.h" #include "pbm.h" -static unsigned short int itemBuff[8]; -static unsigned int itemCnt; /* takes values 0 to 8 */ -FILE * putFp; +static struct ItemPutter { + unsigned short int itemBuff[8]; + unsigned int itemCnt; /* takes values 0 to 8 */ + FILE * putFp; +} ip; static void putinit(FILE * const ofP) { - putFp = ofP; - itemCnt = 0; + ip.putFp = ofP; + ip.itemCnt = 0; } @@ -36,21 +39,24 @@ putinit(FILE * const ofP) { static void putitem(uint16_t const item) { - if (itemCnt == 8 ) { + if (ip.itemCnt == 8 ) { /* Buffer is full. Write out one line. */ int rc; - rc = fprintf(putFp, + rc = fprintf(ip.putFp, "\t0x%04x,0x%04x,0x%04x,0x%04x," "0x%04x,0x%04x,0x%04x,0x%04x,\n", - itemBuff[0],itemBuff[1],itemBuff[2],itemBuff[3], - itemBuff[4],itemBuff[5],itemBuff[6],itemBuff[7]); + ip.itemBuff[0], ip.itemBuff[1], + ip.itemBuff[2], ip.itemBuff[3], + ip.itemBuff[4], ip.itemBuff[5], + ip.itemBuff[6], ip.itemBuff[7]); if (rc < 0) pm_error("fprintf() failed to write Icon bitmap"); - itemCnt = 0; + ip.itemCnt = 0; } - itemBuff[itemCnt++] = item & 0xffff; /* Only lower 16 bits are used */ + ip.itemBuff[ip.itemCnt++] = item & 0xffff; + /* Only lower 16 bits are used */ } @@ -60,10 +66,11 @@ putterm(void) { unsigned int i; - for (i = 0; i < itemCnt; ++i) { + for (i = 0; i < ip.itemCnt; ++i) { int rc; - rc = fprintf(putFp, "%s0x%04x%c", i == 0 ? "\t" : "", itemBuff[i], - i == itemCnt - 1 ? '\n' : ','); + rc = fprintf(ip.putFp, "%s0x%04x%c", i == 0 ? "\t" : "", + ip.itemBuff[i], + i == ip.itemCnt - 1 ? '\n' : ','); if (rc < 0) pm_error("fprintf() failed to write Icon bitmap"); } |