mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
7b9b1f45d3
commit
ed9a65c4f6
5 changed files with 54 additions and 44 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Jul 23 18:27:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/tk/{stubs,tcltklib}.c, ext/tk/tkutil/tkutil.c: fix warnings
|
||||
about constness and signedness.
|
||||
|
||||
Wed Jul 23 17:04:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/openssl/openssl_missing.h (d2i_of_void): define for older
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
|
||||
stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
|
||||
tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h stubs.h
|
||||
stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h stubs.h
|
||||
|
|
|
@ -318,7 +318,7 @@ ruby_tk_stubs_init(tcl_ip)
|
|||
if ((*p_Tk_Init)(tcl_ip) == TCL_ERROR)
|
||||
return FAIL_Tk_Init;
|
||||
|
||||
if (!Tk_InitStubs(tcl_ip, "8.1", 0))
|
||||
if (!Tk_InitStubs(tcl_ip, (char *)"8.1", 0))
|
||||
return FAIL_Tk_InitStubs;
|
||||
|
||||
#ifdef __MACOS__
|
||||
|
@ -357,7 +357,7 @@ ruby_tk_stubs_safeinit(tcl_ip)
|
|||
if ((*p_Tk_SafeInit)(tcl_ip) == TCL_ERROR)
|
||||
return FAIL_Tk_Init;
|
||||
|
||||
if (!Tk_InitStubs(tcl_ip, "8.1", 0))
|
||||
if (!Tk_InitStubs(tcl_ip, (char *)"8.1", 0))
|
||||
return FAIL_Tk_InitStubs;
|
||||
|
||||
#ifdef __MACOS__
|
||||
|
|
|
@ -119,7 +119,7 @@ fprintf(stderr, ARG1, ARG2, ARG3); fprintf(stderr, "\n"); fflush(stderr); }
|
|||
static const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE;
|
||||
|
||||
/* finalize_proc_name */
|
||||
static char *finalize_hook_name = "INTERP_FINALIZE_HOOK";
|
||||
static const char finalize_hook_name[] = "INTERP_FINALIZE_HOOK";
|
||||
|
||||
static void ip_finalize _((Tcl_Interp*));
|
||||
|
||||
|
@ -188,13 +188,14 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
|
|||
static VALUE ip_invoke _((int, VALUE*, VALUE));
|
||||
static VALUE ip_invoke_with_position _((int, VALUE*, VALUE, Tcl_QueuePosition));
|
||||
static VALUE tk_funcall _((VALUE(), int, VALUE*, VALUE));
|
||||
static VALUE callq_safelevel_handler _((VALUE, VALUE));
|
||||
|
||||
/* Tcl's object type */
|
||||
#if TCL_MAJOR_VERSION >= 8
|
||||
static char *Tcl_ObjTypeName_ByteArray = "bytearray";
|
||||
static const char Tcl_ObjTypeName_ByteArray[] = "bytearray";
|
||||
static Tcl_ObjType *Tcl_ObjType_ByteArray;
|
||||
|
||||
static char *Tcl_ObjTypeName_String = "string";
|
||||
static const char Tcl_ObjTypeName_String[] = "string";
|
||||
static Tcl_ObjType *Tcl_ObjType_String;
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1)
|
||||
|
@ -1044,12 +1045,12 @@ call_original_exit(ptr, state)
|
|||
|
||||
} else {
|
||||
/* string interface */
|
||||
char **argv;
|
||||
CONST84 char **argv;
|
||||
#define USE_RUBY_ALLOC 0
|
||||
#if USE_RUBY_ALLOC
|
||||
argv = (char **)ALLOC_N(char *, 3); /* XXXXXXXXXX */
|
||||
argv = ALLOC_N(char *, 3); /* XXXXXXXXXX */
|
||||
#else /* not USE_RUBY_ALLOC */
|
||||
argv = (char **)ckalloc(sizeof(char *) * 3);
|
||||
argv = (CONST84 char **)ckalloc(sizeof(char *) * 3);
|
||||
#if 0 /* use Tcl_Preserve/Release */
|
||||
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
|
||||
#endif
|
||||
|
@ -1059,8 +1060,7 @@ call_original_exit(ptr, state)
|
|||
argv[1] = Tcl_GetStringFromObj(state_obj, (int*)NULL);
|
||||
argv[2] = (char *)NULL;
|
||||
|
||||
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip,
|
||||
2, (CONST84 char **)argv);
|
||||
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip, 2, argv);
|
||||
|
||||
#if USE_RUBY_ALLOC
|
||||
free(argv);
|
||||
|
@ -1502,7 +1502,7 @@ static VALUE
|
|||
lib_num_of_mainwindows(self)
|
||||
VALUE self;
|
||||
{
|
||||
#ifdef RUBY_VM /* Ruby 1.9+ !!! */
|
||||
#ifdef RUBY_USE_NATIVE_THREAD /* Ruby 1.9+ !!! */
|
||||
return tk_funcall(lib_num_of_mainwindows_core, 0, (VALUE*)NULL, self);
|
||||
#else
|
||||
return lib_num_of_mainwindows_core(self, 0, (VALUE*)NULL);
|
||||
|
@ -2944,7 +2944,9 @@ ip_ruby_cmd_receiver_const_get(name)
|
|||
char *name;
|
||||
{
|
||||
volatile VALUE klass = rb_cObject;
|
||||
#if 0
|
||||
char *head, *tail;
|
||||
#endif
|
||||
int state;
|
||||
|
||||
#if SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
|
||||
|
@ -2994,8 +2996,9 @@ ip_ruby_cmd_receiver_get(str)
|
|||
char *str;
|
||||
{
|
||||
volatile VALUE receiver;
|
||||
volatile VALUE klass = rb_cObject;
|
||||
#if !SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
|
||||
int state;
|
||||
#endif
|
||||
|
||||
if (str[0] == ':' || ('A' <= str[0] && str[0] <= 'Z')) {
|
||||
/* class | module | constant */
|
||||
|
@ -6093,10 +6096,6 @@ get_str_from_obj(obj)
|
|||
int len, binary = 0;
|
||||
const char *s;
|
||||
volatile VALUE str;
|
||||
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 4)
|
||||
int len2;
|
||||
const char *s2;
|
||||
#endif
|
||||
|
||||
#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
|
||||
s = Tcl_GetStringFromObj(obj, &len);
|
||||
|
@ -6105,7 +6104,7 @@ get_str_from_obj(obj)
|
|||
/* TCL_VERSION 8.1 -- 8.3 */
|
||||
if (Tcl_GetCharLength(obj) != Tcl_UniCharLen(Tcl_GetUnicode(obj))) {
|
||||
/* possibly binary string */
|
||||
s = Tcl_GetByteArrayFromObj(obj, &len);
|
||||
s = (char *)Tcl_GetByteArrayFromObj(obj, &len);
|
||||
binary = 1;
|
||||
} else {
|
||||
/* possibly text string */
|
||||
|
@ -6113,7 +6112,7 @@ get_str_from_obj(obj)
|
|||
}
|
||||
#else /* TCL_VERSION >= 8.4 */
|
||||
if (IS_TCL_BYTEARRAY(obj)) {
|
||||
s = Tcl_GetByteArrayFromObj(obj, &len);
|
||||
s = (char *)Tcl_GetByteArrayFromObj(obj, &len);
|
||||
binary = 1;
|
||||
} else {
|
||||
s = Tcl_GetStringFromObj(obj, &len);
|
||||
|
@ -6153,7 +6152,7 @@ get_obj_from_str(str)
|
|||
StringValue(enc);
|
||||
if (strcmp(RSTRING_PTR(enc), "binary") == 0) {
|
||||
/* binary string */
|
||||
return Tcl_NewByteArrayObj(s, RSTRING_LEN(str));
|
||||
return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
|
||||
} else {
|
||||
/* text string */
|
||||
return Tcl_NewStringObj(s, RSTRING_LEN(str));
|
||||
|
@ -6161,11 +6160,11 @@ get_obj_from_str(str)
|
|||
#ifdef HAVE_RUBY_ENCODING_H
|
||||
} else if (rb_enc_get_index(str) == ENCODING_INDEX_BINARY) {
|
||||
/* binary string */
|
||||
return Tcl_NewByteArrayObj(s, RSTRING_LEN(str));
|
||||
return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
|
||||
#endif
|
||||
} else if (strlen(s) != RSTRING_LEN(str)) {
|
||||
/* probably binary string */
|
||||
return Tcl_NewByteArrayObj(s, RSTRING_LEN(str));
|
||||
return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
|
||||
} else {
|
||||
/* probably text string */
|
||||
return Tcl_NewStringObj(s, RSTRING_LEN(str));
|
||||
|
@ -7343,7 +7342,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
|||
StringValue(str);
|
||||
tclstr = Tcl_NewStringObj(RSTRING_PTR(str), RSTRING_LEN(str));
|
||||
Tcl_IncrRefCount(tclstr);
|
||||
s = Tcl_GetByteArrayFromObj(tclstr, &len);
|
||||
s = (char*)Tcl_GetByteArrayFromObj(tclstr, &len);
|
||||
str = rb_tainted_str_new(s, len);
|
||||
s = (char*)NULL;
|
||||
Tcl_DecrRefCount(tclstr);
|
||||
|
@ -9195,7 +9194,7 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode)
|
|||
VALUE name;
|
||||
VALUE error_mode;
|
||||
{
|
||||
struct tcltkip *ptr = get_ip(interp);
|
||||
get_ip(interp);
|
||||
|
||||
rb_secure(4);
|
||||
|
||||
|
@ -10148,6 +10147,8 @@ Init_tcltklib()
|
|||
Tcl_ObjType_String = Tcl_GetObjType(Tcl_ObjTypeName_String);
|
||||
|
||||
/* --------------------------------------------------------------- */
|
||||
|
||||
(void)call_original_exit;
|
||||
}
|
||||
|
||||
/* eof */
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue