diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 16:00:19 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 16:00:19 (GMT) |
commit | 6dc1f8021ed597b13289a02c41c2e9660525a81a (patch) | |
tree | 54877f6753e15ace22e9329ff6b339b965192fc3 /generic/tclZlib.c | |
parent | b788457ad48d5cc34b431418f7d076d83f78b5ff (diff) | |
download | tcl-6dc1f8021ed597b13289a02c41c2e9660525a81a.zip tcl-6dc1f8021ed597b13289a02c41c2e9660525a81a.tar.gz tcl-6dc1f8021ed597b13289a02c41c2e9660525a81a.tar.bz2 |
Use TIP #613's Tcl_GetIndexFromObj() to eliminate typecasts which are no longer necessary
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r-- | generic/tclZlib.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 6a9a38a..8ab0661 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2390,7 +2390,7 @@ ZlibPushSubcmd( FMT_INFLATE }; Tcl_Channel chan; - int chanMode, format, mode = 0, level, i, option; + int chanMode, format, mode = 0, level, i; static const char *const pushCompressOptions[] = { "-dictionary", "-header", "-level", NULL }; @@ -2398,7 +2398,7 @@ ZlibPushSubcmd( "-dictionary", "-header", "-level", "-limit", NULL }; const char *const *pushOptions = pushDecompressOptions; - enum pushOptionsEnum {poDictionary, poHeader, poLevel, poLimit}; + enum pushOptionsEnum {poDictionary, poHeader, poLevel, poLimit} option; Tcl_Obj *headerObj = NULL, *compDictObj = NULL; int limit = DEFAULT_BUFFER_SIZE, dummy; @@ -2480,7 +2480,7 @@ ZlibPushSubcmd( Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL); return TCL_ERROR; } - switch ((enum pushOptionsEnum) option) { + switch (option) { case poHeader: headerObj = objv[i]; if (Tcl_DictObjSize(interp, headerObj, &dummy) != TCL_OK) { @@ -2560,7 +2560,7 @@ ZlibStreamCmd( Tcl_Obj *const objv[]) { Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd; - int command, count, code; + int count, code; Tcl_Obj *obj; static const char *const cmds[] = { "add", "checksum", "close", "eof", "finalize", "flush", @@ -2570,7 +2570,7 @@ ZlibStreamCmd( enum zlibStreamCommands { zs_add, zs_checksum, zs_close, zs_eof, zs_finalize, zs_flush, zs_fullflush, zs_get, zs_header, zs_put, zs_reset - }; + } command; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option data ?...?"); @@ -2582,7 +2582,7 @@ ZlibStreamCmd( return TCL_ERROR; } - switch ((enum zlibStreamCommands) command) { + switch (command) { case zs_add: /* $strm add ?$flushopt? $data */ return ZlibStreamAddCmd(zstream, interp, objc, objv); case zs_header: /* $strm header */ @@ -2686,14 +2686,14 @@ ZlibStreamAddCmd( Tcl_Obj *const objv[]) { Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd; - int index, code, buffersize = -1, flush = -1, i; + int code, buffersize = -1, flush = -1, i; Tcl_Obj *obj, *compDictObj = NULL; static const char *const add_options[] = { "-buffer", "-dictionary", "-finalize", "-flush", "-fullflush", NULL }; enum addOptions { ao_buffer, ao_dictionary, ao_finalize, ao_flush, ao_fullflush - }; + } index; for (i=2; i<objc-1; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], add_options, "option", 0, @@ -2701,7 +2701,7 @@ ZlibStreamAddCmd( return TCL_ERROR; } - switch ((enum addOptions) index) { + switch (index) { case ao_flush: /* -flush */ if (flush >= 0) { flush = -2; @@ -2813,14 +2813,14 @@ ZlibStreamPutCmd( Tcl_Obj *const objv[]) { Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd; - int index, flush = -1, i; + int flush = -1, i; Tcl_Obj *compDictObj = NULL; static const char *const put_options[] = { "-dictionary", "-finalize", "-flush", "-fullflush", NULL }; enum putOptions { po_dictionary, po_finalize, po_flush, po_fullflush - }; + } index; for (i=2; i<objc-1; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], put_options, "option", 0, @@ -2828,7 +2828,7 @@ ZlibStreamPutCmd( return TCL_ERROR; } - switch ((enum putOptions) index) { + switch (index) { case po_flush: /* -flush */ if (flush >= 0) { flush = -2; |