Index: tls.c ================================================================== --- tls.c +++ tls.c @@ -878,11 +878,11 @@ if (model != NULL) { int mode; /* Get the "model" context */ chan = Tcl_GetChannel(interp, model, &mode); if (chan == (Tcl_Channel) NULL) { - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } /* * Make sure to operate on the topmost channel @@ -889,19 +889,19 @@ */ chan = Tcl_GetTopChannel(chan); if (Tcl_GetChannelType(chan) != Tls_ChannelType()) { Tcl_AppendResult(interp, "bad channel \"", Tcl_GetChannelName(chan), "\": not a TLS channel", NULL); - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } ctx = ((State *)Tcl_GetChannelInstanceData(chan))->ctx; } else { if ((ctx = CTX_Init(statePtr, server, proto, keyfile, certfile, key, cert, key_len, cert_len, CAdir, CAfile, ciphers, DHparams)) == (SSL_CTX*)0) { - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } } statePtr->ctx = ctx; @@ -927,11 +927,11 @@ dprintf("Created channel named %s", Tcl_GetChannelName(statePtr->self)); if (statePtr->self == (Tcl_Channel) NULL) { /* * No use of Tcl_EventuallyFree because no possible Tcl_Preserve. */ - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } Tcl_SetChannelOption(interp, statePtr->self, "-translation", Tcl_DStringValue(&upperChannelTranslation)); Tcl_SetChannelOption(interp, statePtr->self, "-encoding", Tcl_DStringValue(&upperChannelEncoding)); @@ -945,20 +945,20 @@ statePtr->ssl = SSL_new(statePtr->ctx); if (!statePtr->ssl) { /* SSL library error */ Tcl_AppendResult(interp, "couldn't construct ssl session: ", REASON(), (char *) NULL); - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } #ifndef OPENSSL_NO_TLSEXT if (servername) { if (!SSL_set_tlsext_host_name(statePtr->ssl, servername) && require) { Tcl_AppendResult(interp, "setting TLS host name extension failed", (char *) NULL); - Tls_Free((char *) statePtr); + Tls_Free(statePtr); return TCL_ERROR; } } #endif @@ -1692,11 +1692,11 @@ * Frees all the state * *------------------------------------------------------------------- */ void -Tls_Free( char *blockPtr ) +Tls_Free( void *blockPtr ) { State *statePtr = (State *)blockPtr; dprintf("Called"); Index: tlsIO.c ================================================================== --- tlsIO.c +++ tlsIO.c @@ -116,24 +116,21 @@ * Side effects: * Closes the socket of the channel. * *------------------------------------------------------------------- */ -static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) { +static int TlsCloseProc(ClientData instanceData, TCL_UNUSED(Tcl_Interp *)) { State *statePtr = (State *) instanceData; - dprintf("TlsCloseProc(%p)", (void *) statePtr); + dprintf("TlsCloseProc(%p)", statePtr); Tls_Clean(statePtr); - Tcl_EventuallyFree((ClientData)statePtr, Tls_Free); + Tcl_EventuallyFree(statePtr, Tls_Free); dprintf("Returning TCL_OK"); return(TCL_OK); - - /* Interp is unused. */ - interp = interp; } /* *------------------------------------------------------* * @@ -150,11 +147,11 @@ int Tls_WaitForConnect(State *statePtr, int *errorCodePtr, int handshakeFailureIsPermanent) { unsigned long backingError; int err, rc; int bioShouldRetry; - dprintf("WaitForConnect(%p)", (void *) statePtr); + dprintf("WaitForConnect(%p)", statePtr); dprintFlags(statePtr); if (!(statePtr->flags & TLS_TCL_INIT)) { dprintf("Tls_WaitForConnect called on already initialized channel -- returning with immediate success"); *errorCodePtr = 0; Index: tlsInt.h ================================================================== --- tlsInt.h +++ tlsInt.h @@ -153,20 +153,36 @@ #ifdef USE_TCL_STUBS #ifndef Tcl_StackChannel #error "Unable to compile on this version of Tcl" #endif /* Tcl_GetStackedChannel */ #endif /* USE_TCL_STUBS */ + +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif + +#ifndef TCL_UNUSED +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# elif defined(__GNUC__) && (__GNUC__ > 2) +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) +# endif +#endif + /* * Forward declarations */ const Tcl_ChannelType *Tls_ChannelType(void); Tcl_Channel Tls_GetParent(State *statePtr, int maskFlags); Tcl_Obj *Tls_NewX509Obj(Tcl_Interp *interp, X509 *cert); void Tls_Error(State *statePtr, char *msg); -void Tls_Free(char *blockPtr); +void Tls_Free(void *blockPtr); void Tls_Clean(State *statePtr); int Tls_WaitForConnect(State *statePtr, int *errorCodePtr, int handshakeFailureIsPermanent); BIO *BIO_new_tcl(State* statePtr, int flags);