summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.2.245
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2009-08-26 10:00:38 -0500
committer Eric Hameleers <alien@slackware.com>2018-05-31 22:41:17 +0200
commit5a12e7c134274dba706667107d10d231517d3e05 (patch)
tree55718d5acb710fde798d9f38d0bbaf594ed4b296 /source/ap/vim/patches/7.2.245
downloadcurrent-5a12e7c134274dba706667107d10d231517d3e05.tar.gz
current-5a12e7c134274dba706667107d10d231517d3e05.tar.xz
Slackware 13.0slackware-13.0
Wed Aug 26 10:00:38 CDT 2009 Slackware 13.0 x86_64 is released as stable! Thanks to everyone who helped make this release possible -- see the RELEASE_NOTES for the credits. The ISOs are off to the replicator. This time it will be a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. We're taking pre-orders now at store.slackware.com. Please consider picking up a copy to help support the project. Once again, thanks to the entire Slackware community for all the help testing and fixing things and offering suggestions during this development cycle. As always, have fun and enjoy! -P.
Diffstat (limited to 'source/ap/vim/patches/7.2.245')
-rw-r--r--source/ap/vim/patches/7.2.245165
1 files changed, 165 insertions, 0 deletions
diff --git a/source/ap/vim/patches/7.2.245 b/source/ap/vim/patches/7.2.245
new file mode 100644
index 000000000..d046c97f1
--- /dev/null
+++ b/source/ap/vim/patches/7.2.245
@@ -0,0 +1,165 @@
+To: vim-dev@vim.org
+Subject: Patch 7.2.245
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.2.245
+Problem: When 'enc' is "utf-16" and 'fenc' is "utf-8" writing a file does
+ conversion while none should be done. (Yukihiro Nakadaira) When
+ 'fenc' is empty the file is written as utf-8 instead of utf-16.
+Solution: Do proper comparison of encodings, taking into account that all
+ Unicode values for 'enc' use utf-8 internally.
+Files: src/fileio.c
+
+
+*** ../vim-7.2.244/src/fileio.c 2009-07-29 18:05:57.000000000 +0200
+--- src/fileio.c 2009-07-29 17:04:06.000000000 +0200
+***************
+*** 134,140 ****
+ #ifdef FEAT_MBYTE
+ static linenr_T readfile_linenr __ARGS((linenr_T linecnt, char_u *p, char_u *endp));
+ static int ucs2bytes __ARGS((unsigned c, char_u **pp, int flags));
+! static int same_encoding __ARGS((char_u *a, char_u *b));
+ static int get_fio_flags __ARGS((char_u *ptr));
+ static char_u *check_for_bom __ARGS((char_u *p, long size, int *lenp, int flags));
+ static int make_bom __ARGS((char_u *buf, char_u *name));
+--- 134,140 ----
+ #ifdef FEAT_MBYTE
+ static linenr_T readfile_linenr __ARGS((linenr_T linecnt, char_u *p, char_u *endp));
+ static int ucs2bytes __ARGS((unsigned c, char_u **pp, int flags));
+! static int need_conversion __ARGS((char_u *fenc));
+ static int get_fio_flags __ARGS((char_u *ptr));
+ static char_u *check_for_bom __ARGS((char_u *p, long size, int *lenp, int flags));
+ static int make_bom __ARGS((char_u *buf, char_u *name));
+***************
+*** 1043,1055 ****
+ }
+
+ /*
+! * Conversion is required when the encoding of the file is different
+! * from 'encoding' or 'encoding' is UTF-16, UCS-2 or UCS-4 (requires
+! * conversion to UTF-8).
+ */
+ fio_flags = 0;
+! converted = (*fenc != NUL && !same_encoding(p_enc, fenc));
+! if (converted || enc_unicode != 0)
+ {
+
+ /* "ucs-bom" means we need to check the first bytes of the file
+--- 1043,1054 ----
+ }
+
+ /*
+! * Conversion may be required when the encoding of the file is different
+! * from 'encoding' or 'encoding' is UTF-16, UCS-2 or UCS-4.
+ */
+ fio_flags = 0;
+! converted = need_conversion(fenc);
+! if (converted)
+ {
+
+ /* "ucs-bom" means we need to check the first bytes of the file
+***************
+*** 3969,3978 ****
+ fenc = buf->b_p_fenc;
+
+ /*
+! * The file needs to be converted when 'fileencoding' is set and
+! * 'fileencoding' differs from 'encoding'.
+ */
+! converted = (*fenc != NUL && !same_encoding(p_enc, fenc));
+
+ /*
+ * Check if UTF-8 to UCS-2/4 or Latin1 conversion needs to be done. Or
+--- 3968,3976 ----
+ fenc = buf->b_p_fenc;
+
+ /*
+! * Check if the file needs to be converted.
+ */
+! converted = need_conversion(fenc);
+
+ /*
+ * Check if UTF-8 to UCS-2/4 or Latin1 conversion needs to be done. Or
+***************
+*** 5502,5521 ****
+ }
+
+ /*
+! * Return TRUE if "a" and "b" are the same 'encoding'.
+! * Ignores difference between "ansi" and "latin1", "ucs-4" and "ucs-4be", etc.
+ */
+ static int
+! same_encoding(a, b)
+! char_u *a;
+! char_u *b;
+ {
+! int f;
+
+! if (STRCMP(a, b) == 0)
+! return TRUE;
+! f = get_fio_flags(a);
+! return (f != 0 && get_fio_flags(b) == f);
+ }
+
+ /*
+--- 5500,5536 ----
+ }
+
+ /*
+! * Return TRUE if file encoding "fenc" requires conversion from or to
+! * 'encoding'.
+ */
+ static int
+! need_conversion(fenc)
+! char_u *fenc;
+ {
+! int same_encoding;
+! int enc_flags;
+! int fenc_flags;
+
+! if (*fenc == NUL || STRCMP(p_enc, fenc) == 0)
+! same_encoding = TRUE;
+! else
+! {
+! /* Ignore difference between "ansi" and "latin1", "ucs-4" and
+! * "ucs-4be", etc. */
+! enc_flags = get_fio_flags(p_enc);
+! fenc_flags = get_fio_flags(fenc);
+! same_encoding = (enc_flags != 0 && fenc_flags == enc_flags);
+! }
+! if (same_encoding)
+! {
+! /* Specified encoding matches with 'encoding'. This requires
+! * conversion when 'encoding' is Unicode but not UTF-8. */
+! return enc_unicode != 0;
+! }
+!
+! /* Encodings differ. However, conversion is not needed when 'enc' is any
+! * Unicode encoding and the file is UTF-8. */
+! return !(enc_utf8 && fenc_flags == FIO_UTF8);
+ }
+
+ /*
+*** ../vim-7.2.244/src/version.c 2009-07-29 18:05:57.000000000 +0200
+--- src/version.c 2009-07-29 18:20:08.000000000 +0200
+***************
+*** 678,679 ****
+--- 678,681 ----
+ { /* Add new patch number below this line */
++ /**/
++ 245,
+ /**/
+
+--
+An actual excerpt from a classified section of a city newspaper:
+"Illiterate? Write today for free help!"
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ download, build and distribute -- http://www.A-A-P.org ///
+ \\\ help me help AIDS victims -- http://ICCF-Holland.org ///