summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-07-30 14:46:52 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-07-30 14:47:53 -0500
commit4eb18e9ca288973bfb2ade0b7e6bb2325caec3a4 (patch)
treecfe737a2922e63217a4cd1bf30f1287c365494ec
parentdd8075794117d283fa5e9d6edf857f47b40c35ff (diff)
downloadlibpng-1.5.0beta37.tar.gz
[devel] Imported from libpng-1.5.0beta37.tarv1.5.0beta37
-rw-r--r--png.c210
-rw-r--r--pngrutil.c6
-rw-r--r--pngtrans.c2
3 files changed, 109 insertions, 109 deletions
diff --git a/png.c b/png.c
index 58d1ccc0e..2651b2fe3 100644
--- a/png.c
+++ b/png.c
@@ -1184,112 +1184,112 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
fp *= 10;
/* Use modf here, not floor and subtract, so that
- * the separation is done in one step. At the end
- * of the loop don't break the number into parts so
- * that the final digit is rounded.
- */
+ * the separation is done in one step. At the end
+ * of the loop don't break the number into parts so
+ * that the final digit is rounded.
+ */
if (cdigits+czero-clead+1 < (int)precision)
- fp = modf(fp, &d);
+ fp = modf(fp, &d);
else
{
- d = floor(fp + .5);
-
- if (d > 9)
- {
- /* Rounding up to 10, handle that here. */
- if (czero > 0)
- {
- --czero, d = 1;
- if (cdigits == 0) --clead;
+ d = floor(fp + .5);
+
+ if (d > 9)
+ {
+ /* Rounding up to 10, handle that here. */
+ if (czero > 0)
+ {
+ --czero, d = 1;
+ if (cdigits == 0) --clead;
}
- else
- {
- while (cdigits > 0 && d > 9)
- {
- int ch = *--ascii;
-
- if (exp != (-1))
- ++exp;
-
- else if (ch == 46)
- {
- ch = *--ascii, ++size;
- /* Advance exp to '1', so that the
- * decimal point happens after the
- * previous digit.
- */
- exp = 1;
- }
-
- --cdigits;
- d = ch - 47; /* I.e. 1+(ch-48) */
- }
-
- /* Did we reach the beginning? If so adjust the
- * exponent but take into account the leading
- * decimal point.
- */
- if (d > 9) /* cdigits == 0 */
- {
- if (exp == (-1))
- {
- /* Leading decimal point (plus zeros?), if
- * we lose the decimal point here it must
- * be reentered below.
- */
- int ch = *--ascii;
-
- if (ch == 46)
- ++size, exp = 1;
-
- /* Else lost a leading zero, so 'exp' is
- * still ok at (-1)
- */
- }
- else
- ++exp;
-
- /* In all cases we output a '1' */
- d = 1;
- }
- }
- }
- fp = 0; /* Guarantees termination below. */
+ else
+ {
+ while (cdigits > 0 && d > 9)
+ {
+ int ch = *--ascii;
+
+ if (exp != (-1))
+ ++exp;
+
+ else if (ch == 46)
+ {
+ ch = *--ascii, ++size;
+ /* Advance exp to '1', so that the
+ * decimal point happens after the
+ * previous digit.
+ */
+ exp = 1;
+ }
+
+ --cdigits;
+ d = ch - 47; /* I.e. 1+(ch-48) */
+ }
+
+ /* Did we reach the beginning? If so adjust the
+ * exponent but take into account the leading
+ * decimal point.
+ */
+ if (d > 9) /* cdigits == 0 */
+ {
+ if (exp == (-1))
+ {
+ /* Leading decimal point (plus zeros?), if
+ * we lose the decimal point here it must
+ * be reentered below.
+ */
+ int ch = *--ascii;
+
+ if (ch == 46)
+ ++size, exp = 1;
+
+ /* Else lost a leading zero, so 'exp' is
+ * still ok at (-1)
+ */
+ }
+ else
+ ++exp;
+
+ /* In all cases we output a '1' */
+ d = 1;
+ }
+ }
+ }
+ fp = 0; /* Guarantees termination below. */
}
if (d == 0)
{
- ++czero;
- if (cdigits == 0) ++clead;
+ ++czero;
+ if (cdigits == 0) ++clead;
}
else
{
- /* Included embedded zeros in the digit count. */
- cdigits += czero - clead;
- clead = 0;
-
- while (czero > 0)
- {
- /* exp == (-1) means we just output the decimal
- * place - after the DP don't adjust 'exp' any
- * more!
- */
- if (exp != (-1))
- {
- if (exp == 0) *ascii++ = 46, --size;
- /* PLUS 1: TOTAL 4 */
- --exp;
- }
- *ascii++ = 48, --czero;
- }
-
- if (exp != (-1))
- {
- if (exp == 0) *ascii++ = 46, --size; /* counted above */
- --exp;
- }
- *ascii++ = 48 + (int)d, ++cdigits;
+ /* Included embedded zeros in the digit count. */
+ cdigits += czero - clead;
+ clead = 0;
+
+ while (czero > 0)
+ {
+ /* exp == (-1) means we just output the decimal
+ * place - after the DP don't adjust 'exp' any
+ * more!
+ */
+ if (exp != (-1))
+ {
+ if (exp == 0) *ascii++ = 46, --size;
+ /* PLUS 1: TOTAL 4 */
+ --exp;
+ }
+ *ascii++ = 48, --czero;
+ }
+
+ if (exp != (-1))
+ {
+ if (exp == 0) *ascii++ = 46, --size; /* counted above */
+ --exp;
+ }
+ *ascii++ = 48 + (int)d, ++cdigits;
}
}
while (cdigits+czero-clead < (int)precision && fp > DBL_MIN);
@@ -1306,19 +1306,19 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
if (exp >= (-1) && exp <= 2)
{
/* The following only happens if we didn't output the
- * leading zeros above for negative exponent, so this
- * doest add to the digit requirement. Note that the
- * two zeros here can only be output if the two leading
- * zeros were *not* output, so this doesn't increase
- * the output count.
- */
+ * leading zeros above for negative exponent, so this
+ * doest add to the digit requirement. Note that the
+ * two zeros here can only be output if the two leading
+ * zeros were *not* output, so this doesn't increase
+ * the output count.
+ */
while (--exp >= 0) *ascii++ = 48;
*ascii = 0;
/* Total buffer requirement (including the '\0') is
- * 5+precision - see check at the start.
- */
+ * 5+precision - see check at the start.
+ */
return;
}
@@ -1452,7 +1452,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
* have 31 bits each, however the result may be 32 bits.
*/
png_uint_32 s16 = (A >> 16) * (T & 0xffff) +
- (A & 0xffff) * (T >> 16);
+ (A & 0xffff) * (T >> 16);
/* Can't overflow because the a*times bit is only 30
* bits at most.
*/
@@ -1486,7 +1486,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
if (s32 > d32)
{
- if (s00 < d00) --s32; /* carry */
+ if (s00 < d00) --s32; /* carry */
s32 -= d32, s00 -= d00, result += 1<<bitshift;
}
@@ -2052,7 +2052,7 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
# else
if (shift)
- ig = (ig * 65535U + max_by_2)/max;
+ ig = (ig * 65535U + max_by_2)/max;
sub_table[j] = png_gamma_16bit_correct(ig, gamma);
# endif
diff --git a/pngrutil.c b/pngrutil.c
index e801ecf78..918ecc766 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -3492,10 +3492,10 @@ png_get_num_cols(png_structp png_ptr)
if (png_ptr != NULL)
{
if (png_ptr->flags & PNG_FLAG_ROW_INIT)
- return png_ptr->iwidth;
+ return png_ptr->iwidth;
else
- png_error(png_ptr, "Call png_start_read_image or png_read_update_info "
- "before png_get_num_cols");
+ png_error(png_ptr, "Call png_start_read_image or png_read_update_info "
+ "before png_get_num_cols");
}
/* Here on error */
diff --git a/pngtrans.c b/pngtrans.c
index c95b4a0be..dee31d7be 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -701,5 +701,5 @@ png_get_user_transform_ptr(png_structp png_ptr)
#endif
}
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
- PNG_WRITE_USER_TRANSFORM_SUPPORTED */
+ PNG_WRITE_USER_TRANSFORM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */