Fix CLAMP macro overwritten by glib headers

Fixes #188

When I moved the macro definition below all of the includes, I got the
following compiler warning:

/usr/include/glib-2.0/glib/gmacros.h:246:0: note: this is the location
of the previous definition
 #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low))
? (low) : (x)))

So, that's the macro definition that was being used whenever "CLAMP" was
used. It's pretty obvious what went wrong.
This commit is contained in:
Jordan Klassen
2015-05-02 12:35:05 -07:00
parent 8b0a67a253
commit ba15832b9e
+3 -7
View File
@@ -49,11 +49,6 @@
#include "systemtime.h"
#include "hooks.h"
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define CLAMP(lo,x,up) (MAX((lo), MIN((x), (up))))
/* pause() is not defined on windows platform but is not needed either.
Use a noop macro instead. */
#ifdef __WIN32__
@@ -97,6 +92,8 @@
# include "location-corelocation.h"
#endif
#undef CLAMP
#define CLAMP(lo,mid,up) (((lo) > (mid)) ? (lo) : (((mid) < (up)) ? (mid) : (up)))
/* Union of state data for gamma adjustment methods */
typedef union {
@@ -978,8 +975,7 @@ run_continual_mode(const location_t *loc,
}
/* Clamp alpha value */
adjustment_alpha =
MAX(0.0, MIN(adjustment_alpha, 1.0));
adjustment_alpha = CLAMP(0.0, adjustment_alpha, 1.0);
}
/* Interpolate between 6500K and calculated