ruby-changes:14896
From: nobu <ko1@a...>
Date: Fri, 26 Feb 2010 14:17:35 +0900 (JST)
Subject: [ruby-changes:14896] Ruby:r26765 (trunk): * pack.c (pack_pack, pack_unpack): suppressed warnings.
nobu 2010-02-26 14:17:13 +0900 (Fri, 26 Feb 2010) New Revision: 26765 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26765 Log: * pack.c (pack_pack, pack_unpack): suppressed warnings. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 26764) +++ ChangeLog (revision 26765) @@ -1,3 +1,7 @@ +Fri Feb 26 14:17:09 2010 Nobuyoshi Nakada <nobu@r...> + + * pack.c (pack_pack, pack_unpack): suppressed warnings. + Fri Feb 26 07:44:51 2010 NARUSE, Yui <naruse@r...> * ext/dl: revert dl with libffi because it can't run on mswin now. Index: pack.c =================================================================== --- pack.c (revision 26764) +++ pack.c (revision 26765) @@ -647,13 +647,13 @@ case 'i': /* signed int */ signed_p = 1; - integer_size = sizeof(int); + integer_size = (int)sizeof(int); bigendian_p = BIGENDIAN_P(); goto pack_integer; case 'I': /* unsigned int */ signed_p = 0; - integer_size = sizeof(int); + integer_size = (int)sizeof(int); bigendian_p = BIGENDIAN_P(); goto pack_integer; @@ -1139,16 +1139,19 @@ } #define PACK_LENGTH_ADJUST_SIZE(sz) do { \ - tmp = 0; \ + tmp_len = 0; \ if (len > (long)((send-s)/sz)) { \ if (!star) { \ - tmp = len-(send-s)/sz; \ + tmp_len = len-(send-s)/sz; \ } \ len = (send-s)/sz; \ } \ } while (0) -#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil) +#define PACK_ITEM_ADJUST() do { \ + if (tmp_len > 0) \ + rb_ary_store(ary, RARRAY_LEN(ary)+tmp_len-1, Qnil); \ +} while (0) static VALUE infected_str_new(const char *ptr, long len, VALUE str) @@ -1260,8 +1263,8 @@ char *p, *pend; VALUE ary; char type; - long len; - int tmp, star; + long len, tmp_len; + int star; #ifdef NATINT_PACK int natint; /* native integer */ #endif @@ -1485,13 +1488,13 @@ case 'i': signed_p = 1; - integer_size = sizeof(int); + integer_size = (int)sizeof(int); bigendian_p = BIGENDIAN_P(); goto unpack_integer; case 'I': signed_p = 0; - integer_size = sizeof(int); + integer_size = (int)sizeof(int); bigendian_p = BIGENDIAN_P(); goto unpack_integer; @@ -1955,7 +1958,7 @@ break; case 'P': - if (sizeof(char *) <= send - s) { + if (sizeof(char *) <= (size_t)(send - s)) { VALUE tmp = Qnil; char *t; @@ -1995,7 +1998,7 @@ if (len > (long)((send - s) / sizeof(char *))) len = (send - s) / sizeof(char *); while (len-- > 0) { - if (send - s < sizeof(char *)) + if ((size_t)(send - s) < sizeof(char *)) break; else { VALUE tmp = Qnil; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/