Commit 55daad71 authored by Paul Eggert's avatar Paul Eggert
Browse files

* buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast.

The cast incorrectly truncated 64-bit byte offsets to 32 bits, and
isn't needed on 32-bit machines.
parent 41cb286c
......@@ -5,7 +5,9 @@
* xfns.c (x_set_scroll_bar_default_width): Remove unused 'int' locals.
* buffer.h (PTR_BYTE_POS): Don't assume a byte count fits in 'unsigned'.
* buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast.
The cast incorrectly truncated 64-bit byte offsets to 32 bits, and
isn't needed on 32-bit machines.
* buffer.c (Fgenerate_new_buffer_name): Use EMACS_INT for count, not int.
(advance_to_char_boundary): Return EMACS_INT, not int.
......
......@@ -337,7 +337,7 @@ while (0)
#define PTR_BYTE_POS(ptr) \
((ptr) - (current_buffer)->text->beg \
- (ptr - (current_buffer)->text->beg <= (size_t) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \
- (ptr - (current_buffer)->text->beg <= GPT_BYTE - BEG_BYTE ? 0 : GAP_SIZE) \
+ BEG_BYTE)
/* Return character at byte position POS. */
......@@ -396,7 +396,7 @@ extern unsigned char *_fetch_multibyte_char_p;
#define BUF_PTR_BYTE_POS(buf, ptr) \
((ptr) - (buf)->text->beg \
- (ptr - (buf)->text->beg <= (unsigned) (BUF_GPT_BYTE ((buf)) - BEG_BYTE)\
- (ptr - (buf)->text->beg <= BUF_GPT_BYTE (buf) - BEG_BYTE \
? 0 : BUF_GAP_SIZE ((buf))) \
+ BEG_BYTE)
......
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