[devel] Fixed some spelling and indentation.
diff --git a/png.c b/png.c
index 4dadc6d..cece39f 100644
--- a/png.c
+++ b/png.c
@@ -1342,7 +1342,7 @@
}
/* Here on buffer too small. */
- png_error(png_ptr, "ASCII convertion buffer too small");
+ png_error(png_ptr, "ASCII conversion buffer too small");
}
# endif /* FLOATING_POINT */
@@ -1401,9 +1401,21 @@
#else
int negative = 0;
png_uint_32 A, T, D;
- if (a < 0) negative = 1, A = -a; else A = a;
- if (times < 0) negative = !negative, T = -times; else T = times;
- if (div < 0) negative = !negative, D = -div; else D = div;
+
+ if (a < 0)
+ negative = 1, A = -a;
+ else
+ A = a;
+
+ if (times < 0)
+ negative = !negative, T = -times;
+ else
+ T = times;
+
+ if (div < 0)
+ negative = !negative, D = -div;
+ else
+ D = div;
/* Following can't overflow because the arguments only
* have 31 bits each, however the result may be 32 bits.
@@ -1432,6 +1444,7 @@
while (--bitshift >= 0)
{
png_uint_32 d32, d00;
+
if (bitshift > 0)
d32 = D >> (32-bitshift), d00 = D << bitshift;
else
@@ -1442,8 +1455,9 @@
if (s00 < d00) --s32; /* carry */
s32 -= d32, s00 -= d00, result += 1<<bitshift;
}
- else if (s32 == d32 && s00 >= d00)
- s32 = 0, s00 -= d00, result += 1<<bitshift;
+ else
+ if (s32 == d32 && s00 >= d00)
+ s32 = 0, s00 -= d00, result += 1<<bitshift;
}
/* Handle the rounding. */
@@ -1638,7 +1652,7 @@
24347096U, 0U
#if 0
/* The following are the values for 16 bit tables - these work fine for the 8
- * bit convertions but produce very slightly larger errors in the 16 bit log
+ * bit conversions but produce very slightly larger errors in the 16 bit log
* (about 1.2 as opposed to 0.7 absolute error in the final value). To use
* these all the shifts below must be adjusted appropriately.
*/
@@ -1667,10 +1681,18 @@
* input), return 7.99998 for the overflow (log 0) case - so the result is
* always at most 19 bits.
*/
- if ((x &= 0xff) == 0) return 0xffffffff;
- if ((x & 0xf0) == 0) log = 4, x <<= 4;
- if ((x & 0xc0) == 0) log += 2, x <<= 2;
- if ((x & 0x80) == 0) log += 1, x <<= 1;
+ if ((x &= 0xff) == 0)
+ return 0xffffffff;
+
+ if ((x & 0xf0) == 0)
+ log = 4, x <<= 4;
+
+ if ((x & 0xc0) == 0)
+ log += 2, x <<= 2;
+
+ if ((x & 0x80) == 0)
+ log += 1, x <<= 1;
+
return (log << 16) + ((png_8bit_l2[x-128]+32768)>>16);
}
@@ -1710,11 +1732,20 @@
unsigned log = 0;
/* As above, but now the input has 16 bits. */
- if ((x &= 0xffff) == 0) return 0xffffffff;
- if ((x & 0xff00) == 0) log = 8, x <<= 8;
- if ((x & 0xf000) == 0) log += 4, x <<= 4;
- if ((x & 0xc000) == 0) log += 2, x <<= 2;
- if ((x & 0x8000) == 0) log += 1, x <<= 1;
+ if ((x &= 0xffff) == 0)
+ return 0xffffffff;
+
+ if ((x & 0xff00) == 0)
+ log = 8, x <<= 8;
+
+ if ((x & 0xf000) == 0)
+ log += 4, x <<= 4;
+
+ if ((x & 0xc000) == 0)
+ log += 2, x <<= 2;
+
+ if ((x & 0x8000) == 0)
+ log += 1, x <<= 1;
/* Calculate the base logarithm from the top 8 bits as a 28 bit fractional
* value.
@@ -1800,12 +1831,23 @@
* converge on 45426 and this is used to allow linear interpolation of the
* low bits.
*/
- if (x & 0x800) e -= (((e >> 16) * 44938U) + 16U) >> 5;
- if (x & 0x400) e -= (((e >> 16) * 45181U) + 32U) >> 6;
- if (x & 0x200) e -= (((e >> 16) * 45303U) + 64U) >> 7;
- if (x & 0x100) e -= (((e >> 16) * 45365U) + 128U) >> 8;
- if (x & 0x080) e -= (((e >> 16) * 45395U) + 256U) >> 9;
- if (x & 0x040) e -= (((e >> 16) * 45410U) + 512U) >> 10;
+ if (x & 0x800)
+ e -= (((e >> 16) * 44938U) + 16U) >> 5;
+
+ if (x & 0x400)
+ e -= (((e >> 16) * 45181U) + 32U) >> 6;
+
+ if (x & 0x200)
+ e -= (((e >> 16) * 45303U) + 64U) >> 7;
+
+ if (x & 0x100)
+ e -= (((e >> 16) * 45365U) + 128U) >> 8;
+
+ if (x & 0x080)
+ e -= (((e >> 16) * 45395U) + 256U) >> 9;
+
+ if (x & 0x040)
+ e -= (((e >> 16) * 45410U) + 512U) >> 10;
/* And handle the low 6 bits in a single block. */
e -= (((e >> 16) * 355U * (x & 0x3fU)) + 256U) >> 9;
diff --git a/pngget.c b/pngget.c
index 25cd873..9634f80 100644
--- a/pngget.c
+++ b/pngget.c
@@ -295,7 +295,7 @@
ppi_from_ppm(png_uint_32 ppm)
{
#if 0
- /* The convertion is *(2.54/100), in binary (32 digits):
+ /* The conversion is *(2.54/100), in binary (32 digits):
* .00000110100000001001110101001001
*/
png_uint_32 t1001, t1101;
diff --git a/pngpriv.h b/pngpriv.h
index b2ebf0d..3c40cab 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -116,11 +116,11 @@
*/
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
- /* pngarith.c requires the following ANSI-C constants if the convertion of
+ /* png.c requires the following ANSI-C constants if the conversion of
* floating point to ASCII is implemented therein:
*
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
- * DBL_MIN Smalles normalized fp number (can be set to an arbitrary value)
+ * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
@@ -366,7 +366,7 @@
* when it is supposedly disabled.)
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
-/* The floating point convertion can't overflow, though it can and
+/* The floating point conversion can't overflow, though it can and
* does lose accuracy relative to the original fixed point value.
* In practice this doesn't matter because png_fixed_point only
* stores numbers with very low precision. The png_ptr and s
@@ -375,7 +375,7 @@
*/
#define png_float(png_ptr, fixed, s) (.00001 * (fixed))
-/* The fixed point convertion performs range checking and evaluates
+/* The fixed point conversion performs range checking and evaluates
* its argument multiple times, so must be used with care. The
* range checking uses the PNG specification values for a signed
* 32 bit fixed point value except that the values are deliberately
diff --git a/pngrutil.c b/pngrutil.c
index 880da9a..c25813f 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -71,7 +71,7 @@
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format and there
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
- * the following code does a two's complement to native convertion.
+ * the following code does a two's complement to native conversion.
*/
png_int_32 (PNGAPI
png_get_int_32)(png_bytep buf)
diff --git a/pngvalid.c b/pngvalid.c
index 43358cb..a3a13b9 100644
--- a/pngvalid.c
+++ b/pngvalid.c
@@ -1876,7 +1876,7 @@
* used by the library - otherwise we will get spurious errors from the
* internal sbit style approximation.
*
- * The threshold test is here because otherwise the 16 to 8 convertion will
+ * The threshold test is here because otherwise the 16 to 8 conversion will
* proceed *without* gamma correction, and the tests above will fail (but not
* by much) - this could be fixed, it only appears with the -g option.
*/