diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-27 23:20:22 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-27 23:20:22 +0000 |
commit | 772c4792d998deb70f1719c1a2ad82f2defde5f0 (patch) | |
tree | f512ff95f5e767aa5bb1655caa0aaf87063a624a /urt/rle_row_alc.c | |
parent | f336dfc59346a26a045f7e0df0ecba32d904c55e (diff) | |
download | netpbm-mirror-772c4792d998deb70f1719c1a2ad82f2defde5f0.tar.gz netpbm-mirror-772c4792d998deb70f1719c1a2ad82f2defde5f0.tar.xz netpbm-mirror-772c4792d998deb70f1719c1a2ad82f2defde5f0.zip |
Promote Development release to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4318 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'urt/rle_row_alc.c')
-rw-r--r-- | urt/rle_row_alc.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/urt/rle_row_alc.c b/urt/rle_row_alc.c index 982e1c5e..d7631744 100644 --- a/urt/rle_row_alc.c +++ b/urt/rle_row_alc.c @@ -1,14 +1,14 @@ /* * This software is copyrighted as noted below. It may be freely copied, - * modified, and redistributed, provided that the copyright notice is + * modified, and redistributed, provided that the copyright notice is * preserved on all copies. - * + * * There is no warranty or other guarantee of fitness for this software, * it is provided solely "as is". Bug reports or fixes may be sent * to the author, who may or may not act on them as he desires. * * You may not include this software in a program or other software product - * without supplying the source, or without informing the end-user that the + * without supplying the source, or without informing the end-user that the * source is available for no extra charge. * * If you modify this software, you should include a notice giving the @@ -18,13 +18,13 @@ * Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire * to have all "void" functions so declared. */ -/* +/* * rle_row_alc.c - Allocate buffers for rle_getrow/rle_putrow. - * - * Author: Spencer W. Thomas - * Computer Science Dept. - * University of Utah - * Date: Fri Nov 14 1986 + * + * Author: Spencer W. Thomas + * Computer Science Dept. + * University of Utah + * Date: Fri Nov 14 1986 * Copyright (c) 1986, Spencer W. Thomas */ @@ -35,24 +35,24 @@ /***************************************************************** * TAG( rle_row_alloc ) - * + * * Allocate buffer space for use by rle_getrow and rle_putrow. * Inputs: - * the_hdr: Header structure for RLE file to be read or - * written. + * the_hdr: Header structure for RLE file to be read or + * written. * Outputs: - * scanp: Pointer to pointer to created scanline buffer. - * This pointer is adjusted for the alpha channel, - * if present. - * Returns 0 for success, -1 if malloc failed. + * scanp: Pointer to pointer to created scanline buffer. + * This pointer is adjusted for the alpha channel, + * if present. + * Returns 0 for success, -1 if malloc failed. * Assumptions: - * No input scanline will extend beyond the declared xmax endpoint. + * No input scanline will extend beyond the declared xmax endpoint. * Algorithm: - * Count number of channels actually used (check bitmap). - * Allocate nchan*rowlength pixels, allocate a buffer - * to hold ncolors+alpha pointers, and give each channel - * rowlength pixels. Rowlength is xmax + 1, to allow for rle_getrow - * usage. + * Count number of channels actually used (check bitmap). + * Allocate nchan*rowlength pixels, allocate a buffer + * to hold ncolors+alpha pointers, and give each channel + * rowlength pixels. Rowlength is xmax + 1, to allow for rle_getrow + * usage. */ int rle_row_alloc( the_hdr, scanp ) @@ -64,33 +64,33 @@ rle_pixel ***scanp; rowlen = the_hdr->xmax + 1; if ( the_hdr->alpha && RLE_BIT( *the_hdr, RLE_ALPHA ) ) - nchan++; + nchan++; for ( i = 0; i < the_hdr->ncolors; i++ ) - if ( RLE_BIT( *the_hdr, i ) ) - nchan++; + if ( RLE_BIT( *the_hdr, i ) ) + nchan++; ncol = the_hdr->ncolors + the_hdr->alpha; if ( (scanbuf = (rle_pixel **)malloc( ncol * sizeof(rle_pixel *) )) == 0 ) - return -1; + return -1; if ( (pixbuf = (rle_pixel *)malloc( nchan * rowlen * - sizeof(rle_pixel) )) == 0 ) + sizeof(rle_pixel) )) == 0 ) { - free( scanbuf ); - return -1; + free( scanbuf ); + return -1; } if ( the_hdr->alpha ) - scanbuf++; + scanbuf++; for ( i = -the_hdr->alpha; i < the_hdr->ncolors; i++ ) - if ( RLE_BIT( *the_hdr, i ) ) - { - scanbuf[i] = pixbuf; - pixbuf += rowlen; - } - else - scanbuf[i] = 0; + if ( RLE_BIT( *the_hdr, i ) ) + { + scanbuf[i] = pixbuf; + pixbuf += rowlen; + } + else + scanbuf[i] = 0; *scanp = scanbuf; return 0; @@ -99,18 +99,18 @@ rle_pixel ***scanp; /***************************************************************** * TAG( rle_row_free ) - * + * * Free storage allocated by rle_row_alloc(). * Inputs: - * the_hdr: Header structure as above. - * scanp: Pointer to scanbuf above. + * the_hdr: Header structure as above. + * scanp: Pointer to scanbuf above. * Outputs: - * Frees storage referenced by scanp and nrawp. + * Frees storage referenced by scanp and nrawp. * Assumptions: - * Storage was allocated by rle_row_alloc, or by use of same - * algorithm, at least. + * Storage was allocated by rle_row_alloc, or by use of same + * algorithm, at least. * Algorithm: - * free scanp[0] and scanp. + * free scanp[0] and scanp. */ void rle_row_free( the_hdr, scanp ) @@ -120,12 +120,12 @@ rle_pixel **scanp; int i; if ( the_hdr->alpha ) - scanp--; + scanp--; for ( i = 0; i < the_hdr->ncolors + the_hdr->alpha; i++ ) - if ( scanp[i] != 0 ) - { - free( (char *)scanp[i] ); - break; - } + if ( scanp[i] != 0 ) + { + free( (char *)scanp[i] ); + break; + } free( (char *)scanp ); } |