mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Expanded TAB characters, again.
This commit is contained in:
86
png.c
86
png.c
@@ -1402,49 +1402,49 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
|
||||
|
||||
if (num <= 0x80000000U) /* else overflowed */
|
||||
{
|
||||
unsigned ndigits = 0, first = 16/*flag value*/;
|
||||
unsigned ndigits = 0, first = 16/*flag value*/;
|
||||
char digits[10];
|
||||
|
||||
while (num)
|
||||
{
|
||||
/* Split the low digit off num: */
|
||||
unsigned tmp = num/10;
|
||||
num -= tmp*10;
|
||||
digits[ndigits++] = (char)(48 + num);
|
||||
/* Record the first non-zero digit, note that this is a number
|
||||
* starting at 1, it's not actually the array index.
|
||||
*/
|
||||
if (first == 16 && num > 0)
|
||||
first = ndigits;
|
||||
num = tmp;
|
||||
}
|
||||
while (num)
|
||||
{
|
||||
/* Split the low digit off num: */
|
||||
unsigned tmp = num/10;
|
||||
num -= tmp*10;
|
||||
digits[ndigits++] = (char)(48 + num);
|
||||
/* Record the first non-zero digit, note that this is a number
|
||||
* starting at 1, it's not actually the array index.
|
||||
*/
|
||||
if (first == 16 && num > 0)
|
||||
first = ndigits;
|
||||
num = tmp;
|
||||
}
|
||||
|
||||
if (ndigits > 0)
|
||||
{
|
||||
while (ndigits > 5) *ascii++ = digits[--ndigits];
|
||||
/* The remaining digits are fractional digits, ndigits is '5' or
|
||||
* smaller at this point. It is certainly not zero. Check for a
|
||||
* non-zero fractional digit:
|
||||
*/
|
||||
if (first <= 5)
|
||||
{
|
||||
unsigned i;
|
||||
*ascii++ = 46; /* decimal point */
|
||||
/* ndigits may be <5 for small numbers, output leading zeros then
|
||||
* ndigits digits to first:
|
||||
*/
|
||||
i = 5;
|
||||
while (ndigits < i) *ascii++ = 48, --i;
|
||||
while (ndigits >= first) *ascii++ = digits[--ndigits];
|
||||
/* Don't output the trailing zeros! */
|
||||
}
|
||||
}
|
||||
else
|
||||
*ascii++ = 48;
|
||||
if (ndigits > 0)
|
||||
{
|
||||
while (ndigits > 5) *ascii++ = digits[--ndigits];
|
||||
/* The remaining digits are fractional digits, ndigits is '5' or
|
||||
* smaller at this point. It is certainly not zero. Check for a
|
||||
* non-zero fractional digit:
|
||||
*/
|
||||
if (first <= 5)
|
||||
{
|
||||
unsigned i;
|
||||
*ascii++ = 46; /* decimal point */
|
||||
/* ndigits may be <5 for small numbers, output leading zeros then
|
||||
* ndigits digits to first:
|
||||
*/
|
||||
i = 5;
|
||||
while (ndigits < i) *ascii++ = 48, --i;
|
||||
while (ndigits >= first) *ascii++ = digits[--ndigits];
|
||||
/* Don't output the trailing zeros! */
|
||||
}
|
||||
}
|
||||
else
|
||||
*ascii++ = 48;
|
||||
|
||||
/* And null terminate the string: */
|
||||
*ascii = 0;
|
||||
return;
|
||||
/* And null terminate the string: */
|
||||
*ascii = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2020,8 +2020,8 @@ png_gamma_8bit_correct(unsigned value, png_fixed_point gamma)
|
||||
if (png_muldiv(&res, gamma, log, PNG_FP_1))
|
||||
return png_exp8bit(res);
|
||||
|
||||
/* Overflow. */
|
||||
value = 0;
|
||||
/* Overflow. */
|
||||
value = 0;
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -2043,8 +2043,8 @@ png_gamma_16bit_correct(unsigned value, png_fixed_point gamma)
|
||||
if (png_muldiv(&res, gamma, log, PNG_FP_1))
|
||||
return png_exp16bit(res);
|
||||
|
||||
/* Overflow. */
|
||||
value = 0;
|
||||
/* Overflow. */
|
||||
value = 0;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user