mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 14:23:33 +00:00
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.
This commit is contained in:
parent
a509552f4c
commit
37e133a0e5
|
@ -1,3 +1,9 @@
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue