summaryrefslogtreecommitdiff
path: root/ext/sdbm
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-25 06:46:57 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-25 06:46:57 (GMT)
commit6b1cf264a80f2efe6a4b42553b8bf2e16f51690a (patch)
treede2cec1bac93bf9b8a5807f7da3a21c04756f19c /ext/sdbm
parente3c3733a30091958cb00bc1a2e4f0882fe6d59d6 (diff)
* ext/sdbm/_sdbm.c (sdbm_open): use size_t.
* ext/syck/bytecode.c: ditto. * ext/sdbm/_sdbm.c (delpair): use ptrdiff_t. * ext/sdbm/init.c: use RSTRING_LENINT. * ext/dl/handle.c: suppress warning: shorten-64-to-32. * ext/strscan/strscan.c: ditto. * ext/syck/emitter.c: ditto. * ext/syck/implicit.c: ditto. * ext/syck/syck.c: ditto. * ext/syck/token.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/sdbm')
-rw-r--r--ext/sdbm/_sdbm.c8
-rw-r--r--ext/sdbm/init.c20
2 files changed, 14 insertions, 14 deletions
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 5e2b8cc..28e5b03 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -155,7 +155,7 @@ sdbm_open(register char *file, register int flags, register int mode)
register DBM *db;
register char *dirname;
register char *pagname;
- register int n;
+ register size_t n;
if (file == NULL || !*file)
return errno = EINVAL, (DBM *) NULL;
@@ -164,7 +164,7 @@ sdbm_open(register char *file, register int flags, register int mode)
*/
n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
- if ((dirname = malloc((unsigned) n)) == NULL)
+ if ((dirname = malloc(n)) == NULL)
return errno = ENOMEM, (DBM *) NULL;
/*
* build the file names
@@ -755,9 +755,9 @@ delpair(char *pag, datum key)
register int m;
register char *dst = pag + (i == 1 ? PBLKSIZ : GET_SHORT(ino,i - 1));
register char *src = pag + GET_SHORT(ino,i + 1);
- register int zoo = dst - src;
+ register ptrdiff_t zoo = dst - src;
- debug(("free-up %d ", zoo));
+ debug(("free-up %"PRIdPTRDIFF" ", zoo));
/*
* shift data/keys down
*/
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index fdb7fd4..6a02e1e 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -145,7 +145,7 @@ fsdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
value = sdbm_fetch(dbm, key);
@@ -185,7 +185,7 @@ fsdbm_key(VALUE obj, VALUE valstr)
ExportStringValue(valstr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
@@ -259,7 +259,7 @@ fsdbm_delete(VALUE obj, VALUE keystr)
fdbm_modify(obj);
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
@@ -334,13 +334,13 @@ fsdbm_delete_if(VALUE obj)
keystr = RARRAY_PTR(ary)[i];
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
if (sdbm_delete(dbm, key)) {
rb_raise(rb_eDBMError, "sdbm_delete failed");
}
}
if (status) rb_jump_tag(status);
- if (n > 0) dbmp->di_size = n - RARRAY_LEN(ary);
+ if (n > 0) dbmp->di_size = n - RARRAY_LENINT(ary);
return obj;
}
@@ -401,10 +401,10 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
ExportStringValue(valstr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
@@ -588,7 +588,7 @@ fsdbm_has_key(VALUE obj, VALUE keystr)
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
val = sdbm_fetch(dbm, key);
@@ -605,12 +605,12 @@ fsdbm_has_value(VALUE obj, VALUE valstr)
ExportStringValue(valstr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
val = sdbm_fetch(dbm, key);
- if (val.dsize == RSTRING_LEN(valstr) &&
+ if (val.dsize == RSTRING_LENINT(valstr) &&
memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0)
return Qtrue;
}