1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/dbm/dbm.c (struct dbmdata, fdbm_key, fdbm_delete_if): fixed

type warnings.

* time.c (calc_tm_yday): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-07-16 07:40:37 +00:00
parent 96863dc358
commit 048d2e6d32
2 changed files with 5 additions and 6 deletions

View file

@ -26,7 +26,7 @@ static VALUE rb_cDBM, rb_eDBMError;
#define RUBY_DBM_RW_BIT 0x20000000 #define RUBY_DBM_RW_BIT 0x20000000
struct dbmdata { struct dbmdata {
int di_size; long di_size;
DBM *di_dbm; DBM *di_dbm;
}; };
@ -212,7 +212,7 @@ fdbm_key(VALUE obj, VALUE valstr)
GetDBM2(obj, dbmp, dbm); GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) { for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key); val = dbm_fetch(dbm, key);
if (val.dsize == RSTRING_LEN(valstr) && if ((long)val.dsize == RSTRING_LEN(valstr) &&
memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0) { memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0) {
return rb_tainted_str_new(key.dptr, key.dsize); return rb_tainted_str_new(key.dptr, key.dsize);
} }
@ -335,7 +335,8 @@ fdbm_delete_if(VALUE obj)
DBM *dbm; DBM *dbm;
VALUE keystr, valstr; VALUE keystr, valstr;
VALUE ret, ary = rb_ary_new(); VALUE ret, ary = rb_ary_new();
int i, status = 0, n; int i, status = 0;
long n;
fdbm_modify(obj); fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm); GetDBM2(obj, dbmp, dbm);

4
time.c
View file

@ -963,11 +963,9 @@ static const int leap_year_days_in_month[] = {
static int static int
calc_tm_yday(long tm_year, int tm_mon, int tm_mday) calc_tm_yday(long tm_year, int tm_mon, int tm_mday)
{ {
int tm_year_mod400; int tm_year_mod400 = (int)MOD(tm_year, 400);
int tm_yday = tm_mday; int tm_yday = tm_mday;
tm_year_mod400 = MOD(tm_year, 400);
if (leap_year_p(tm_year_mod400 + 1900)) if (leap_year_p(tm_year_mod400 + 1900))
tm_yday += leap_year_yday_offset[tm_mon]; tm_yday += leap_year_yday_offset[tm_mon];
else else