Bug #3522 closed
String::size return invalid size on mswin64
Added by beuniv (shintaro kuwamoto) over 14 years ago.
Updated almost 14 years ago.
ruby -v :
ruby 1.9.2dev (2010-07-01 revision 28513) [x64-mswin64_90]
[ruby-dev:41782]
Description
=begin
x64-mswin64_90環境で、15文字以上のUTF-8文字列のサイズが正常に取得できません。
Z:\ruby-trunk\build>ruby -e"puts "1234567890123\u{3042}".size"
14
Z:\ruby-trunk\build>ruby -e"puts "12345678901234\u{3042}".size"
19
=end
=begin
遠藤です。
2010年7月2日19:05 shintaro kuwamoto redmine@ruby-lang.org :
x64-mswin64_90環境で、15文字以上のUTF-8文字列のサイズが正常に取得できません。
Z:\ruby-trunk\build>ruby -e"puts "1234567890123\u{3042}".size"
14
Z:\ruby-trunk\build>ruby -e"puts "12345678901234\u{3042}".size"
19
ひょっとして以下のパッチで直らないでしょうか。
diff --git a/string.c b/string.c
index 703797f..510c04e 100644
--- a/string.c
+++ b/string.c
@@ -141,7 +141,7 @@ static inline const char *
search_nonascii(const char *p, const char *e)
{
#if SIZEOF_VALUE == 8
-# define NONASCII_MASK 0x8080808080808080LL
+# define NONASCII_MASK 0x8080808080808080ULL
#elif SIZEOF_VALUE == 4
define NONASCII_MASK 0x80808080UL¶
#endif
--
Yusuke Endoh mame@tsg.ne.jp
=end
=begin
こんばんわ。
ひょっとして以下のパッチで直らないでしょうか。
diff --git a/string.c b/string.c
index 703797f..510c04e 100644
--- a/string.c
+++ b/string.c
@@ -141,7 +141,7 @@ static inline const char *
search_nonascii(const char *p, const char *e)
{
#if SIZEOF_VALUE == 8
-# define NONASCII_MASK 0x8080808080808080LL
+# define NONASCII_MASK 0x8080808080808080ULL
#elif SIZEOF_VALUE == 4
define NONASCII_MASK 0x80808080UL¶
#endif
おお。動くようになりました。
ありがとうございます。
Z:\ruby-trunk\build>ruby -e"puts "1234567890123\u{3042}".size"
14
Z:\ruby-trunk\build>ruby -e"puts "12345678901234\u{3042}".size"
15
--
kuwamoto
=end
=begin
遠藤です。
2010年7月5日23:42 kuwamoto shintaro beuniv@gmail.com :
おお。動くようになりました。
ありがとうございます。
おお。確認ありがとうございます。コミットしておきます。
しかし、0x8080808080808080LL を signed long long int にしてしまうのは¶
VC のバグのような気もする¶
--
Yusuke Endoh mame@tsg.ne.jp
=end
Status changed from Open to Closed
% Done changed from 0 to 100
=begin
This issue was solved with changeset r28544.
shintaro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Status changed from Closed to Assigned
Assignee set to yugui (Yuki Sonoda)
Status changed from Assigned to Closed
Assignee changed from yugui (Yuki Sonoda) to mame (Yusuke Endoh)
Also available in: Atom
PDF
Like 0
Like 0 Like 0 Like 0 Like 0 Like 0 Like 0