]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2099: different line endings in ja.sjis.po and ja.po v9.1.2099
authorMuraoka Taro <koron.kaoriya@gmail.com>
Tue, 20 Jan 2026 19:07:02 +0000 (19:07 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 20 Jan 2026 19:07:02 +0000 (19:07 +0000)
Problem:  Depending on the worker's environment, the line endings in
          ja.sjis.po may differ from those in the source ja.po.

Solution: By setting standard input and output to binary mode, the line
          endings for input and output will match (Muraoka Taro)

This occurs when using MINGW gcc on Windows and git with autocrlf=false.
In this case, the line endings in ja.po are LF, but because sjiscorr
compiled with MINGW gcc uses text mode for standard input and output,
the line endings in the output ja.sjis.po will be CRLF.

This mismatch in line endings confuses git, causing large differences to
occur when updating.

In addition, the comment style has been changed to // to match the rest
of Vim's code.

closes: #19226

Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/po/sjiscorr.c
src/version.c

index c6c39833de284e8aa4f8d05c8ebefc4adbcaec0a..6decb9216a8f89b6089e39c96fe26a8eddaae22b 100644 (file)
@@ -1,17 +1,28 @@
-/*
- * Simplistic program to correct SJIS inside strings.  When a trail byte is a
- * backslash it needs to be doubled.
- * Public domain.
- */
+// Simplistic program to correct SJIS inside strings.  When a trail byte is a
+// backslash it needs to be doubled.
+// Public domain.
+
 #include <stdio.h>
 #include <string.h>
 
+#ifdef _WIN32
+#      include <fcntl.h>
+#      include <io.h>
+#endif
+
        int
 main(int argc, char **argv)
 {
        char buffer[BUFSIZ];
        char *p;
 
+       // Windows only: put standard input and output into binary mode so that the
+       // line endings in the output match those in the input.
+#ifdef _WIN32
+       _setmode(_fileno(stdin), _O_BINARY);
+       _setmode(_fileno(stdout), _O_BINARY);
+#endif
+
        while (fgets(buffer, BUFSIZ, stdin) != NULL)
        {
                for (p = buffer; *p != 0; p++)
@@ -22,11 +33,10 @@ main(int argc, char **argv)
                                fputs("charset=CP932", stdout);
                                p += 12;
                        }
-                       else if (strncmp(p, "# Original translations", 23) == 0)
+                       else if (strncmp(p, "# Original translations.", 24) == 0)
                        {
+                               p += 24 - 1; // subtracting 1 by considering "p++" in the loop.
                                fputs("# Generated from ja.po, DO NOT EDIT.", stdout);
-                               while (p[1] != '\n')
-                                       ++p;
                        }
                        else if (*(unsigned char *)p == 0x81 && p[1] == '_')
                        {
@@ -46,3 +56,5 @@ main(int argc, char **argv)
                }
        }
 }
+
+// vim:set ts=4 sts=4 sw=4 noet:
index 4790f8de2ed9f956f169c1e4cda3280638828daf..71388c23edbeddd837eb6558c1ad3eb6f276c3b2 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2099,
 /**/
     2098,
 /**/