aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert2017-03-04 23:14:52 -0800
committerPaul Eggert2017-03-04 23:18:39 -0800
commit0d55c44a9a00da3b8542e92586654adeb2bcf228 (patch)
tree1105e60b43ef80d105ca613ece1c8cfc6ee64f07 /src/fileio.c
parent44e7ee2e356452139156e8175c46f646835d27ff (diff)
downloademacs-0d55c44a9a00da3b8542e92586654adeb2bcf228.tar.gz
emacs-0d55c44a9a00da3b8542e92586654adeb2bcf228.zip
Compare and round more carefully
* etc/NEWS: Document this. * src/data.c (store_symval_forwarding): * src/sound.c (parse_sound): Do not botch NaN comparison. * src/data.c (cons_to_unsigned, cons_to_signed): Signal an error if a floating-point arg is not integral. * src/data.c (cons_to_unsigned, cons_to_signed): * src/fileio.c (file_offset): Use simpler overflow check. * src/dbusbind.c (xd_extract_signed, xd_extract_unsigned): Avoid rounding error in overflow check. (Fcar_less_than_car): Use arithcompare directly. * test/src/charset-tests.el: New file.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 38400623793..acbf76e0d81 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3426,11 +3426,12 @@ file_offset (Lisp_Object val)
3426 if (FLOATP (val)) 3426 if (FLOATP (val))
3427 { 3427 {
3428 double v = XFLOAT_DATA (val); 3428 double v = XFLOAT_DATA (val);
3429 if (0 <= v 3429 if (0 <= v && v < 1.0 + TYPE_MAXIMUM (off_t))
3430 && (sizeof (off_t) < sizeof v 3430 {
3431 ? v <= TYPE_MAXIMUM (off_t) 3431 off_t o = v;
3432 : v < TYPE_MAXIMUM (off_t))) 3432 if (o == v)
3433 return v; 3433 return o;
3434 }
3434 } 3435 }
3435 3436
3436 wrong_type_argument (intern ("file-offset"), val); 3437 wrong_type_argument (intern ("file-offset"), val);
@@ -5163,7 +5164,7 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
5163 doc: /* Return t if (car A) is numerically less than (car B). */) 5164 doc: /* Return t if (car A) is numerically less than (car B). */)
5164 (Lisp_Object a, Lisp_Object b) 5165 (Lisp_Object a, Lisp_Object b)
5165{ 5166{
5166 return CALLN (Flss, Fcar (a), Fcar (b)); 5167 return arithcompare (Fcar (a), Fcar (b), ARITH_LESS);
5167} 5168}
5168 5169
5169/* Build the complete list of annotations appropriate for writing out 5170/* Build the complete list of annotations appropriate for writing out