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.430 < prev    next >
Encoding:
Internet Message Format  |  2004-04-01  |  2.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.430
  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.430
  11. Problem:    BOM at start of a vim script file is not recognized and causes an
  12.         error message.
  13. Solution:   Detect the BOM and skip over it.  Also fix that after using
  14.         ":scriptencoding" the iconv() file descriptor was not closed
  15.         (memory leak).
  16. Files:        src/ex_cmds2.c
  17.  
  18.  
  19. *** ../vim-6.2.429/src/ex_cmds2.c    Sat Mar 27 13:23:01 2004
  20. --- src/ex_cmds2.c    Fri Apr  2 15:20:21 2004
  21. ***************
  22. *** 2256,2261 ****
  23. --- 2256,2275 ----
  24.   #endif
  25.   #ifdef FEAT_MBYTE
  26.       cookie.conv.vc_type = CONV_NONE;        /* no conversion */
  27. +     /* Try reading the first few bytes to check for a UTF-8 BOM. */
  28. +     {
  29. +     char_u        buf[3];
  30. +     if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
  31. +                                   == (size_t)3
  32. +         && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  33. +         /* Found BOM, setup conversion and skip over it. */
  34. +         convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
  35. +     else
  36. +         /* No BOM found, rewind. */
  37. +         fseek(cookie.fp, (off_t)0L, SEEK_SET);
  38. +     }
  39.   #endif
  40.   
  41.       /*
  42. ***************
  43. *** 2332,2337 ****
  44. --- 2346,2355 ----
  45.       retval = OK;
  46.       fclose(cookie.fp);
  47.       vim_free(cookie.nextline);
  48. + #ifdef FEAT_MBYTE
  49. +     convert_setup(&cookie.conv, NULL, NULL);
  50. + #endif
  51.       if (got_int)
  52.       EMSG(_(e_interr));
  53.       sourcing_name = save_sourcing_name;
  54. *** ../vim-6.2.429/src/version.c    Fri Apr  2 14:41:35 2004
  55. --- src/version.c    Fri Apr  2 15:23:36 2004
  56. ***************
  57. *** 639,640 ****
  58. --- 639,642 ----
  59.   {   /* Add new patch number below this line */
  60. + /**/
  61. +     430,
  62.   /**/
  63.  
  64. -- 
  65. hundred-and-one symptoms of being an internet addict:
  66. 240. You think Webster's Dictionary is a directory of WEB sites.
  67.  
  68.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  69. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  70. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  71.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  72.