aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.c
diff options
context:
space:
mode:
authorPaul Eggert2020-03-27 00:58:31 -0700
committerPaul Eggert2020-03-27 01:06:54 -0700
commitde00a933e4b35b42398582eaba58531e5fdd46ca (patch)
tree1999aba74c99e98e2b101faf65160acb45fd9b52 /src/character.c
parent10bedb75c915158b7662d4dfa4afa3a231714268 (diff)
downloademacs-de00a933e4b35b42398582eaba58531e5fdd46ca.tar.gz
emacs-de00a933e4b35b42398582eaba58531e5fdd46ca.zip
Treat out-of-range positions consistently
If a position argument to get-byte etc. is an out-of-range integer, treat it the same regardless of whether it is a fixnum or a bignum. * src/buffer.c (fix_position): New function. * src/buffer.c (validate_region): * src/character.c (Fget_byte): * src/coding.c (Ffind_coding_systems_region_internal) (Fcheck_coding_systems_region): * src/composite.c (Ffind_composition_internal): * src/editfns.c (Fposition_bytes, Fchar_after, Fchar_before) (Finsert_buffer_substring, Fcompare_buffer_substrings) (Fnarrow_to_region): * src/fns.c (Fsecure_hash_algorithms): * src/font.c (Finternal_char_font, Ffont_at): * src/fringe.c (Ffringe_bitmaps_at_pos): * src/search.c (search_command): * src/textprop.c (get_char_property_and_overlay): * src/window.c (Fpos_visible_in_window_p): * src/xdisp.c (Fwindow_text_pixel_size): Use it instead of CHECK_FIXNUM_COERCE_MARKER, so that the code is simpler and treats bignums consistently with fixnums. * src/buffer.h (CHECK_FIXNUM_COERCE_MARKER): Define here rather than in lisp.h, and reimplement in terms of fix_position so that it treats bignums consistently with fixnums. * src/lisp.h (CHECK_FIXNUM_COERCE_MARKER): Move to buffer.h. * src/textprop.c (validate_interval_range): Signal with original bounds rather than modified ones.
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/character.c b/src/character.c
index 5d419a2e836..d71cb3f145c 100644
--- a/src/character.c
+++ b/src/character.c
@@ -931,10 +931,10 @@ character is not ASCII nor 8-bit character, an error is signaled. */)
931 } 931 }
932 else 932 else
933 { 933 {
934 CHECK_FIXNUM_COERCE_MARKER (position); 934 EMACS_INT fixed_pos = fix_position (position);
935 if (XFIXNUM (position) < BEGV || XFIXNUM (position) >= ZV) 935 if (! (BEGV <= fixed_pos && fixed_pos < ZV))
936 args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV)); 936 args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV));
937 pos = XFIXNAT (position); 937 pos = fixed_pos;
938 p = CHAR_POS_ADDR (pos); 938 p = CHAR_POS_ADDR (pos);
939 } 939 }
940 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) 940 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))