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.532 < prev    next >
Encoding:
Internet Message Format  |  2004-05-04  |  5.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.532 (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.532 (extra)
  11. Problem:    Compiling for Win32s with VC 4.1 doesn't work.
  12. Solution:   Don't use CP_UTF8 if it's not defined.  Don't use CSIDL_COMMON*
  13.             when not defined.
  14. Files:      src/dosinst.h, src/fileio.c
  15.  
  16.  
  17. *** ../vim-6.2.531/src/dosinst.h    Tue May  4 15:53:18 2004
  18. --- src/dosinst.h    Wed May  5 14:43:43 2004
  19. ***************
  20. *** 227,240 ****
  21. --- 227,248 ----
  22.       if (strcmp(shell_folder_name, "desktop") == 0)
  23.       {
  24.       pcsidl = &desktop_csidl;
  25. + #ifdef CSIDL_COMMON_DESKTOPDIRECTORY
  26.       csidl = CSIDL_COMMON_DESKTOPDIRECTORY;
  27.       alt_csidl = CSIDL_DESKTOP;
  28. + #else
  29. +     csidl = CSIDL_DESKTOP;
  30. + #endif
  31.       }
  32.       else if (strncmp(shell_folder_name, "Programs", 8) == 0)
  33.       {
  34.       pcsidl = &programs_csidl;
  35. + #ifdef CSIDL_COMMON_PROGRAMS
  36.       csidl = CSIDL_COMMON_PROGRAMS;
  37.       alt_csidl = CSIDL_PROGRAMS;
  38. + #else
  39. +     csidl = CSIDL_PROGRAMS;
  40. + #endif
  41.       }
  42.       else
  43.       {
  44. *** ../vim-6.2.531/src/fileio.c    Sat May  1 21:04:31 2004
  45. --- src/fileio.c    Wed May  5 14:36:19 2004
  46. ***************
  47. *** 1357,1385 ****
  48.           int    needed;
  49.           char_u    *p;
  50.           int    u8c;
  51. -         int    l, len;
  52.   
  53.           /*
  54.            * 1. find out how many ucs-2 characters there are.
  55.            */
  56.           if (FIO_GET_CP(fio_flags) == CP_UTF8)
  57.           {
  58.               /* Handle CP_UTF8 ourselves to be able to handle trailing
  59.                * bytes properly.  First find out the number of
  60.                * characters and check for trailing bytes. */
  61.               needed = 0;
  62.               p = ptr;
  63. !             for (len = from_size; len > 0; len -= l)
  64.               {
  65. !             l = utf_ptr2len_check_len(p, len);
  66. !             if (l > len)            /* incomplete char */
  67.               {
  68.                   if (l > CONV_RESTLEN)
  69.                   /* weird overlong byte sequence */
  70.                   goto rewind_retry;
  71. !                 mch_memmove(conv_rest, p, len);
  72. !                 conv_restlen = len;
  73. !                 from_size -= len;
  74.                   break;
  75.               }
  76.               if (l == 1 && *p >= 0x80)    /* illegal byte */
  77. --- 1357,1387 ----
  78.           int    needed;
  79.           char_u    *p;
  80.           int    u8c;
  81.   
  82.           /*
  83.            * 1. find out how many ucs-2 characters there are.
  84.            */
  85. + #  ifdef CP_UTF8    /* VC 4.1 doesn't define CP_UTF8 */
  86.           if (FIO_GET_CP(fio_flags) == CP_UTF8)
  87.           {
  88. +             int        l, flen;
  89.               /* Handle CP_UTF8 ourselves to be able to handle trailing
  90.                * bytes properly.  First find out the number of
  91.                * characters and check for trailing bytes. */
  92.               needed = 0;
  93.               p = ptr;
  94. !             for (flen = from_size; flen > 0; flen -= l)
  95.               {
  96. !             l = utf_ptr2len_check_len(p, flen);
  97. !             if (l > flen)            /* incomplete char */
  98.               {
  99.                   if (l > CONV_RESTLEN)
  100.                   /* weird overlong byte sequence */
  101.                   goto rewind_retry;
  102. !                 mch_memmove(conv_rest, p, flen);
  103. !                 conv_restlen = flen;
  104. !                 from_size -= flen;
  105.                   break;
  106.               }
  107.               if (l == 1 && *p >= 0x80)    /* illegal byte */
  108. ***************
  109. *** 1389,1394 ****
  110. --- 1391,1397 ----
  111.               }
  112.           }
  113.           else
  114. + #  endif
  115.           {
  116.               /* We can't tell if the last byte of an MBCS string is
  117.                * valid and MultiByteToWideChar() returns zero if it
  118. ***************
  119. *** 1425,1438 ****
  120.           if (ucsp < ptr + size)
  121.               goto rewind_retry;
  122.   
  123.           if (FIO_GET_CP(fio_flags) == CP_UTF8)
  124.           {
  125.               /* Convert from utf-8 to ucs-2. */
  126.               needed = 0;
  127.               p = ptr;
  128. !             for (len = from_size; len > 0; len -= l)
  129.               {
  130. !             l = utf_ptr2len_check_len(p, len);
  131.               u8c = utf_ptr2char(p);
  132.               ucsp[needed * 2] = (u8c & 0xff);
  133.               ucsp[needed * 2 + 1] = (u8c >> 8);
  134. --- 1428,1444 ----
  135.           if (ucsp < ptr + size)
  136.               goto rewind_retry;
  137.   
  138. + #  ifdef CP_UTF8    /* VC 4.1 doesn't define CP_UTF8 */
  139.           if (FIO_GET_CP(fio_flags) == CP_UTF8)
  140.           {
  141. +             int        l, flen;
  142.               /* Convert from utf-8 to ucs-2. */
  143.               needed = 0;
  144.               p = ptr;
  145. !             for (flen = from_size; flen > 0; flen -= l)
  146.               {
  147. !             l = utf_ptr2len_check_len(p, flen);
  148.               u8c = utf_ptr2char(p);
  149.               ucsp[needed * 2] = (u8c & 0xff);
  150.               ucsp[needed * 2 + 1] = (u8c >> 8);
  151. ***************
  152. *** 1441,1446 ****
  153. --- 1447,1453 ----
  154.               }
  155.           }
  156.           else
  157. + #  endif
  158.               needed = MultiByteToWideChar(FIO_GET_CP(fio_flags),
  159.                           MB_ERR_INVALID_CHARS, (LPCSTR)ptr,
  160.                            from_size, (LPWSTR)ucsp, needed);
  161. ***************
  162. *** 4705,4710 ****
  163. --- 4712,4718 ----
  164.   
  165.           fromlen = to - ip->bw_conv_buf;
  166.           buf = to;
  167. + #  ifdef CP_UTF8    /* VC 4.1 doesn't define CP_UTF8 */
  168.           if (FIO_GET_CP(flags) == CP_UTF8)
  169.           {
  170.           /* Convert from UCS-2 to UTF-8, using the remainder of the
  171. ***************
  172. *** 4723,4728 ****
  173. --- 4731,4737 ----
  174.           len = to - buf;
  175.           }
  176.           else
  177. + #endif
  178.           {
  179.           /* Convert from UCS-2 to the codepage, using the remainder of
  180.            * the conversion buffer.  If the conversion uses the default
  181. ***************
  182. *** 5064,5072 ****
  183. --- 5073,5083 ----
  184.       cp = encname2codepage(ptr);
  185.       if (cp == 0)
  186.       {
  187. + #  ifdef CP_UTF8    /* VC 4.1 doesn't define CP_UTF8 */
  188.       if (STRCMP(ptr, "utf-8") == 0)
  189.           cp = CP_UTF8;
  190.       else
  191. + #  endif
  192.           return 0;
  193.       }
  194.       return FIO_PUT_CP(cp) | FIO_CODEPAGE;
  195. *** ../vim-6.2.531/src/version.c    Wed May  5 12:38:40 2004
  196. --- src/version.c    Wed May  5 14:45:21 2004
  197. ***************
  198. *** 643,644 ****
  199. --- 643,646 ----
  200.   {   /* Add new patch number below this line */
  201. + /**/
  202. +     532,
  203.   /**/
  204.  
  205. -- 
  206. An actual excerpt from a classified section of a city newspaper:
  207. "Illiterate?  Write today for free help!"
  208.  
  209.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  210. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  211. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  212.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  213.