Commit af5a5a98 authored by Andreas Schwab's avatar Andreas Schwab

* lisp.h (CHECK_RANGED_INTEGER): Make value to check the first

argument.
* character.c, charset.c, menu.c, process.c, window.c: Adjust all
uses.
parent 3cfbebba
2012-06-30 Andreas Schwab <schwab@linux-m68k.org>
* lisp.h (CHECK_RANGED_INTEGER): Make value to check the first
argument.
* character.c, charset.c, menu.c, process.c, window.c: Adjust all
uses.
2012-06-29 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (try_window_id): Undo last change.
......
......@@ -927,7 +927,7 @@ usage: (unibyte-string &rest BYTES) */)
for (i = 0; i < n; i++)
{
CHECK_RANGED_INTEGER (0, args[i], 255);
CHECK_RANGED_INTEGER (args[i], 0, 255);
*p++ = XINT (args[i]);
}
......
......@@ -878,9 +878,9 @@ usage: (define-charset-internal ...) */)
min_byte_obj = Faref (val, make_number (i * 2));
max_byte_obj = Faref (val, make_number (i * 2 + 1));
CHECK_RANGED_INTEGER (0, min_byte_obj, 255);
CHECK_RANGED_INTEGER (min_byte_obj, 0, 255);
min_byte = XINT (min_byte_obj);
CHECK_RANGED_INTEGER (min_byte, max_byte_obj, 255);
CHECK_RANGED_INTEGER (max_byte_obj, min_byte, 255);
max_byte = XINT (max_byte_obj);
charset.code_space[i * 4] = min_byte;
charset.code_space[i * 4 + 1] = max_byte;
......@@ -898,7 +898,7 @@ usage: (define-charset-internal ...) */)
charset.dimension = dimension;
else
{
CHECK_RANGED_INTEGER (1, val, 4);
CHECK_RANGED_INTEGER (val, 1, 4);
charset.dimension = XINT (val);
}
......@@ -991,7 +991,7 @@ usage: (define-charset-internal ...) */)
charset.iso_revision = -1;
else
{
CHECK_RANGED_INTEGER (-1, val, 63);
CHECK_RANGED_INTEGER (val, -1, 63);
charset.iso_revision = XINT (val);
}
......
......@@ -1716,7 +1716,7 @@ typedef struct {
#define CHECK_NATNUM(x) \
CHECK_TYPE (NATNUMP (x), Qwholenump, x)
#define CHECK_RANGED_INTEGER(lo, x, hi) \
#define CHECK_RANGED_INTEGER(x, lo, hi) \
do { \
CHECK_NUMBER (x); \
if (! ((lo) <= XINT (x) && XINT (x) <= (hi))) \
......@@ -1730,9 +1730,9 @@ typedef struct {
#define CHECK_TYPE_RANGED_INTEGER(type, x) \
do { \
if (TYPE_SIGNED (type)) \
CHECK_RANGED_INTEGER (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)); \
CHECK_RANGED_INTEGER (x, TYPE_MINIMUM (type), TYPE_MAXIMUM (type)); \
else \
CHECK_RANGED_INTEGER (0, x, TYPE_MAXIMUM (type)); \
CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type)); \
} while (0)
#define CHECK_MARKER(x) \
......
......@@ -1198,14 +1198,16 @@ no quit occurs and `x-popup-menu' returns nil. */)
but I don't want to make one now. */
CHECK_WINDOW (window);
CHECK_RANGED_INTEGER ((xpos < INT_MIN - MOST_NEGATIVE_FIXNUM
CHECK_RANGED_INTEGER (x,
(xpos < INT_MIN - MOST_NEGATIVE_FIXNUM
? (EMACS_INT) INT_MIN - xpos
: MOST_NEGATIVE_FIXNUM),
x, INT_MAX - xpos);
CHECK_RANGED_INTEGER ((ypos < INT_MIN - MOST_NEGATIVE_FIXNUM
INT_MAX - xpos);
CHECK_RANGED_INTEGER (y,
(ypos < INT_MIN - MOST_NEGATIVE_FIXNUM
? (EMACS_INT) INT_MIN - ypos
: MOST_NEGATIVE_FIXNUM),
y, INT_MAX - ypos);
INT_MAX - ypos);
xpos += XINT (x);
ypos += XINT (y);
......
......@@ -1028,8 +1028,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size,
(register Lisp_Object process, Lisp_Object height, Lisp_Object width)
{
CHECK_PROCESS (process);
CHECK_RANGED_INTEGER (0, height, INT_MAX);
CHECK_RANGED_INTEGER (0, width, INT_MAX);
CHECK_RANGED_INTEGER (height, 0, INT_MAX);
CHECK_RANGED_INTEGER (width, 0, INT_MAX);
if (XPROCESS (process)->infd < 0
|| set_window_size (XPROCESS (process)->infd,
......
......@@ -6163,7 +6163,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
if (!NILP (width))
{
CHECK_RANGED_INTEGER (0, width, INT_MAX);
CHECK_RANGED_INTEGER (width, 0, INT_MAX);
if (XINT (width) == 0)
vertical_type = Qnil;
......
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