diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /converter/pbm/mgrtopbm.c | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/pbm/mgrtopbm.c')
-rw-r--r-- | converter/pbm/mgrtopbm.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/converter/pbm/mgrtopbm.c b/converter/pbm/mgrtopbm.c index 712e3be9..e0a88883 100644 --- a/converter/pbm/mgrtopbm.c +++ b/converter/pbm/mgrtopbm.c @@ -58,12 +58,12 @@ interpHdrHeight(struct b_header const head, static void -readMgrHeader(FILE * const ifP, - unsigned int * const colsP, - unsigned int * const rowsP, - unsigned int * const depthP, +readMgrHeader(FILE * const ifP, + unsigned int * const colsP, + unsigned int * const rowsP, + unsigned int * const depthP, unsigned int * const padrightP ) { - + struct b_header head; unsigned int pad; size_t bytesRead; @@ -73,10 +73,10 @@ readMgrHeader(FILE * const ifP, pm_error("Unable to read 1st byte of file. " "fread() returns errno %d (%s)", errno, strerror(errno)); - if (head.magic[0] == 'y' && head.magic[1] == 'z') { + if (head.magic[0] == 'y' && head.magic[1] == 'z') { /* new style bitmap */ size_t bytesRead; - bytesRead = fread(&head.depth, + bytesRead = fread(&head.depth, sizeof(head) - sizeof(struct old_b_header), 1, ifP); if (bytesRead != 1 ) pm_error("Unable to read header after 1st byte. " @@ -84,11 +84,11 @@ readMgrHeader(FILE * const ifP, errno, strerror(errno)); *depthP = (int) head.depth - ' '; pad = 8; - } else if (head.magic[0] == 'x' && head.magic[1] == 'z') { + } else if (head.magic[0] == 'x' && head.magic[1] == 'z') { /* old style bitmap with 32-bit padding */ *depthP = 1; pad = 32; - } else if (head.magic[0] == 'z' && head.magic[1] == 'z') { + } else if (head.magic[0] == 'z' && head.magic[1] == 'z') { /* old style bitmap with 16-bit padding */ *depthP = 1; pad = 16; @@ -104,8 +104,8 @@ readMgrHeader(FILE * const ifP, interpHdrWidth (head, colsP); interpHdrHeight(head, rowsP); - - *padrightP = ( ( *colsP + pad - 1 ) / pad ) * pad - *colsP; + + *padrightP = ((*colsP + pad - 1) / pad) * pad - *colsP; } @@ -131,7 +131,7 @@ main(int argc, inputFileName = argv[1]; else inputFileName = "-"; - + ifP = pm_openr(inputFileName); readMgrHeader(ifP, &cols, &rows, &depth, &padright); @@ -141,7 +141,7 @@ main(int argc, pbm_writepbminit(stdout, cols, rows, 0); bitrow = pbm_allocrow_packed(cols + padright); - + itemCount = (cols + padright ) / 8; for (row = 0; row < rows; ++row) { @@ -166,9 +166,9 @@ main(int argc, Changed bitrow from plain to raw, read function from getc() to fread(), write function from pbm_writepbmrow() to pbm_writepbmrow_packed(). Retired bitwise transformation functions. - + NOT tested for old-style format files. Only one zz file in mgrsrc-0.69 . - + */ |