fixed bug in the resolution saving code and added a sanity check to the

* app/xcf.c: fixed bug in the resolution saving code and
	added a sanity check to the resolution loading. (thanks to austin)
This commit is contained in:
jaycox 1998-12-17 02:03:43 +00:00
parent b375288c88
commit ccf22ebb29
3 changed files with 29 additions and 6 deletions

View file

@ -1,3 +1,8 @@
1998-12-16 Jay Cox <jaycox@earthlink.net>
* app/xcf.c: fixed bug in the resolution saving code and
added a sanity check to the resolution loading.
Wed Dec 16 13:27:23 PST 1998 Manish Singh <yosh@gimp.org>
* plug-ins/gfig/gfig.c: removed my_gtk_label_set, since the underlying

View file

@ -904,8 +904,9 @@ xcf_save_prop (XcfInfo *info,
{
float xresolution, yresolution;
xresolution = va_arg (args, gfloat);
yresolution = va_arg (args, gfloat);
/* we pass in floats, but they are promoted to double by the compiler */
xresolution = va_arg (args, double);
yresolution = va_arg (args, double);
size = 4*2;
@ -1552,6 +1553,14 @@ xcf_load_image_props (XcfInfo *info,
{
info->cp += xcf_read_float (info->fp, &gimage->xresolution, 1);
info->cp += xcf_read_float (info->fp, &gimage->yresolution, 1);
if (gimage->xresolution < 1e-5 || gimage->xresolution > 1e+5 ||
gimage->yresolution < 1e-5 || gimage->yresolution > 1e+5)
{
g_message(_("Warning, resolution out of range in XCF file"));
gimage->xresolution = 72.0;
gimage->yresolution = 72.0;
}
}
break;
case PROP_TATTOO:
@ -1570,7 +1579,7 @@ xcf_load_image_props (XcfInfo *info,
parasite_free(p);
}
if (info->cp - base != prop_size)
g_message("Error detected while loading an image's parasites");
g_message(_("Error detected while loading an image's parasites"));
}
break;
default:

View file

@ -904,8 +904,9 @@ xcf_save_prop (XcfInfo *info,
{
float xresolution, yresolution;
xresolution = va_arg (args, gfloat);
yresolution = va_arg (args, gfloat);
/* we pass in floats, but they are promoted to double by the compiler */
xresolution = va_arg (args, double);
yresolution = va_arg (args, double);
size = 4*2;
@ -1552,6 +1553,14 @@ xcf_load_image_props (XcfInfo *info,
{
info->cp += xcf_read_float (info->fp, &gimage->xresolution, 1);
info->cp += xcf_read_float (info->fp, &gimage->yresolution, 1);
if (gimage->xresolution < 1e-5 || gimage->xresolution > 1e+5 ||
gimage->yresolution < 1e-5 || gimage->yresolution > 1e+5)
{
g_message(_("Warning, resolution out of range in XCF file"));
gimage->xresolution = 72.0;
gimage->yresolution = 72.0;
}
}
break;
case PROP_TATTOO:
@ -1570,7 +1579,7 @@ xcf_load_image_props (XcfInfo *info,
parasite_free(p);
}
if (info->cp - base != prop_size)
g_message("Error detected while loading an image's parasites");
g_message(_("Error detected while loading an image's parasites"));
}
break;
default: