home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / old / 5.5.040 < prev    next >
Encoding:
Internet Message Format  |  1999-11-30  |  4.3 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.5.040
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.040
  8. Problem:    Multi-byte: When there is some error in xim_real_init(), it can
  9.             close XIM and return.  After this there can be a segv.
  10. Solution:   Test "xic" for being non-NULL, don't set "xim" to NULL.  Also try 
  11.             to find more matches for supported styles. (Sung-Hyun Nam)
  12. Files:      src/multbyte.c
  13.  
  14.  
  15. *** ../vim-5.5.39/src/multbyte.c    Sun Oct 31 15:20:13 1999
  16. --- src/multbyte.c    Wed Dec  1 18:21:21 1999
  17. ***************
  18. *** 189,195 ****
  19.   
  20.   static int    xim_has_focus = 0;
  21.   #ifdef USE_GUI_X11
  22. - static XIM    xim;
  23.   static XIMStyle    input_style;
  24.   static int    status_area_enabled = TRUE;
  25.   #endif
  26. --- 189,194 ----
  27. ***************
  28. *** 539,545 ****
  29.   
  30.       xim_real_init(x11_window, x11_display);
  31.       gui_set_winsize(FALSE);
  32. !     if (xim != NULL)
  33.       XUnregisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
  34.                        xim_instantiate_cb, NULL);
  35.   }
  36. --- 538,544 ----
  37.   
  38.       xim_real_init(x11_window, x11_display);
  39.       gui_set_winsize(FALSE);
  40. !     if (xic != NULL)
  41.       XUnregisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
  42.                        xim_instantiate_cb, NULL);
  43.   }
  44. ***************
  45. *** 556,562 ****
  46.   
  47.       gui_get_x11_windis(&x11_window, &x11_display);
  48.   
  49. -     xim = NULL;
  50.       xic = NULL;
  51.       status_area_enabled = FALSE;
  52.   
  53. --- 555,560 ----
  54. ***************
  55. *** 575,581 ****
  56.   
  57.       gui_get_x11_windis(&x11_window, &x11_display);
  58.   
  59. -     xim = NULL;
  60.       xic = NULL;
  61.   
  62.       if (xim_real_init(x11_window, x11_display))
  63. --- 573,578 ----
  64. ***************
  65. *** 601,606 ****
  66. --- 598,604 ----
  67.           *end,
  68.           tmp[1024],
  69.           buf[32];
  70. +     XIM        xim = NULL;
  71.       XIMStyles    *xim_styles;
  72.       XIMStyle    this_input_style = 0;
  73.       Boolean    found;
  74. ***************
  75. *** 620,656 ****
  76.       EMSG("XIM requires VIM compiled with +fontset feature.");
  77.       return FALSE;
  78.   #endif
  79. !     if (xim == NULL)
  80.       {
  81. !     if (!gui.input_method || !*gui.input_method)
  82. !     {
  83. !         if ((p = XSetLocaleModifiers("")) != NULL && *p)
  84. !         xim = XOpenIM(x11_display, NULL, NULL, NULL);
  85. !     }
  86. !     else
  87.       {
  88. !         strcpy(tmp, gui.input_method);
  89. !         for (ns = s = tmp; ns && *s;)
  90. !         {
  91. !         while (*s && isspace((unsigned char)*s))
  92. !             s++;
  93. !         if (!*s)
  94. !             break;
  95. !         if ((ns = end = strchr(s, ',')) == 0)
  96. !             end = s + strlen(s);
  97. !         while (isspace((unsigned char)*end))
  98. !             end--;
  99. !         *end = '\0';
  100. !         strcpy(buf, "@im=");
  101. !         strcat(buf, s);
  102. !         if ((p = XSetLocaleModifiers(buf)) != NULL
  103. !             && *p
  104. !             && (xim = XOpenIM(x11_display, NULL, NULL, NULL)) != NULL)
  105. !             break;
  106.   
  107. !         s = ns + 1;
  108. !         }
  109.       }
  110.       }
  111.   
  112. --- 618,655 ----
  113.       EMSG("XIM requires VIM compiled with +fontset feature.");
  114.       return FALSE;
  115.   #endif
  116. !     if (xic != NULL)
  117. !     return FALSE;
  118. !     if (!gui.input_method || !*gui.input_method)
  119.       {
  120. !     if ((p = XSetLocaleModifiers("")) != NULL && *p)
  121. !         xim = XOpenIM(x11_display, NULL, NULL, NULL);
  122. !     }
  123. !     else
  124. !     {
  125. !     strcpy(tmp, gui.input_method);
  126. !     for (ns = s = tmp; ns && *s;)
  127.       {
  128. !         while (*s && isspace((unsigned char)*s))
  129. !         s++;
  130. !         if (!*s)
  131. !         break;
  132. !         if ((ns = end = strchr(s, ',')) == 0)
  133. !         end = s + strlen(s);
  134. !         while (isspace((unsigned char)*end))
  135. !         end--;
  136. !         *end = '\0';
  137. !         strcpy(buf, "@im=");
  138. !         strcat(buf, s);
  139. !         if ((p = XSetLocaleModifiers(buf)) != NULL
  140. !         && *p
  141. !         && (xim = XOpenIM(x11_display, NULL, NULL, NULL)) != NULL)
  142. !         break;
  143.   
  144. !         s = ns + 1;
  145.       }
  146.       }
  147.   
  148. ***************
  149. *** 711,716 ****
  150. --- 710,722 ----
  151.       {
  152.           if (this_input_style == xim_styles->supported_styles[i])
  153.           {
  154. +         found = True;
  155. +         break;
  156. +         }
  157. +         if ((xim_styles->supported_styles[i] & this_input_style)
  158. +             == (this_input_style & ~XIMStatusArea))
  159. +         {
  160. +         this_input_style &= ~XIMStatusArea;
  161.           found = True;
  162.           break;
  163.           }
  164. *** ../vim-5.5.39/src/version.c    Wed Dec  1 20:19:07 1999
  165. --- src/version.c    Wed Dec  1 18:29:17 1999
  166. ***************
  167. *** 420,420 ****
  168. --- 420,421 ----
  169.   {   /* Add new patch number below this line */
  170. +     40,
  171.  
  172. -- 
  173. hundred-and-one symptoms of being an internet addict:
  174. 158. You get a tuner card so you can watch TV while surfing.
  175.  
  176. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  177.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  178.