comparison src/mbyte.c @ 3549:f52d2ea0f81c v7.3.535

updated for version 7.3.535 Problem: Many #ifdefs for MB_MAXBYTES. Solution: Also define MB_MAXBYTES without the +multi_byte feature. Fix places where the buffer didn't include space for a NUL byte.
author Bram Moolenaar <bram@vim.org>
date Fri, 01 Jun 2012 15:21:02 +0200
parents 276d58e9265c
children a8897fd5d074
comparison
equal deleted inserted replaced
3548:7a6efa56f306 3549:f52d2ea0f81c
706 * are treated as leading byte character. (note : This assumption 706 * are treated as leading byte character. (note : This assumption
707 * is not always true.) 707 * is not always true.)
708 */ 708 */
709 n = (i & 0x80) ? 2 : 1; 709 n = (i & 0x80) ? 2 : 1;
710 # else 710 # else
711 char buf[MB_MAXBYTES]; 711 char buf[MB_MAXBYTES + 1];
712 # ifdef X_LOCALE 712 # ifdef X_LOCALE
713 # ifndef mblen 713 # ifndef mblen
714 # define mblen _Xmblen 714 # define mblen _Xmblen
715 # endif 715 # endif
716 # endif 716 # endif
1951 } 1951 }
1952 1952
1953 /* 1953 /*
1954 * Convert the character at screen position "off" to a sequence of bytes. 1954 * Convert the character at screen position "off" to a sequence of bytes.
1955 * Includes the composing characters. 1955 * Includes the composing characters.
1956 * "buf" must at least have the length MB_MAXBYTES. 1956 * "buf" must at least have the length MB_MAXBYTES + 1.
1957 * Only to be used when ScreenLinesUC[off] != 0. 1957 * Only to be used when ScreenLinesUC[off] != 0.
1958 * Returns the produced number of bytes. 1958 * Returns the produced number of bytes.
1959 */ 1959 */
1960 int 1960 int
1961 utfc_char2bytes(off, buf) 1961 utfc_char2bytes(off, buf)