[Bug #3522] String::size return invalid size on mswin64

Bug #3522: String::size return invalid size on mswin64
http://redmine.ruby-lang.org/issues/show/3522

e$B5/I<<Te(B: shintaro kuwamoto
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2010-07-01 revision 28513) [x64-mswin64_90]

x64-mswin64_90e$B4D6-$G!"e(B15e$BJ8;z0J>e$Ne(BUTF-8e$BJ8;zNs$N%5%$%:$,@5>o$K<hF@$G$-$^$;$s!#e(B

Z:\ruby-trunk\build>ruby -e"puts "1234567890123\u{3042}".size"
14

Z:\ruby-trunk\build>ruby -e"puts "12345678901234\u{3042}".size"
19

e$B1sF#$G$9!#e(B

2010e$BG/e(B7e$B7ne(B2e$BF|e(B19:05 shintaro kuwamoto
[email protected]:

x64-mswin64_90e$B4D6-$G!"e(B15e$BJ8;z0J>e$Ne(BUTF-8e$BJ8;zNs$N%5%$%:$,@5>o$K<hF@$G$-$^$;$s!#e(B

Z:\ruby-trunk\build>ruby -e"puts "1234567890123\u{3042}".size"
14

Z:\ruby-trunk\build>ruby -e"puts "12345678901234\u{3042}".size"
19

e$B$R$g$C$H$7$F0J2<$N%Q%C%A$GD>$i$J$$$G$7$g$&$+!#e(B

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

e$B$3$s$P$s$o!#e(B

#if SIZEOF_VALUE == 8
-# define NONASCII_MASK 0x8080808080808080LL
+# define NONASCII_MASK 0x8080808080808080ULL
#elif SIZEOF_VALUE == 4

define NONASCII_MASK 0x80808080UL

#endif

e$B$$!#F0$/$h$&$K$J$j$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B

Z:\ruby-trunk\build>ruby -e"puts “1234567890123\u{3042}”.size"
14

Z:\ruby-trunk\build>ruby -e"puts “12345678901234\u{3042}”.size"
15

e$B%A%1%C%He(B #3522 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

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.


http://redmine.ruby-lang.org/issues/show/3522

e$B1sF#$G$9!#e(B

2010e$BG/e(B7e$B7ne(B5e$BF|e(B23:42 kuwamoto shintaro
[email protected]:

e$B$$!#F0$/$h$&$K$J$j$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B

e$B$$!#3NG’$"$j$,$H$&$4$6$$$^$9!#%3%_%C%H$7$F$*$-$^$9!#e(B

e$B$7$+$7!"e(B0x8080808080808080LL e$B$re(B signed long long int

e$B$K$7$F$7$^$&$N$Oe(B

VC e$B$N%P%0$N$h$&$J5$$b$9$ke(B