Loading ...
Sorry, an error occurred while loading the content.

Patch 6.2.430

Expand Messages
  • Bram Moolenaar
    Patch 6.2.430 Problem: BOM at start of a vim script file is not recognized and causes an error message. Solution: Detect the BOM and skip over it. Also
    Message 1 of 1 , Apr 2, 2004
    • 0 Attachment
      Patch 6.2.430
      Problem: BOM at start of a vim script file is not recognized and causes an
      error message.
      Solution: Detect the BOM and skip over it. Also fix that after using
      ":scriptencoding" the iconv() file descriptor was not closed
      (memory leak).
      Files: src/ex_cmds2.c


      *** ../vim-6.2.429/src/ex_cmds2.c Sat Mar 27 13:23:01 2004
      --- src/ex_cmds2.c Fri Apr 2 15:20:21 2004
      ***************
      *** 2256,2261 ****
      --- 2256,2275 ----
      #endif
      #ifdef FEAT_MBYTE
      cookie.conv.vc_type = CONV_NONE; /* no conversion */
      +
      + /* Try reading the first few bytes to check for a UTF-8 BOM. */
      + {
      + char_u buf[3];
      +
      + if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
      + == (size_t)3
      + && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
      + /* Found BOM, setup conversion and skip over it. */
      + convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
      + else
      + /* No BOM found, rewind. */
      + fseek(cookie.fp, (off_t)0L, SEEK_SET);
      + }
      #endif

      /*
      ***************
      *** 2332,2337 ****
      --- 2346,2355 ----
      retval = OK;
      fclose(cookie.fp);
      vim_free(cookie.nextline);
      + #ifdef FEAT_MBYTE
      + convert_setup(&cookie.conv, NULL, NULL);
      + #endif
      +
      if (got_int)
      EMSG(_(e_interr));
      sourcing_name = save_sourcing_name;
      *** ../vim-6.2.429/src/version.c Fri Apr 2 14:41:35 2004
      --- src/version.c Fri Apr 2 15:23:36 2004
      ***************
      *** 639,640 ****
      --- 639,642 ----
      { /* Add new patch number below this line */
      + /**/
      + 430,
      /**/

      --
      hundred-and-one symptoms of being an internet addict:
      240. You think Webster's Dictionary is a directory of WEB sites.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.