]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.535 v7.3.535
authorBram Moolenaar <Bram@vim.org>
Fri, 1 Jun 2012 13:21:02 +0000 (15:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 1 Jun 2012 13:21:02 +0000 (15:21 +0200)
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.

src/arabic.c
src/edit.c
src/eval.c
src/getchar.c
src/mbyte.c
src/misc1.c
src/screen.c
src/spell.c
src/version.c
src/vim.h

index 8c1f64c4051f08f21ab5533dec031400b8efc3a6..72c64b51877c8f2d963275c945c7b932e3866ef6 100644 (file)
@@ -1066,7 +1066,7 @@ arabic_shape(c, ccp, c1p, prev_c, prev_c1, next_c)
 
     if (curr_c != c && ccp != NULL)
     {
-       char_u buf[MB_MAXBYTES];
+       char_u buf[MB_MAXBYTES + 1];
 
        /* Update the first byte of the character. */
        (*mb_char2bytes)(curr_c, buf);
index 39985bdd57a3bd074818bc638abc4e9066053e1e..ebecdb6ececef8175c868a5d47fec55fc49131aa 100644 (file)
@@ -1648,11 +1648,7 @@ static int  pc_status;
 #define PC_STATUS_RIGHT        1       /* right halve of double-wide char */
 #define PC_STATUS_LEFT 2       /* left halve of double-wide char */
 #define PC_STATUS_SET  3       /* pc_bytes was filled */
-#ifdef FEAT_MBYTE
 static char_u pc_bytes[MB_MAXBYTES + 1]; /* saved bytes */
-#else
-static char_u pc_bytes[2];             /* saved bytes */
-#endif
 static int  pc_attr;
 static int  pc_row;
 static int  pc_col;
@@ -6819,11 +6815,7 @@ set_last_insert(c)
     char_u     *s;
 
     vim_free(last_insert);
-#ifdef FEAT_MBYTE
     last_insert = alloc(MB_MAXBYTES * 3 + 5);
-#else
-    last_insert = alloc(6);
-#endif
     if (last_insert != NULL)
     {
        s = last_insert;
@@ -6861,7 +6853,7 @@ add_char2buf(c, s)
     char_u     *s;
 {
 #ifdef FEAT_MBYTE
-    char_u     temp[MB_MAXBYTES];
+    char_u     temp[MB_MAXBYTES + 1];
     int                i;
     int                len;
 
@@ -7423,7 +7415,7 @@ mb_replace_pop_ins(cc)
     int                cc;
 {
     int                n;
-    char_u     buf[MB_MAXBYTES];
+    char_u     buf[MB_MAXBYTES + 1];
     int                i;
     int                c;
 
@@ -10109,11 +10101,7 @@ do_insert_char_pre(c)
     int c;
 {
     char_u     *res;
-#ifdef FEAT_MBYTE
     char_u     buf[MB_MAXBYTES + 1];
-#else
-    char_u     buf[2];
-#endif
 
     /* Return quickly when there is nothing to do. */
     if (!has_insertcharpre())
index 07cb87f998d4e4b7945289f9c56b02fa32292864..2dd36b012a783da8d820935af1ae840715826dc5 100644 (file)
@@ -19170,11 +19170,7 @@ get_vim_var_list(idx)
 set_vim_var_char(c)
     int c;
 {
-#ifdef FEAT_MBYTE
-    char_u     buf[MB_MAXBYTES];
-#else
-    char_u     buf[2];
-#endif
+    char_u     buf[MB_MAXBYTES + 1];
 
 #ifdef FEAT_MBYTE
     if (has_mbyte)
index 606d9a2c6fd63e9e364187005253418afd14159b..aea8d10da731b611c6a2721cf83aac1dee168156 100644 (file)
@@ -723,7 +723,7 @@ read_redo(init, old_redo)
     int                                c;
 #ifdef FEAT_MBYTE
     int                                n;
-    char_u                     buf[MB_MAXBYTES];
+    char_u                     buf[MB_MAXBYTES + 1];
     int                                i;
 #endif
 
@@ -1072,7 +1072,7 @@ ins_char_typebuf(c)
     int            c;
 {
 #ifdef FEAT_MBYTE
-    char_u     buf[MB_MAXBYTES];
+    char_u     buf[MB_MAXBYTES + 1];
 #else
     char_u     buf[4];
 #endif
@@ -1547,7 +1547,7 @@ vgetc()
     int                c, c2;
 #ifdef FEAT_MBYTE
     int                n;
-    char_u     buf[MB_MAXBYTES];
+    char_u     buf[MB_MAXBYTES + 1];
     int                i;
 #endif
 
@@ -4335,11 +4335,7 @@ check_abbr(c, ptr, col, mincol)
     int                scol;           /* starting column of the abbr. */
     int                j;
     char_u     *s;
-#ifdef FEAT_MBYTE
     char_u     tb[MB_MAXBYTES + 4];
-#else
-    char_u     tb[4];
-#endif
     mapblock_T *mp;
 #ifdef FEAT_LOCALMAP
     mapblock_T *mp2;
index 75b41ead9859bfc971dd46ec6744cd816497850a..23944018f2f5ca599d5e9859551c7e1f96d36520 100644 (file)
@@ -708,7 +708,7 @@ codepage_invalid:
             */
            n = (i & 0x80) ? 2 : 1;
 # else
-           char buf[MB_MAXBYTES];
+           char buf[MB_MAXBYTES + 1];
 # ifdef X_LOCALE
 #  ifndef mblen
 #   define mblen _Xmblen
@@ -1953,7 +1953,7 @@ utfc_ptr2char_len(p, pcc, maxlen)
 /*
  * Convert the character at screen position "off" to a sequence of bytes.
  * Includes the composing characters.
- * "buf" must at least have the length MB_MAXBYTES.
+ * "buf" must at least have the length MB_MAXBYTES + 1.
  * Only to be used when ScreenLinesUC[off] != 0.
  * Returns the produced number of bytes.
  */
index b30b07771da8f3b78833d69a81312f6f7350f710..8588411df13afd82c347a21b80822016e5e2f705 100644 (file)
@@ -1932,7 +1932,7 @@ ins_char(c)
     int                c;
 {
 #if defined(FEAT_MBYTE) || defined(PROTO)
-    char_u     buf[MB_MAXBYTES];
+    char_u     buf[MB_MAXBYTES + 1];
     int                n;
 
     n = (*mb_char2bytes)(c, buf);
index fd74707e0024af56dab0710eef82925db60b174e..e5a5b1915be252a7f6a48fc784a5ef0bb90b4115 100644 (file)
@@ -6621,16 +6621,17 @@ screen_putchar(c, row, col, attr)
     int            row, col;
     int            attr;
 {
-#ifdef FEAT_MBYTE
     char_u     buf[MB_MAXBYTES + 1];
 
-    buf[(*mb_char2bytes)(c, buf)] = NUL;
-#else
-    char_u     buf[2];
-
-    buf[0] = c;
-    buf[1] = NUL;
+#ifdef FEAT_MBYTE
+    if (has_mbyte)
+       buf[(*mb_char2bytes)(c, buf)] = NUL;
+    else
 #endif
+    {
+       buf[0] = c;
+       buf[1] = NUL;
+    }
     screen_puts(buf, row, col, attr);
 }
 
index 2ab31c92fe0aa39f5152f3945736549dcd0f612b..f1099674b5c06f7b3aed1dfcd53b61274da0074b 100644 (file)
@@ -13694,7 +13694,7 @@ similar_chars(slang, c1, c2)
 {
     int                m1, m2;
 #ifdef FEAT_MBYTE
-    char_u     buf[MB_MAXBYTES];
+    char_u     buf[MB_MAXBYTES + 1];
     hashitem_T  *hi;
 
     if (c1 >= 256)
index 9dd4001848a8c1eab41e5e36697bbf51c282e103..773d5b03c2bfe10de37b32ee55c0df68f93df085 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    535,
 /**/
     534,
 /**/
index 5cd5e3026f3e679e63ddaa2f9efbf8f3af91253d..d63551d8afc3c2d037d59cde1af1c6be8720a97f 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1703,6 +1703,8 @@ int vim_memcmp __ARGS((void *, void *, size_t));
  * character of up to 6 bytes, or one 16-bit character of up to three bytes
  * plus six following composing characters of three bytes each. */
 # define MB_MAXBYTES   21
+#else
+# define MB_MAXBYTES   1
 #endif
 
 #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
@@ -2017,6 +2019,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
  #pragma warning(disable : 4312)
 #endif
 
+/* Note: a NULL argument for vim_realloc() is not portable, don't use it. */
 #if defined(MEM_PROFILE)
 # define vim_realloc(ptr, size)  mem_realloc((ptr), (size))
 #else