[devel] Expanded TAB characters, again.

This commit is contained in:
Glenn Randers-Pehrson 2010-07-31 13:45:04 -05:00
parent c27291d4e3
commit 3df324d845
5 changed files with 96 additions and 96 deletions

86
png.c
View File

@ -1402,49 +1402,49 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
if (num <= 0x80000000U) /* else overflowed */ if (num <= 0x80000000U) /* else overflowed */
{ {
unsigned ndigits = 0, first = 16/*flag value*/; unsigned ndigits = 0, first = 16/*flag value*/;
char digits[10]; char digits[10];
while (num) while (num)
{ {
/* Split the low digit off num: */ /* Split the low digit off num: */
unsigned tmp = num/10; unsigned tmp = num/10;
num -= tmp*10; num -= tmp*10;
digits[ndigits++] = (char)(48 + num); digits[ndigits++] = (char)(48 + num);
/* Record the first non-zero digit, note that this is a number /* Record the first non-zero digit, note that this is a number
* starting at 1, it's not actually the array index. * starting at 1, it's not actually the array index.
*/ */
if (first == 16 && num > 0) if (first == 16 && num > 0)
first = ndigits; first = ndigits;
num = tmp; num = tmp;
} }
if (ndigits > 0) if (ndigits > 0)
{ {
while (ndigits > 5) *ascii++ = digits[--ndigits]; while (ndigits > 5) *ascii++ = digits[--ndigits];
/* The remaining digits are fractional digits, ndigits is '5' or /* The remaining digits are fractional digits, ndigits is '5' or
* smaller at this point. It is certainly not zero. Check for a * smaller at this point. It is certainly not zero. Check for a
* non-zero fractional digit: * non-zero fractional digit:
*/ */
if (first <= 5) if (first <= 5)
{ {
unsigned i; unsigned i;
*ascii++ = 46; /* decimal point */ *ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros then /* ndigits may be <5 for small numbers, output leading zeros then
* ndigits digits to first: * ndigits digits to first:
*/ */
i = 5; i = 5;
while (ndigits < i) *ascii++ = 48, --i; while (ndigits < i) *ascii++ = 48, --i;
while (ndigits >= first) *ascii++ = digits[--ndigits]; while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */ /* Don't output the trailing zeros! */
} }
} }
else else
*ascii++ = 48; *ascii++ = 48;
/* And null terminate the string: */ /* And null terminate the string: */
*ascii = 0; *ascii = 0;
return; return;
} }
} }
@ -2020,8 +2020,8 @@ png_gamma_8bit_correct(unsigned value, png_fixed_point gamma)
if (png_muldiv(&res, gamma, log, PNG_FP_1)) if (png_muldiv(&res, gamma, log, PNG_FP_1))
return png_exp8bit(res); return png_exp8bit(res);
/* Overflow. */ /* Overflow. */
value = 0; value = 0;
# endif # endif
} }
@ -2043,8 +2043,8 @@ png_gamma_16bit_correct(unsigned value, png_fixed_point gamma)
if (png_muldiv(&res, gamma, log, PNG_FP_1)) if (png_muldiv(&res, gamma, log, PNG_FP_1))
return png_exp16bit(res); return png_exp16bit(res);
/* Overflow. */ /* Overflow. */
value = 0; value = 0;
# endif # endif
} }

View File

@ -216,7 +216,7 @@ png_get_pixel_aspect_ratio_fixed(png_structp png_ptr, png_infop info_ptr)
if (png_muldiv(&res, info_ptr->y_pixels_per_unit, PNG_FP_1, if (png_muldiv(&res, info_ptr->y_pixels_per_unit, PNG_FP_1,
info_ptr->x_pixels_per_unit)) info_ptr->x_pixels_per_unit))
return res; return res;
} }
#endif #endif
return 0; return 0;

View File

@ -1214,7 +1214,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
info_ptr = info_ptr; /* To quiet some compiler warnings */ info_ptr = info_ptr; /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place tEXt"); png_error(png_ptr, "Out of place tEXt");
/*NOT REACHED*/ /*NOT REACHED*/
} }
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K

View File

@ -3075,8 +3075,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
} }
default: default:
png_error(png_ptr, "Ignoring bad adaptive filter type"); png_error(png_ptr, "Ignoring bad adaptive filter type");
/*NOT REACHED */ /*NOT REACHED */
break; break;
} }
} }

View File

