summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2002-01-25 21:36:09 (GMT)
committerdgp <dgp@users.sourceforge.net>2002-01-25 21:36:09 (GMT)
commitfd92b8826ad83d09e08d67e70a6deae1deb9a06f (patch)
tree54697caaa61e187b7d32cb6fb844d0d2671da6c9 /win
parent7bb89f954aeb2e32b07d01513217ab6930f80ccf (diff)
downloadtcl-fd92b8826ad83d09e08d67e70a6deae1deb9a06f.zip
tcl-fd92b8826ad83d09e08d67e70a6deae1deb9a06f.tar.gz
tcl-fd92b8826ad83d09e08d67e70a6deae1deb9a06f.tar.bz2
* [Patch 505630] Updated interfaces of generic/tclBasic.cc (TIP 27).
* [Patch 506818] Updated interfaces of generic/tclHash.c (TIP 27). * [Patch 506807] Updated interfaces of generic/tclObj.c (TIP 27). * [Patch 507304] Updated interfaces of win/tclWin32.c (TIP 27). * Update all callers.
Diffstat (limited to 'win')
-rw-r--r--win/tclWin32Dll.c6
-rw-r--r--win/tclWinFCmd.c4
-rw-r--r--win/tclWinFile.c21
-rw-r--r--win/tclWinLoad.c4
-rw-r--r--win/tclWinPipe.c6
-rw-r--r--win/tclWinReg.c73
-rw-r--r--win/tclWinSerial.c4
7 files changed, 62 insertions, 56 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index c1194dd..d37a6ad 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.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: tclWin32Dll.c,v 1.11 2001/11/19 17:45:12 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.12 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -490,7 +490,7 @@ TclWinSetInterfaces(
*---------------------------------------------------------------------------
*/
-TCHAR *
+CONST TCHAR *
Tcl_WinUtfToTChar(string, len, dsPtr)
CONST char *string; /* Source string in UTF-8. */
int len; /* Source string length in bytes, or < 0 for
@@ -502,7 +502,7 @@ Tcl_WinUtfToTChar(string, len, dsPtr)
string, len, dsPtr);
}
-char *
+CONST char *
Tcl_WinTCharToUtf(string, len, dsPtr)
CONST TCHAR *string; /* Source string in Unicode when running
* NT, ANSI when running 95. */
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index ee49af9..5ebe7d7 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.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: tclWinFCmd.c,v 1.19 2002/01/18 14:17:06 dgp Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.20 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -1888,7 +1888,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
Tcl_DStringFree(&ds);
} else {
/* We're on WinNT or 2000 or XP */
- char *nativePath;
+ CONST char *nativePath;
#if 0
/*
* We don't use this simpler version, because the speed
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 29f8fef..f92eeaa 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.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: tclWinFile.c,v 1.23 2002/01/25 20:40:56 dgp Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.24 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -80,7 +80,7 @@ TclpFindExecutable(argv0)
*/
(*tclWinProcs->getModuleFileNameProc)(NULL, wName, MAX_PATH);
- Tcl_WinTCharToUtf((TCHAR *) wName, -1, &ds);
+ Tcl_WinTCharToUtf((CONST TCHAR *) wName, -1, &ds);
tclNativeExecutableName = ckalloc((unsigned) (Tcl_DStringLength(&ds) + 1));
strcpy(tclNativeExecutableName, Tcl_DStringValue(&ds));
@@ -132,7 +132,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types)
Tcl_DString ds;
Tcl_DString dsOrig;
Tcl_Obj *fileNamePtr;
- TCHAR *nativeName;
+ CONST TCHAR *nativeName;
int matchSpecialDots;
/*
@@ -269,15 +269,15 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types)
for (found = 1; found != 0;
found = (*tclWinProcs->findNextFileProc)(handle, &data)) {
- TCHAR *nativeMatchResult;
- char *name, *fname;
+ CONST TCHAR *nativeMatchResult;
+ CONST char *name, *fname;
int typeOk = 1;
if (tclWinProcs->useWide) {
- nativeName = (TCHAR *) data.w.cFileName;
+ nativeName = (CONST TCHAR *) data.w.cFileName;
} else {
- nativeName = (TCHAR *) data.a.cFileName;
+ nativeName = (CONST TCHAR *) data.a.cFileName;
}
name = Tcl_WinTCharToUtf(nativeName, -1, &ds);
@@ -643,8 +643,7 @@ static int
NativeIsExec(nativePath)
CONST TCHAR *nativePath;
{
- CONST char *p;
- char *path;
+ CONST char *p, *path;
Tcl_DString ds;
/*
@@ -937,7 +936,7 @@ NativeStat(nativePath, statPtr)
if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) {
CONST char *p;
DWORD dw;
- TCHAR *nativeVol;
+ CONST TCHAR *nativeVol;
Tcl_DString volString;
p = strchr(fullPath + 2, '\\');
@@ -997,7 +996,7 @@ NativeStat(nativePath, statPtr)
if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) {
CONST char *p;
DWORD dw;
- TCHAR *nativeVol;
+ CONST TCHAR *nativeVol;
Tcl_DString volString;
p = strchr(fullPath + 2, '\\');
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index 9cd5c21..8e23490 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.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: tclWinLoad.c,v 1.10 2002/01/09 19:09:28 kennykb Exp $
+ * RCS: @(#) $Id: tclWinLoad.c,v 1.11 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -55,7 +55,7 @@ TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
* this file. */
{
HINSTANCE handle;
- TCHAR *nativeName;
+ CONST TCHAR *nativeName;
Tcl_DString ds;
char *fileName = Tcl_GetString(pathPtr);
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 3380942..cac423d 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.22 2002/01/25 20:40:56 dgp Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.23 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -578,7 +578,7 @@ TclpOpenFile(path, mode)
HANDLE handle;
DWORD accessMode, createMode, shareMode, flags;
Tcl_DString ds;
- TCHAR *nativePath;
+ CONST TCHAR *nativePath;
/*
* Map the access bits to the NT access mode.
@@ -1360,7 +1360,7 @@ ApplicationType(interp, originalName, fullName)
DWORD attr, read;
IMAGE_DOS_HEADER header;
Tcl_DString nameBuf, ds;
- TCHAR *nativeName;
+ CONST TCHAR *nativeName;
WCHAR nativeFullPath[MAX_PATH];
static char extensions[][5] = {"", ".com", ".exe", ".bat"};
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index dee4188..84c31ea 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.14 2002/01/18 14:07:40 dgp Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.15 2002/01/25 21:36:10 dgp Exp $
*/
#include <tclPort.h>
@@ -80,7 +80,7 @@ static DWORD lastType = REG_RESOURCE_LIST;
typedef struct RegWinProcs {
int useWide;
- LONG (WINAPI *regConnectRegistryProc)(TCHAR *, HKEY, PHKEY);
+ LONG (WINAPI *regConnectRegistryProc)(CONST TCHAR *, HKEY, PHKEY);
LONG (WINAPI *regCreateKeyExProc)(HKEY, CONST TCHAR *, DWORD, TCHAR *,
DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *, DWORD *);
LONG (WINAPI *regDeleteKeyProc)(HKEY, CONST TCHAR *);
@@ -106,7 +106,7 @@ static RegWinProcs *regWinProcs;
static RegWinProcs asciiProcs = {
0,
- (LONG (WINAPI *)(TCHAR *, HKEY, PHKEY)) RegConnectRegistryA,
+ (LONG (WINAPI *)(CONST TCHAR *, HKEY, PHKEY)) RegConnectRegistryA,
(LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, TCHAR *,
DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *,
DWORD *)) RegCreateKeyExA,
@@ -131,7 +131,7 @@ static RegWinProcs asciiProcs = {
static RegWinProcs unicodeProcs = {
1,
- (LONG (WINAPI *)(TCHAR *, HKEY, PHKEY)) RegConnectRegistryW,
+ (LONG (WINAPI *)(CONST TCHAR *, HKEY, PHKEY)) RegConnectRegistryW,
(LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, TCHAR *,
DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *,
DWORD *)) RegCreateKeyExW,
@@ -179,7 +179,8 @@ static DWORD OpenSubKey(char *hostName, HKEY rootKey,
static int ParseKeyName(Tcl_Interp *interp, char *name,
char **hostNamePtr, HKEY *rootKeyPtr,
char **keyNamePtr);
-static DWORD RecursiveDeleteKey(HKEY hStartKey, TCHAR * pKeyName);
+static DWORD RecursiveDeleteKey(HKEY hStartKey,
+ CONST TCHAR * pKeyName);
static int RegistryObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj * CONST objv[]);
@@ -352,6 +353,7 @@ DeleteKey(
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Obj *keyNameObj) /* Name of key to delete. */
{
+ CONST TCHAR *nativeTail;
char *tail, *buffer, *hostName, *keyName;
HKEY rootKey, subkey;
DWORD result;
@@ -405,8 +407,8 @@ DeleteKey(
* Now we recursively delete the key and everything below it.
*/
- tail = Tcl_WinUtfToTChar(tail, -1, &buf);
- result = RecursiveDeleteKey(subkey, tail);
+ nativeTail = Tcl_WinUtfToTChar(tail, -1, &buf);
+ result = RecursiveDeleteKey(subkey, nativeTail);
Tcl_DStringFree(&buf);
if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
@@ -505,7 +507,8 @@ GetKeyNames(
{
HKEY key;
DWORD index;
- char buffer[MAX_PATH+1], *pattern, *name;
+ TCHAR buffer[MAX_PATH+1];
+ char *pattern, *name;
Tcl_Obj *resultPtr;
int result = TCL_OK;
Tcl_DString ds;
@@ -533,7 +536,7 @@ GetKeyNames(
resultPtr = Tcl_GetObjResult(interp);
for (index = 0; (*regWinProcs->regEnumKeyProc)(key, index, buffer,
MAX_PATH+1) == ERROR_SUCCESS; index++) {
- Tcl_WinTCharToUtf((TCHAR *) buffer, -1, &ds);
+ Tcl_WinTCharToUtf(buffer, -1, &ds);
name = Tcl_DStringValue(&ds);
if (pattern && !Tcl_StringMatch(name, pattern)) {
Tcl_DStringFree(&ds);
@@ -581,6 +584,7 @@ GetType(
Tcl_DString ds;
char *valueName;
int length;
+ CONST TCHAR *nativeValue;
/*
* Attempt to open the key for reading.
@@ -598,8 +602,8 @@ GetType(
resultPtr = Tcl_GetObjResult(interp);
valueName = Tcl_GetStringFromObj(valueNameObj, &length);
- valueName = Tcl_WinUtfToTChar(valueName, length, &ds);
- result = (*regWinProcs->regQueryValueExProc)(key, valueName, NULL, &type,
+ nativeValue = Tcl_WinUtfToTChar(valueName, length, &ds);
+ result = (*regWinProcs->regQueryValueExProc)(key, nativeValue, NULL, &type,
NULL, NULL);
Tcl_DStringFree(&ds);
RegCloseKey(key);
@@ -655,6 +659,7 @@ GetValue(
Tcl_Obj *resultPtr;
Tcl_DString data, buf;
int nameLen;
+ CONST TCHAR *nativeValue;
/*
* Attempt to open the key for reading.
@@ -682,9 +687,9 @@ GetValue(
resultPtr = Tcl_GetObjResult(interp);
valueName = Tcl_GetStringFromObj(valueNameObj, &nameLen);
- valueName = Tcl_WinUtfToTChar(valueName, nameLen, &buf);
+ nativeValue = Tcl_WinUtfToTChar(valueName, nameLen, &buf);
- result = (*regWinProcs->regQueryValueExProc)(key, valueName, NULL, &type,
+ result = (*regWinProcs->regQueryValueExProc)(key, nativeValue, NULL, &type,
(BYTE *) Tcl_DStringValue(&data), &length);
while (result == ERROR_MORE_DATA) {
/*
@@ -694,7 +699,7 @@ GetValue(
*/
length *= 2;
Tcl_DStringSetLength(&data, (int) length);
- result = (*regWinProcs->regQueryValueExProc)(key, valueName, NULL,
+ result = (*regWinProcs->regQueryValueExProc)(key, nativeValue, NULL,
&type, (BYTE *) Tcl_DStringValue(&data), &length);
}
Tcl_DStringFree(&buf);
@@ -938,23 +943,24 @@ OpenKey(
static DWORD
OpenSubKey(
- char *hostName, /* Host to access, or NULL for local. */
+ CONST char *hostName, /* Host to access, or NULL for local. */
HKEY rootKey, /* Root registry key. */
- char *keyName, /* Subkey name. */
+ CONST char *keyName, /* Subkey name. */
REGSAM mode, /* Access mode. */
int flags, /* 0 or REG_CREATE. */
HKEY *keyPtr) /* Returned HKEY. */
{
DWORD result;
Tcl_DString buf;
+ CONST TCHAR *nativeHost, nativeKey;
/*
* Attempt to open the root key on a remote host if necessary.
*/
if (hostName) {
- hostName = Tcl_WinUtfToTChar(hostName, -1, &buf);
- result = (*regWinProcs->regConnectRegistryProc)(hostName, rootKey,
+ nativeHost = Tcl_WinUtfToTChar(hostName, -1, &buf);
+ result = (*regWinProcs->regConnectRegistryProc)(nativeHost, rootKey,
&rootKey);
Tcl_DStringFree(&buf);
if (result != ERROR_SUCCESS) {
@@ -967,10 +973,10 @@ OpenSubKey(
* that this key must be closed by the caller.
*/
- keyName = Tcl_WinUtfToTChar(keyName, -1, &buf);
+ nativeKey = Tcl_WinUtfToTChar(keyName, -1, &buf);
if (flags & REG_CREATE) {
DWORD create;
- result = (*regWinProcs->regCreateKeyExProc)(rootKey, keyName, 0, "",
+ result = (*regWinProcs->regCreateKeyExProc)(rootKey, nativeKey, 0, "",
REG_OPTION_NON_VOLATILE, mode, NULL, keyPtr, &create);
} else {
if (rootKey == HKEY_PERFORMANCE_DATA) {
@@ -982,7 +988,7 @@ OpenSubKey(
*keyPtr = HKEY_PERFORMANCE_DATA;
result = ERROR_SUCCESS;
} else {
- result = (*regWinProcs->regOpenKeyExProc)(rootKey, keyName, 0,
+ result = (*regWinProcs->regOpenKeyExProc)(rootKey, nativeKey, 0,
mode, keyPtr);
}
}
@@ -1103,7 +1109,7 @@ ParseKeyName(
static DWORD
RecursiveDeleteKey(
HKEY startKey, /* Parent of key to be deleted. */
- char *keyName) /* Name of key to be deleted in external
+ CONST TCHAR *keyName) /* Name of key to be deleted in external
* encoding, not UTF. */
{
DWORD result, size, maxSize;
@@ -1140,13 +1146,14 @@ RecursiveDeleteKey(
*/
size = maxSize;
- result=(*regWinProcs->regEnumKeyExProc)(hKey, 0,
+ result=(*regWinProcs->regEnumKeyExProc)(hKey, 0, (TCHAR *)
Tcl_DStringValue(&subkey), &size, NULL, NULL, NULL, NULL);
if (result == ERROR_NO_MORE_ITEMS) {
result = (*regWinProcs->regDeleteKeyProc)(startKey, keyName);
break;
} else if (result == ERROR_SUCCESS) {
- result = RecursiveDeleteKey(hKey, Tcl_DStringValue(&subkey));
+ result = RecursiveDeleteKey(hKey,
+ (CONST TCHAR *) Tcl_DStringValue(&subkey));
}
}
Tcl_DStringFree(&subkey);
@@ -1186,6 +1193,7 @@ SetValue(
char *valueName;
Tcl_Obj *resultPtr;
Tcl_DString nameBuf;
+ CONST TCHAR *native;
if (typeObj == NULL) {
type = REG_SZ;
@@ -1201,7 +1209,7 @@ SetValue(
}
valueName = Tcl_GetStringFromObj(valueNameObj, &length);
- valueName = Tcl_WinUtfToTChar(valueName, length, &nameBuf);
+ native = Tcl_WinUtfToTChar(valueName, length, &nameBuf);
resultPtr = Tcl_GetObjResult(interp);
if (type == REG_DWORD || type == REG_DWORD_BIG_ENDIAN) {
@@ -1213,7 +1221,7 @@ SetValue(
}
value = ConvertDWORD(type, value);
- result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type,
+ result = (*regWinProcs->regSetValueExProc)(key, native, 0, type,
(BYTE*) &value, sizeof(DWORD));
} else if (type == REG_MULTI_SZ) {
Tcl_DString data, buf;
@@ -1248,16 +1256,15 @@ SetValue(
Tcl_WinUtfToTChar(Tcl_DStringValue(&data), Tcl_DStringLength(&data)+1,
&buf);
- result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type,
+ result = (*regWinProcs->regSetValueExProc)(key, native, 0, type,
(BYTE *) Tcl_DStringValue(&buf),
(DWORD) Tcl_DStringLength(&buf));
Tcl_DStringFree(&data);
Tcl_DStringFree(&buf);
} else if (type == REG_SZ || type == REG_EXPAND_SZ) {
Tcl_DString buf;
- char *data = Tcl_GetStringFromObj(dataObj, &length);
-
- data = Tcl_WinUtfToTChar(data, length, &buf);
+ CONST char *data = Tcl_GetStringFromObj(dataObj, &length);
+ CONST TCHAR *native = Tcl_WinUtfToTChar(data, length, &buf);
/*
* Include the null in the length, padding if needed for Unicode.
@@ -1268,8 +1275,8 @@ SetValue(
}
length = Tcl_DStringLength(&buf) + 1;
- result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type,
- (BYTE*)data, (DWORD) length);
+ result = (*regWinProcs->regSetValueExProc)(key, native, 0, type,
+ (BYTE*)native, (DWORD) length);
Tcl_DStringFree(&buf);
} else {
char *data;
@@ -1279,7 +1286,7 @@ SetValue(
*/
data = Tcl_GetByteArrayFromObj(dataObj, &length);
- result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type,
+ result = (*regWinProcs->regSetValueExProc)(key, native, 0, type,
(BYTE *)data, (DWORD) length);
}
Tcl_DStringFree(&nameBuf);
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 4fa856a..6a60700 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.19 2002/01/24 01:34:16 dgp Exp $
+ * RCS: @(#) $Id: tclWinSerial.c,v 1.20 2002/01/25 21:36:10 dgp Exp $
*/
#include "tclWinInt.h"
@@ -1531,7 +1531,7 @@ SerialSetOptionProc(instanceData, interp, optionName, value)
BOOL result, flag;
size_t len, vlen;
Tcl_DString ds;
- TCHAR *native;
+ CONST TCHAR *native;
int argc;
char **argv;