• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

nkfのGitリポジトリのfork


Commit MetaInfo

Révision5d213c263b33494a0af1e45cf3414151f0daaf2e (tree)
l'heure2010-04-14 09:20:25
AuteurNARUSE, Yui <naruse@user...>
CommiterNARUSE, Yui

Message de Log

Refix [nkf-bug:21393]. (explicit -X)

patched by Anonymous person:
http://sourceforge.jp/ticket/browse.php?group_id=248&tid=21393

Change Summary

Modification

--- a/nkf.c
+++ b/nkf.c
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
3- * Copyright (c) 1996-2009, The nkf Project.
3+ * Copyright (c) 1996-2010, The nkf Project.
44 *
55 * This software is provided 'as-is', without any express or implied
66 * warranty. In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
2121 * 3. This notice may not be removed or altered from any source distribution.
2222 */
2323 #define NKF_VERSION "2.1.1"
24-#define NKF_RELEASE_DATE "2010-04-13"
24+#define NKF_RELEASE_DATE "2010-04-14"
2525 #define COPY_RIGHT \
2626 "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
2727 "Copyright (C) 1996-2010, The nkf Project."
@@ -382,6 +382,8 @@ static unsigned char stdibuf[IOBUF_SIZE];
382382 static unsigned char stdobuf[IOBUF_SIZE];
383383 #endif
384384
385+#define NKF_UNSPECIFIED (-TRUE)
386+
385387 /* flags */
386388 static int unbuf_f = FALSE;
387389 static int estab_f = FALSE;
@@ -396,7 +398,7 @@ static int mimebuf_f = FALSE; /* MIME buffered input */
396398 static int broken_f = FALSE; /* convert ESC-less broken JIS */
397399 static int iso8859_f = FALSE; /* ISO8859 through */
398400 static int mimeout_f = FALSE; /* base64 mode */
399-static int x0201_f = X0201_DEFAULT; /* convert JIS X 0201 */
401+static int x0201_f = NKF_UNSPECIFIED; /* convert JIS X 0201 */
400402 static int iso2022jp_f = FALSE; /* replace non ISO-2022-JP with GETA */
401403
402404 #ifdef UNICODE_NORMALIZATION
@@ -1209,7 +1211,7 @@ set_input_encoding(nkf_encoding *enc)
12091211 case CP50220:
12101212 case CP50221:
12111213 case CP50222:
1212- x0201_f = FALSE;
1214+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
12131215 #ifdef SHIFTJIS_CP932
12141216 cp51932_f = TRUE;
12151217 #endif
@@ -1231,7 +1233,7 @@ set_input_encoding(nkf_encoding *enc)
12311233 case SHIFT_JIS:
12321234 break;
12331235 case WINDOWS_31J:
1234- x0201_f = FALSE;
1236+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
12351237 #ifdef SHIFTJIS_CP932
12361238 cp51932_f = TRUE;
12371239 #endif
@@ -1253,7 +1255,7 @@ set_input_encoding(nkf_encoding *enc)
12531255 case EUCJP_NKF:
12541256 break;
12551257 case CP51932:
1256- x0201_f = FALSE;
1258+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
12571259 #ifdef SHIFTJIS_CP932
12581260 cp51932_f = TRUE;
12591261 #endif
@@ -1324,7 +1326,7 @@ set_output_encoding(nkf_encoding *enc)
13241326 {
13251327 switch (nkf_enc_to_index(enc)) {
13261328 case CP50220:
1327- x0201_f = TRUE;
1329+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
13281330 #ifdef SHIFTJIS_CP932
13291331 if (cp932inv_f == TRUE) cp932inv_f = FALSE;
13301332 #endif
@@ -1333,7 +1335,7 @@ set_output_encoding(nkf_encoding *enc)
13331335 #endif
13341336 break;
13351337 case CP50221:
1336- x0201_f = FALSE;
1338+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
13371339 #ifdef SHIFTJIS_CP932
13381340 if (cp932inv_f == TRUE) cp932inv_f = FALSE;
13391341 #endif
@@ -1362,7 +1364,7 @@ set_output_encoding(nkf_encoding *enc)
13621364 case SHIFT_JIS:
13631365 break;
13641366 case WINDOWS_31J:
1365- x0201_f = FALSE;
1367+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
13661368 #ifdef UTF8_OUTPUT_ENABLE
13671369 ms_ucs_map_f = UCS_MAP_CP932;
13681370 #endif
@@ -1391,7 +1393,7 @@ set_output_encoding(nkf_encoding *enc)
13911393 #endif
13921394 break;
13931395 case CP51932:
1394- x0201_f = FALSE;
1396+ if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
13951397 #ifdef SHIFTJIS_CP932
13961398 if (cp932inv_f == TRUE) cp932inv_f = FALSE;
13971399 #endif
@@ -5188,7 +5190,7 @@ reinit(void)
51885190 broken_f = FALSE;
51895191 iso8859_f = FALSE;
51905192 mimeout_f = FALSE;
5191- x0201_f = X0201_DEFAULT;
5193+ x0201_f = NKF_UNSPECIFIED;
51925194 iso2022jp_f = FALSE;
51935195 #if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
51945196 ms_ucs_map_f = UCS_MAP_ASCII;
@@ -5301,6 +5303,10 @@ module_connection(void)
53015303 if (nkf_enc_unicode_p(output_encoding))
53025304 output_mode = UTF_8;
53035305
5306+ if (x0201_f == NKF_UNSPECIFIED) {
5307+ x0201_f = X0201_DEFAULT;
5308+ }
5309+
53045310 /* replace continucation module, from output side */
53055311
53065312 /* output redicrection */
--- a/nkf_test.pl
+++ b/nkf_test.pl
@@ -2,8 +2,6 @@
22 #
33 # nkf test program for nkf-2
44 #
5-# $Id: nkf_test.pl,v 1.31 2008/11/18 21:43:19 naruse Exp $
6-#
75 # Shinji KONO <kono@ie.u-ryukyu.ac.jp>
86 # Sun Aug 18 12:25:40 JST 1996
97 # Sun Nov 8 00:16:06 JST 1998
@@ -1041,11 +1039,16 @@ printf "%-40s", "[nkf-forum:48850] ";
10411039 "From: =?ISO-2022-JP?B?GyRCJCIkIiQiJCIkIiQiJCIkIiQiGyhC?=" .
10421040 " <x-xxxx@xxxxxxxxxxxx.co.jp>\n");
10431041
1044-printf "%-40s", "[nkf-bug:21393] ";
1042+printf "%-40s", "[nkf-bug:21393]-x ";
10451043 &test("$nkf --ic=UTF-8 --oc=CP932",
10461044 "\xEF\xBD\xBC\xEF\xBE\x9E\xEF\xBD\xAC\xEF\xBD\xB0\xEF\xBE\x8F\xEF\xBE\x9D\xEF\xBD\xA5\xEF\xBE\x8E\xEF\xBE\x9F\xEF\xBE\x83\xEF\xBE\x84\xEF\xBD\xA1",
10471045 "\xBC\xDE\xAC\xB0\xCF\xDD\xA5\xCE\xDF\xC3\xC4\xA1");
10481046
1047+printf "%-40s", "[nkf-bug:21393]-X ";
1048+ &test("$nkf --ic=UTF-8 --oc=CP932 -X",
1049+ "\xEF\xBD\xBC\xEF\xBE\x9E\xEF\xBD\xAC\xEF\xBD\xB0\xEF\xBE\x8F\xEF\xBE\x9D\xEF\xBD\xA5\xEF\xBE\x8E\xEF\xBE\x9F\xEF\xBE\x83\xEF\xBE\x84\xEF\xBD\xA1",
1050+ "\x83W\x83\x83\x81[\x83}\x83\x93\x81E\x83|\x83e\x83g\x81B");
1051+
10491052 if (!NKF) {
10501053 printf "%-40s", "Guess NL";
10511054 &command_tests(