Skip to content

Commit

Permalink
* pack.c (pack_pack, pack_unpack): suppressed warnings.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Feb 26, 2010
1 parent 59e4e93 commit aec5868
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fri Feb 26 14:17:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>

* pack.c (pack_pack, pack_unpack): suppressed warnings.

Fri Feb 26 07:44:51 2010 NARUSE, Yui <naruse@ruby-lang.org>

* ext/dl: revert dl with libffi because it can't run on mswin now.
Expand Down
25 changes: 14 additions & 11 deletions pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,13 @@ pack_pack(VALUE ary, VALUE fmt)

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;

Expand Down Expand Up @@ -1139,16 +1139,19 @@ hex2num(char c)
}

#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)
Expand Down Expand Up @@ -1260,8 +1263,8 @@ pack_unpack(VALUE str, VALUE fmt)
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
Expand Down Expand Up @@ -1485,13 +1488,13 @@ pack_unpack(VALUE str, VALUE fmt)

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;

Expand Down Expand Up @@ -1955,7 +1958,7 @@ pack_unpack(VALUE str, VALUE fmt)
break;

case 'P':
if (sizeof(char *) <= send - s) {
if (sizeof(char *) <= (size_t)(send - s)) {
VALUE tmp = Qnil;
char *t;

Expand Down Expand Up @@ -1995,7 +1998,7 @@ pack_unpack(VALUE str, VALUE fmt)
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;
Expand Down

0 comments on commit aec5868

Please sign in to comment.