Fixed off by one error in xcf rle saving. Only shows up on some non-Linux

systems.

-Yosh
This commit is contained in:
Manish Singh 1998-01-27 08:23:48 +00:00
parent 928e811e2d
commit b798753917
3 changed files with 22 additions and 14 deletions

View File

@ -1,3 +1,7 @@
Tue Jan 27 00:18:28 PST 1998 Manish Singh <yosh@gimp.org>
* app/xcf.c: fixes an off by one error in xcf_tile_save_rle()
Sun Jan 25 18:41:17 PST 1998 Manish Singh <yosh@gimp.org> Sun Jan 25 18:41:17 PST 1998 Manish Singh <yosh@gimp.org>
* app/about_dialog.c: Added a couple names here * app/about_dialog.c: Added a couple names here

View File

@ -1134,8 +1134,8 @@ xcf_save_tile_rle (XcfInfo *info,
* matching values. * matching values.
*/ */
if ((length == 32768) || if ((length == 32768) ||
((length > 1) && (last != *data)) || ((size - length) <= 0) ||
((size - length) == 0)) ((length > 1) && (last != *data)))
{ {
count += length; count += length;
if (length >= 128) if (length >= 128)
@ -1163,8 +1163,8 @@ xcf_save_tile_rle (XcfInfo *info,
* non-matching values. * non-matching values.
*/ */
if ((length == 32768) || if ((length == 32768) ||
((length > 0) && (last == *data)) || ((size - length) == 0) ||
((size - length) == 0)) ((length > 0) && (last == *data)))
{ {
count += length; count += length;
state = 0; state = 0;
@ -1203,9 +1203,11 @@ xcf_save_tile_rle (XcfInfo *info,
break; break;
} }
length += 1; if (size > 0) {
last = *data; length += 1;
data += bpp; last = *data;
data += bpp;
}
} }
if (count != (tile->ewidth * tile->eheight)) if (count != (tile->ewidth * tile->eheight))

View File

@ -1134,8 +1134,8 @@ xcf_save_tile_rle (XcfInfo *info,
* matching values. * matching values.
*/ */
if ((length == 32768) || if ((length == 32768) ||
((length > 1) && (last != *data)) || ((size - length) <= 0) ||
((size - length) == 0)) ((length > 1) && (last != *data)))
{ {
count += length; count += length;
if (length >= 128) if (length >= 128)
@ -1163,8 +1163,8 @@ xcf_save_tile_rle (XcfInfo *info,
* non-matching values. * non-matching values.
*/ */
if ((length == 32768) || if ((length == 32768) ||
((length > 0) && (last == *data)) || ((size - length) == 0) ||
((size - length) == 0)) ((length > 0) && (last == *data)))
{ {
count += length; count += length;
state = 0; state = 0;
@ -1203,9 +1203,11 @@ xcf_save_tile_rle (XcfInfo *info,
break; break;
} }
length += 1; if (size > 0) {
last = *data; length += 1;
data += bpp; last = *data;
data += bpp;
}
} }
if (count != (tile->ewidth * tile->eheight)) if (count != (tile->ewidth * tile->eheight))