Commit 0aec8c07 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added GIMP_MAX_MEMSIZE, an arbitrary upper limit for memory sizes. It must

2003-11-25  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimplimits.h: added GIMP_MAX_MEMSIZE, an arbitrary
	upper limit for memory sizes. It must be smaller than G_MAXDOUBLE
	since our memsize entry doesn't handle anything larger.

	* app/widgets/gimppropwidgets.c (gimp_prop_memsize_entry_new):
	check against GIMP_MAX_MEMSIZE, not G_MAXDOUBLE.

	* app/config/gimpbaseconfig.c
	* app/config/gimpcoreconfig.c
	* app/config/gimpguiconfig.c: use GIMP_MAX_MEMSIZE instead of
	G_MAXULONG. The latter is larger than G_MAXDOUBLE on 64bit
	machines and caused bug #127908.

	* libgimpwidgets/gimpmemsizeentry.c: added casts to guint64.
parent 348a785e
2003-11-25 Sven Neumann <sven@gimp.org>
* libgimpbase/gimplimits.h: added GIMP_MAX_MEMSIZE, an arbitrary
upper limit for memory sizes. It must be smaller than G_MAXDOUBLE
since our memsize entry doesn't handle anything larger.
* app/widgets/gimppropwidgets.c (gimp_prop_memsize_entry_new):
check against GIMP_MAX_MEMSIZE, not G_MAXDOUBLE.
* app/config/gimpbaseconfig.c
* app/config/gimpcoreconfig.c
* app/config/gimpguiconfig.c: use GIMP_MAX_MEMSIZE instead of
G_MAXULONG. The latter is larger than G_MAXDOUBLE on 64bit
machines and caused bug #127908.
* libgimpwidgets/gimpmemsizeentry.c: added casts to guint64.
2003-11-25 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/interp_md5.[ch]: removed these unused files
......@@ -122,7 +122,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
"tile-cache-size", TILE_CACHE_SIZE_BLURB,
0, G_MAXULONG, 1 << 26,
0, GIMP_MAX_MEMSIZE, 1 << 26,
GIMP_PARAM_CONFIRM);
}
......
......@@ -221,7 +221,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_CONFIRM);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_UNDO_SIZE,
"undo-size", UNDO_SIZE_BLURB,
0, G_MAXULONG, 1 << 22,
0, GIMP_MAX_MEMSIZE, 1 << 22,
GIMP_PARAM_CONFIRM);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class,
PROP_PLUGINRC_PATH,
......
......@@ -198,7 +198,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_MAX_NEW_IMAGE_SIZE,
"max-new-image-size",
MAX_NEW_IMAGE_SIZE_BLURB,
0, (guint64) 1 << 40, 1 << 26,
0, GIMP_MAX_MEMSIZE, 1 << 26,
0);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH,
"theme-path", THEME_PATH_BLURB,
......
......@@ -998,14 +998,8 @@ gimp_prop_memsize_entry_new (GObject *config,
uint64_spec = G_PARAM_SPEC_UINT64 (param_spec);
#ifndef _MSC_VER
/* avoid getting gimppropwidgets.c(999) : warning C4056:
* overflow in floating-point constant arithmetic
* and runtime failing (the check seems not useful to me anyway)
*/
g_return_val_if_fail (uint64_spec->minimum <= (guint64) G_MAXDOUBLE, NULL);
g_return_val_if_fail (uint64_spec->maximum <= (guint64) G_MAXDOUBLE, NULL);
#endif
g_return_val_if_fail (uint64_spec->minimum <= GIMP_MAX_MEMSIZE, NULL);
g_return_val_if_fail (uint64_spec->maximum <= GIMP_MAX_MEMSIZE, NULL);
entry = gimp_memsize_entry_new (value,
uint64_spec->minimum,
......
2003-11-25 Sven Neumann <sven@gimp.org>
* libgimpbase/libgimpbase-sections.txt
* libgimpbase/tmpl/gimplimits.sgml: added GIMP_MAX_MEMSIZE.
2003-11-23 Michael Natterer <mitch@gimp.org>
* app/app-docs.sgml
......
......@@ -29,6 +29,7 @@ GIMP_MIN_IMAGE_SIZE
GIMP_MAX_IMAGE_SIZE
GIMP_MIN_RESOLUTION
GIMP_MAX_RESOLUTION
GIMP_MAX_MEMSIZE
GIMP_CHECK_SIZE
GIMP_CHECK_SIZE_SM
GIMP_CHECK_DARK
......
......@@ -43,6 +43,13 @@ Boundaries of some GIMP data types and some global constants.
<!-- ##### MACRO GIMP_MAX_MEMSIZE ##### -->
<para>
</para>
<!-- ##### MACRO GIMP_CHECK_SIZE ##### -->
<para>
......
......@@ -34,15 +34,23 @@
#define GIMP_MIN_RESOLUTION 5e-3 /* shouldn't display as 0.000 */
#define GIMP_MAX_RESOLUTION 65536.0
/* memory sizes
*/
#define GIMP_MAX_MEMSIZE ((guint64) 1 << 42) /* 4 terabyte;
* needs a 64bit variable
* and must be < G_MAXDOUBLE
*/
/* the size of the checks which indicate transparency...
*/
#define GIMP_CHECK_SIZE 8
#define GIMP_CHECK_SIZE_SM 4
#define GIMP_CHECK_SIZE 8
#define GIMP_CHECK_SIZE_SM 4
/* ...and their colors
*/
#define GIMP_CHECK_DARK 0.4 /* corresponds to GRAY_CHECKS as */
#define GIMP_CHECK_LIGHT 0.6 /* defined in app/image_render.c */
#define GIMP_CHECK_DARK 0.4
#define GIMP_CHECK_LIGHT 0.6
#endif /* __GIMP_LIMITS_H__ */
......@@ -199,7 +199,8 @@ gimp_memsize_entry_new (guint64 value,
for (shift = 30; shift > 10; shift -= 10)
{
if (value > (1 << shift) && value % (1 << shift) == 0)
if (value > ((guint64) 1 << shift) &&
value % ((guint64) 1 << shift) == 0)
break;
}
......@@ -260,7 +261,8 @@ gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
for (shift = 30; shift > 10; shift -= 10)
{
if (value > (1 << shift) && value % (1 << shift) == 0)
if (value > ((guint64) 1 << shift) &&
value % ((guint64) 1 << shift) == 0)
break;
}
......
......@@ -998,14 +998,8 @@ gimp_prop_memsize_entry_new (GObject *config,
uint64_spec = G_PARAM_SPEC_UINT64 (param_spec);
#ifndef _MSC_VER
/* avoid getting gimppropwidgets.c(999) : warning C4056:
* overflow in floating-point constant arithmetic
* and runtime failing (the check seems not useful to me anyway)
*/
g_return_val_if_fail (uint64_spec->minimum <= (guint64) G_MAXDOUBLE, NULL);
g_return_val_if_fail (uint64_spec->maximum <= (guint64) G_MAXDOUBLE, NULL);
#endif
g_return_val_if_fail (uint64_spec->minimum <= GIMP_MAX_MEMSIZE, NULL);
g_return_val_if_fail (uint64_spec->maximum <= GIMP_MAX_MEMSIZE, NULL);
entry = gimp_memsize_entry_new (value,
uint64_spec->minimum,
......
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