summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-11-03 12:09:23 (GMT)
committernijtmans <nijtmans>2010-11-03 12:09:23 (GMT)
commitf3a48000e4c73654b48530a402518c8c89c3be06 (patch)
tree46b52e1fadb5484cfd6be47dc982afb94162c5d2 /win
parentd4d95330eb4e444b9ed5cbdfbad4fa6e887fd2b9 (diff)
downloadtcl-f3a48000e4c73654b48530a402518c8c89c3be06.zip
tcl-f3a48000e4c73654b48530a402518c8c89c3be06.tar.gz
tcl-f3a48000e4c73654b48530a402518c8c89c3be06.tar.bz2
[FRQ 2965056]: Windows build with -DUNICODE
(more clean-ups for pre-win2000 stuff)
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFCmd.c16
-rw-r--r--win/tclWinFile.c16
-rw-r--r--win/tclWinReg.c28
3 files changed, 20 insertions, 40 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index a35cc3b..8de5e9f 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.69 2010/10/12 10:21:55 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.70 2010/11/03 12:09:23 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -1278,7 +1278,7 @@ TraverseWinTree(
return traverseProc(nativeSource, nativeTarget, DOTREE_F, errorPtr);
}
- Tcl_DStringAppend(sourcePtr, (char *) L"\\*.*", 4 * sizeof(WCHAR) + 1);
+ Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\*.*"), 4 * sizeof(TCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1);
nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr);
@@ -1302,15 +1302,15 @@ TraverseWinTree(
return result;
}
- sourceLen = oldSourceLen + sizeof(WCHAR);
- Tcl_DStringAppend(sourcePtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ sourceLen = oldSourceLen + sizeof(TCHAR);
+ Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, sourceLen);
if (targetPtr != NULL) {
oldTargetLen = Tcl_DStringLength(targetPtr);
targetLen = oldTargetLen;
- targetLen += sizeof(WCHAR);
- Tcl_DStringAppend(targetPtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ targetLen += sizeof(TCHAR);
+ Tcl_DStringAppend(targetPtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
Tcl_DStringSetLength(targetPtr, targetLen);
}
@@ -1319,7 +1319,7 @@ TraverseWinTree(
TCHAR *nativeName;
int len;
- WCHAR *wp = data.cFileName;
+ TCHAR *wp = data.cFileName;
if (*wp == '.') {
wp++;
if (*wp == '.') {
@@ -1330,7 +1330,7 @@ TraverseWinTree(
}
}
nativeName = (TCHAR *) data.cFileName;
- len = wcslen(data.cFileName) * sizeof(WCHAR);
+ len = _tcslen(data.cFileName) * sizeof(TCHAR);
/*
* Append name after slash, and recurse on the file.
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index e3d674b..6ef6f8c 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.115 2010/10/12 10:21:55 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.116 2010/11/03 12:09:23 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -573,6 +573,7 @@ WinReadLinkDirectory(
*/
offset = 0;
+#ifdef UNICODE
if (reparseBuffer->MountPointReparseBuffer.PathBuffer[0] == L'\\') {
/*
* Check whether this is a mounted volume.
@@ -634,6 +635,7 @@ WinReadLinkDirectory(
offset = 4;
}
}
+#endif /* UNICODE */
Tcl_WinTCharToUtf((const TCHAR *)
reparseBuffer->MountPointReparseBuffer.PathBuffer,
@@ -1712,19 +1714,19 @@ static int
NativeIsExec(
const TCHAR *path)
{
- int len = wcslen(path);
+ int len = _tcslen(path);
if (len < 5) {
return 0;
}
- if (path[len-4] != L'.') {
+ if (path[len-4] != TEXT('.')) {
return 0;
}
- if ((_wcsicmp(path+len-3, L"exe") == 0)
- || (_wcsicmp(path+len-3, L"com") == 0)
- || (_wcsicmp(path+len-3, L"bat") == 0)) {
+ if ((_tcsicmp(path+len-3, TEXT("exe")) == 0)
+ || (_tcsicmp(path+len-3, TEXT("com")) == 0)
+ || (_tcsicmp(path+len-3, TEXT("bat")) == 0)) {
return 1;
}
return 0;
@@ -3128,7 +3130,7 @@ TclNativeDupInternalRep(
return NULL;
}
- len = sizeof(TCHAR) * (_tcslen((const WCHAR *) clientData) + 1);
+ len = sizeof(TCHAR) * (_tcslen((const TCHAR *) clientData) + 1);
copy = (char *) ckalloc(len);
memcpy(copy, clientData, len);
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 26ad6df..96aa3d8 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.55 2010/10/11 12:11:53 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.56 2010/11/03 12:09:23 nijtmans Exp $
*/
#undef STATIC_BUILD
@@ -1491,34 +1491,12 @@ AppendSystemError(
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (TCHAR *) tMsgPtrPtr,
0, NULL);
if (length == 0) {
- char *msgPtr;
-
- length = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (char *) &msgPtr,
- 0, NULL);
- if (length > 0) {
- tMsgPtr = (TCHAR *)
- LocalAlloc(LPTR, (length + 1) * sizeof(TCHAR));
- MultiByteToWideChar(CP_ACP, 0, msgPtr, length + 1, tMsgPtr,
- length + 1);
- LocalFree(msgPtr);
- }
- }
- if (length == 0) {
- if (error == ERROR_CALL_NOT_IMPLEMENTED) {
- strcpy(msgBuf, "function not supported under Win32s");
- } else {
- sprintf(msgBuf, "unknown error: %ld", error);
- }
+ sprintf(msgBuf, "unknown error: %ld", error);
msg = msgBuf;
} else {
- Tcl_Encoding encoding;
char *msgPtr;
- encoding = Tcl_GetEncoding(NULL, "unicode");
- Tcl_ExternalToUtfDString(encoding, (char *) tMsgPtr, -1, &ds);
- Tcl_FreeEncoding(encoding);
+ Tcl_WinTCharToUtf(tMsgPtr, -1, &ds);
LocalFree(tMsgPtr);
msgPtr = Tcl_DStringValue(&ds);