Commit fd05c7e9 authored by Paul Eggert's avatar Paul Eggert
Browse files

* buffer.c: Integer signedness fixes.

(alloc_buffer_text, enlarge_buffer_text):
Use ptrdiff_t rather than size_t when either will do, as we prefer
signed integers.
parent 5b8ffbdd
2011-07-07 Paul Eggert <eggert@cs.ucla.edu>
* buffer.c: Integer signedness fixes.
(alloc_buffer_text, enlarge_buffer_text):
Use ptrdiff_t rather than size_t when either will do, as we prefer
signed integers.
* bidi.c: Integer signedness and overflow fixes.
(bidi_cache_idx, bidi_cache_last_idx, bidi_cache_fetch_state)
(bidi_cache_search, bidi_cache_find_level_change)
......
......@@ -152,7 +152,7 @@ Lisp_Object Qmodification_hooks;
Lisp_Object Qinsert_in_front_hooks;
Lisp_Object Qinsert_behind_hooks;
static void alloc_buffer_text (struct buffer *, size_t);
static void alloc_buffer_text (struct buffer *, ptrdiff_t);
static void free_buffer_text (struct buffer *b);
static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT);
......@@ -4816,7 +4816,7 @@ extern void r_alloc_free (POINTER_TYPE **ptr);
/* Allocate NBYTES bytes for buffer B's text buffer. */
static void
alloc_buffer_text (struct buffer *b, size_t nbytes)
alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
{
POINTER_TYPE *p;
......@@ -4846,8 +4846,8 @@ void
enlarge_buffer_text (struct buffer *b, EMACS_INT delta)
{
POINTER_TYPE *p;
size_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
+ delta);
ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
+ delta);
BLOCK_INPUT;
#if defined USE_MMAP_FOR_BUFFERS
p = mmap_realloc ((POINTER_TYPE **) &b->text->beg, nbytes);
......
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