@ -1228,20 +1228,20 @@ png_init_filter_heuristics(png_structp png_ptr, int heuristic_method,
png_ptr->prev_filters[i] = 255; png_ptr->prev_filters[i] = 255;
} }
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr, png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights)); (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr, png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights)); (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
for (i = 0; i < num_weights; i++) for (i = 0; i < num_weights; i++)
{ {
png_ptr->inv_filter_weights[i] = png_ptr->inv_filter_weights[i] =
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
} }
/* Safe to set this now */ /* Safe to set this now */
png_ptr->num_prev_filters = (png_byte)num_weights; png_ptr->num_prev_filters = (png_byte)num_weights;
} }
/* If, in the future, there are other filter methods, this would /* If, in the future, there are other filter methods, this would
@ -1249,17 +1249,17 @@ png_init_filter_heuristics(png_structp png_ptr, int heuristic_method,
*/ */
if (png_ptr->filter_costs == NULL) if (png_ptr->filter_costs == NULL)
{ {
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr, png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
} }
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
{ {
png_ptr->inv_filter_costs[i] = png_ptr->inv_filter_costs[i] =
png_ptr->filter_costs[i] = PNG_COST_FACTOR; png_ptr->filter_costs[i] = PNG_COST_FACTOR;
} }
/* All the arrays are inited, safe to set this: */ /* All the arrays are inited, safe to set this: */
@ -1300,20 +1300,20 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int i; int i;
for (i = 0; i < num_weights; i++) for (i = 0; i < num_weights; i++)
{ {
if (filter_weights[i] <= 0.0) if (filter_weights[i] <= 0.0)
{ {
png_ptr->inv_filter_weights[i] = png_ptr->inv_filter_weights[i] =
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
} }
else else
{ {
png_ptr->inv_filter_weights[i] = png_ptr->inv_filter_weights[i] =
(png_uint_16)(PNG_WEIGHT_FACTOR*filter_weights[i]+.5); (png_uint_16)(PNG_WEIGHT_FACTOR*filter_weights[i]+.5);
png_ptr->filter_weights[i] = png_ptr->filter_weights[i] =
(png_uint_16)(PNG_WEIGHT_FACTOR/filter_weights[i]+.5); (png_uint_16)(PNG_WEIGHT_FACTOR/filter_weights[i]+.5);
} }
} }
/* Here is where we set the relative costs of the different filters. We /* Here is where we set the relative costs of the different filters. We
@ -1325,11 +1325,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
*/ */
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) if (filter_costs[i] >= 1.0) for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) if (filter_costs[i] >= 1.0)
{ {
png_ptr->inv_filter_costs[i] = png_ptr->inv_filter_costs[i] =
(png_uint_16)(PNG_COST_FACTOR / filter_costs[i] + .5); (png_uint_16)(PNG_COST_FACTOR / filter_costs[i] + .5);
png_ptr->filter_costs[i] = png_ptr->filter_costs[i] =
(png_uint_16)(PNG_COST_FACTOR * filter_costs[i] + .5); (png_uint_16)(PNG_COST_FACTOR * filter_costs[i] + .5);
} }
} }
} }
@ -1355,20 +1355,20 @@ png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
int i; int i;
for (i = 0; i < num_weights; i++) for (i = 0; i < num_weights; i++)
{ {
if (filter_weights[i] <= 0) if (filter_weights[i] <= 0)
{ {
png_ptr->inv_filter_weights[i] = png_ptr->inv_filter_weights[i] =
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
} }
else else
{ {
png_ptr->inv_filter_weights[i] = (png_uint_16) png_ptr->inv_filter_weights[i] = (png_uint_16)
((PNG_WEIGHT_FACTOR*filter_weights[i]+PNG_FP_HALF)/PNG_FP_1); ((PNG_WEIGHT_FACTOR*filter_weights[i]+PNG_FP_HALF)/PNG_FP_1);
png_ptr->filter_weights[i] = (png_uint_16)((PNG_WEIGHT_FACTOR* png_ptr->filter_weights[i] = (png_uint_16)((PNG_WEIGHT_FACTOR*
PNG_FP_1+(filter_weights[i]/2))/filter_weights[i]); PNG_FP_1+(filter_weights[i]/2))/filter_weights[i]);
} }
} }
/* Here is where we set the relative costs of the different filters. We /* Here is where we set the relative costs of the different filters. We
@ -1381,11 +1381,11 @@ png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
if (filter_costs[i] >= PNG_FP_1) if (filter_costs[i] >= PNG_FP_1)
{ {
png_ptr->inv_filter_costs[i] = (png_uint_16)((PNG_COST_FACTOR* png_ptr->inv_filter_costs[i] = (png_uint_16)((PNG_COST_FACTOR*
PNG_FP_1+(filter_costs[i]/2)) / filter_costs[i]); PNG_FP_1+(filter_costs[i]/2)) / filter_costs[i]);
png_ptr->filter_costs[i] = (png_uint_16) png_ptr->filter_costs[i] = (png_uint_16)
((PNG_COST_FACTOR * filter_costs[i] +PNG_FP_HALF)/PNG_FP_1); ((PNG_COST_FACTOR * filter_costs[i] +PNG_FP_HALF)/PNG_FP_1);
} }
} }
} }