aboutsummaryrefslogtreecommitdiffstats
path: root/src/textconv.c
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/textconv.c
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/textconv.c')
-rw-r--r--src/textconv.c19
1 files changed, 16 insertions, 3 deletions
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. */