[前][次][番号順一覧][スレッド一覧]

ruby-changes:8497

From: yugui <ko1@a...>
Date: Thu, 30 Oct 2008 01:07:50 +0900 (JST)
Subject: [ruby-changes:8497] Ruby:r20031 (ruby_1_9_1): merged r20004 from trunk into ruby_1_9_1.

yugui	2008-10-30 01:07:35 +0900 (Thu, 30 Oct 2008)

  New Revision: 20031

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20031

  Log:
    merged r20004 from trunk into ruby_1_9_1.
       * ext/nkf/nkf-utf8/nkf.c (kanji_convert): output unicode chars.
         [ruby-dev:36957]
       * ext/nkf/nkf-utf8/nkf.c (numchar_getc): increase buffer size.
         reported and patched at [ruby-dev:36957] by mame.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/ext/nkf/nkf-utf8/nkf.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20030)
+++ ruby_1_9_1/ChangeLog	(revision 20031)
@@ -30,6 +30,14 @@
 	* win32/win32.c (rb_w32_open): need to seek to the end of the file when
 	  O_APPEND is specified.
 
+Tue Oct 28 23:29:06 2008  NARUSE, Yui  <naruse@r...>
+
+	* ext/nkf/nkf-utf8/nkf.c (kanji_convert): output unicode chars.
+	  [ruby-dev:36957]
+
+	* ext/nkf/nkf-utf8/nkf.c (numchar_getc): increase buffer size.
+	  reported and patched at [ruby-dev:36957] by mame.
+
 Tue Oct 28 23:03:46 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* test/ruby/test_proc.rb: filled all patterns for testing
Index: ruby_1_9_1/ext/nkf/nkf-utf8/nkf.c
===================================================================
--- ruby_1_9_1/ext/nkf/nkf-utf8/nkf.c	(revision 20030)
+++ ruby_1_9_1/ext/nkf/nkf-utf8/nkf.c	(revision 20031)
@@ -33,7 +33,7 @@
  ***********************************************************************/
 #define NKF_IDENT "$Id$"
 #define NKF_VERSION "2.0.8"
-#define NKF_RELEASE_DATE "2008-02-08"
+#define NKF_RELEASE_DATE "2008-10-28"
 #define COPY_RIGHT \
     "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW\n" \
     "Copyright (C) 2002-2008 Kono, Furukawa, Naruse, mastodon"
@@ -41,6 +41,10 @@
 #include "config.h"
 #include "nkf.h"
 #include "utf8tbl.h"
+#ifdef __WIN32__
+#include <windows.h>
+#include <locale.h>
+#endif
 
 /* state of output_mode and input_mode
 
@@ -718,7 +722,16 @@
 #ifdef HAVE_LANGINFO_H
     return nl_langinfo(CODESET);
 #elif defined(__WIN32__)
-    return sprintf("CP%d", GetACP());
+    char buf[16];
+    char *str;
+    int len = sprintf(buf, "CP%d", GetACP());
+    if (len > 0) {
+      str = malloc(len + 1);
+      strcpy(str, buf);
+      str[len] = '\0';
+      return str;
+    }
+    else return NULL;
 #else
     return NULL;
 #endif
@@ -4100,7 +4113,7 @@
     nkf_char (*g)(FILE *) = i_ngetc;
     nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc;
     int i = 0, j;
-    nkf_char buf[8];
+    nkf_char buf[12];
     long c = -1;
 
     buf[i] = (*g)(f);
@@ -5328,6 +5341,10 @@
 		SEND;
 	    }
 	}
+	else if (nkf_char_unicode_p(c1)) {
+	    (*oconv)(0, c1);
+	    NEXT;
+	}
 	else {
 	    /* first byte */
 	    if (input_mode == JIS_X_0208 && DEL <= c1 && c1 < 0x92) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]