diff options
| author | Kenichi Handa | 2007-09-14 04:12:53 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-09-14 04:12:53 +0000 |
| commit | 25c460e52e2146c34d53c240519ec06cd2f1d20d (patch) | |
| tree | a08ab8efa1572377e9359c637511c4417419fbe9 | |
| parent | e1b19750b67c2aeaeebf0b950406fc851d7de806 (diff) | |
| download | emacs-25c460e52e2146c34d53c240519ec06cd2f1d20d.tar.gz emacs-25c460e52e2146c34d53c240519ec06cd2f1d20d.zip | |
(handle_one_xevent): Skip decoding if nbytes is zero.
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xterm.c | 67 |
2 files changed, 38 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2e4a32f4c93..4dd7d11c1a7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2007-09-14 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * xterm.c (handle_one_xevent): Skip decoding if nbytes is zero. | ||
| 4 | |||
| 1 | 2007-09-13 Jason Rumney <jasonr@gnu.org> | 5 | 2007-09-13 Jason Rumney <jasonr@gnu.org> |
| 2 | 6 | ||
| 3 | * fringe.c (w32_init_fringe, mac_init_fringe): Add rif argument. | 7 | * fringe.c (w32_init_fringe, mac_init_fringe): Add rif argument. |
diff --git a/src/xterm.c b/src/xterm.c index 9e85967ba42..fcf5e0b2193 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6538,42 +6538,43 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6538 | gives us composition information. */ | 6538 | gives us composition information. */ |
| 6539 | coding.composing = COMPOSITION_DISABLED; | 6539 | coding.composing = COMPOSITION_DISABLED; |
| 6540 | 6540 | ||
| 6541 | for (i = 0; i < nbytes; i++) | 6541 | if (nbytes > 0) |
| 6542 | { | 6542 | { |
| 6543 | STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); | 6543 | /* Decode the input data. */ |
| 6544 | } | 6544 | int require; |
| 6545 | unsigned char *p; | ||
| 6545 | 6546 | ||
| 6546 | { | 6547 | for (i = 0; i < nbytes; i++) |
| 6547 | /* Decode the input data. */ | 6548 | { |
| 6548 | int require; | 6549 | STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); |
| 6549 | unsigned char *p; | 6550 | } |
| 6550 | |||
| 6551 | require = decoding_buffer_size (&coding, nbytes); | ||
| 6552 | p = (unsigned char *) alloca (require); | ||
| 6553 | coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 6554 | /* We explicitly disable composition handling because | ||
| 6555 | key data should not contain any composition sequence. */ | ||
| 6556 | coding.composing = COMPOSITION_DISABLED; | ||
| 6557 | decode_coding (&coding, copy_bufptr, p, nbytes, require); | ||
| 6558 | nbytes = coding.produced; | ||
| 6559 | nchars = coding.produced_char; | ||
| 6560 | copy_bufptr = p; | ||
| 6561 | } | ||
| 6562 | 6551 | ||
| 6563 | /* Convert the input data to a sequence of | 6552 | require = decoding_buffer_size (&coding, nbytes); |
| 6564 | character events. */ | 6553 | p = (unsigned char *) alloca (require); |
| 6565 | for (i = 0; i < nbytes; i += len) | 6554 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6566 | { | 6555 | /* We explicitly disable composition handling because |
| 6567 | if (nchars == nbytes) | 6556 | key data should not contain any composition sequence. */ |
| 6568 | c = copy_bufptr[i], len = 1; | 6557 | coding.composing = COMPOSITION_DISABLED; |
| 6569 | else | 6558 | decode_coding (&coding, copy_bufptr, p, nbytes, require); |
| 6570 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | 6559 | nbytes = coding.produced; |
| 6571 | nbytes - i, len); | 6560 | nchars = coding.produced_char; |
| 6572 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) | 6561 | copy_bufptr = p; |
| 6573 | ? ASCII_KEYSTROKE_EVENT | 6562 | |
| 6574 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | 6563 | /* Convert the input data to a sequence of |
| 6575 | inev.ie.code = c; | 6564 | character events. */ |
| 6576 | kbd_buffer_store_event_hold (&inev.ie, hold_quit); | 6565 | for (i = 0; i < nbytes; i += len) |
| 6566 | { | ||
| 6567 | if (nchars == nbytes) | ||
| 6568 | c = copy_bufptr[i], len = 1; | ||
| 6569 | else | ||
| 6570 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | ||
| 6571 | nbytes - i, len); | ||
| 6572 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) | ||
| 6573 | ? ASCII_KEYSTROKE_EVENT | ||
| 6574 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | ||
| 6575 | inev.ie.code = c; | ||
| 6576 | kbd_buffer_store_event_hold (&inev.ie, hold_quit); | ||
| 6577 | } | ||
| 6577 | } | 6578 | } |
| 6578 | 6579 | ||
| 6579 | /* Previous code updated count by nchars rather than nbytes, | 6580 | /* Previous code updated count by nchars rather than nbytes, |