aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/tkutil
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-23 09:27:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-23 09:27:49 +0000
commited9a65c4f609afcabf0a2d7254453592ba0cf243 (patch)
tree28cd29c0acdfeadf01c3915d295a69e070bc198b /ext/tk/tkutil
parent7b9b1f45d35ffeb055c509cba3e9775790d2206b (diff)
downloadruby-ed9a65c4f609afcabf0a2d7254453592ba0cf243.tar.gz
* ext/tk/{stubs,tcltklib}.c, ext/tk/tkutil/tkutil.c: fix warnings
about constness and signedness. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/tkutil')
-rw-r--r--ext/tk/tkutil/tkutil.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index 6f35e195df..8155bff5ce 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil/tkutil.c
@@ -205,6 +205,7 @@ fromDefaultEnc_toUTF8(str, self)
return tk_toUTF8(1, argv, self);
}
+#if 0
static VALUE
fromUTF8_toDefaultEnc(str, self)
VALUE str;
@@ -215,6 +216,7 @@ fromUTF8_toDefaultEnc(str, self)
argv[0] = str;
return tk_fromUTF8(1, argv, self);
}
+#endif
static int
to_strkey(key, value, hash)
@@ -968,12 +970,14 @@ tcl2rb_bool(self, value)
}
}
+#if 0
static VALUE
tkstr_to_dec(value)
VALUE value;
{
return rb_cstr_to_inum(RSTRING_PTR(value), 10, 1);
}
+#endif
static VALUE
tkstr_to_int(value)
@@ -1077,8 +1081,8 @@ tcl2rb_num_or_str(self, value)
struct cbsubst_info {
int full_subst_length;
int keylen[CBSUBST_TBL_MAX];
- unsigned char *key[CBSUBST_TBL_MAX];
- unsigned char type[CBSUBST_TBL_MAX];
+ char *key[CBSUBST_TBL_MAX];
+ char type[CBSUBST_TBL_MAX];
ID ivar[CBSUBST_TBL_MAX];
VALUE proc;
VALUE aliases;
@@ -1100,9 +1104,9 @@ subst_free(ptr)
if (ptr) {
for(i = 0; i < CBSUBST_TBL_MAX; i++) {
- if (ptr->key[i] != (unsigned char *)NULL) {
+ if (ptr->key[i] != NULL) {
free(ptr->key[i]);
- ptr->key[i] = (unsigned char *)NULL;
+ ptr->key[i] = NULL;
}
}
free(ptr);
@@ -1122,7 +1126,7 @@ allocate_cbsubst_info()
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
inf->keylen[idx] = 0;
- inf->key[idx] = (unsigned char *) NULL;
+ inf->key[idx] = NULL;
inf->type[idx] = '\0';
inf->ivar[idx] = (ID) 0;
}
@@ -1240,7 +1244,7 @@ cbsubst_sym_to_subst(self, sym)
{
struct cbsubst_info *inf;
const char *str;
- unsigned char *buf, *ptr;
+ char *buf, *ptr;
int idx, len;
ID id;
volatile VALUE ret;
@@ -1273,7 +1277,7 @@ cbsubst_sym_to_subst(self, sym)
ptr += len;
} else {
/* single char */
- *(ptr++) = idx;
+ *(ptr++) = (unsigned char)idx;
}
*(ptr++) = ' ';
@@ -1294,7 +1298,7 @@ cbsubst_get_subst_arg(argc, argv, self)
{
struct cbsubst_info *inf;
const char *str;
- unsigned char *buf, *ptr;
+ char *buf, *ptr;
int i, idx, len;
ID id;
volatile VALUE arg_sym, ret;
@@ -1339,7 +1343,7 @@ cbsubst_get_subst_arg(argc, argv, self)
ptr += len;
} else {
/* single char */
- *(ptr++) = idx;
+ *(ptr++) = (unsigned char)idx;
}
*(ptr++) = ' ';
@@ -1364,7 +1368,7 @@ cbsubst_get_subst_key(self, str)
volatile VALUE ret;
VALUE keyval;
int i, len, keylen, idx;
- unsigned char *buf, *ptr, *key;
+ char *buf, *ptr, *key;
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
len = RARRAY_LEN(list);
@@ -1372,11 +1376,11 @@ cbsubst_get_subst_key(self, str)
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
- ptr = buf = ALLOC_N(unsigned char, inf->full_subst_length + len + 1);
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + len + 1);
for(i = 0; i < len; i++) {
keyval = RARRAY_PTR(list)[i];
- key = (unsigned char*)RSTRING_PTR(keyval);
+ key = RSTRING_PTR(keyval);
if (*key == '%') {
if (*(key + 2) == '\0') {
/* single char */
@@ -1386,7 +1390,7 @@ cbsubst_get_subst_key(self, str)
keylen = RSTRING_LEN(keyval) - 1;
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->keylen[idx] != keylen) continue;
- if (inf->key[idx][0] != *(key + 1)) continue;
+ if ((unsigned char)inf->key[idx][0] != (unsigned char)*(key + 1)) continue;
if (strncmp(inf->key[idx], key + 1, keylen)) continue;
break;
}
@@ -1402,7 +1406,7 @@ cbsubst_get_subst_key(self, str)
}
*ptr = '\0';
- ret = rb_str_new2((const char*)buf);
+ ret = rb_str_new2(buf);
free(buf);
return ret;
}
@@ -1412,16 +1416,16 @@ cbsubst_get_all_subst_keys(self)
VALUE self;
{
struct cbsubst_info *inf;
- unsigned char *buf, *ptr;
- unsigned char *keys_buf, *keys_ptr;
+ char *buf, *ptr;
+ char *keys_buf, *keys_ptr;
int idx, len;
volatile VALUE ret;
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
- ptr = buf = ALLOC_N(unsigned char, inf->full_subst_length + 1);
- keys_ptr = keys_buf = ALLOC_N(unsigned char, CBSUBST_TBL_MAX + 1);
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
+ keys_ptr = keys_buf = ALLOC_N(char, CBSUBST_TBL_MAX + 1);
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->ivar[idx] == (ID) 0) continue;
@@ -1445,7 +1449,7 @@ cbsubst_get_all_subst_keys(self)
*ptr = '\0';
*keys_ptr = '\0';
- ret = rb_ary_new3(2, rb_str_new2(keys_buf), rb_str_new2((const char*)buf));
+ ret = rb_ary_new3(2, rb_str_new2(keys_buf), rb_str_new2(buf));
free(buf);
free(keys_buf);