Use finite() instead of isnan() and isinf(). Use _finite() on WIN32.

According to Garry, finite() is probably available more widely than
isinf().


--Sven
This commit is contained in:
Sven Neumann 2000-04-11 09:37:25 +00:00
parent 5a40e72bd3
commit 752a685b20
5 changed files with 23 additions and 17 deletions

View File

@ -1,3 +1,11 @@
2000-04-11 Sven Neumann <sven@gimp.org>
* libgimp/gimpmath.h: defined FINITE() macro that defaults to
finite(). Hopefully this is more portable than isnan() and isinf().
* app/gimage_cmds.c
* tools/pdbgen/pdb/gimage.pdb: use FINITE() here
2000-04-11 Tor Lillqvist <tml@iki.fi>
* README: Warn about the ads in the messages from the

View File

@ -34,9 +34,9 @@
#include "layer.h"
#include "layer_pvt.h"
#include "libgimp/gimpmath.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpmath.h"
static ProcRecord image_list_proc;
static ProcRecord image_new_proc;
@ -3455,10 +3455,10 @@ image_set_resolution_invoker (Argument *args)
if (success)
{
if (ISNAN (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
ISINF (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
ISNAN (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
ISINF (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
if (!FINITE (xresolution) ||
xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
!FINITE (yresolution) ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));

View File

@ -81,11 +81,9 @@ extern "C" {
#define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI))
#ifdef G_OS_WIN32
#define ISNAN(x) _isnan(x)
#define ISINF(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF))
#define FINITE(x) _finite(x)
#else
#define ISNAN(x) isnan(x)
#define ISINF(x) isinf(x)
#define FINITE(x) finite(x)
#endif
#ifdef __cplusplus

View File

@ -1212,10 +1212,10 @@ HELP
$invoke{code} = <<'CODE';
{
if (ISNAN (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
ISINF (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
ISNAN (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
ISINF (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
if (!FINITE (xresolution) ||
xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
!FINITE (yresolution) ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));

View File

@ -1212,10 +1212,10 @@ HELP
$invoke{code} = <<'CODE';
{
if (ISNAN (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
ISINF (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
ISNAN (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
ISINF (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
if (!FINITE (xresolution) ||
xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
!FINITE (yresolution) ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));