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.1.183 < prev    next >
Encoding:
Internet Message Format  |  2002-09-15  |  3.6 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.183
  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.1.183
  11. Problem:    When 'fencs' is empty and 'enc' is utf-8, reading a file with
  12.         illegal bytes gives "CONVERSION ERROR" even though no conversion
  13.         is done.  'readonly' is set, even though writing the file results
  14.         in an unmodified file.
  15. Solution:   For this specific error use "ILLEGAL BYTE" and don't set
  16.         'readonly'.
  17. Files:        src/fileio.c
  18.  
  19.  
  20. *** ../vim61.182/src/fileio.c    Sun Aug  4 22:13:27 2002
  21. --- src/fileio.c    Mon Sep 16 21:44:14 2002
  22. ***************
  23. *** 250,255 ****
  24. --- 250,256 ----
  25.   #ifdef FEAT_MBYTE
  26.       int        can_retry;
  27.       int        conv_error = FALSE;    /* conversion error detected */
  28. +     int        illegal_byte = FALSE;    /* illegal byte detected */
  29.       char_u    *tmpname = NULL;    /* name of 'charconvert' output file */
  30.       int        fio_flags = 0;
  31.       char_u    *fenc;            /* fileencoding to use */
  32. ***************
  33. *** 1401,1407 ****
  34.           }
  35.           else if (enc_utf8 && !conv_error && !curbuf->b_p_bin)
  36.           {
  37. !         /* Converting to UTF-8: Check if the bytes are valid UTF-8.
  38.            * Need to start before "ptr" when part of the character was
  39.            * read in the previous read() call. */
  40.           for (p = ptr - utf_head_off(buffer, ptr); p < ptr + size; ++p)
  41. --- 1403,1409 ----
  42.           }
  43.           else if (enc_utf8 && !conv_error && !curbuf->b_p_bin)
  44.           {
  45. !         /* Reading UTF-8: Check if the bytes are valid UTF-8.
  46.            * Need to start before "ptr" when part of the character was
  47.            * read in the previous read() call. */
  48.           for (p = ptr - utf_head_off(buffer, ptr); p < ptr + size; ++p)
  49. ***************
  50. *** 1410,1416 ****
  51.               {
  52.               len = utf_ptr2len_check(p);
  53.               /* A length of 1 means it's an illegal byte.  Accept
  54. !              * an incomplete charater at the end though, the next
  55.                * read() will get the next bytes, we'll check it
  56.                * then. */
  57.               if (len == 1)
  58. --- 1412,1418 ----
  59.               {
  60.               len = utf_ptr2len_check(p);
  61.               /* A length of 1 means it's an illegal byte.  Accept
  62. !              * an incomplete character at the end though, the next
  63.                * read() will get the next bytes, we'll check it
  64.                * then. */
  65.               if (len == 1)
  66. ***************
  67. *** 1441,1447 ****
  68.               }
  69.   
  70.               /* There is no alternative fenc, just report the error. */
  71. !             conv_error = TRUE;
  72.           }
  73.           }
  74.   #endif
  75. --- 1443,1454 ----
  76.               }
  77.   
  78.               /* There is no alternative fenc, just report the error. */
  79. ! # ifdef USE_ICONV
  80. !             if (iconv_fd != (iconv_t)-1)
  81. !             conv_error = TRUE;
  82. !             else
  83. ! # endif
  84. !             illegal_byte = TRUE;
  85.           }
  86.           }
  87.   #endif
  88. ***************
  89. *** 1821,1826 ****
  90. --- 1828,1838 ----
  91.           if (conv_error)
  92.           {
  93.           STRCAT(IObuff, _("[CONVERSION ERROR]"));
  94. +         c = TRUE;
  95. +         }
  96. +         else if (illegal_byte)
  97. +         {
  98. +         STRCAT(IObuff, _("[ILLEGAL BYTE]"));
  99.           c = TRUE;
  100.           }
  101.           else
  102. *** ../vim61.182/src/version.c    Mon Sep 16 21:26:10 2002
  103. --- src/version.c    Mon Sep 16 21:52:36 2002
  104. ***************
  105. *** 608,609 ****
  106. --- 608,611 ----
  107.   {   /* Add new patch number below this line */
  108. + /**/
  109. +     183,
  110.   /**/
  111.  
  112. -- 
  113. "You're fired." (1980)
  114. "You're laid off." (1985)
  115. "You're downsized." (1990)
  116. "You're rightsized." (1992)
  117.                 (Scott Adams - The Dilbert principle)
  118.  
  119.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  120. ///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
  121. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  122.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  123.