summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index c8bb98b..e77fbc0 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -47,8 +47,8 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
*/
typedef struct MountPointMap {
- TCHAR *volumeName; /* Native wide string volume name. */
- TCHAR driveLetter; /* Drive letter corresponding to the volume
+ WCHAR *volumeName; /* Native wide string volume name. */
+ WCHAR driveLetter; /* Drive letter corresponding to the volume
* name. */
struct MountPointMap *nextPtr;
/* Pointer to next structure in list, or
@@ -120,6 +120,8 @@ DllMain(
DWORD reason, /* Reason this function is being called. */
LPVOID reserved) /* Not used. */
{
+ (void)reserved;
+
switch (reason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInst);
@@ -362,11 +364,11 @@ TclWinResetInterfaces(void)
char
TclWinDriveLetterForVolMountPoint(
- const TCHAR *mountPoint)
+ const WCHAR *mountPoint)
{
MountPointMap *dlIter, *dlPtr2;
- TCHAR Target[55]; /* Target of mount at mount point */
- TCHAR drive[4] = TEXT("A:\\");
+ WCHAR Target[55]; /* Target of mount at mount point */
+ WCHAR drive[4] = L"A:\\";
/*
* Detect the volume mounted there. Unfortunately, there is no simple way
@@ -377,22 +379,22 @@ TclWinDriveLetterForVolMountPoint(
Tcl_MutexLock(&mountPointMap);
dlIter = driveLetterLookup;
while (dlIter != NULL) {
- if (_tcscmp(dlIter->volumeName, mountPoint) == 0) {
+ if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
/*
* We need to check whether this information is still valid, since
* either the user or various programs could have adjusted the
* mount points on the fly.
*/
- drive[0] = (TCHAR) dlIter->driveLetter;
+ drive[0] = (WCHAR) dlIter->driveLetter;
/*
* Try to read the volume mount point and see where it points.
*/
- if (GetVolumeNameForVolumeMountPoint(drive,
+ if (GetVolumeNameForVolumeMountPointW(drive,
Target, 55) != 0) {
- if (_tcscmp(dlIter->volumeName, Target) == 0) {
+ if (wcscmp(dlIter->volumeName, Target) == 0) {
/*
* Nothing has changed.
*/
@@ -449,13 +451,13 @@ TclWinDriveLetterForVolMountPoint(
* Try to read the volume mount point and see where it points.
*/
- if (GetVolumeNameForVolumeMountPoint(drive,
+ if (GetVolumeNameForVolumeMountPointW(drive,
Target, 55) != 0) {
int alreadyStored = 0;
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
- if (_tcscmp(dlIter->volumeName, Target) == 0) {
+ if (wcscmp(dlIter->volumeName, Target) == 0) {
alreadyStored = 1;
break;
}
@@ -476,7 +478,7 @@ TclWinDriveLetterForVolMountPoint(
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
- if (_tcscmp(dlIter->volumeName, mountPoint) == 0) {
+ if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
Tcl_MutexUnlock(&mountPointMap);
return (char) dlIter->driveLetter;
}
@@ -523,7 +525,7 @@ TclWinDriveLetterForVolMountPoint(
* nativeBuffer <- UtfToExternal(encoding, utfBuffer);
* Tcl_FreeEncoding(encoding);
*
- * By convention, in Windows a TCHAR is a Unicode character. If you plan
+ * By convention, in Windows a WCHAR is a Unicode character. If you plan
* on targeting a Unicode interface when running on Windows, these
* functions should be used. If you plan on targetting a "char" oriented
* function on Windows, use Tcl_UtfToExternal() with an encoding of NULL.
@@ -581,8 +583,8 @@ Tcl_WinUtfToTChar(
while (p < end) {
p += TclUtfToUniChar(p, &ch);
if (ch > 0xFFFF) {
- *w++ = (wchar_t) (0xD800 + ((ch -= 0x10000) >> 10));
- *w++ = (wchar_t) (0xDC00 | (ch & 0x3FF));
+ *w++ = (WCHAR) (0xD800 + ((ch -= 0x10000) >> 10));
+ *w++ = (WCHAR) (0xDC00 | (ch & 0x3FF));
} else {
*w++ = ch;
}
@@ -595,8 +597,8 @@ Tcl_WinUtfToTChar(
ch = UCHAR(*p++);
}
if (ch > 0xFFFF) {
- *w++ = (wchar_t) (0xD800 + ((ch -= 0x10000) >> 10));
- *w++ = (wchar_t) (0xDC00 | (ch & 0x3FF));
+ *w++ = (WCHAR) (0xD800 + ((ch -= 0x10000) >> 10));
+ *w++ = (WCHAR) (0xDC00 | (ch & 0x3FF));
} else {
*w++ = ch;
}
@@ -607,7 +609,7 @@ Tcl_WinUtfToTChar(
return wString;
#else
- return Tcl_UtfToUniCharDString(string, len, dsPtr);
+ return (TCHAR *)Tcl_UtfToUniCharDString(string, len, dsPtr);
#endif
}
@@ -620,7 +622,7 @@ Tcl_WinTCharToUtf(
* converted string is stored. */
{
#if TCL_UTF_MAX > 4
- const TCHAR *w, *wEnd;
+ const WCHAR *w, *wEnd;
char *p, *result;
int oldLength, blen = 1;
#endif
@@ -630,7 +632,7 @@ Tcl_WinTCharToUtf(
return NULL;
}
if (len < 0) {
- len = wcslen((TCHAR *)string);
+ len = wcslen((WCHAR *)string);
} else {
len /= 2;
}
@@ -640,8 +642,8 @@ Tcl_WinTCharToUtf(
result = Tcl_DStringValue(dsPtr) + oldLength;
p = result;
- wEnd = (TCHAR *)string + len;
- for (w = (TCHAR *)string; w < wEnd; ) {
+ wEnd = (WCHAR *)string + len;
+ for (w = (WCHAR *)string; w < wEnd; ) {
if (!blen && ((*w & 0xFC00) != 0xDC00)) {
/* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);