diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-23 09:27:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-23 09:27:49 +0000 |
commit | ed9a65c4f609afcabf0a2d7254453592ba0cf243 (patch) | |
tree | 28cd29c0acdfeadf01c3915d295a69e070bc198b /ext/tk/tcltklib.c | |
parent | 7b9b1f45d35ffeb055c509cba3e9775790d2206b (diff) | |
download | ruby-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/tcltklib.c')
-rw-r--r-- | ext/tk/tcltklib.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index 00a3256a82..70894269ec 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -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 */ |