From aff951c3594a4949b58ab47c2036ac79040a1071 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 29 Dec 2019 20:12:09 +0000 Subject: Fix typos in comments and messages, whitespace git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3726 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/libpamd.c | 210 +++++++++++++++++----------------- lib/libpammap.c | 116 +++++++++---------- lib/libpamwrite.c | 66 +++++------ lib/libpbm3.c | 2 +- lib/libppmd.c | 309 ++++++++++++++++++++++++++------------------------- lib/libsystem.c | 38 +++---- lib/pam.h | 2 +- lib/util/LICENSE.txt | 2 +- lib/util/nstring.h | 2 +- lib/util/shhopt.c | 2 +- 10 files changed, 377 insertions(+), 372 deletions(-) (limited to 'lib') diff --git a/lib/libpamd.c b/lib/libpamd.c index 952150b4..2b9eb693 100644 --- a/lib/libpamd.c +++ b/lib/libpamd.c @@ -1,4 +1,4 @@ -/* +/* ** ** This library module contains the pamdraw routines. ** @@ -12,7 +12,7 @@ ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. -** +** ** The character drawing routines are by John Walker ** Copyright (C) 1994 by John Walker, kelvin@fourmilab.ch */ @@ -89,7 +89,7 @@ pointIsWithinBounds(pamd_point const p, return (p.x >= 0 && p.x < cols && p.y >= 0 && p.y < rows); } - + static pamd_point vectorSum(pamd_point const a, @@ -106,7 +106,7 @@ static long int const DDA_SCALE = 8192; /* Several factors govern the limit of x, y coordination values. - The limit must be representable as (signed) int for coordinates to + The limit must be representable as (signed) int for coordinates to be carried in struct penpos (immediately above). The following calculation, done with long ints, must not overflow: @@ -116,7 +116,7 @@ static long int const DDA_SCALE = 8192; dy = (y1 - y0) * DDA_SCALE / abs(x1 - x0); Overflow conditions for pamd_text are rather complicated, for commands - come from an external PPMD font file. See comments below. + come from an external PPMD font file. See comments below. */ @@ -145,11 +145,11 @@ pamd_validatePoint(pamd_point const p) { static void drawPoint(pamd_drawproc drawproc, const void * const clientdata, - tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, + tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p) { /*---------------------------------------------------------------------------- Draw a single point, assuming that it is within the bounds of the @@ -171,16 +171,16 @@ drawPoint(pamd_drawproc drawproc, void -pamd_point_drawproc(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_point_drawproc(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const p, const void * const clientdata) { unsigned int i; - + if ((p.x >= 0) && (p.x < cols) && (p.y >= 0) && (p.y < rows)) for (i = 0; i < depth; ++i) tuples[p.y][p.x][i] = (sample) *((tuple *) clientdata + i); @@ -216,15 +216,15 @@ findRectangleIntersection(struct rectangle const rect1, void -pamd_filledrectangle(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, - int const left, - int const top, - int const width, - int const height, +pamd_filledrectangle(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, + int const left, + int const top, + int const width, + int const height, pamd_drawproc drawProc, const void * const clientdata) { @@ -390,16 +390,16 @@ clipEnd1(pamd_point const p0, at 0. -----------------------------------------------------------------------------*/ pamd_point c1; - /* The current clipped location of p1; we clip it multile times + /* The current clipped location of p1; we clip it multiple times to get the final location. */ /* p0 is in the frame: */ assert(p0.x >= 0 && p0.x < cols); assert(p0.y >= 0 && p0.y < rows); - + /* Clip End 1 of the line horizontally */ c1 = p1; /* initial value */ - + if (c1.x < 0) { /* We know the line isn't vertical, since End 0 is in the frame and End 1 is left of frame. @@ -413,7 +413,7 @@ clipEnd1(pamd_point const p0, c1.y = c1.y + (p0.y - c1.y) * (cols - 1 - c1.x) / (p0.x - c1.x); c1.x = cols - 1; } - + /* Clip End 1 of the line vertically */ if (c1.y < 0) { /* We know the line isn't horizontal, since End 0 is in the frame @@ -477,11 +477,11 @@ clipLine(pamd_point const p0, static void drawShallowLine(pamd_drawproc drawProc, const void * const clientdata, - tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, + tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p0, pamd_point const p1) { /*---------------------------------------------------------------------------- @@ -526,11 +526,11 @@ drawShallowLine(pamd_drawproc drawProc, static void drawSteepLine(pamd_drawproc drawProc, const void * const clientdata, - tuple ** const tuples, - int const cols, - int const rows, + tuple ** const tuples, + int const cols, + int const rows, int const depth, - sample const maxval, + sample const maxval, pamd_point const p0, pamd_point const p1) { /*---------------------------------------------------------------------------- @@ -574,11 +574,11 @@ drawSteepLine(pamd_drawproc drawProc, void -pamd_line(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_line(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p0, pamd_point const p1, pamd_drawproc drawProc, @@ -639,11 +639,11 @@ distanceFromLine(pamd_point const p, void -pamd_spline3(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_spline3(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p0, pamd_point const ctl, pamd_point const p1, @@ -679,11 +679,11 @@ pamd_spline3(tuple ** const tuples, void -pamd_polyspline(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_polyspline(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const p0, unsigned int const nc, pamd_point * const c, @@ -692,7 +692,7 @@ pamd_polyspline(tuple ** const tuples, const void * const clientdata) { pamd_point p; - + unsigned int i; assert(nc > 0); @@ -713,11 +713,11 @@ pamd_polyspline(tuple ** const tuples, void -pamd_spline4(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_spline4(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const endPt0, pamd_point const endPt1, pamd_point const ctlPt0, @@ -739,13 +739,13 @@ pamd_spline4(tuple ** const tuples, void -pamd_circle(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_circle(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const center, - unsigned int const radius, + unsigned int const radius, pamd_drawproc drawProc, const void * const clientData) { /*---------------------------------------------------------------------------- @@ -755,7 +755,7 @@ pamd_circle(tuple ** const tuples, it might maintain state that is affected by imaginary points outside the image. - Initial point is 3 o'clock. + Initial point is 3 o'clock. -----------------------------------------------------------------------------*/ if (radius >= DDA_SCALE) pm_error("Error drawing circle. Radius %d is too large.", radius); @@ -869,11 +869,11 @@ pamd_fill_create(void) { stateP->curedge = 0; fillObjP->stateP = stateP; - + /* Turn off line clipping. */ /* UGGH! We must eliminate this global variable */ oldclip = pamd_setlineclip(0); - + return fillObjP; } @@ -969,11 +969,11 @@ continueSegment(struct fillState * const stateP, */ void -pamd_fill_drawproc(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_fill_drawproc(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const p, const void * const clientdata) { @@ -1029,7 +1029,7 @@ yxCompare(const void * const c1Arg, pamd_point const p2 = c2P->point; int retval; - + if (p1.y > p2.y) retval = 1; else if (p1.y < p2.y) @@ -1047,15 +1047,15 @@ yxCompare(const void * const c1Arg, void -pamd_fill(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_fill(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, struct fillobj * const fillObjP, pamd_drawproc drawProc, const void * const clientdata) { - + struct fillState * const fh = fillObjP->stateP; int pedge; @@ -1222,7 +1222,7 @@ icos(int const deg) { times the cosine -----------------------------------------------------------------------------*/ return isin(deg + 90); -} +} @@ -1294,7 +1294,7 @@ textPosFromFontPos(pamd_point const fontPos, /* Position relative to the top left of the whole text box, assuming the text box is horizontal and has font scale. */ - + pamd_point const ps = makePoint((pl.x * (int)height) / Scalef, (pl.y * (int)height) / Scalef); /* Same as above, but with the text box its actual size */ @@ -1344,7 +1344,7 @@ drawGlyph(const struct ppmd_glyph * const glyphP, text box, in the coordinate system of the canvas. 'rotcos' and 'rotsin' tell how that text box is rotated with respect to the horizontal on the canvas. - + 'height' is the height in canvas tuples of a glyph. This is a scale factor to convert font coordinates to canvas coordinates. -----------------------------------------------------------------------------*/ @@ -1384,7 +1384,7 @@ drawGlyph(const struct ppmd_glyph * const glyphP, glyphOrigin, height, rotcos, rotsin); - + pamd_line(tuples, cols, rows, depth, maxval, p, n, drawProc, clientdata); @@ -1407,15 +1407,15 @@ drawGlyph(const struct ppmd_glyph * const glyphP, void -pamd_text(tuple** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_text(tuple** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const pos, - int const height, - int const angle, - const char * const sArg, + int const height, + int const angle, + const char * const sArg, pamd_drawproc drawProc, const void * const clientdata) { /*---------------------------------------------------------------------------- @@ -1451,7 +1451,7 @@ pamd_text(tuple** const tuples, unsigned int cursorAdvance; - pamd_validatePoint(p); + pamd_validatePoint(p); drawGlyph(glyphP, p, tuples, cols, rows, depth, maxval, height, pos, rotcos, rotsin, @@ -1471,12 +1471,12 @@ pamd_text(tuple** const tuples, static pamd_drawproc extetnsDrawproc; #endif -static void -extentsDrawproc(tuple** const tuples, - unsigned int const cols, +static void +extentsDrawproc(tuple** const tuples, + unsigned int const cols, unsigned int const rows, unsigned int const depth, - sample const maxval, + sample const maxval, pamd_point const p, const void * const clientdata) { /*---------------------------------------------------------------------------- @@ -1492,12 +1492,12 @@ extentsDrawproc(tuple** const tuples, void -pamd_text_box(int const height, - int const angle, - const char * const s, - int * const leftP, - int * const topP, - int * const rightP, +pamd_text_box(int const height, + int const angle, + const char * const s, + int * const leftP, + int * const topP, + int * const rightP, int * const bottomP) { /*---------------------------------------------------------------------------- Calculate extents rectangle for a given piece of text. For most @@ -1511,10 +1511,10 @@ pamd_text_box(int const height, extbottom = -32767; pamd_text(NULL, 32767, 32767, 255, 255, makePoint(1000, 1000), - height, angle, s, + height, angle, s, extentsDrawproc, NULL); - *leftP = extleft - 1000; + *leftP = extleft - 1000; *topP = exttop - 1000; *rightP = extright - 1000; *bottomP = extbottom - 1000; diff --git a/lib/libpammap.c b/lib/libpammap.c index 22224913..569156fe 100644 --- a/lib/libpammap.c +++ b/lib/libpammap.c @@ -64,7 +64,7 @@ pnm_createtuplehash(void) { pm_error("Out of memory allocating tuple hash of size %u", HASH_SIZE); - for (i = 0; i < HASH_SIZE; ++i) + for (i = 0; i < HASH_SIZE; ++i) retval[i] = NULL; return retval; @@ -82,13 +82,13 @@ pnm_destroytuplehash(tuplehash const tuplehash) { for (i = 0; i < HASH_SIZE; ++i) { struct tupleint_list_item * p; struct tupleint_list_item * next; - + /* Walk this chain, freeing each element */ for (p = tuplehash[i]; p; p = next) { next = p->next; free(p); - } + } } /* Free the table of chains */ @@ -98,18 +98,18 @@ pnm_destroytuplehash(tuplehash const tuplehash) { -static struct tupleint_list_item * +static struct tupleint_list_item * allocTupleIntListItem(struct pam * const pamP) { - /* This is complicated by the fact that the last element of a + /* This is complicated by the fact that the last element of a tupleint_list_item is of variable length, because the last element - of _it_ is of variable length + of _it_ is of variable length */ struct tupleint_list_item * retval; - unsigned int const size = - sizeof(*retval) - sizeof(retval->tupleint.tuple) + unsigned int const size = + sizeof(*retval) - sizeof(retval->tupleint.tuple) + pamP->depth * sizeof(sample); retval = (struct tupleint_list_item *) malloc(size); @@ -121,7 +121,7 @@ allocTupleIntListItem(struct pam * const pamP) { void pnm_addtotuplehash(struct pam * const pamP, - tuplehash const tuplehash, + tuplehash const tuplehash, tuple const tupletoadd, int const value, int * const fitsP) { @@ -138,7 +138,7 @@ pnm_addtotuplehash(struct pam * const pamP, *fitsP = FALSE; else { unsigned int const hashvalue = pnm_hashtuple(pamP, tupletoadd); - + *fitsP = TRUE; pnm_assigntuple(pamP, listItemP->tupleint.tuple, tupletoadd); @@ -151,10 +151,10 @@ pnm_addtotuplehash(struct pam * const pamP, void -pnm_lookuptuple(struct pam * const pamP, - const tuplehash tuplehash, - const tuple searchval, - int * const foundP, +pnm_lookuptuple(struct pam * const pamP, + const tuplehash tuplehash, + const tuple searchval, + int * const foundP, int * const retvalP) { /*---------------------------------------------------------------------------- Return as *revtvalP the index of the tuple value 'searchval' in the @@ -183,18 +183,18 @@ pnm_lookuptuple(struct pam * const pamP, static void -addColorOccurrenceToHash(tuple const color, +addColorOccurrenceToHash(tuple const color, tuplehash const tuplefreqhash, struct pam * const pamP, unsigned int const maxsize, unsigned int * const sizeP, bool * const fullP) { - + unsigned int const hashvalue = pnm_hashtuple(pamP, color); - + struct tupleint_list_item *p; - for (p = tuplefreqhash[hashvalue]; + for (p = tuplefreqhash[hashvalue]; p && !pnm_tupleequal(pamP, p->tupleint.tuple, color); p = p->next); @@ -205,7 +205,7 @@ addColorOccurrenceToHash(tuple const color, } else { /* It's not in the hash yet, so add it (if allowed) */ ++(*sizeP); - if (maxsize > 0 && *sizeP > maxsize) + if (maxsize > 0 && *sizeP > maxsize) *fullP = TRUE; else { *fullP = FALSE; @@ -228,7 +228,7 @@ pnm_addtuplefreqoccurrence(struct pam * const pamP, tuplehash const tuplefreqhash, int * const firstOccurrenceP) { /*---------------------------------------------------------------------------- - Tally one more occurence of the tuple value 'value' to the tuple frequencey + Tally one more occurrence of the tuple value 'value' to the tuple frequency hash 'tuplefreqhash', adding the tuple to the hash if it isn't there already. @@ -238,10 +238,10 @@ pnm_addtuplefreqoccurrence(struct pam * const pamP, program. -----------------------------------------------------------------------------*/ unsigned int const hashvalue = pnm_hashtuple(pamP, value); - + struct tupleint_list_item * p; - for (p = tuplefreqhash[hashvalue]; + for (p = tuplefreqhash[hashvalue]; p && !pnm_tupleequal(pamP, p->tupleint.tuple, value); p = p->next); @@ -270,8 +270,8 @@ pnm_addtuplefreqoccurrence(struct pam * const pamP, static void computehashrecoverable(struct pam * const pamP, - tuple ** const tupleArray, - unsigned int const maxsize, + tuple ** const tupleArray, + unsigned int const maxsize, unsigned int const newDepth, sample const newMaxval, unsigned int * const sizeP, @@ -295,20 +295,20 @@ computehashrecoverable(struct pam * const pamP, *tuplefreqhashP = pnm_createtuplehash(); *sizeP = 0; /* initial value */ - + *rowbufferP = pnm_allocpamrow(pamP); - + *colorP = pnm_allocpamtuple(pamP); - + full = FALSE; /* initial value */ - + /* Go through the entire raster, building a hash table of - tuple values. + tuple values. */ for (row = 0; row < pamP->height && !full; ++row) { unsigned int col; const tuple * tuplerow; /* The row of tuples we are processing */ - + if (tupleArray) tuplerow = tupleArray[row]; else { @@ -335,8 +335,8 @@ computehashrecoverable(struct pam * const pamP, static tuplehash computetuplefreqhash(struct pam * const pamP, - tuple ** const tupleArray, - unsigned int const maxsize, + tuple ** const tupleArray, + unsigned int const maxsize, unsigned int const newDepth, sample const newMaxval, unsigned int * const sizeP) { @@ -350,18 +350,18 @@ computetuplefreqhash(struct pam * const pamP, 2) an open PAM file, positioned to the raster. In this case, 'tupleArray' is NULL. *pamP contains the file descriptor. - - We return with the file still open and its position undefined. + + We return with the file still open and its position undefined. In either case, *pamP contains parameters of the tuple array. Return the number of unique tuple values found as *sizeP. - However, if the number of unique tuple values is greater than 'maxsize', + However, if the number of unique tuple values is greater than 'maxsize', return a null return value and *sizeP undefined. The tuple values that index the hash have depth 'newDepth'. We look at - only the first 'newDepth' planes of the input. Caler must ensure that + only the first 'newDepth' planes of the input. Caller must ensure that the input has at least that many planes. The tuple values that index the hash are scaled to a new maxval of @@ -374,18 +374,18 @@ computetuplefreqhash(struct pam * const pamP, /* Buffer for a row read from the input file; undefined (but still allocated) if input is not from a file. */ - tuple color; + tuple color; /* The color currently being added, scaled to the new maxval */ jmp_buf jmpbuf; jmp_buf * origJmpbufP; - + /* Initialize to "none" for purposes of error recovery */ tuplefreqhash = NULL; rowbuffer = NULL; color = NULL; if (setjmp(jmpbuf) != 0) { - if (color) + if (color) pnm_freepamtuple(color); if (rowbuffer) pnm_freepamrow(rowbuffer); @@ -413,24 +413,24 @@ pnm_computetuplefreqhash(struct pam * const pamP, Compute the tuple frequency hash for the tuple array tupleArray[][]. -----------------------------------------------------------------------------*/ return computetuplefreqhash(pamP, tupleArray, maxsize, - pamP->depth, pamP->maxval, + pamP->depth, pamP->maxval, sizeP); } static void -alloctupletable(const struct pam * const pamP, +alloctupletable(const struct pam * const pamP, unsigned int const size, tupletable * const tupletableP, const char ** const errorP) { - + if (UINT_MAX / sizeof(struct tupleint) < size) pm_asprintf(errorP, "size %u is too big for arithmetic", size); else { unsigned int const mainTableSize = size * sizeof(struct tupleint *); - unsigned int const tupleIntSize = - sizeof(struct tupleint) - sizeof(sample) + unsigned int const tupleIntSize = + sizeof(struct tupleint) - sizeof(sample) + pamP->depth * sizeof(sample); /* To save the enormous amount of time it could take to allocate @@ -442,7 +442,7 @@ alloctupletable(const struct pam * const pamP, else { unsigned int const allocSize = mainTableSize + size * tupleIntSize; void * pool; - + pool = malloc(allocSize); if (!pool) @@ -469,7 +469,7 @@ alloctupletable(const struct pam * const pamP, tupletable -pnm_alloctupletable(const struct pam * const pamP, +pnm_alloctupletable(const struct pam * const pamP, unsigned int const size) { tupletable retval; @@ -491,8 +491,8 @@ void pnm_freetupletable(const struct pam * const pamP, tupletable const tupletable) { - /* Note that the address 'tupletable' is, to the operating system, - the address of a larger block of memory that contains not only + /* Note that the address 'tupletable' is, to the operating system, + the address of a larger block of memory that contains not only tupletable, but all the samples to which it points (e.g. tupletable[0].tuple[0]) */ @@ -574,7 +574,7 @@ pnm_tuplehashtotable(const struct pam * const pamP, tuplehash -pnm_computetupletablehash(struct pam * const pamP, +pnm_computetupletablehash(struct pam * const pamP, tupletable const tupletable, unsigned int const tupletableSize) { /*---------------------------------------------------------------------------- @@ -591,12 +591,12 @@ pnm_computetupletablehash(struct pam * const pamP, tuplehash tupletablehash; unsigned int i; int fits; - + tupletablehash = pnm_createtuplehash(); fits = TRUE; /* initial assumption */ for (i = 0; i < tupletableSize && fits; ++i) { - pnm_addtotuplehash(pamP, tupletablehash, + pnm_addtotuplehash(pamP, tupletablehash, tupletable[i]->tuple, i, &fits); } if (!fits) { @@ -658,7 +658,7 @@ pnm_computetuplefreqtable3(struct pam * const pamP, "argument (%u) greater than input depth (%u)", newDepth, pamP->depth); - tuplefreqhash = computetuplefreqhash(pamP, tupleArray, maxsize, + tuplefreqhash = computetuplefreqhash(pamP, tupleArray, maxsize, newDepth, newMaxval, &uniqueCount); if (tuplefreqhash == NULL) tuplefreqtable = NULL; @@ -704,8 +704,8 @@ pnm_computetuplefreqtable(struct pam * const pamP, char* -pam_colorname(struct pam * const pamP, - tuple const color, +pam_colorname(struct pam * const pamP, + tuple const color, enum colornameFormat const format) { unsigned int r, g, b; @@ -726,9 +726,9 @@ pam_colorname(struct pam * const pamP, while (!done) { struct colorfile_entry const ce = pm_colorget(f); if (ce.colorname) { - unsigned int const this_diff = - abs((int)r - (int)ce.r) + - abs((int)g - (int)ce.g) + + unsigned int const this_diff = + abs((int)r - (int)ce.r) + + abs((int)g - (int)ce.g) + abs((int)b - (int)ce.b); if (this_diff < best_diff) { @@ -739,7 +739,7 @@ pam_colorname(struct pam * const pamP, done = TRUE; } fclose(f); - if (best_diff != 32767 && + if (best_diff != 32767 && (best_diff == 0 || format == PAM_COLORNAME_ENGLISH)) return colorname; } diff --git a/lib/libpamwrite.c b/lib/libpamwrite.c index 29ddeaa2..1ff334aa 100644 --- a/lib/libpamwrite.c +++ b/lib/libpamwrite.c @@ -13,7 +13,7 @@ offset stuff. */ #define _FILE_OFFSET_BITS 64 -#define _LARGE_FILES +#define _LARGE_FILES #include #include @@ -28,8 +28,8 @@ static __inline__ unsigned int -samplesPerPlainLine(sample const maxval, - unsigned int const depth, +samplesPerPlainLine(sample const maxval, + unsigned int const depth, unsigned int const lineLength) { /*---------------------------------------------------------------------------- Return the minimum number of samples that should go in a line @@ -61,7 +61,7 @@ writePamPlainPbmRow(const struct pam * const pamP, unsigned int const samplesPerLine = 70; for (col = 0; col < pamP->width; ++col) - fprintf(pamP->file, + fprintf(pamP->file, ((col+1) % samplesPerLine == 0 || col == pamP->width-1) ? "%1u\n" : "%1u", tuplerow[col][0] == PAM_PBM_BLACK ? PBM_BLACK : PBM_WHITE); @@ -73,13 +73,13 @@ static void writePamPlainRow(const struct pam * const pamP, const tuple * const tuplerow) { - int const samplesPerLine = + int const samplesPerLine = samplesPerPlainLine(pamP->maxval, pamP->depth, 79); int col; unsigned int samplesInCurrentLine; /* number of samples written from start of line */ - + samplesInCurrentLine = 0; for (col = 0; col < pamP->width; ++col) { @@ -92,7 +92,7 @@ writePamPlainRow(const struct pam * const pamP, if (samplesInCurrentLine >= samplesPerLine) { fprintf(pamP->file, "\n"); samplesInCurrentLine = 0; - } + } } } fprintf(pamP->file, "\n"); @@ -108,11 +108,11 @@ formatPbmRow(const struct pam * const pamP, unsigned char accum; int col; - + accum = 0; /* initial value */ - + for (col=0; col < pamP->width; ++col) { - accum |= + accum |= (tuplerow[col][0] == PAM_PBM_BLACK ? PBM_BLACK : PBM_WHITE) << (7-col%8); if (col%8 == 7) { @@ -138,7 +138,7 @@ formatPbmRow(const struct pam * const pamP, */ static __inline__ void -sampleToBytes2(unsigned char buf[2], +sampleToBytes2(unsigned char buf[2], sample const sampleval) { buf[0] = (sampleval >> 8) & 0xff; @@ -148,7 +148,7 @@ sampleToBytes2(unsigned char buf[2], static __inline__ void -sampleToBytes3(unsigned char buf[3], +sampleToBytes3(unsigned char buf[3], sample const sampleval) { buf[0] = (sampleval >> 16) & 0xff; @@ -159,7 +159,7 @@ sampleToBytes3(unsigned char buf[3], static __inline__ void -sampleToBytes4(unsigned char buf[4], +sampleToBytes4(unsigned char buf[4], sample const sampleval) { buf[0] = (sampleval >> 24 ) & 0xff; @@ -185,7 +185,7 @@ format1BpsRow(const struct pam * const pamP, unsigned int bufferCursor; bufferCursor = 0; /* initial value */ - + for (col = 0; col < pamP->width; ++col) { unsigned int plane; for (plane=0; plane < pamP->depth; ++plane) @@ -210,7 +210,7 @@ format2BpsRow(const struct pam * const pamP, unsigned int bufferCursor; bufferCursor = 0; /* initial value */ - + for (col=0; col < pamP->width; ++col) { unsigned int plane; for (plane = 0; plane < pamP->depth; ++plane) @@ -236,7 +236,7 @@ format3BpsRow(const struct pam * const pamP, unsigned int bufferCursor; bufferCursor = 0; /* initial value */ - + for (col=0; col < pamP->width; ++col) { unsigned int plane; for (plane = 0; plane < pamP->depth; ++plane) @@ -262,7 +262,7 @@ format4BpsRow(const struct pam * const pamP, unsigned int bufferCursor; bufferCursor = 0; /* initial value */ - + for (col=0; col < pamP->width; ++col) { unsigned int plane; for (plane = 0; plane < pamP->depth; ++plane) @@ -285,7 +285,7 @@ pnm_formatpamrow(const struct pam * const pamP, at *outbuf. 'outbuf' must be the address of space allocated with pnm_allocrowimage(). - + We return as *rowSizeP the number of bytes in the row image. -----------------------------------------------------------------------------*/ if (PAM_FORMAT_TYPE(pamP->format) == PBM_TYPE) @@ -310,7 +310,7 @@ writePamRawRow(const struct pam * const pamP, const tuple * const tuplerow, unsigned int const count) { /*---------------------------------------------------------------------------- - Write mutiple ('count') copies of the same row ('tuplerow') to the file, + Write multiple ('count') copies of the same row ('tuplerow') to the file, in raw (not plain) format. -----------------------------------------------------------------------------*/ jmp_buf jmpbuf; @@ -330,10 +330,10 @@ writePamRawRow(const struct pam * const pamP, unsigned int i; pm_setjmpbufsave(&jmpbuf, &origJmpbufP); - + for (i = 0; i < count; ++i) { size_t bytesWritten; - + bytesWritten = fwrite(outbuf, 1, rowImageSize, pamP->file); if (bytesWritten != rowImageSize) pm_error("fwrite() failed to write an image row to the file. " @@ -346,16 +346,16 @@ writePamRawRow(const struct pam * const pamP, -void -pnm_writepamrow(const struct pam * const pamP, +void +pnm_writepamrow(const struct pam * const pamP, const tuple * const tuplerow) { - /* For speed, we don't check any of the inputs for consistency + /* For speed, we don't check any of the inputs for consistency here (unless it's necessary to avoid crashing). Any consistency - checking should have been done by a prior call to + checking should have been done by a prior call to pnm_writepaminit(). */ - + if (pamP->format == PAM_FORMAT || !(pm_plain_output || pamP->plainformat)) writePamRawRow(pamP, tuplerow, 1); else { @@ -371,7 +371,7 @@ pnm_writepamrow(const struct pam * const pamP, assert(false); break; default: - pm_error("Invalid 'format' value %u in pam structure", + pm_error("Invalid 'format' value %u in pam structure", pamP->format); } } @@ -380,7 +380,7 @@ pnm_writepamrow(const struct pam * const pamP, void -pnm_writepamrowmult(const struct pam * const pamP, +pnm_writepamrowmult(const struct pam * const pamP, const tuple * const tuplerow, unsigned int const count) { /*---------------------------------------------------------------------------- @@ -397,14 +397,16 @@ pnm_writepamrowmult(const struct pam * const pamP, -void -pnm_writepam(struct pam * const pamP, +void +pnm_writepam(struct pam * const pamP, tuple ** const tuplearray) { int row; pnm_writepaminit(pamP); - - for (row = 0; row < pamP->height; ++row) + + for (row = 0; row < pamP->height; ++row) pnm_writepamrow(pamP, tuplearray[row]); } + + diff --git a/lib/libpbm3.c b/lib/libpbm3.c index 0144abe2..456d3986 100644 --- a/lib/libpbm3.c +++ b/lib/libpbm3.c @@ -389,7 +389,7 @@ pbm_writepbmrow_bitoffset(FILE * const fileP, unsigned char * const window = &packedBits[offset/8]; /* Area of packed row buffer from which we take the image data. Aligned to nearest byte boundary to the left, so the first - few bits might be irrelvant. + few bits might be irrelevant. Also our work buffer, in which we shift bits and from which we ultimately write the bits to the file. diff --git a/lib/libppmd.c b/lib/libppmd.c index a94ff107..e0654c8f 100644 --- a/lib/libppmd.c +++ b/lib/libppmd.c @@ -1,4 +1,4 @@ -/* +/* ** ** This library module contains the ppmdraw routines. ** @@ -10,7 +10,7 @@ ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. -** +** ** The character drawing routines are by John Walker ** Copyright (C) 1994 by John Walker, kelvin@fourmilab.ch */ @@ -85,7 +85,7 @@ pointIsWithinBounds(ppmd_point const p, return (p.x >= 0 && p.x < cols && p.y >= 0 && p.y < rows); } - + static ppmd_point vectorSum(ppmd_point const a, @@ -102,7 +102,7 @@ static long int const DDA_SCALE = 8192; /* Several factors govern the limit of x, y coordination values. - The limit must be representable as (signed) int for coordinates to + The limit must be representable as (signed) int for coordinates to be carried in struct penpos (immediately above). The following calculation, done with long ints, must not overflow: @@ -112,7 +112,7 @@ static long int const DDA_SCALE = 8192; dy = (y1 - y0) * DDA_SCALE / abs(x1 - x0); Overflow conditions for ppmd_text are rather complicated, for commands - come from an external PPMD font file. See comments below. + come from an external PPMD font file. See comments below. */ @@ -141,10 +141,10 @@ ppmd_validatePoint(ppmd_point const p) { static void drawPoint(ppmd_drawprocp drawproc, const void * const clientdata, - pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, + pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p) { /*---------------------------------------------------------------------------- Draw a single point, assuming that it is within the bounds of the @@ -152,7 +152,7 @@ drawPoint(ppmd_drawprocp drawproc, -----------------------------------------------------------------------------*/ if (drawproc == PPMD_NULLDRAWPROC) { const pixel * const pixelP = clientdata; - + assert(p.x >= 0); assert(p.x < cols); assert(p.y >= 0); assert(p.y < rows); @@ -176,7 +176,7 @@ makeDrawProcXY(ppmd_drawproc * const drawProc, retval.drawProc = drawProc; retval.clientData = clientData; - + return retval; } @@ -204,10 +204,10 @@ drawProcPointXY(pixel ** const pixels, void -ppmd_point_drawprocp(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_point_drawprocp(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const p, const void * const clientdata) { @@ -218,16 +218,16 @@ ppmd_point_drawprocp(pixel ** const pixels, void -ppmd_point_drawproc(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x, - int const y, +ppmd_point_drawproc(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x, + int const y, const void* const clientdata) { ppmd_point p; - + p.x = x; p.y = y; @@ -264,14 +264,14 @@ findRectangleIntersection(struct rectangle const rect1, void -ppmd_filledrectangle(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x, - int const y, - int const width, - int const height, +ppmd_filledrectangle(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x, + int const y, + int const width, + int const height, ppmd_drawproc drawProc, const void * const clientdata) { @@ -437,16 +437,16 @@ clipEnd1(ppmd_point const p0, at 0. -----------------------------------------------------------------------------*/ ppmd_point c1; - /* The current clipped location of p1; we clip it multile times + /* The current clipped location of p1; we clip it multiple times to get the final location. */ /* p0 is in the frame: */ assert(p0.x >= 0 && p0.x < cols); assert(p0.y >= 0 && p0.y < rows); - + /* Clip End 1 of the line horizontally */ c1 = p1; /* initial value */ - + if (c1.x < 0) { /* We know the line isn't vertical, since End 0 is in the frame and End 1 is left of frame. @@ -460,7 +460,7 @@ clipEnd1(ppmd_point const p0, c1.y = c1.y + (p0.y - c1.y) * (cols - 1 - c1.x) / (p0.x - c1.x); c1.x = cols - 1; } - + /* Clip End 1 of the line vertically */ if (c1.y < 0) { /* We know the line isn't horizontal, since End 0 is in the frame @@ -524,10 +524,10 @@ clipLine(ppmd_point const p0, static void drawShallowLine(ppmd_drawprocp drawProc, const void * const clientdata, - pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, + pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const p1) { /*---------------------------------------------------------------------------- @@ -571,10 +571,10 @@ drawShallowLine(ppmd_drawprocp drawProc, static void drawSteepLine(ppmd_drawprocp drawProc, const void * const clientdata, - pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, + pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const p1) { /*---------------------------------------------------------------------------- @@ -617,10 +617,10 @@ drawSteepLine(ppmd_drawprocp drawProc, void -ppmd_linep(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_linep(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const p1, ppmd_drawprocp drawProc, @@ -662,14 +662,14 @@ ppmd_linep(pixel ** const pixels, void -ppmd_line(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const x1, - int const y1, +ppmd_line(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const x1, + int const y1, ppmd_drawproc drawProc, const void * const clientData) { @@ -701,10 +701,10 @@ static unsigned int void -ppmd_spline3p(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_spline3p(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const ctl, ppmd_point const p1, @@ -740,16 +740,16 @@ ppmd_spline3p(pixel ** const pixels, void -ppmd_spline3(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const x1, - int const y1, - int const x2, - int const y2, +ppmd_spline3(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const x1, + int const y1, + int const x2, + int const y2, ppmd_drawproc drawProc, const void * const clientdata) { @@ -765,10 +765,10 @@ ppmd_spline3(pixel ** const pixels, void -ppmd_polysplinep(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_polysplinep(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const p0, unsigned int const nc, ppmd_point * const c, @@ -777,7 +777,7 @@ ppmd_polysplinep(pixel ** const pixels, const void * const clientdata) { ppmd_point p; - + unsigned int i; assert(nc > 0); @@ -796,17 +796,17 @@ ppmd_polysplinep(pixel ** const pixels, void -ppmd_polyspline(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const nc, - int * const xc, - int * const yc, - int const x1, - int const y1, +ppmd_polyspline(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const nc, + int * const xc, + int * const yc, + int const x1, + int const y1, ppmd_drawproc drawProc, const void * const clientdata) { @@ -837,10 +837,10 @@ ppmd_polyspline(pixel ** const pixels, void -ppmd_spline4p(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_spline4p(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const endPt0, ppmd_point const endPt1, ppmd_point const ctlPt0, @@ -862,12 +862,12 @@ ppmd_spline4p(pixel ** const pixels, void -ppmd_circlep(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_circlep(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const center, - unsigned int const radius, + unsigned int const radius, ppmd_drawprocp drawProc, const void * const clientData) { /*---------------------------------------------------------------------------- @@ -877,7 +877,7 @@ ppmd_circlep(pixel ** const pixels, it might maintain state that is affected by imaginary points outside the image. - Initial point is 3 o'clock. + Initial point is 3 o'clock. -----------------------------------------------------------------------------*/ if (radius >= DDA_SCALE) pm_error("Error drawing circle. Radius %d is too large.", radius); @@ -936,13 +936,13 @@ ppmd_circlep(pixel ** const pixels, void -ppmd_circle(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const cx, - int const cy, - int const radius, +ppmd_circle(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const cx, + int const cy, + int const radius, ppmd_drawproc drawProc, const void * const clientData) { @@ -1013,11 +1013,11 @@ ppmd_fill_create(void) { stateP->curedge = 0; fillObjP->stateP = stateP; - + /* Turn off line clipping. */ /* UGGH! We must eliminate this global variable */ oldclip = ppmd_setlineclip(0); - + return fillObjP; } @@ -1129,10 +1129,10 @@ continueSegment(struct fillState * const stateP, */ void -ppmd_fill_drawprocp(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_fill_drawprocp(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const p, const void * const clientdata) { @@ -1174,12 +1174,12 @@ ppmd_fill_drawprocp(pixel ** const pixels, void -ppmd_fill_drawproc(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x, - int const y, +ppmd_fill_drawproc(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x, + int const y, const void * const clientData) { ppmd_fill_drawprocp(pixels, cols, rows, maxval, makePoint(x, y), @@ -1204,7 +1204,7 @@ yxCompare(const void * const c1Arg, ppmd_point const p2 = c2P->point; int retval; - + if (p1.y > p2.y) retval = 1; else if (p1.y < p2.y) @@ -1222,10 +1222,10 @@ yxCompare(const void * const c1Arg, void -ppmd_fill(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_fill(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, struct fillobj * const fillObjP, ppmd_drawproc drawProc, const void * const clientdata) { @@ -1387,7 +1387,7 @@ static long isin(int deg) static long icos(int deg) { return isin(deg + 90); -} +} static int twosCompByteValue(unsigned char const c) { @@ -1453,7 +1453,7 @@ textPosFromFontPos(ppmd_point const fontPos, /* Position relative to the top left of the whole text box, assuming the text box is horizontal and has font scale. */ - + ppmd_point const ps = makePoint((pl.x * (int)height) / Scalef, (pl.y * (int)height) / Scalef); /* Same as above, but with the text box its actual size */ @@ -1502,7 +1502,7 @@ drawGlyph(const struct ppmd_glyph * const glyphP, text box, in the coordinate system of the canvas. 'rotcos' and 'rotsin' tell how that text box is rotated with respect to the horizontal on the canvas. - + 'height' is the height in canvas pixels of a glyph. This is a scale factor to convert font coordinates to canvas coordinates. -----------------------------------------------------------------------------*/ @@ -1542,7 +1542,7 @@ drawGlyph(const struct ppmd_glyph * const glyphP, glyphOrigin, height, rotcos, rotsin); - + ppmd_linep(pixels, cols, rows, maxval, p, n, drawProc, clientdata); @@ -1565,14 +1565,14 @@ drawGlyph(const struct ppmd_glyph * const glyphP, void -ppmd_textp(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_textp(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const pos, - int const height, - int const angle, - const char * const sArg, + int const height, + int const angle, + const char * const sArg, ppmd_drawprocp drawProc, const void * const clientdata) { /*---------------------------------------------------------------------------- @@ -1608,7 +1608,7 @@ ppmd_textp(pixel** const pixels, unsigned int cursorAdvance; - ppmd_validatePoint(p); + ppmd_validatePoint(p); drawGlyph(glyphP, p, pixels, cols, rows, maxval, height, pos, rotcos, rotsin, @@ -1625,15 +1625,15 @@ ppmd_textp(pixel** const pixels, void -ppmd_text(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const xpos, - int const ypos, - int const height, - int const angle, - const char * const sArg, +ppmd_text(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const xpos, + int const ypos, + int const height, + int const angle, + const char * const sArg, ppmd_drawproc drawProc, const void * const clientData) { @@ -1648,13 +1648,13 @@ ppmd_text(pixel** const pixels, /* EXTENTS_DRAWPROC -- Drawproc which just accumulates the extents rectangle bounding the text. */ -static void -extents_drawproc (pixel** const pixels, - int const cols, +static void +extents_drawproc (pixel** const pixels, + int const cols, int const rows, - pixval const maxval, - int const x, - int const y, + pixval const maxval, + int const x, + int const y, const void * const clientdata) { extleft = MIN(extleft, x); @@ -1673,22 +1673,25 @@ extents_drawproc (pixel** const pixels, */ void -ppmd_text_box(int const height, - int const angle, - const char * const s, - int * const left, - int * const top, - int * const right, +ppmd_text_box(int const height, + int const angle, + const char * const s, + int * const left, + int * const top, + int * const right, int * const bottom) { extleft = 32767; exttop = 32767; extright = -32767; extbottom = -32767; - ppmd_text(NULL, 32767, 32767, 255, 1000, 1000, height, angle, s, + ppmd_text(NULL, 32767, 32767, 255, 1000, 1000, height, angle, s, extents_drawproc, NULL); - *left = extleft - 1000; + *left = extleft - 1000; *top = exttop - 1000; *right = extright - 1000; *bottom = extbottom - 1000; } + + + diff --git a/lib/libsystem.c b/lib/libsystem.c index bf2416a4..ba48ed85 100644 --- a/lib/libsystem.c +++ b/lib/libsystem.c @@ -128,8 +128,8 @@ execProgram(const char * const progName, static void -createPipeFeeder(void pipeFeederRtn(int, void *), - void * const feederParm, +createPipeFeeder(void pipeFeederRtn(int, void *), + void * const feederParm, int * const fdP, pid_t * const pidP) { /*---------------------------------------------------------------------------- @@ -143,7 +143,7 @@ createPipeFeeder(void pipeFeederRtn(int, void *), pm_pipe(pipeToFeed); rc = fork(); if (rc < 0) { - pm_error("fork() of stdin feeder failed. errno=%d (%s)", + pm_error("fork() of stdin feeder failed. errno=%d (%s)", errno, strerror(errno)); } else if (rc == 0) { /* This is the child -- the stdin feeder process */ @@ -190,13 +190,13 @@ spawnProcessor(const char * const progName, rc = fork(); if (rc < 0) { - pm_error("fork() of processor process failed. errno=%d (%s)", + pm_error("fork() of processor process failed. errno=%d (%s)", errno, strerror(errno)); } else if (rc == 0) { /* The program child */ int stdoutFd; - + if (pipeStdout) { close(stdoutpipe[0]); stdoutFd = stdoutpipe[1]; @@ -230,7 +230,7 @@ signalName(unsigned int const signalClass) { /* There are various signal classes that are not universally defined, so we make a half-hearted attempt to determine whether they are and not try to recognize the ones that aren't. We do this by testing - whether a macro is defind with the signal class name. That could give + whether a macro is defined with the signal class name. That could give a false negative, because the signal class name isn't necessarily defined as a macro, but it's a really, really small problem to miss one of these signal classes here, so we don't bother with all the work @@ -332,7 +332,7 @@ pm_termStatusDesc(int const termStatusArg) { for a BSD 'union wait' (instead of int) argument to WIFEXITED. The magic involves defining a variable with 'typeof' the argument and assigning to that variable. - + To work around this, we make sure the argument is not constant. */ @@ -426,14 +426,14 @@ pm_system2_vp(const char * const progName, program process and the current process and have the program write its Standard Output to that pipe. The current process runs 'stdoutAccepter' to read the data from that pipe. - + But if 'stdoutFeeder' is NULL, we just tell the program process to write to the current process' Standard Output. So there are two processes when stdinFeeder is NULL and three when stdinFeeder is non-null. */ - + int progStdinFd; /* File descriptor that the processor program will get as Standard Input @@ -459,9 +459,9 @@ pm_system2_vp(const char * const progName, int progStdoutFd; /* Make a child process to run the program and pipe back to us its - Standard Output + Standard Output */ - spawnProcessor(progName, argArray, progStdinFd, + spawnProcessor(progName, argArray, progStdinFd, &progStdoutFd, &processorPid); /* Dispose of the stdout from that child */ @@ -483,7 +483,7 @@ pm_system2_vp(const char * const progName, waitpid(processorPid, &termStatus, 0); - if (feederPid) + if (feederPid) cleanupFeederProcess(feederPid); *termStatusP = termStatus; @@ -520,7 +520,7 @@ pm_system2_lp(const char * const progName, !endOfArgs; ) { const char * const arg = va_arg(args, const char *); - + REALLOCARRAY(argArray, n+1); argArray[n++] = arg; @@ -560,7 +560,7 @@ pm_system2(void stdinFeeder(int, void *), Return as *termStatusP the termination status of the processor process (the one running the program named 'progName'). -----------------------------------------------------------------------------*/ - pm_system2_lp("/bin/sh", + pm_system2_lp("/bin/sh", stdinFeeder, feederParm, stdoutAccepter, accepterParm, termStatusP, "sh", "-c", shellCommand, NULL); @@ -625,7 +625,7 @@ pm_system_lp(const char * const progName, !endOfArgs; ) { const char * const arg = va_arg(args, const char *); - + REALLOCARRAY(argArray, n+1); argArray[n++] = arg; @@ -716,15 +716,15 @@ pm_feed_from_memory(int const pipeToFeedFd, void * const feederParm) { pm_bufferDesc * const inputBufferP = feederParm; - + FILE * const outFileP = fdopen(pipeToFeedFd, "w"); - + size_t bytesTransferred; /* The following signals (and normally kills) the process with SIGPIPE if the pipe does not take all 'size' bytes. */ - bytesTransferred = + bytesTransferred = fwrite(inputBufferP->buffer, 1, inputBufferP->size, outFileP); if (inputBufferP->bytesTransferredP) @@ -740,7 +740,7 @@ pm_accept_to_memory(int const pipetosuckFd, void * const accepterParm ) { pm_bufferDesc * const outputBufferP = accepterParm; - + FILE * const inFileP = fdopen(pipetosuckFd, "r"); size_t bytesTransferred; diff --git a/lib/pam.h b/lib/pam.h index 0055858b..5edc8a01 100644 --- a/lib/pam.h +++ b/lib/pam.h @@ -240,7 +240,7 @@ typedef float * pnm_transformMap; Each transform map is an array indexed by a PAM sample value, containing 'float' values. So it must have 'maxval' - entries. The sample -> samplen tranformation is just the + entries. The sample -> samplen transformation is just the obvious table lookup. The samplen -> sample transformation is more complicated -- if the samplen value is between map[N] and map[N+1], then the sample value is N. And only transforms diff --git a/lib/util/LICENSE.txt b/lib/util/LICENSE.txt index aeb06a7f..4baac593 100644 --- a/lib/util/LICENSE.txt +++ b/lib/util/LICENSE.txt @@ -113,7 +113,7 @@ written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End diff --git a/lib/util/nstring.h b/lib/util/nstring.h index 5159277c..f9d3dffa 100644 --- a/lib/util/nstring.h +++ b/lib/util/nstring.h @@ -146,7 +146,7 @@ strncaseeq(const char * const comparand, - If the function can't get the memory, it returns 'pm_strsol', which is a string that is in static memory that contains text - indicating an out of memory failure has occurred, intead of + indicating an out of memory failure has occurred, instead of NULL. This makes it much easier for programs to ignore this possibility. diff --git a/lib/util/shhopt.c b/lib/util/shhopt.c index c0b4ba47..cc8f165e 100644 --- a/lib/util/shhopt.c +++ b/lib/util/shhopt.c @@ -6,7 +6,7 @@ | or passed to functions as specified. | | REQUIREMENTS Some systems lack the ANSI C -function strtoul. If your - | system is one of those, you'll ned to write one yourself, + | system is one of those, you'll need to write one yourself, | or get the GNU liberty-library (from prep.ai.mit.edu). | | WRITTEN BY Sverre H. Huseby -- cgit 1.4.1