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 / 6.2.474 < prev    next >
Encoding:
Internet Message Format  |  2004-04-15  |  8.8 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.474 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.474 (extra, after 6.2.456)
  11. Problem:    When Vim is starting up conversion is done unnecessarily.  Failure
  12.         to find the runtime files on Windows 98. (Randall W. Morris)
  13. Solution:   Init enc_codepage negative, only use it when not negative.
  14.         Don't use GetFileAttributesW() on Windows 98 or earlier.
  15. Files:        src/globals.h, src/gui_w32.c, src/gui_w48.c, src/os_mswin.c,
  16.         src/os_win32.c
  17.  
  18.  
  19. *** ../vim-6.2.473/src/globals.h    Mon Apr  5 20:28:39 2004
  20. --- src/globals.h    Thu Apr 15 21:10:07 2004
  21. ***************
  22. *** 669,675 ****
  23.   EXTERN int    enc_unicode INIT(= 0);    /* 2: UCS-2 or UTF-16, 4: UCS-4 */
  24.   EXTERN int    enc_utf8 INIT(= FALSE);        /* UTF-8 encoded Unicode */
  25.   # ifdef WIN3264
  26. ! EXTERN int    enc_codepage INIT(= 0);        /* codepage nr of 'encoding' */
  27.   # endif
  28.   EXTERN int    has_mbyte INIT(= 0);        /* any multi-byte encoding */
  29.   
  30. --- 669,677 ----
  31.   EXTERN int    enc_unicode INIT(= 0);    /* 2: UCS-2 or UTF-16, 4: UCS-4 */
  32.   EXTERN int    enc_utf8 INIT(= FALSE);        /* UTF-8 encoded Unicode */
  33.   # ifdef WIN3264
  34. ! /* Codepage nr of 'encoding'.  Negative means it's not been set yet, zero
  35. !  * means 'encoding' is not a valid codepage. */
  36. ! EXTERN int    enc_codepage INIT(= -1);
  37.   # endif
  38.   EXTERN int    has_mbyte INIT(= 0);        /* any multi-byte encoding */
  39.   
  40. *** ../vim-6.2.473/src/gui_w32.c    Tue Mar 30 22:11:17 2004
  41. --- src/gui_w32.c    Thu Apr 15 21:13:07 2004
  42. ***************
  43. *** 1832,1838 ****
  44.       /* Check if the Unicode buffer exists and is big enough.  Create it
  45.        * with the same lengt as the multi-byte string, the number of wide
  46.        * characters is always equal or smaller. */
  47. !     if ((enc_utf8 || (enc_codepage != 0 && (int)GetACP() != enc_codepage))
  48.           && (unicodebuf == NULL || len > unibuflen))
  49.       {
  50.       vim_free(unicodebuf);
  51. --- 1831,1837 ----
  52.       /* Check if the Unicode buffer exists and is big enough.  Create it
  53.        * with the same lengt as the multi-byte string, the number of wide
  54.        * characters is always equal or smaller. */
  55. !     if ((enc_utf8 || (enc_codepage > 0 && (int)GetACP() != enc_codepage))
  56.           && (unicodebuf == NULL || len > unibuflen))
  57.       {
  58.       vim_free(unicodebuf);
  59. ***************
  60. *** 1875,1881 ****
  61.                    foptions, pcliprect, unicodebuf, clen, unicodepdy);
  62.       len = cells;    /* used for underlining */
  63.       }
  64. !     else if (enc_codepage != 0 && (int)GetACP() != enc_codepage)
  65.       {
  66.       /* If we want to display codepage data, and the current CP is not the
  67.        * ANSI one, we need to go via Unicode. */
  68. --- 1874,1880 ----
  69.                    foptions, pcliprect, unicodebuf, clen, unicodepdy);
  70.       len = cells;    /* used for underlining */
  71.       }
  72. !     else if (enc_codepage > 0 && (int)GetACP() != enc_codepage)
  73.       {
  74.       /* If we want to display codepage data, and the current CP is not the
  75.        * ANSI one, we need to go via Unicode. */
  76. *** ../vim-6.2.473/src/gui_w48.c    Tue Apr  6 21:31:48 2004
  77. --- src/gui_w48.c    Thu Apr 15 21:13:48 2004
  78. ***************
  79. *** 2628,2634 ****
  80.       char_u  *icon)
  81.   {
  82.   #ifdef FEAT_MBYTE
  83. !     if (title != NULL && enc_codepage != (int)GetACP())
  84.       {
  85.       WCHAR    *wbuf;
  86.   
  87. --- 2628,2634 ----
  88.       char_u  *icon)
  89.   {
  90.   #ifdef FEAT_MBYTE
  91. !     if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
  92.       {
  93.       WCHAR    *wbuf;
  94.   
  95. *** ../vim-6.2.473/src/os_mswin.c    Wed Apr 14 14:10:23 2004
  96. --- src/os_mswin.c    Thu Apr 15 21:15:07 2004
  97. ***************
  98. *** 451,457 ****
  99.       if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':')
  100.       *p = NUL;
  101.   #ifdef FEAT_MBYTE
  102. !     if ((int)GetACP() != enc_codepage)
  103.       {
  104.       WCHAR    *wp = enc_to_ucs2(buf, NULL);
  105.       int    n;
  106. --- 451,457 ----
  107.       if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':')
  108.       *p = NUL;
  109.   #ifdef FEAT_MBYTE
  110. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  111.       {
  112.       WCHAR    *wp = enc_to_ucs2(buf, NULL);
  113.       int    n;
  114. ***************
  115. *** 1034,1040 ****
  116.       lenp = &len_loc;
  117.       }
  118.   
  119. !     if (enc_codepage != 0)
  120.       {
  121.       /* We can do any CP### -> UCS-2 in one pass, and we can do it
  122.        * without iconv() (convert_* may need iconv). */
  123. --- 1034,1040 ----
  124.       lenp = &len_loc;
  125.       }
  126.   
  127. !     if (enc_codepage > 0)
  128.       {
  129.       /* We can do any CP### -> UCS-2 in one pass, and we can do it
  130.        * without iconv() (convert_* may need iconv). */
  131. ***************
  132. *** 1093,1099 ****
  133.       lenp = &len_loc;
  134.       }
  135.   
  136. !     if (enc_codepage != 0)
  137.       {
  138.       /* We can do any UCS-2 -> CP### in one pass. */
  139.       int length;
  140. --- 1093,1099 ----
  141.       lenp = &len_loc;
  142.       }
  143.   
  144. !     if (enc_codepage > 0)
  145.       {
  146.       /* We can do any UCS-2 -> CP### in one pass. */
  147.       int length;
  148. *** ../vim-6.2.473/src/os_win32.c    Wed Apr 14 10:43:29 2004
  149. --- src/os_win32.c    Thu Apr 15 21:20:20 2004
  150. ***************
  151. *** 2366,2372 ****
  152.       char_u *name)
  153.   {
  154.   #ifdef FEAT_MBYTE
  155. !     if ((int)GetACP() != enc_codepage)
  156.       {
  157.       WCHAR    *p = enc_to_ucs2(name, NULL);
  158.       long    n;
  159. --- 2366,2376 ----
  160.       char_u *name)
  161.   {
  162.   #ifdef FEAT_MBYTE
  163. !     /* Apparently GetFileAttributesW() exists on Win95/98/ME, but it doesn't
  164. !      * work. */
  165. !     PlatformId();
  166. !     if (g_PlatformId == VER_PLATFORM_WIN32_NT
  167. !             && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  168.       {
  169.       WCHAR    *p = enc_to_ucs2(name, NULL);
  170.       long    n;
  171. ***************
  172. *** 2393,2399 ****
  173.   {
  174.       perm |= FILE_ATTRIBUTE_ARCHIVE;    /* file has changed, set archive bit */
  175.   #ifdef FEAT_MBYTE
  176. !     if ((int)GetACP() != enc_codepage)
  177.       {
  178.       WCHAR    *p = enc_to_ucs2(name, NULL);
  179.       long    n;
  180. --- 2397,2403 ----
  181.   {
  182.       perm |= FILE_ATTRIBUTE_ARCHIVE;    /* file has changed, set archive bit */
  183.   #ifdef FEAT_MBYTE
  184. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  185.       {
  186.       WCHAR    *p = enc_to_ucs2(name, NULL);
  187.       long    n;
  188. ***************
  189. *** 2419,2425 ****
  190.   #ifdef FEAT_MBYTE
  191.       WCHAR    *p = NULL;
  192.   
  193. !     if ((int)GetACP() != enc_codepage)
  194.       p = enc_to_ucs2(name, NULL);
  195.   #endif
  196.   
  197. --- 2423,2433 ----
  198.   #ifdef FEAT_MBYTE
  199.       WCHAR    *p = NULL;
  200.   
  201. !     /* Apparently GetFileAttributesW() exists on Win95/98/ME, but it doesn't
  202. !      * work. */
  203. !     PlatformId();
  204. !     if (g_PlatformId == VER_PLATFORM_WIN32_NT
  205. !             && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  206.       p = enc_to_ucs2(name, NULL);
  207.   #endif
  208.   
  209. ***************
  210. *** 4014,4020 ****
  211.       WCHAR    *wn = NULL;
  212.       int        n;
  213.   
  214. !     if ((int)GetACP() != enc_codepage)
  215.       {
  216.       wn = enc_to_ucs2(name, NULL);
  217.       if (wn != NULL)
  218. --- 4022,4028 ----
  219.       WCHAR    *wn = NULL;
  220.       int        n;
  221.   
  222. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  223.       {
  224.       wn = enc_to_ucs2(name, NULL);
  225.       if (wn != NULL)
  226. ***************
  227. *** 4155,4161 ****
  228.       WCHAR    *wnew = NULL;
  229.       int        retval = 0;
  230.   
  231. !     if ((int)GetACP() != enc_codepage)
  232.       {
  233.       wold = enc_to_ucs2((char_u *)pszOldFile, NULL);
  234.       wnew = enc_to_ucs2((char_u *)pszNewFile, NULL);
  235. --- 4163,4169 ----
  236.       WCHAR    *wnew = NULL;
  237.       int        retval = 0;
  238.   
  239. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  240.       {
  241.       wold = enc_to_ucs2((char_u *)pszOldFile, NULL);
  242.       wnew = enc_to_ucs2((char_u *)pszNewFile, NULL);
  243. ***************
  244. *** 4268,4274 ****
  245.   #ifdef FEAT_MBYTE
  246.       WCHAR    *wn = NULL;
  247.   
  248. !     if ((int)GetACP() != enc_codepage)
  249.       wn = enc_to_ucs2(n, NULL);
  250.   #endif
  251.   
  252. --- 4276,4282 ----
  253.   #ifdef FEAT_MBYTE
  254.       WCHAR    *wn = NULL;
  255.   
  256. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  257.       wn = enc_to_ucs2(n, NULL);
  258.   #endif
  259.   
  260. ***************
  261. *** 4378,4384 ****
  262.       WCHAR    *wn;
  263.       int        f;
  264.   
  265. !     if ((int)GetACP() != enc_codepage)
  266.       {
  267.       wn = enc_to_ucs2(name, NULL);
  268.       if (wn != NULL)
  269. --- 4386,4392 ----
  270.       WCHAR    *wn;
  271.       int        f;
  272.   
  273. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  274.       {
  275.       wn = enc_to_ucs2(name, NULL);
  276.       if (wn != NULL)
  277. ***************
  278. *** 4401,4407 ****
  279.       WCHAR    *wn, *wm;
  280.       FILE    *f;
  281.   
  282. !     if ((int)GetACP() != enc_codepage)
  283.       {
  284.       wn = enc_to_ucs2(name, NULL);
  285.       wm = enc_to_ucs2(mode, NULL);
  286. --- 4409,4415 ----
  287.       WCHAR    *wn, *wm;
  288.       FILE    *f;
  289.   
  290. !     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
  291.       {
  292.       wn = enc_to_ucs2(name, NULL);
  293.       wm = enc_to_ucs2(mode, NULL);
  294. *** ../vim-6.2.473/src/version.c    Thu Apr 15 20:45:41 2004
  295. --- src/version.c    Fri Apr 16 11:03:59 2004
  296. ***************
  297. *** 639,640 ****
  298. --- 639,642 ----
  299.   {   /* Add new patch number below this line */
  300. + /**/
  301. +     474,
  302.   /**/
  303.  
  304. -- 
  305. If an elephant is left tied to a parking meter, the parking fee has to be paid
  306. just as it would for a vehicle.
  307.         [real standing law in Florida, United States of America]
  308.  
  309.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  310. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  311. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  312.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  313.