1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-10-28 14:30:17 +00:00
parent d8c68028fa
commit b87182fa7f
2 changed files with 28 additions and 3 deletions

View file

@ -1,3 +1,11 @@
Tue Oct 28 23:29:06 2008 NARUSE, Yui <naruse@ruby-lang.org>
* 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@yugui.jp>
* test/ruby/test_proc.rb: filled all patterns for testing

View file

@ -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 @@ nkf_locale_charmap()
#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 @@ numchar_getc(FILE *f)
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 @@ kanji_convert(FILE *f)
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) {