summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-09-20 14:28:13 (GMT)
committernijtmans <nijtmans>2010-09-20 14:28:13 (GMT)
commitd24e3a2febe9142596afe7c394f7bbc27b193eb6 (patch)
tree96204d0bbc6dfb2be47bad7394e64e6cc9ba34b1 /win
parent069e4bbf42e885f83b8bd9264b1e74d0aaf47c0a (diff)
downloadtcl-d24e3a2febe9142596afe7c394f7bbc27b193eb6.zip
tcl-d24e3a2febe9142596afe7c394f7bbc27b193eb6.tar.gz
tcl-d24e3a2febe9142596afe7c394f7bbc27b193eb6.tar.bz2
Eliminate tclWinProcs->useWide everywhere, since the value is always "1" on platforms >win95dogeen_assembler_split
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFCmd.c85
-rw-r--r--win/tclWinFile.c126
-rw-r--r--win/tclWinPipe.c32
3 files changed, 54 insertions, 189 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 156db19..fe89976 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.66 2010/09/18 05:42:26 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.67 2010/09/20 14:28:15 nijtmans Exp $
*/
/* TODO: This file does not compile in UNICODE mode.
@@ -487,8 +487,7 @@ DoRenameFile(
nativeRest[0] = '\0';
result = TCL_ERROR;
- nativePrefix = (tclWinProcs->useWide)
- ? (TCHAR *) L"tclr" : (TCHAR *) "tclr";
+ nativePrefix = (TCHAR *) L"tclr";
if (tclWinProcs->getTempFileNameProc(nativeTmp, nativePrefix,
0, tempBuf) != 0) {
/*
@@ -1290,12 +1289,8 @@ TraverseWinTree(
return traverseProc(nativeSource, nativeTarget, DOTREE_F, errorPtr);
}
- if (tclWinProcs->useWide) {
- Tcl_DStringAppend(sourcePtr, (char *) L"\\*.*", 4 * sizeof(WCHAR) + 1);
- Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1);
- } else {
- Tcl_DStringAppend(sourcePtr, "\\*.*", 4);
- }
+ Tcl_DStringAppend(sourcePtr, (char *) L"\\*.*", 4 * sizeof(WCHAR) + 1);
+ Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1);
nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr);
handle = tclWinProcs->findFirstFileProc(nativeSource, &data);
@@ -1318,28 +1313,16 @@ TraverseWinTree(
return result;
}
- sourceLen = oldSourceLen;
-
- if (tclWinProcs->useWide) {
- sourceLen += sizeof(WCHAR);
- Tcl_DStringAppend(sourcePtr, (char *) L"\\", sizeof(WCHAR) + 1);
- Tcl_DStringSetLength(sourcePtr, sourceLen);
- } else {
- sourceLen += 1;
- Tcl_DStringAppend(sourcePtr, "\\", 1);
- }
+ sourceLen = oldSourceLen + sizeof(WCHAR);
+ Tcl_DStringAppend(sourcePtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ Tcl_DStringSetLength(sourcePtr, sourceLen);
if (targetPtr != NULL) {
oldTargetLen = Tcl_DStringLength(targetPtr);
targetLen = oldTargetLen;
- if (tclWinProcs->useWide) {
- targetLen += sizeof(WCHAR);
- Tcl_DStringAppend(targetPtr, (char *) L"\\", sizeof(WCHAR) + 1);
- Tcl_DStringSetLength(targetPtr, targetLen);
- } else {
- targetLen += 1;
- Tcl_DStringAppend(targetPtr, "\\", 1);
- }
+ targetLen += sizeof(WCHAR);
+ Tcl_DStringAppend(targetPtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ Tcl_DStringSetLength(targetPtr, targetLen);
}
found = 1;
@@ -1347,29 +1330,18 @@ TraverseWinTree(
TCHAR *nativeName;
int len;
- if (tclWinProcs->useWide) {
- WCHAR *wp;
-
- wp = data.w.cFileName;
+ WCHAR *wp = data.w.cFileName;
+ if (*wp == '.') {
+ wp++;
if (*wp == '.') {
wp++;
- if (*wp == '.') {
- wp++;
- }
- if (*wp == '\0') {
- continue;
- }
}
- nativeName = (TCHAR *) data.w.cFileName;
- len = wcslen(data.w.cFileName) * sizeof(WCHAR);
- } else {
- if ((strcmp(data.a.cFileName, ".") == 0)
- || (strcmp(data.a.cFileName, "..") == 0)) {
+ if (*wp == '\0') {
continue;
}
- nativeName = (TCHAR *) data.a.cFileName;
- len = strlen(data.a.cFileName);
}
+ nativeName = (TCHAR *) data.w.cFileName;
+ len = wcslen(data.w.cFileName) * sizeof(WCHAR);
/*
* Append name after slash, and recurse on the file.
@@ -1776,27 +1748,14 @@ ConvertFileNameFormat(
}
goto cleanup;
}
- if (tclWinProcs->useWide) {
- nativeName = (TCHAR *) data.w.cAlternateFileName;
- if (longShort) {
- if (data.w.cFileName[0] != '\0') {
- nativeName = (TCHAR *) data.w.cFileName;
- }
- } else {
- if (data.w.cAlternateFileName[0] == '\0') {
- nativeName = (TCHAR *) data.w.cFileName;
- }
+ nativeName = (TCHAR *) data.w.cAlternateFileName;
+ if (longShort) {
+ if (data.w.cFileName[0] != '\0') {
+ nativeName = (TCHAR *) data.w.cFileName;
}
} else {
- nativeName = (TCHAR *) data.a.cAlternateFileName;
- if (longShort) {
- if (data.a.cFileName[0] != '\0') {
- nativeName = (TCHAR *) data.a.cFileName;
- }
- } else {
- if (data.a.cAlternateFileName[0] == '\0') {
- nativeName = (TCHAR *) data.a.cFileName;
- }
+ if (data.w.cAlternateFileName[0] == '\0') {
+ nativeName = (TCHAR *) data.w.cFileName;
}
}
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index af5788e..98c9fc2 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.111 2010/09/18 05:56:17 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.112 2010/09/20 14:28:13 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -1051,14 +1051,8 @@ TclpMatchInDirectory(
int checkDrive = 0, isDrive;
DWORD attr;
- if (tclWinProcs->useWide) {
- native = (const TCHAR *) data.w.cFileName;
- attr = data.w.dwFileAttributes;
- } else {
- native = (const TCHAR *) data.a.cFileName;
- attr = data.a.dwFileAttributes;
- }
-
+ native = (const TCHAR *) data.w.cFileName;
+ attr = data.w.dwFileAttributes;
utfname = tclWinProcs->tchar2utf(native, -1, &ds);
if (!matchSpecialDots) {
@@ -1745,55 +1739,22 @@ NativeAccess(
static int
NativeIsExec(
- const TCHAR *nativePath)
+ const TCHAR *path)
{
- if (tclWinProcs->useWide) {
- const WCHAR *path = (const WCHAR *) nativePath;
- int len = wcslen(path);
-
- if (len < 5) {
- return 0;
- }
-
- if (path[len-4] != L'.') {
- return 0;
- }
-
- /*
- * Use wide-char case-insensitive comparison
- */
-
- if ((_wcsicmp(path+len-3, L"exe") == 0)
- || (_wcsicmp(path+len-3, L"com") == 0)
- || (_wcsicmp(path+len-3, L"bat") == 0)) {
- return 1;
- }
- } else {
- const char *p;
-
- /*
- * We are only looking for pure ascii.
- */
+ int len = wcslen(path);
- p = strrchr((const char *) nativePath, '.');
- if (p != NULL) {
- p++;
-
- /*
- * Note: in the old code, stat considered '.pif' files as
- * executable, whereas access did not.
- */
+ if (len < 5) {
+ return 0;
+ }
- if ((strcasecmp(p, "exe") == 0)
- || (strcasecmp(p, "com") == 0)
- || (strcasecmp(p, "bat") == 0)) {
- /*
- * File that ends with .exe, .com, or .bat is executable.
- */
+ if (path[len-4] != L'.') {
+ return 0;
+ }
- return 1;
- }
- }
+ if ((_wcsicmp(path+len-3, L"exe") == 0)
+ || (_wcsicmp(path+len-3, L"com") == 0)
+ || (_wcsicmp(path+len-3, L"bat") == 0)) {
+ return 1;
}
return 0;
}
@@ -1938,21 +1899,12 @@ TclpGetCwd(
* Watch for the weird Windows c:\\UNC syntax.
*/
- if (tclWinProcs->useWide) {
- WCHAR *native = (WCHAR *) buffer;
- if ((native[0] != '\0') && (native[1] == ':')
- && (native[2] == '\\') && (native[3] == '\\')) {
- native += 2;
- }
- tclWinProcs->tchar2utf((TCHAR *) native, -1, bufferPtr);
- } else {
- char *native = (char *) buffer;
- if ((native[0] != '\0') && (native[1] == ':')
- && (native[2] == '\\') && (native[3] == '\\')) {
- native += 2;
- }
- tclWinProcs->tchar2utf((TCHAR *) native, -1, bufferPtr);
+ WCHAR *native = (WCHAR *) buffer;
+ if ((native[0] != '\0') && (native[1] == ':')
+ && (native[2] == '\\') && (native[3] == '\\')) {
+ native += 2;
}
+ tclWinProcs->tchar2utf((TCHAR *) native, -1, bufferPtr);
/*
* Convert to forward slashes for easier use in scripts.
@@ -2351,22 +2303,8 @@ TclpGetNativeCwd(
}
if (clientData != NULL) {
- if (tclWinProcs->useWide) {
- /*
- * Unicode representation when running on NT/2K/XP.
- */
-
- if (wcscmp((const WCHAR*)clientData, (const WCHAR*)buffer) == 0) {
- return clientData;
- }
- } else {
- /*
- * ANSI representation when running on 95/98/ME.
- */
-
- if (strcmp((const char*) clientData, (const char*) buffer) == 0) {
- return clientData;
- }
+ if (wcscmp((const WCHAR*)clientData, (const WCHAR*)buffer) == 0) {
+ return clientData;
}
}
@@ -3221,11 +3159,7 @@ TclNativeCreateNativeRep(
}
}
tclWinProcs->utf2tchar(str, len, &ds);
- if (tclWinProcs->useWide) {
- len = Tcl_DStringLength(&ds) + sizeof(WCHAR);
- } else {
- len = Tcl_DStringLength(&ds) + sizeof(char);
- }
+ len = Tcl_DStringLength(&ds) + sizeof(WCHAR);
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc((unsigned) len);
memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len);
@@ -3262,19 +3196,7 @@ TclNativeDupInternalRep(
return NULL;
}
- if (tclWinProcs->useWide) {
- /*
- * Unicode representation when running on NT/2K/XP.
- */
-
- len = sizeof(WCHAR) * (wcslen((const WCHAR *) clientData) + 1);
- } else {
- /*
- * ANSI representation when running on 95/98/ME.
- */
-
- len = sizeof(char) * (strlen((const char *) clientData) + 1);
- }
+ len = sizeof(TCHAR) * (_tcslen((const WCHAR *) clientData) + 1);
copy = (char *) ckalloc(len);
memcpy(copy, clientData, len);
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index a71e5af..a41898d 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.82 2010/09/09 14:30:20 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.83 2010/09/20 14:28:15 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -477,21 +477,14 @@ TempFileName(
TCHAR name[MAX_PATH]) /* Buffer in which name for temporary file
* gets stored. */
{
- TCHAR *prefix;
-
- prefix = (tclWinProcs->useWide) ? (TCHAR *) L"TCL" : (TCHAR *) "TCL";
+ TCHAR *prefix = TEXT("TCL");
if (tclWinProcs->getTempPathProc(MAX_PATH, name) != 0) {
if (tclWinProcs->getTempFileNameProc(name, prefix, 0, name) != 0) {
return 1;
}
}
- if (tclWinProcs->useWide) {
- ((WCHAR *) name)[0] = '.';
- ((WCHAR *) name)[1] = '\0';
- } else {
- ((char *) name)[0] = '.';
- ((char *) name)[1] = '\0';
- }
+ name[0] = '.';
+ name[1] = '\0';
return tclWinProcs->getTempFileNameProc(name, prefix, 0, name);
}
@@ -3115,11 +3108,7 @@ TclpOpenTemporaryFile(
if (length == 0) {
goto gotError;
}
- if (tclWinProcs->useWide) {
- namePtr += length * sizeof(WCHAR);
- } else {
- namePtr += length;
- }
+ namePtr += length * sizeof(TCHAR);
if (basenameObj) {
const char *string = Tcl_GetStringFromObj(basenameObj, &length);
@@ -3128,9 +3117,8 @@ TclpOpenTemporaryFile(
namePtr += Tcl_DStringLength(&buf);
Tcl_DStringFree(&buf);
} else {
- TCHAR *baseStr = tclWinProcs->useWide ?
- (TCHAR *) L"TCL" : (TCHAR *) "TCL";
- int length = tclWinProcs->useWide ? 3*sizeof(WCHAR) : 3;
+ TCHAR *baseStr = TEXT("TCL");
+ int length = 3 * sizeof(TCHAR);
memcpy(namePtr, baseStr, length);
namePtr += length;
@@ -3146,11 +3134,7 @@ TclpOpenTemporaryFile(
counter = (unsigned short) (counter + 1);
tclWinProcs->utf2tchar(number, strlen(number), &buf);
memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf));
- if (tclWinProcs->useWide) {
- *(WCHAR *)(namePtr + Tcl_DStringLength(&buf) + 1) = '\0';
- } else {
- namePtr[Tcl_DStringLength(&buf) + 1] = '\0';
- }
+ *(WCHAR *)(namePtr + Tcl_DStringLength(&buf) + 1) = '\0';
Tcl_DStringFree(&buf);
handle = tclWinProcs->createFileProc((TCHAR *) name,