aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 47346a7d4d4..9bc344e9612 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -520,12 +520,13 @@ static intmax_t
520xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi) 520xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
521{ 521{
522 CHECK_NUMBER (x); 522 CHECK_NUMBER (x);
523 if (FIXNUMP (x)) 523 if (INTEGERP (x))
524 { 524 {
525 if (lo <= XFIXNUM (x) && XFIXNUM (x) <= hi) 525 intmax_t i;
526 return XFIXNUM (x); 526 if (integer_to_intmax (x, &i) && lo <= i && i <= hi)
527 return i;
527 } 528 }
528 else if (FLOATP (x)) 529 else
529 { 530 {
530 double d = XFLOAT_DATA (x); 531 double d = XFLOAT_DATA (x);
531 if (lo <= d && d < 1.0 + hi) 532 if (lo <= d && d < 1.0 + hi)
@@ -535,12 +536,6 @@ xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
535 return n; 536 return n;
536 } 537 }
537 } 538 }
538 else if (! (MOST_NEGATIVE_FIXNUM <= lo && hi <= MOST_POSITIVE_FIXNUM))
539 {
540 intmax_t i = bignum_to_intmax (x);
541 if (i != 0 && lo <= i && i <= hi)
542 return i;
543 }
544 539
545 if (xd_in_read_queued_messages) 540 if (xd_in_read_queued_messages)
546 Fthrow (Qdbus_error, Qnil); 541 Fthrow (Qdbus_error, Qnil);
@@ -553,12 +548,13 @@ static uintmax_t
553xd_extract_unsigned (Lisp_Object x, uintmax_t hi) 548xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
554{ 549{
555 CHECK_NUMBER (x); 550 CHECK_NUMBER (x);
556 if (FIXNUMP (x)) 551 if (INTEGERP (x))
557 { 552 {
558 if (0 <= XFIXNUM (x) && XFIXNUM (x) <= hi) 553 uintmax_t i;
559 return XFIXNUM (x); 554 if (integer_to_uintmax (x, &i) && i <= hi)
555 return i;
560 } 556 }
561 else if (FLOATP (x)) 557 else
562 { 558 {
563 double d = XFLOAT_DATA (x); 559 double d = XFLOAT_DATA (x);
564 if (0 <= d && d < 1.0 + hi) 560 if (0 <= d && d < 1.0 + hi)
@@ -568,12 +564,6 @@ xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
568 return n; 564 return n;
569 } 565 }
570 } 566 }
571 else if (! (hi <= MOST_POSITIVE_FIXNUM))
572 {
573 uintmax_t i = bignum_to_uintmax (x);
574 if (i != 0 && i <= hi)
575 return i;
576 }
577 567
578 if (xd_in_read_queued_messages) 568 if (xd_in_read_queued_messages)
579 Fthrow (Qdbus_error, Qnil); 569 Fthrow (Qdbus_error, Qnil);