diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/pamscale.c | 10 | ||||
-rw-r--r-- | editor/pamsistoaglyph.c | 17 | ||||
-rw-r--r-- | editor/pnmnorm.c | 4 | ||||
-rw-r--r-- | editor/pnmscalefixed.c | 6 | ||||
-rw-r--r-- | editor/ppmdist.c | 27 |
5 files changed, 43 insertions, 21 deletions
diff --git a/editor/pamscale.c b/editor/pamscale.c index 485ae27f..48b0f8dd 100644 --- a/editor/pamscale.c +++ b/editor/pamscale.c @@ -1143,7 +1143,7 @@ createWeightListSet(unsigned int const sourceSize, 2) Filter out any frequencies that are too high to be captured by the new sampling -- i.e. frequencies above 1/2 the new - sample rate. This is the information we must lose due to low + sample rate. This is the information we must lose because of low sample rate. 3) Sample the result at the new sample rate. @@ -1656,7 +1656,7 @@ horizontalScale(tuplen * const inputtuplenrow, it by a factor of 'xscale', to create the output row 'newtuplenrow', described by *outpamP. - Due to arithmetic imprecision, we may have to stretch slightly the + Because of arithmetic imprecision, we may have to stretch slightly the contents of the last pixel of the output row to make a full pixel. Return as *stretchP the fraction of a pixel by which we had to stretch in this way. @@ -1697,7 +1697,7 @@ horizontalScale(tuplen * const inputtuplenrow, } /* There's not enough left in the current input pixel to fill up a whole output column, so just accumulate the remainder of the - pixel into the current output column. Due to rounding, we may + pixel into the current output column. Because of rounding, we may have a tiny bit of pixel left and have run out of output pixels. In that case, we throw away what's left. */ @@ -1850,7 +1850,7 @@ issueStretchWarning(bool const verbose, row. */ if (verbose) - pm_message("%f of bottom row stretched due to " + pm_message("%f of bottom row stretched because of " "arithmetic imprecision", fracrowtofill); } @@ -1884,7 +1884,7 @@ scaleHorizontallyAndOutputRow(struct pam * const inpamP, xscale, &stretch); if (verbose && row == 0) - pm_message("%f of right column stretched due to " + pm_message("%f of right column stretched because of " "arithmetic imprecision", stretch); diff --git a/editor/pamsistoaglyph.c b/editor/pamsistoaglyph.c index 9866b7bd..6b093520 100644 --- a/editor/pamsistoaglyph.c +++ b/editor/pamsistoaglyph.c @@ -247,12 +247,19 @@ findRegionEyeSeparation( gray ** const grayArray, +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn compareInts; +#endif + static int -compare_ints( const void * const firstP, - const void * const secondP ) { +compareInts(const void * const a, + const void * const b) { + + const int * const firstP = a; + const int * const secondP = b; - int const first = *(int *)firstP; - int const second = *(int *)secondP; + int const first = *firstP; + int const second = *secondP; int retval; @@ -311,7 +318,7 @@ findEyeSeparation( struct pam * const pamP, rowSeparation[numValidRows++] = sep; } if (numValidRows > 0) { - qsort( rowSeparation, numValidRows, sizeof(int), compare_ints ); + qsort(rowSeparation, numValidRows, sizeof(int), compareInts); bestSeparation = rowSeparation[numValidRows/2]; } free( rowSeparation ); diff --git a/editor/pnmnorm.c b/editor/pnmnorm.c index 56685ee0..70d5641a 100644 --- a/editor/pnmnorm.c +++ b/editor/pnmnorm.c @@ -452,7 +452,7 @@ resolvePercentParams(FILE * const ifP, to black and the one that is to be stretched to white) as requested by the -bvalue, -bpercent, -wvalue, and -wpercent options. - These values may be invalid due to overlapping, and they may exceed + These values may be invalid because of overlapping, and they may exceed the maximum allowed stretch; Caller must deal with that. -----------------------------------------------------------------------------*/ unsigned int * hist; /* malloc'ed */ @@ -735,7 +735,7 @@ computeTransferFunction(bool const quadratic, 3 points. This stretching could conceivably result in more brightnesses mapping to - zero and full brightness that 'bvalue' and 'wvalue' demand, due to + zero and full brightness that 'bvalue' and 'wvalue' demand, because of rounding. Define function only for values 0..maxval. diff --git a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c index 81efc9f4..884ca315 100644 --- a/editor/pnmscalefixed.c +++ b/editor/pnmscalefixed.c @@ -256,7 +256,7 @@ compute_output_dimensions(const struct cmdline_info cmdline, *newrowsP = rows; } - /* If the calculations above yielded (due to rounding) a zero + /* If the calculations above yielded (because of rounding) a zero dimension, we fudge it up to 1. We do this rather than considering it a specification error (and dying) because it's friendlier to automated processes that work on arbitrary input. It saves them @@ -283,7 +283,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[], output rows. *stretchP is the number of columns (could be fractional) on the right - that we had to fill by stretching due to rounding problems. + that we had to fill by stretching because of rounding problems. -----------------------------------------------------------------------------*/ long r, g, b; long fraccoltofill, fraccolleft; @@ -574,7 +574,7 @@ main(int argc, char **argv ) { if (cmdline.verbose && row == 0 && stretch != 0) pm_message("%d/%d = %f right columns filled by stretching " - "due to arithmetic imprecision", + "because of arithmetic imprecision", stretch, SCALE, (float) stretch/SCALE); pnm_writepnmrow(stdout, newxelrow, newcols, diff --git a/editor/ppmdist.c b/editor/ppmdist.c index bca96adc..e8f17bff 100644 --- a/editor/ppmdist.c +++ b/editor/ppmdist.c @@ -22,6 +22,7 @@ struct colorToGrayEntry { #define MAXCOLORS 255 + static gray newGrayValue(pixel *pix, struct colorToGrayEntry *colorToGrayMap, int colors) { @@ -40,20 +41,34 @@ newGrayValue(pixel *pix, struct colorToGrayEntry *colorToGrayMap, int colors) { +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn cmpColorToGrayEntryByIntensity; +#endif + static int -cmpColorToGrayEntryByIntensity(const void *entry1, const void *entry2) { +cmpColorToGrayEntryByIntensity(const void * const a, + const void * const b) { + + const struct colorToGrayEntry * const entry1P = a; + const struct colorToGrayEntry * const entry2P = b; - return ((struct colorToGrayEntry *) entry1)->gray - - ((struct colorToGrayEntry *) entry2)->gray; + return entry1P->gray - entry2P->gray; } +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn cmpColorToGrayEntryByFrequency; +#endif + static int -cmpColorToGrayEntryByFrequency(const void * entry1, const void * entry2) { +cmpColorToGrayEntryByFrequency(const void * const a, + const void * const b) { + + const struct colorToGrayEntry * const entry1P = a; + const struct colorToGrayEntry * const entry2P = b; - return ((struct colorToGrayEntry *) entry1)->frequency - - ((struct colorToGrayEntry *) entry2)->frequency; + return entry1P->frequency - entry2P->frequency; } |