Commit 37e133a0 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

cast usage of unsigned bytes variable in array subscripting to signed, so

2004-01-05  Manish Singh  <yosh@gimp.org>

        * app/paint-funcs/paint-funcs.c (expand_line): cast usage of unsigned
        bytes variable in array subscripting to signed, so we really do get
        a negative value when we need it. Fixes #130398.
parent a509552f
2004-01-05 Manish Singh <yosh@gimp.org>
* app/paint-funcs/paint-funcs.c (expand_line): cast usage of unsigned
bytes variable in array subscripting to signed, so we really do get
a negative value when we need it. Fixes #130398.
2004-01-05 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/CEL.c: fixed coding style issues, removed
......@@ -2852,6 +2852,9 @@ expand_line (gdouble *dest,
ratio = old_width / (gdouble) width;
/* we can overflow src's boundaries, so we expect our caller to have
allocated extra space for us to do so safely (see scale_region ()) */
/* this could be optimized much more by precalculating the coefficients for
each x */
switch(interp)
......@@ -2863,7 +2866,10 @@ expand_line (gdouble *dest,
/* +2, -2 is there because (int) rounds towards 0 and we need
to round down */
frac = (x * ratio - 0.5) - src_col;
s = &src[src_col * bytes];
/* cast bytes to signed int to make sure the result is signed */
s = &src[src_col * (int) bytes];
for (b = 0; b < bytes; b++)
dest[b] = cubic (frac, s[b - bytes], s[b], s[b + bytes],
s[b + bytes * 2]);
......@@ -2879,7 +2885,10 @@ expand_line (gdouble *dest,
/* +2, -2 is there because (int) rounds towards 0 and we need
to round down */
frac = (x * ratio - 0.5) - src_col;
s = &src[src_col * bytes];
/* cast bytes to signed int to make sure the result is signed */
s = &src[src_col * (int) bytes];
for (b = 0; b < bytes; b++)
dest[b] = ((s[b + bytes] - s[b]) * frac + s[b]);
dest += bytes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment