1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix small bugs

* src/androidterm.c (android_handle_ime_event): Pacify compiler
warnings.
* src/textconv.c (really_set_composing_text)
(handle_pending_conversion_events, get_extracted_text): Fix
reentrancy problems and uses of uninitialized values.
This commit is contained in:
Po Lu 2023-02-15 13:38:53 +08:00
parent a62fa69ec9
commit b875a2eaf3
2 changed files with 19 additions and 4 deletions

View file

@ -572,7 +572,7 @@ android_decode_utf16 (unsigned short *utf16, size_t n)
static void
android_handle_ime_event (union android_event *event, struct frame *f)
{
Lisp_Object text;
Lisp_Object text UNINIT;
/* First, decode the text if necessary. */
@ -4811,6 +4811,8 @@ NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window,
event.ime.position = start;
event.ime.text = NULL;
event.ime.counter = ++edit_counter;
android_write_event (&event);
}
/* Structure describing the context for `getSelection'. */

View file

@ -583,6 +583,8 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
Fpoint (), Qnil);
Fset_marker_insertion_type (f->conversion.compose_region_end,
Qt);
start = position;
}
else
{
@ -875,14 +877,25 @@ handle_pending_conversion_events (void)
/* Test if F has any outstanding conversion events. Then
process them in bottom to up order. */
for (action = f->conversion.actions; action; action = next)
while (true)
{
/* Redisplay in between if there is more than one
action. */
action.
This can read input. This function must be reentrant
here. */
if (handled)
redisplay ();
/* Reload action. */
action = f->conversion.actions;
/* If there are no more actions, break. */
if (!action)
break;
/* Unlink this action. */
next = action->next;
f->conversion.actions = next;
@ -1134,7 +1147,7 @@ get_extracted_text (struct frame *f, ptrdiff_t n,
/* Detect overflow. */
if (!(start <= PT <= end))
if (!(start <= PT && PT <= end))
goto finish;
/* Convert the character positions to byte positions. */