diff options
author | nijtmans <nijtmans> | 2008-10-14 22:43:29 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2008-10-14 22:43:29 (GMT) |
commit | de27d1ee5e8ba5ad01354e36be8914a8303bf45d (patch) | |
tree | 97b4e007760939b802f2a8b16101f0e89c3e39c1 /win | |
parent | 45c244cd8dcd109d144858140ce8c0c070c79f7e (diff) | |
download | tcl-de27d1ee5e8ba5ad01354e36be8914a8303bf45d.zip tcl-de27d1ee5e8ba5ad01354e36be8914a8303bf45d.tar.gz tcl-de27d1ee5e8ba5ad01354e36be8914a8303bf45d.tar.bz2 |
* win/tclWinChan.c: Fix minor compiler warnings when
* win/tclWinDde.c: compiling wit -Wwrite-strings
* win/tclWinInit.c:
* win/tclWinReg.c:
* win/tclWinSerial.c:
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 4 | ||||
-rw-r--r-- | win/tclWinDde.c | 34 | ||||
-rw-r--r-- | win/tclWinInit.c | 6 | ||||
-rw-r--r-- | win/tclWinReg.c | 29 | ||||
-rw-r--r-- | win/tclWinSerial.c | 4 |
5 files changed, 40 insertions, 37 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 5d2a774..20f618d 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.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: tclWinChan.c,v 1.51 2008/05/23 21:00:47 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.52 2008/10/14 22:43:30 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1221,7 +1221,7 @@ TclpGetDefaultStdChannel( Tcl_Channel channel; HANDLE handle; int mode = -1; - char *bufMode = NULL; + const char *bufMode = NULL; DWORD handleId = (DWORD)INVALID_HANDLE_VALUE; /* Standard handle to retrieve. */ diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 1622686..30f50ce 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.32 2008/04/27 22:21:36 dkf Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.33 2008/10/14 22:43:29 nijtmans Exp $ */ #include "tclInt.h" @@ -98,7 +98,7 @@ static int DdeCreateClient(struct DdeEnumServices *es); static BOOL CALLBACK DdeEnumWindowsCallback(HWND hwndTarget, LPARAM lParam); static void DdeExitProc(ClientData clientData); static int DdeGetServicesList(Tcl_Interp *interp, - char *serviceName, char *topicName); + const char *serviceName, const char *topicName); static HDDEDATA CALLBACK DdeServerProc(UINT uType, UINT uFmt, HCONV hConv, HSZ ddeTopic, HSZ ddeItem, HDDEDATA hData, DWORD dwData1, DWORD dwData2); @@ -107,7 +107,7 @@ static LRESULT DdeServicesOnAck(HWND hwnd, WPARAM wParam, static void DeleteProc(ClientData clientData); static Tcl_Obj * ExecuteRemoteObject(RegisteredInterp *riPtr, Tcl_Obj *ddeObjectPtr); -static int MakeDdeConnection(Tcl_Interp *interp, char *name, +static int MakeDdeConnection(Tcl_Interp *interp, const char *name, HCONV *ddeConvPtr); static void SetDdeError(Tcl_Interp *interp); @@ -265,10 +265,10 @@ Initialize(void) *---------------------------------------------------------------------- */ -static char * +static const char * DdeSetServerName( Tcl_Interp *interp, - char *name, /* The name that will be used to refer to the + const char *name, /* The name that will be used to refer to the * interpreter in later "send" commands. Must * be globally unique. */ int exactName, /* Should we make a unique name? 0 = unique */ @@ -278,7 +278,7 @@ DdeSetServerName( int suffix, offset; RegisteredInterp *riPtr, *prevPtr; Tcl_DString dString; - char *actualName; + const char *actualName; Tcl_Obj *srvListPtr = NULL, **srvPtrPtr = NULL; int n, srvCount = 0, lastSuffix, r = TCL_OK; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -879,7 +879,7 @@ DdeExitProc( static int MakeDdeConnection( Tcl_Interp *interp, /* Used to report errors. */ - char *name, /* The connection to use. */ + const char *name, /* The connection to use. */ HCONV *ddeConvPtr) { HSZ ddeTopic, ddeService; @@ -1050,8 +1050,8 @@ DdeEnumWindowsCallback( static int DdeGetServicesList( Tcl_Interp *interp, - char *serviceName, - char *topicName) + const char *serviceName, + const char *topicName) { struct DdeEnumServices es; @@ -1098,7 +1098,7 @@ static void SetDdeError( Tcl_Interp *interp) /* The interp to put the message in. */ { - char *errorMessage; + const char *errorMessage; switch (DdeGetLastError(ddeInstance)) { case DMLERR_DATAACKTIMEOUT: @@ -1143,7 +1143,7 @@ Tcl_DdeObjCmd( int objc, /* Number of arguments */ Tcl_Obj *const * objv) /* The arguments */ { - static const char *ddeCommands[] = { + static const char *const ddeCommands[] = { "servername", "execute", "poke", "request", "services", "eval", (char *) NULL }; @@ -1151,16 +1151,16 @@ Tcl_DdeObjCmd( DDE_SERVERNAME, DDE_EXECUTE, DDE_POKE, DDE_REQUEST, DDE_SERVICES, DDE_EVAL }; - static const char *ddeSrvOptions[] = { + static const char *const ddeSrvOptions[] = { "-force", "-handler", "--", NULL }; enum DdeSrvOptions { DDE_SERVERNAME_EXACT, DDE_SERVERNAME_HANDLER, DDE_SERVERNAME_LAST, }; - static const char *ddeExecOptions[] = { + static const char *const ddeExecOptions[] = { "-async", NULL }; - static const char *ddeReqOptions[] = { + static const char *const ddeReqOptions[] = { "-binary", NULL }; @@ -1170,7 +1170,7 @@ Tcl_DdeObjCmd( HSZ ddeService = NULL, ddeTopic = NULL, ddeItem = NULL, ddeCookie = NULL; HDDEDATA ddeData = NULL, ddeItemData = NULL, ddeReturn; HCONV hConv = NULL; - char *serviceName = NULL, *topicName = NULL, *string; + const char *serviceName = NULL, *topicName = NULL, *string; DWORD ddeResult; Tcl_Obj *objPtr, *handlerPtr = NULL; @@ -1599,7 +1599,7 @@ Tcl_DdeObjCmd( objPtr = Tcl_ConcatObj(objc, objv); string = Tcl_GetStringFromObj(objPtr, &length); - ddeItemData = DdeCreateDataHandle(ddeInstance, string, + ddeItemData = DdeCreateDataHandle(ddeInstance, (char *)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, string, (DWORD) length, 0); + DdeGetData(ddeData, (char *)string, (DWORD) length, 0); Tcl_SetObjLength(resultPtr, (int) strlen(string)); if (Tcl_ListObjIndex(NULL, resultPtr, 0, &objPtr) != TCL_OK) { diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 97bd9cf..d47b2cb 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.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: tclWinInit.c,v 1.77 2008/09/25 14:30:23 dkf Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.78 2008/10/14 22:43:30 nijtmans Exp $ */ #include "tclWinInt.h" @@ -85,12 +85,12 @@ typedef struct { #define NUMPLATFORMS 4 -static char *platforms[NUMPLATFORMS] = { +static const char *platforms[NUMPLATFORMS] = { "Win32s", "Windows 95", "Windows NT", "Windows CE" }; #define NUMPROCESSORS 11 -static char *processors[NUMPROCESSORS] = { +static const char *processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", "amd64", "ia32_on_win64" }; diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 75c5dd9..e46eb70 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.42 2008/07/19 22:50:43 nijtmans Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.43 2008/10/14 22:43:30 nijtmans Exp $ */ #include "tclInt.h" @@ -48,7 +48,7 @@ * system predefined keys. */ -static const char *rootKeyNames[] = { +static const char *const rootKeyNames[] = { "HKEY_LOCAL_MACHINE", "HKEY_USERS", "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_CURRENT_CONFIG", "HKEY_PERFORMANCE_DATA", "HKEY_DYN_DATA", NULL @@ -67,7 +67,7 @@ static const char REGISTRY_ASSOC_KEY[] = "registry::command"; * types so we don't need a separate table to hold the mapping. */ -static const char *typeNames[] = { +static const char *const typeNames[] = { "none", "sz", "expand_sz", "binary", "dword", "dword_big_endian", "link", "multi_sz", "resource_list", NULL }; @@ -335,9 +335,9 @@ RegistryObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { int index; - char *errString = NULL; + const char *errString = NULL; - static const char *subcommands[] = { + static const char *const subcommands[] = { "broadcast", "delete", "get", "keys", "set", "type", "values", NULL }; enum SubCmdIdx { @@ -1505,7 +1505,7 @@ AppendSystemError( { int length; WCHAR *wMsgPtr, **wMsgPtrPtr = &wMsgPtr; - char *msg; + const char *msg; char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE]; Tcl_DString ds; Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); @@ -1533,32 +1533,35 @@ AppendSystemError( } if (length == 0) { if (error == ERROR_CALL_NOT_IMPLEMENTED) { - msg = "function not supported under Win32s"; + strcpy(msgBuf, "function not supported under Win32s"); } else { sprintf(msgBuf, "unknown error: %ld", error); - msg = msgBuf; } + msg = msgBuf; } else { Tcl_Encoding encoding; + char *msgPtr; encoding = Tcl_GetEncoding(NULL, "unicode"); Tcl_ExternalToUtfDString(encoding, (char *) wMsgPtr, -1, &ds); Tcl_FreeEncoding(encoding); LocalFree(wMsgPtr); - msg = Tcl_DStringValue(&ds); + msgPtr = Tcl_DStringValue(&ds); length = Tcl_DStringLength(&ds); /* * Trim the trailing CR/LF from the system message. */ - if (msg[length-1] == '\n') { - msg[--length] = 0; + if (msgPtr[length-1] == '\n') { + --length; } - if (msg[length-1] == '\r') { - msg[--length] = 0; + if (msgPtr[length-1] == '\r') { + --length; } + msgPtr[length] = 0; + msg = msgPtr; } sprintf(id, "%ld", error); diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 16a07af..9135d25 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.37 2008/04/27 22:21:37 dkf Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.38 2008/10/14 22:43:29 nijtmans Exp $ */ #include "tclWinInt.h" @@ -2056,7 +2056,7 @@ SerialGetOptionProc( } if (len==0 || (len>2 && (strncmp(optionName, "-mode", len) == 0))) { char parity; - char *stop; + const char *stop; char buf[2 * TCL_INTEGER_SPACE + 16]; if (!GetCommState(infoPtr->handle, &dcb)) { |