File tree 1 file changed +5
-4
lines changed
gui-lib/mred/private/wx/cocoa
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 426
426
427
427
;; The strings used to store output from UCKeyTranslate is only allocated once:
428
428
(define max-string-length 255 )
429
- (define output-chars (malloc _UniChar max-string-length))
429
+ (define output-chars (malloc _UniChar (add1 max-string-length))) ; leave room for a terminator
430
430
431
431
;; Dead key state
432
432
; A pointer to an unsigned 32-bit value, initialized to zero.
490
490
max-string-length
491
491
actual-string-length
492
492
output-chars)
493
- ; get the number of characters returned, and convert to string
493
+ ;; get the number of characters returned, and convert to string;
494
+ ;; the characters are UTF-16
494
495
(define n (max 0 (min max-string-length (unbox actual-string-length))))
495
- (list->string ( for/list ([i (in-range n)])
496
- (integer->char (ptr-ref output-chars _UniChar i))) ))
496
+ (ptr-set! output-chars _UniChar n 0 ) ; ensure nul terminator
497
+ (cast output-chars _pointer _string/utf-16 ))
497
498
498
499
;;;
499
500
;;; Conversions back and forth between characters and key codes.
You can’t perform that action at this time.
0 commit comments