diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-09-07 16:47:31 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-09-07 16:47:31 +0000 |
commit | 37693f98c95a44079507ccbb7fc51fbab72d6479 (patch) | |
tree | f2ec4b95b2a80eb0ea10df218d90e838760315ef | |
parent | d21bd279be4f70e9cdf4369691dd9e82fadfa5c4 (diff) | |
download | netpbm-mirror-37693f98c95a44079507ccbb7fc51fbab72d6479.tar.gz netpbm-mirror-37693f98c95a44079507ccbb7fc51fbab72d6479.tar.xz netpbm-mirror-37693f98c95a44079507ccbb7fc51fbab72d6479.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4934 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | converter/other/rast.c | 67 | ||||
-rw-r--r-- | converter/other/zeisstopnm.c | 12 | ||||
-rw-r--r-- | converter/pbm/pbmtoplot.c | 19 | ||||
-rw-r--r-- | converter/pgm/bioradtopgm.c | 21 | ||||
-rw-r--r-- | converter/pgm/hipstopgm.c | 15 | ||||
-rw-r--r-- | converter/pgm/lispmtopgm.c | 2 | ||||
-rw-r--r-- | converter/pgm/pgmtofs.c | 24 | ||||
-rw-r--r-- | converter/ppm/mtvtoppm.c | 13 | ||||
-rw-r--r-- | converter/ppm/pi1toppm.c | 12 | ||||
-rw-r--r-- | converter/ppm/ppmtoilbm.c | 54 | ||||
-rw-r--r-- | converter/ppm/ppmtopi1.c | 14 | ||||
-rw-r--r-- | converter/ppm/ppmtopuzz.c | 14 | ||||
-rw-r--r-- | converter/ppm/rgb3toppm.c | 10 | ||||
-rw-r--r-- | converter/ppm/spctoppm.c | 30 | ||||
-rw-r--r-- | editor/pamaltsat.c | 2 | ||||
-rw-r--r-- | editor/pnmalias.c | 8 | ||||
-rw-r--r-- | editor/pnmscalefixed.c | 37 | ||||
-rw-r--r-- | editor/specialty/pbmlife.c | 15 | ||||
-rw-r--r-- | editor/specialty/pgmabel.c | 21 |
19 files changed, 195 insertions, 195 deletions
diff --git a/converter/other/rast.c b/converter/other/rast.c index 1a64f7e5..32a9bc18 100644 --- a/converter/other/rast.c +++ b/converter/other/rast.c @@ -1,4 +1,5 @@ -/* libpnm4.c - pnm utility library part 4 +/* rast.c +** (Formerly named libpnm4.c - pnm utility library part 4) ** ** Copyright (C) 1988 by Jef Poskanzer. ** @@ -20,9 +21,10 @@ */ struct pixrect* -mem_create( w, h, depth ) - int w, h, depth; -{ +mem_create(int const w, + int const h, + int const depth) { + struct pixrect* p; struct mpr_data* m; @@ -64,9 +66,7 @@ mem_create( w, h, depth ) void -mem_free( p ) - struct pixrect* p; -{ +mem_free(struct pixrect* const p) { free( p->pr_data->md_image ); free( p->pr_data ); free( p ); @@ -75,12 +75,12 @@ mem_free( p ) int -pr_dump( p, out, colormap, type, copy_flag ) - struct pixrect* p; - FILE* out; - colormap_t* colormap; - int type, copy_flag; -{ +pr_dump(struct pixrect* const p, + FILE* const out, + colormap_t* const colormap, + int const type, + int const copy_flag) { + struct rasterfile h; int size, besize, count; unsigned char* beimage; @@ -276,17 +276,18 @@ pr_dump( p, out, colormap, type, copy_flag ) int -pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { +pr_load_header(FILE * const ifP, + struct rasterfile * const headerP) { { - long magic; + long int magic; pm_readbiglong(ifP, &magic); if (magic != RAS_MAGIC) pm_error("Wrong magic number for a RAST file"); } { - long width; + long int width; pm_readbiglong(ifP, &width); if (width < 0) @@ -295,7 +296,7 @@ pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { headerP->ras_width = width; } { - long height; + long int height; pm_readbiglong(ifP, &height); if (height < 0) @@ -304,7 +305,7 @@ pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { headerP->ras_height = height; } { - long depth; + long int depth; pm_readbiglong(ifP, &depth); if (depth < 0) @@ -313,7 +314,7 @@ pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { headerP->ras_depth = depth; } { - long length; + long int length; pm_readbiglong(ifP, &length); if (length < 0) @@ -325,7 +326,7 @@ pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { pm_readbiglong(ifP, &headerP->ras_maptype); { - long mapLength; + long int mapLength; pm_readbiglong(ifP, &mapLength); if (mapLength < 0) @@ -339,11 +340,10 @@ pr_load_header(FILE * const ifP, struct rasterfile * const headerP) { int -pr_load_colormap( in, hP, colormap ) - FILE* in; - struct rasterfile* hP; - colormap_t* colormap; -{ +pr_load_colormap(FILE* const in, + struct rasterfile* const hP, + colormap_t* const colormap) { + if ( colormap == NULL || hP->ras_maptype == RMT_NONE ) { int i; @@ -416,18 +416,17 @@ pr_load_colormap( in, hP, colormap ) struct pixrect* -pr_load_image( in, hP, colormap ) - FILE* in; - struct rasterfile* hP; - colormap_t* colormap; -{ +pr_load_image(FILE* const in, + struct rasterfile* const hP, + colormap_t* const colormap) { + struct pixrect* p; unsigned char* beimage; - register unsigned char* bep; - register unsigned char* bp; - register unsigned char c; + unsigned char* bep; + unsigned char* bp; + unsigned char c; int i; - register int j, count; + int j, count; p = mem_create( hP->ras_width, hP->ras_height, hP->ras_depth ); if ( p == NULL ) diff --git a/converter/other/zeisstopnm.c b/converter/other/zeisstopnm.c index 5f1e97ec..d3b50770 100644 --- a/converter/other/zeisstopnm.c +++ b/converter/other/zeisstopnm.c @@ -52,20 +52,18 @@ #include "pnm.h" int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* ifp; int argn, row, i; - register int col; + int col; int rows=0, cols=0; int format = 0; xel* xelrow; - register xel* xP; + xel* xP; char* buf = NULL; unsigned char *lutr, *lutg, *lutb; - long nread = 0; + long int nread = 0; unsigned char* byteP; const char* const usage = "[-pgm|-ppm] [Zeissfile]"; diff --git a/converter/pbm/pbmtoplot.c b/converter/pbm/pbmtoplot.c index db897bd0..b2a7b059 100644 --- a/converter/pbm/pbmtoplot.c +++ b/converter/pbm/pbmtoplot.c @@ -13,26 +13,23 @@ #include <stdio.h> #include "pbm.h" -static void puttwo ARGS((int i)); static void -puttwo( i ) - int i; +puttwo(int const i) { (void) putchar(i); (void) putchar(i >> 8); } + + int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char * argv[]) { + FILE* ifp; - register bit** bits; - register int row, col, scol; + bit** bits; + int row, col, scol; int rows, cols; - pbm_init( &argc, argv ); if ( argc > 2 ) @@ -73,7 +70,7 @@ main( argc, argv ) } exit( 0 ); - } +} diff --git a/converter/pgm/bioradtopgm.c b/converter/pgm/bioradtopgm.c index 471709c1..9acdf8a5 100644 --- a/converter/pgm/bioradtopgm.c +++ b/converter/pgm/bioradtopgm.c @@ -23,15 +23,12 @@ #define BYTE_TO_WORD(lsb,msb) (((BYTE) lsb) + (((BYTE) msb) << 8)) int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char * argv[]) { FILE* ifp; gray* grayrow; - register gray* gP; + gray* gP; int argn, row, i; - register int col, val, val2; + int col, val, val2; int rows=0, cols=0, image_num= -1, image_count, byte_word, check_word; int maxval; BYTE buf[BIORAD_HEADER_LENGTH]; @@ -47,6 +44,18 @@ main( argc, argv ) if ( ISDIGIT( argv[argn][1] )) { image_num = atoi( (argv[argn]+1) ); + + /* TODO atoi() ignores errors. Should be: + + const char * error; + + pm_string_to_int( argv[argn]+1, &image_num, error); + + if (error) + pm_error("Invalid image number. %s", error); + else if (image_num < 0) + pm_error("Internal error: negative image number"); + */ } else pm_usage( usage ); diff --git a/converter/pgm/hipstopgm.c b/converter/pgm/hipstopgm.c index 17048ce7..1517eee1 100644 --- a/converter/pgm/hipstopgm.c +++ b/converter/pgm/hipstopgm.c @@ -53,11 +53,10 @@ read_line(FILE * const fd, static void -read_hips_header( fd, hP ) - FILE* fd; - struct HIPS_Header* hP; -{ - char buf[5000]; +read_hips_header(FILE* const fd, + struct HIPS_Header* const hP) { + + char buf[5000]; /* TODO Check if 5000 is sufficient */ /* Read and toss orig_name. */ read_line( fd, buf, 5000 ); @@ -74,7 +73,7 @@ read_hips_header( fd, hP ) /* Read rows. */ read_line( fd, buf, 5000 ); - hP->rows = atoi( buf ); + hP->rows = atoi( buf ); /* TODO Use pm_string_to_int() instead of atoi() */ /* Read cols. */ read_line( fd, buf, 5000 ); @@ -107,9 +106,9 @@ main(int argc, char * argv[]) { FILE* ifp; gray* grayrow; - register gray* gP; + gray* gP; int argn, row; - register int col; + int col; int maxval; int rows, cols; struct HIPS_Header h; diff --git a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c index 29f280f3..56ae9e2b 100644 --- a/converter/pgm/lispmtopgm.c +++ b/converter/pgm/lispmtopgm.c @@ -138,7 +138,7 @@ getval(FILE * const ifP) { int -main(int argc, const char ** argv) { +main(int argc, const char * argv[]) { FILE * ifP; gray * grayrow; diff --git a/converter/pgm/pgmtofs.c b/converter/pgm/pgmtofs.c index 8780b35a..57ca79cc 100644 --- a/converter/pgm/pgmtofs.c +++ b/converter/pgm/pgmtofs.c @@ -12,25 +12,22 @@ #include "pgm.h" -static void putinit ARGS(( int cols, int rows, int bps )); -static void putitem ARGS(( void )); -static void putgray ARGS(( gray g )); -static void putrest ARGS(( void )); +static void putinit ( int const cols, int const rows, int const bps ); +static void putitem ( void ); +static void putgray ( gray const g ); +static void putrest ( void ); int -main( argc, argv ) - int argc; - char* argv[]; -{ +main(int argc, const char * argv[]) { FILE* ifp; gray** grays; - register gray* gP; + gray* gP; int argn, rows, cols, bps, padright, row, col; gray maxval, nmaxval; const char* const usage = "[pgmfile]"; - pgm_init( &argc, argv ); + pm_proginit(&argc, argv); argn = 1; @@ -87,8 +84,9 @@ main( argc, argv ) static int bitspersample, item, bitsperitem, bitshift, itemsperline, items; static void -putinit( cols, rows, bps ) - int cols, rows, bps; +putinit(int const cols, + int const rows, + int const bps) { printf( "FirstName: \n" ); printf( "LastName: \n" ); @@ -134,7 +132,7 @@ putitem( ) static void -putgray( gray g ) +putgray( gray const g ) { if ( bitsperitem == 8 ) putitem( ); diff --git a/converter/ppm/mtvtoppm.c b/converter/ppm/mtvtoppm.c index 42f99428..73a960c8 100644 --- a/converter/ppm/mtvtoppm.c +++ b/converter/ppm/mtvtoppm.c @@ -12,17 +12,16 @@ #include "ppm.h" +#define MAXLINE 500 /* TODO Check if this is sufficient */ + int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc , char* argv[]) { + FILE* ifp; pixel* pixelrow; - register pixel* pP; + pixel* pP; int rows, cols, row, col; pixval maxval; -#define MAXLINE 500 char line[MAXLINE]; unsigned char buf[3]; @@ -65,7 +64,7 @@ main( argc, argv ) pm_close( stdout ); exit( 0 ); - } +} diff --git a/converter/ppm/pi1toppm.c b/converter/ppm/pi1toppm.c index 9a07f535..57f65582 100644 --- a/converter/ppm/pi1toppm.c +++ b/converter/ppm/pi1toppm.c @@ -19,16 +19,14 @@ static short screen[ROWS*COLS/4]; /* simulates the Atari's video RAM */ int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* ifp; pixel pal[16]; /* Degas palette */ short i; short j; pixel* pixelrow; - register pixel* pP; + pixel* pP; int row, col; @@ -73,7 +71,7 @@ main( argc, argv ) { for ( col = 0, pP = pixelrow; col < COLS; ++col, ++pP ) { - register int c, ind, b, plane; + int c, ind, b, plane; ind = 80 * row + ( ( col >> 4 ) << 2 ); b = 0x8000 >> ( col & 0xf ); @@ -89,7 +87,7 @@ main( argc, argv ) pm_close( stdout ); exit( 0 ); - } +} diff --git a/converter/ppm/ppmtoilbm.c b/converter/ppm/ppmtoilbm.c index c91315c3..630a8d43 100644 --- a/converter/ppm/ppmtoilbm.c +++ b/converter/ppm/ppmtoilbm.c @@ -122,7 +122,7 @@ static pixel *pixrow; for row-by-row operation) */ -static long viewportmodes = 0; +static long int viewportmodes = 0; static int slicesize = 1; /* rows per slice for multipalette images - NOT USED */ @@ -472,7 +472,7 @@ static const unsigned char bitmask[] = {1, 2, 4, 8, 16, 32, 64, 128}; -static long +static long int encodeRow(FILE * const outfile, /* if non-NULL, write uncompressed row to this file */ rawtype * const rawrow, @@ -482,15 +482,15 @@ encodeRow(FILE * const outfile, /* encode algorithm by Johan Widen (jw@jwdata.se) */ int plane, bytes; - long retbytes = 0; + long int retbytes = 0; bytes = ilbm_rowByteCt(cols); /* Encode and write raw bytes in plane-interleaved form. */ for( plane = 0; plane < nPlanes; plane++ ) { - register int col, cbit; - register rawtype *rp; - register unsigned char *cp; + int col, cbit; + rawtype *rp; + unsigned char *cp; int mask; mask = 1 << plane; @@ -517,7 +517,7 @@ encodeRow(FILE * const outfile, -static long +static long int encodeMaskrow(FILE * const ofP, rawtype * const rawrow, int const cols) { @@ -706,7 +706,7 @@ ppmToCmap(pixel * const colorrow, typedef struct { - long count; + long int count; pixval r, g, b; } hentry; @@ -743,7 +743,7 @@ computeHamCmap(int const cols, pixel *cmap; pixval hmaxval; int i, r, g, b, col, row, *htable; - unsigned long dist, maxdist; + unsigned long int dist, maxdist; pm_message("initializing HAM colormap..."); @@ -791,7 +791,7 @@ computeHamCmap(int const cols, for( col = colors-1; col > 0; col-- ) { r = hmap[col].r; g = hmap[col].g; b = hmap[col].b; for( i = 0; i < col; i++ ) { - register int tmp; + int tmp; tmp = hmap[i].r - r; dist = tmp * tmp; tmp = hmap[i].g - g; dist += tmp * tmp; @@ -850,7 +850,7 @@ writeBodyRows(void) { bodyblock *b; int i; - long total = 0; + long int total = 0; for( b = &firstblock; b != NULL; b = b->next ) { for( i = 0; i < b->used; i++ ) { @@ -864,7 +864,7 @@ writeBodyRows(void) { -static long +static long int doHamBody(FILE * const ifP, FILE * const ofP, int const cols, @@ -878,7 +878,7 @@ doHamBody(FILE * const ifP, int col, row, i; rawtype *raw_rowbuf; colorhash_table cht, cht2; - long bodysize = 0; + long int bodysize = 0; int *itoh; /* table image -> ham */ int usehash = 1; int colbits; @@ -959,7 +959,7 @@ doHamBody(FILE * const ifP, spr = itoh[upr]; spg = itoh[upg]; spb = itoh[upb]; noprev = 0; } else { - register long di, dr, dg, db; + long int di, dr, dg, db; int scr, scg, scb; /* scaled values of colormap entry */ scr = itoh[ucr]; scg = itoh[ucg]; scb = itoh[ucb]; @@ -1041,7 +1041,7 @@ ppmToHam(FILE * const ifP, int const hamplanes) { int hamcolors, nPlanes, i, hammaxval; - long oldsize, bodysize, formsize, cmapsize; + long int oldsize, bodysize, formsize, cmapsize; int * table; int colors; pixel * colormap; @@ -1195,7 +1195,7 @@ ppmToHam(FILE * const ifP, -static long +static long int doDeepBody(FILE * const ifP, FILE * const ofP, int const cols, @@ -1206,7 +1206,7 @@ doDeepBody(FILE * const ifP, int row, col; pixel *pP; int *table = NULL; - long bodysize = 0; + long int bodysize = 0; rawtype *redbuf, *greenbuf, *bluebuf; int newmaxval; @@ -1266,7 +1266,7 @@ ppmToDeep(FILE * const ifP, int const bitspercolor) { int nPlanes; - long bodysize, oldsize, formsize; + long int bodysize, oldsize, formsize; if( maskmethod == mskHasTransparentColor ) { pm_message("masking method '%s' not usable with deep ILBM - " @@ -1320,7 +1320,7 @@ ppmToDeep(FILE * const ifP, -static long +static long int doDcolBody(FILE * const ifP, FILE * const ofP, int const cols, @@ -1330,7 +1330,7 @@ doDcolBody(FILE * const ifP, int row, col; pixel *pP; - long bodysize = 0; + long int bodysize = 0; rawtype *redbuf, *greenbuf, *bluebuf; int *redtable, *greentable, *bluetable; @@ -1379,7 +1379,7 @@ ppmToDcol(FILE * const ifP, DirectColor * const dcol) { int nPlanes; - long bodysize, oldsize, formsize; + long int bodysize, oldsize, formsize; if( maskmethod == mskHasTransparentColor ) { pm_message("masking method '%s' not usable with deep ILBM - " @@ -1444,7 +1444,7 @@ ppmToDcol(FILE * const ifP, -static long +static long int doStdBody(FILE * const ifP, FILE * const ofP, int const cols, @@ -1457,7 +1457,7 @@ doStdBody(FILE * const ifP, int row, col, i; pixel *pP; rawtype *raw_rowbuf; - long bodysize = 0; + long int bodysize = 0; int usehash = 1; colorhash_table cht; @@ -1520,7 +1520,7 @@ ppmToStd(FILE * const ifP, int const maxcolors, int const nPlanes) { - long formsize, cmapsize, bodysize, oldsize; + long int formsize, cmapsize, bodysize, oldsize; int colors; pixel * colormap; @@ -1618,7 +1618,7 @@ ppmToRgb8(FILE * const ifP, int const rows, int const maxval) { - long bodysize, oldsize, formsize; + long int bodysize, oldsize, formsize; pixel *pP; int *table = NULL; int row, col1, col2, compr_len, len; @@ -1709,7 +1709,7 @@ ppmToRgbn(FILE * const ifP, int const rows, int const maxval) { - long bodysize, oldsize, formsize; + long int bodysize, oldsize, formsize; pixel *pP; int *table = NULL; int row, col1, col2, compr_len, len; @@ -1967,7 +1967,7 @@ main(int argc, char ** argv) { else if( pm_keymatch(argv[argn], "-camg", 5) ) { char *tail; - long value = 0L; + long int value = 0L; if( ++argn >= argc ) pm_error("-camg requires a value"); diff --git a/converter/ppm/ppmtopi1.c b/converter/ppm/ppmtopi1.c index 896ec7f7..9fa46a62 100644 --- a/converter/ppm/ppmtopi1.c +++ b/converter/ppm/ppmtopi1.c @@ -20,17 +20,15 @@ static short screen[ROWS*COLS/4]; /* simulate the ST's video RAM */ int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* ifp; pixel** pixels; - register pixel *pP; + pixel *pP; colorhist_vector chv; colorhash_table cht; int rows, cols, row, colors, i; - register int col; + int col; pixval maxval; @@ -97,7 +95,7 @@ main( argc, argv ) { for ( col = 0, pP = pixels[row]; col < cols; ++col, ++pP ) { - register int color, ind, b, plane; + int color, ind, b, plane; color = ppm_lookupcolor( cht, pP ); if ( color == -1 ) @@ -117,7 +115,7 @@ main( argc, argv ) (void) pm_writebigshort( stdout, screen[i] ); exit( 0 ); - } +} diff --git a/converter/ppm/ppmtopuzz.c b/converter/ppm/ppmtopuzz.c index 08b852b0..ce9e5e6e 100644 --- a/converter/ppm/ppmtopuzz.c +++ b/converter/ppm/ppmtopuzz.c @@ -16,17 +16,15 @@ #define MAXCOLORS 256 int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* ifp; pixel** pixels; - register pixel* pP; + pixel* pP; colorhist_vector chv; colorhash_table cht; int rows, cols, row, colors, i; - register int col; + int col; pixval maxval; @@ -81,7 +79,7 @@ main( argc, argv ) { for ( col = 0, pP = pixels[row]; col < cols; ++col, ++pP ) { - register int color; + int color; color = ppm_lookupcolor( cht, pP ); if ( color == -1 ) @@ -93,7 +91,7 @@ main( argc, argv ) } exit( 0 ); - } + } diff --git a/converter/ppm/rgb3toppm.c b/converter/ppm/rgb3toppm.c index 00d76916..3e750f38 100644 --- a/converter/ppm/rgb3toppm.c +++ b/converter/ppm/rgb3toppm.c @@ -13,10 +13,8 @@ #include "ppm.h" int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* rfd; FILE* gfd; FILE* bfd; @@ -27,7 +25,7 @@ main( argc, argv ) gray* brow; gray* bP; pixel* pixelrow; - register pixel* pP; + pixel* pP; int rows, cols, trows, tcols, row, col; gray rmaxval, gmaxval, bmaxval; int rformat, gformat, bformat; @@ -85,7 +83,7 @@ main( argc, argv ) pm_close( stdout ); exit( 0 ); - } +} diff --git a/converter/ppm/spctoppm.c b/converter/ppm/spctoppm.c index a20fcfd4..cb8e8f88 100644 --- a/converter/ppm/spctoppm.c +++ b/converter/ppm/spctoppm.c @@ -16,24 +16,22 @@ #define COLS 320 #define MAXVAL 7 -static void DoBitmap ARGS(( FILE* ifp )); -static void DoChar ARGS(( int n, char c )); -static void DoColormap ARGS(( FILE* ifp )); +static void DoBitmap ( FILE* const ifp ); +static void DoChar (int const n, char const c); +static void DoColormap ( FILE* const ifp ); static char screen[ROWS*COLS/2]; static short sscreen[ROWS*COLS/4]; static pixel pal[ROWS][48]; -static long colormap_length, bitmap_length; +static long int colormap_length, bitmap_length; int -main( argc, argv ) - int argc; - char* argv[]; - { +main(int argc, char* argv[]) { + FILE* ifp; char c1, c2; pixel* pixelrow; - register pixel* pP; + pixel* pP; int row, col; @@ -114,11 +112,10 @@ main( argc, argv ) } static void -DoBitmap( ifp ) - FILE* ifp; - { +DoBitmap( FILE* ifp ) { + int i; - long count, data; + long int count, data; signed char h, c; /* Zero out first scan line. */ @@ -166,7 +163,7 @@ DoBitmap( ifp ) } static void -DoChar( int n, char c ) +DoChar( const int n, const char c ) { int i; @@ -176,9 +173,8 @@ DoChar( int n, char c ) } static void -DoColormap( ifp ) - FILE* ifp; - { +DoColormap( FILE* ifp) { + int i, j, b; short mask; diff --git a/editor/pamaltsat.c b/editor/pamaltsat.c index 3bff55bd..4a657224 100644 --- a/editor/pamaltsat.c +++ b/editor/pamaltsat.c @@ -66,7 +66,7 @@ methodFmNm(const char * const methodNm) { if (!methodList) pm_error("Failed to allocate memory for %lu saturation " - "method names", (unsigned long)ARRAY_SIZE(methodTable)); + "method names", (unsigned long int)ARRAY_SIZE(methodTable)); /* Fill the list of methods: */ for (i = 0, methodList[0] = '\0'; i < ARRAY_SIZE(methodTable); ++i) { diff --git a/editor/pnmalias.c b/editor/pnmalias.c index 51a71312..e2dedb91 100644 --- a/editor/pnmalias.c +++ b/editor/pnmalias.c @@ -19,10 +19,10 @@ main(int argc, char * argv[] ) { xel* xelrow[3]; xel* newxelrow; pixel bgcolorppm, fgcolorppm; - register xel* xpP; - register xel* xP; - register xel* xnP; - register xel* nxP; + xel* xpP; + xel* xP; + xel* xnP; + xel* nxP; xel bgcolor, fgcolor; int argn, rows, cols, format, newformat, bgonly, fgonly; int bgalias, fgalias; diff --git a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c index 1a89a2e5..3422680a 100644 --- a/editor/pnmscalefixed.c +++ b/editor/pnmscalefixed.c @@ -271,9 +271,13 @@ compute_output_dimensions(const struct cmdline_info cmdline, static void -horizontal_scale(const xel inputxelrow[], xel newxelrow[], - const int cols, const int newcols, const long sxscale, - const int format, const xelval maxval, +horizontal_scale(const xel inputxelrow[], + xel newxelrow[], + const int cols, + const int newcols, + const long int sxscale, + const int format, + const xelval maxval, int * stretchP) { /*---------------------------------------------------------------------------- Take the input row inputxelrow[], which is 'cols' columns wide, and @@ -286,8 +290,8 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[], *stretchP is the number of columns (could be fractional) on the right that we had to fill by stretching because of rounding problems. -----------------------------------------------------------------------------*/ - long r, g, b; - long fraccoltofill, fraccolleft; + long int r, g, b; + long int fraccoltofill, fraccolleft; unsigned int col; unsigned int newcol; @@ -411,11 +415,11 @@ main(int argc, char **argv ) { int rows, cols, format, newformat, rowsread, newrows, newcols; int row, col, needtoreadrow; xelval maxval, newmaxval; - long sxscale, syscale; - long fracrowtofill, fracrowleft; - long* rs; - long* gs; - long* bs; + long int sxscale, syscale; + long int fracrowtofill, fracrowleft; + long int * rs; + long int * gs; + long int * bs; int vertical_stretch; /* The number of rows we had to fill by stretching because of rounding error, which made us run out of input rows before we @@ -466,9 +470,9 @@ main(int argc, char **argv ) { tempxelrow = xelrow; else tempxelrow = pnm_allocrow( cols ); - rs = (long*) pm_allocrow( cols, sizeof(long) ); - gs = (long*) pm_allocrow( cols, sizeof(long) ); - bs = (long*) pm_allocrow( cols, sizeof(long) ); + rs = (long int *) pm_allocrow( cols, sizeof(long) ); + gs = (long int *) pm_allocrow( cols, sizeof(long) ); + bs = (long int *) pm_allocrow( cols, sizeof(long) ); rowsread = 0; fracrowleft = syscale; needtoreadrow = 1; @@ -529,7 +533,7 @@ main(int argc, char **argv ) { case PPM_TYPE: for ( col = 0, xP = xelrow, nxP = tempxelrow; col < cols; ++col, ++xP, ++nxP ) { - register long r, g, b; + long int r, g, b; r = rs[col] + fracrowtofill * PPM_GETR( *xP ); g = gs[col] + fracrowtofill * PPM_GETG( *xP ); @@ -548,7 +552,7 @@ main(int argc, char **argv ) { default: for ( col = 0, xP = xelrow, nxP = tempxelrow; col < cols; ++col, ++xP, ++nxP ) { - register long g; + long int g; g = gs[col] + fracrowtofill * PNM_GET1( *xP ); g /= SCALE; @@ -598,3 +602,6 @@ main(int argc, char **argv ) { exit( 0 ); } + + + diff --git a/editor/specialty/pbmlife.c b/editor/specialty/pbmlife.c index 03735d58..c1fe8eba 100644 --- a/editor/specialty/pbmlife.c +++ b/editor/specialty/pbmlife.c @@ -13,18 +13,16 @@ #include "pbm.h" int -main( argc, argv ) -int argc; -char* argv[]; - { +main(int argc, char * argv []) { + FILE* ifp; bit* prevrow; bit* thisrow; bit* nextrow; bit* temprow; - register bit* newrow; + bit* newrow; int rows, cols, row; - register int col, count; + int col, count; int format; @@ -111,4 +109,7 @@ char* argv[]; pm_close( stdout ); exit( 0 ); - } +} + + + diff --git a/editor/specialty/pgmabel.c b/editor/specialty/pgmabel.c index 3e05be5e..aeed967b 100644 --- a/editor/specialty/pgmabel.c +++ b/editor/specialty/pgmabel.c @@ -60,7 +60,10 @@ static double *aldl, *ardl; /* pointer for weighting factors */ ** adl <- pre-calculated surface coefficient for each segment */ static double -Sum ( int n, double *xr, int N, double *adl) +Sum ( int const n, + double const *xr, + int const N, + double const *adl) { int k; double result=0.0; @@ -80,7 +83,9 @@ Sum ( int n, double *xr, int N, double *adl) ** r <- radial position of the center of the surface */ static double -dr ( int R, double r, int N) +dr ( int const R, + double const r, + int const N) { double a; double b; @@ -96,9 +101,11 @@ dr ( int R, double r, int N) ** adl <- array with pre-calculated weighting factors */ static void -abel ( float *y, int N, double *adl) +abel ( float * y, + int const N, + double * const adl) { - register int n; + int n; double *rho, *rhop; /* results and new index */ MALLOCARRAY(rho, N); @@ -155,10 +162,8 @@ help() /* ---------------------------------------------------------------------------- ** main program */ -int main( argc, argv ) - int argc; - char* argv[]; -{ +int main(int argc, char * argv[] ) { + FILE* ifp; gray maxval; /* maximum gray-level */ gray* grayorig; |