From 0df63f4a63fa3825fa00a0744a5d4868cebf3fd2 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Sun, 16 Aug 2009 10:20:19 +0000 Subject: const addition (pkge.c) Use in stead of "pthread.h" Eliminate some more gcc warnings --- ChangeLog | 7 +++++++ unix/dltest/pkge.c | 4 ++-- unix/tclUnixThrd.c | 4 ++-- win/tclWinDde.c | 32 ++++++++++++++++---------------- win/tclWinReg.c | 16 +++++++--------- 5 files changed, 34 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92ddd99..d408fe8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-06 Jan Nijtmans + + * unix/dltest/pkge.c: const addition + * unix/tclUnixThrd.c: Use in stead of "pthread.h" + * win/tclWinDde.c: Eliminate some more gcc warnings + * win/tclWinReg.c + 2009-08-12 Don Porter TIP #353 IMPLEMENTATION diff --git a/unix/dltest/pkge.c b/unix/dltest/pkge.c index a64ba26..827ee4e 100644 --- a/unix/dltest/pkge.c +++ b/unix/dltest/pkge.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: pkge.c,v 1.10 2007/12/13 15:28:43 dgp Exp $ + * RCS: @(#) $Id: pkge.c,v 1.11 2009/08/16 10:20:20 nijtmans Exp $ */ #include "tcl.h" @@ -38,7 +38,7 @@ Pkge_Init( Tcl_Interp *interp) /* Interpreter in which the package is to be * made available. */ { - static char script[] = "if 44 {open non_existent}"; + static const char script[] = "if 44 {open non_existent}"; if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { return TCL_ERROR; diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index eac1bc8..b4ba1a0 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -10,14 +10,14 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixThrd.c,v 1.60 2008/08/13 23:08:39 das Exp $ + * RCS: @(#) $Id: tclUnixThrd.c,v 1.61 2009/08/16 10:20:20 nijtmans Exp $ */ #include "tclInt.h" #ifdef TCL_THREADS -#include "pthread.h" +#include typedef struct ThreadSpecificData { char nabuf[16]; diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 1425e94..4c7fc5b 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinDde.c,v 1.34 2009/02/03 23:10:57 nijtmans Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.35 2009/08/16 10:20:19 nijtmans Exp $ */ #include "tclInt.h" @@ -722,7 +722,7 @@ DdeServerProc( if (stricmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) { returnString = Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len); - ddeReturn = DdeCreateDataHandle(ddeInstance, (char *)returnString, + ddeReturn = DdeCreateDataHandle(ddeInstance, (LPBYTE)returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); } else { if (Tcl_IsSafe(convPtr->riPtr->interp)) { @@ -735,7 +735,7 @@ DdeServerProc( returnString = Tcl_GetStringFromObj(variableObjPtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, - (char *)returnString, (DWORD) len+1, 0, ddeItem, + (PBYTE)returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); } else { ddeReturn = NULL; @@ -995,8 +995,8 @@ DdeServicesOnAck( es = (struct DdeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); #endif - if ((es->service == (ATOM)NULL || es->service == service) - && (es->topic == (ATOM)NULL || es->topic == topic)) { + if ((es->service == (ATOM)0 || es->service == service) + && (es->topic == (ATOM)0 || es->topic == topic)) { Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL); Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp); @@ -1043,7 +1043,7 @@ DdeEnumWindowsCallback( SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, MAKELONG(es->service, es->topic), SMTO_ABORTIFHUNG, 1000, - &dwResult); + (PDWORD_PTR) &dwResult); return TRUE; } @@ -1058,8 +1058,8 @@ DdeGetServicesList( es.interp = interp; es.result = TCL_OK; es.service = (serviceName == NULL) - ? (ATOM)NULL : GlobalAddAtom(serviceName); - es.topic = (topicName == NULL) ? (ATOM)NULL : GlobalAddAtom(topicName); + ? (ATOM)0 : GlobalAddAtom(serviceName); + es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtom(topicName); Tcl_ResetResult(interp); /* our list is to be appended to result. */ DdeCreateClient(&es); @@ -1068,10 +1068,10 @@ DdeGetServicesList( if (IsWindow(es.hwnd)) { DestroyWindow(es.hwnd); } - if (es.service != (ATOM)NULL) { + if (es.service != (ATOM)0) { GlobalDeleteAtom(es.service); } - if (es.topic != (ATOM)NULL) { + if (es.topic != (ATOM)0) { GlobalDeleteAtom(es.topic); } return es.result; @@ -1364,7 +1364,7 @@ Tcl_DdeObjCmd( break; } - ddeData = DdeCreateDataHandle(ddeInstance, (char *)dataString, + ddeData = DdeCreateDataHandle(ddeInstance, (PBYTE)dataString, (DWORD) dataLength+1, 0, 0, CF_TEXT, 0); if (ddeData != NULL) { if (async) { @@ -1414,10 +1414,10 @@ Tcl_DdeObjCmd( result = TCL_ERROR; } else { DWORD tmp; - char *dataString = DdeAccessData(ddeData, &tmp); + char *dataString = (char *) DdeAccessData(ddeData, &tmp); if (binary) { - returnObjPtr = Tcl_NewByteArrayObj(dataString, + returnObjPtr = Tcl_NewByteArrayObj((unsigned char *)dataString, (int) tmp); } else { returnObjPtr = Tcl_NewStringObj(dataString, -1); @@ -1457,7 +1457,7 @@ Tcl_DdeObjCmd( ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINANSI); if (ddeItem != NULL) { - ddeData = DdeClientTransaction((char *)dataString, (DWORD) length+1, + ddeData = DdeClientTransaction((PBYTE)dataString, (DWORD) length+1, hConv, ddeItem, CF_TEXT, XTYP_POKE, 5000, NULL); if (ddeData == NULL) { SetDdeError(interp); @@ -1599,7 +1599,7 @@ Tcl_DdeObjCmd( objPtr = Tcl_ConcatObj(objc, objv); string = Tcl_GetStringFromObj(objPtr, &length); - ddeItemData = DdeCreateDataHandle(ddeInstance, (char *)string, + ddeItemData = DdeCreateDataHandle(ddeInstance, (PBYTE)string, (DWORD) length+1, 0, 0, CF_TEXT, 0); if (async) { @@ -1642,7 +1642,7 @@ Tcl_DdeObjCmd( length = DdeGetData(ddeData, NULL, 0, 0); Tcl_SetObjLength(resultPtr, length); string = Tcl_GetString(resultPtr); - DdeGetData(ddeData, (char *)string, (DWORD) length, 0); + DdeGetData(ddeData, (PBYTE)string, (DWORD) length, 0); Tcl_SetObjLength(resultPtr, (int) strlen(string)); if (Tcl_ListObjIndex(NULL, resultPtr, 0, &objPtr) != TCL_OK) { diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 16b4b3e..849e9a9 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinReg.c,v 1.45 2009/02/03 23:10:57 nijtmans Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.46 2009/08/16 10:20:19 nijtmans Exp $ */ #include "tclInt.h" @@ -218,6 +218,7 @@ int Registry_Init( Tcl_Interp *interp) { + int useWide; Tcl_Command cmd; if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { @@ -229,11 +230,8 @@ Registry_Init( * appropriate registry function table. */ - if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - regWinProcs = &unicodeProcs; - } else { - regWinProcs = &asciiProcs; - } + useWide = (TclWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS); + regWinProcs = useWide ? &unicodeProcs : &asciiProcs; cmd = Tcl_CreateObjCommand(interp, "registry", RegistryObjCmd, (ClientData)interp, DeleteCmd); @@ -878,7 +876,7 @@ GetValue( */ Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( - Tcl_DStringValue(&data), (int) length)); + (const unsigned char *)Tcl_DStringValue(&data), (int) length)); } Tcl_DStringFree(&data); return result; @@ -1398,7 +1396,7 @@ SetValue( * Store binary data in the registry. */ - data = Tcl_GetByteArrayFromObj(dataObj, &length); + data = (char *) Tcl_GetByteArrayFromObj(dataObj, &length); result = regWinProcs->regSetValueExProc(key, valueName, 0, (DWORD) type, (BYTE *) data, (DWORD) length); } @@ -1471,7 +1469,7 @@ BroadcastValue( */ result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, - (WPARAM) 0, (LPARAM) str, SMTO_ABORTIFHUNG, timeout, &sendResult); + (WPARAM) 0, (LPARAM) str, SMTO_ABORTIFHUNG, timeout, (PDWORD_PTR) &sendResult); objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewLongObj((long) result)); -- cgit v0.12