ruby-changes:11331
From: nobu <ko1@a...>
Date: Sat, 14 Mar 2009 14:16:14 +0900 (JST)
Subject: [ruby-changes:11331] Ruby:r22946 (trunk): * util.c (ruby_strdup, Balloc, rv_alloc): use size_t.
nobu 2009-03-14 14:16:03 +0900 (Sat, 14 Mar 2009) New Revision: 22946 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22946 Log: * util.c (ruby_strdup, Balloc, rv_alloc): use size_t. Modified files: trunk/ChangeLog trunk/util.c Index: ChangeLog =================================================================== --- ChangeLog (revision 22945) +++ ChangeLog (revision 22946) @@ -1,3 +1,7 @@ +Sat Mar 14 14:16:02 2009 Nobuyoshi Nakada <nobu@r...> + + * util.c (ruby_strdup, Balloc, rv_alloc): use size_t. + Sat Mar 14 13:53:11 2009 Nobuyoshi Nakada <nobu@r...> * util.c (ruby_qsort): the result of cmp must be signed, so ge Index: util.c =================================================================== --- util.c (revision 22945) +++ util.c (revision 22946) @@ -33,7 +33,7 @@ retval <<= 3; retval |= *s++ - '0'; } - *retlen = s - start; + *retlen = (int)(s - start); /* less than len */ return retval; } @@ -43,14 +43,14 @@ static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; register const char *s = start; register unsigned long retval = 0; - char *tmp; + const char *tmp; while (len-- && *s && (tmp = strchr(hexdigit, *s))) { retval <<= 4; retval |= (tmp - hexdigit) & 15; s++; } - *retlen = s - start; + *retlen = (int)(s - start); /* less than len */ return retval; } @@ -590,7 +590,7 @@ ruby_strdup(const char *str) { char *tmp; - int len = strlen(str) + 1; + size_t len = strlen(str) + 1; tmp = xmalloc(len); memcpy(tmp, str, len); @@ -898,7 +898,10 @@ #ifdef __cplusplus extern "C" { +#if 0 +} #endif +#endif #if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + defined(IBM) != 1 Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. @@ -1124,7 +1127,7 @@ int x; Bigint *rv; #ifndef Omit_Private_Memory - unsigned int len; + size_t len; #endif ACQUIRE_DTOA_LOCK(0); @@ -1190,7 +1193,7 @@ #ifdef ULLong y = *x * (ULLong)m + carry; carry = y >> 32; - *x++ = (ULong)y & FFFFFFFF; + *x++ = (ULong)(y & FFFFFFFF); #else #ifdef Pack_32 xi = *x; @@ -1379,7 +1382,7 @@ do { z = *x++ * (ULLong)y + *xc + carry; carry = z >> 32; - *xc++ = (ULong)z & FFFFFFFF; + *xc++ = (ULong)(z & FFFFFFFF); } while (x < xae); *xc = (ULong)carry; } @@ -1617,12 +1620,12 @@ do { y = (ULLong)*xa++ - *xb++ - borrow; borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)y & FFFFFFFF; + *xc++ = (ULong)(y & FFFFFFFF); } while (xb < xbe); while (xa < xae) { y = *xa++ - borrow; borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)y & FFFFFFFF; + *xc++ = (ULong)(y & FFFFFFFF); } #else #ifdef Pack_32 @@ -2980,7 +2983,7 @@ carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)y & FFFFFFFF; + *bx++ = (ULong)(y & FFFFFFFF); #else #ifdef Pack_32 si = *sx++; @@ -3020,7 +3023,7 @@ carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)y & FFFFFFFF; + *bx++ = (ULong)(y & FFFFFFFF); #else #ifdef Pack_32 si = *sx++; @@ -3067,7 +3070,7 @@ #endif static char * -nrv_alloc(const char *s, char **rve, int n) +nrv_alloc(const char *s, char **rve, size_t n) { char *rv, *t; @@ -3819,5 +3822,8 @@ } #ifdef __cplusplus +#if 0 +{ +#endif } #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/