aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-15 13:38:53 +0800
committerPo Lu2023-02-15 13:38:53 +0800
commitb875a2eaf31d3e9db0ae70bc6a1ed4c9bcd573ff (patch)
tree827beb2555ba0e1d738f479940f1856a55a01db8 /src
parenta62fa69ec9ee847bd0031f3e39a36d00305d3fba (diff)
downloademacs-b875a2eaf31d3e9db0ae70bc6a1ed4c9bcd573ff.tar.gz
emacs-b875a2eaf31d3e9db0ae70bc6a1ed4c9bcd573ff.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/androidterm.c4
-rw-r--r--src/textconv.c19
2 files changed, 19 insertions, 4 deletions
diff --git a/src/androidterm.c b/src/androidterm.c
index a44bae954da..767b7d8240c 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -572,7 +572,7 @@ android_decode_utf16 (unsigned short *utf16, size_t n)
572static void 572static void
573android_handle_ime_event (union android_event *event, struct frame *f) 573android_handle_ime_event (union android_event *event, struct frame *f)
574{ 574{
575 Lisp_Object text; 575 Lisp_Object text UNINIT;
576 576
577 /* First, decode the text if necessary. */ 577 /* First, decode the text if necessary. */
578 578
@@ -4811,6 +4811,8 @@ NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window,
4811 event.ime.position = start; 4811 event.ime.position = start;
4812 event.ime.text = NULL; 4812 event.ime.text = NULL;
4813 event.ime.counter = ++edit_counter; 4813 event.ime.counter = ++edit_counter;
4814
4815 android_write_event (&event);
4814} 4816}
4815 4817
4816/* Structure describing the context for `getSelection'. */ 4818/* Structure describing the context for `getSelection'. */
diff --git a/src/textconv.c b/src/textconv.c
index b62ed7d1365..a39748457d3 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -583,6 +583,8 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
583 Fpoint (), Qnil); 583 Fpoint (), Qnil);
584 Fset_marker_insertion_type (f->conversion.compose_region_end, 584 Fset_marker_insertion_type (f->conversion.compose_region_end,
585 Qt); 585 Qt);
586
587 start = position;
586 } 588 }
587 else 589 else
588 { 590 {
@@ -875,14 +877,25 @@ handle_pending_conversion_events (void)
875 877
876 /* Test if F has any outstanding conversion events. Then 878 /* Test if F has any outstanding conversion events. Then
877 process them in bottom to up order. */ 879 process them in bottom to up order. */
878 for (action = f->conversion.actions; action; action = next) 880 while (true)
879 { 881 {
880 /* Redisplay in between if there is more than one 882 /* Redisplay in between if there is more than one
881 action. */ 883 action.
884
885 This can read input. This function must be reentrant
886 here. */
882 887
883 if (handled) 888 if (handled)
884 redisplay (); 889 redisplay ();
885 890
891 /* Reload action. */
892 action = f->conversion.actions;
893
894 /* If there are no more actions, break. */
895
896 if (!action)
897 break;
898
886 /* Unlink this action. */ 899 /* Unlink this action. */
887 next = action->next; 900 next = action->next;
888 f->conversion.actions = next; 901 f->conversion.actions = next;
@@ -1134,7 +1147,7 @@ get_extracted_text (struct frame *f, ptrdiff_t n,
1134 1147
1135 /* Detect overflow. */ 1148 /* Detect overflow. */
1136 1149
1137 if (!(start <= PT <= end)) 1150 if (!(start <= PT && PT <= end))
1138 goto finish; 1151 goto finish;
1139 1152
1140 /* Convert the character positions to byte positions. */ 1153 /* Convert the character positions to byte positions. */