summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-05 21:35:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-05 21:35:10 (GMT)
commit2dad23ad65d5cf76fa7e2516a6702a8a6ff34723 (patch)
tree0b80be8eba412258b3fa4c109b6b554863d27378 /win
parenteee14742522aed25744851879c80a96134de7369 (diff)
downloadtcl-2dad23ad65d5cf76fa7e2516a6702a8a6ff34723.zip
tcl-2dad23ad65d5cf76fa7e2516a6702a8a6ff34723.tar.gz
tcl-2dad23ad65d5cf76fa7e2516a6702a8a6ff34723.tar.bz2
More size_t-related consolidations. Now regexp can handle strings >2GB and more. Remove many type-casts which are not necessary any more.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFCmd.c13
-rw-r--r--win/tclWinFile.c10
-rw-r--r--win/tclWinInit.c2
-rw-r--r--win/tclWinPipe.c2
4 files changed, 15 insertions, 12 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index d281c22..1465549 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -1524,8 +1524,8 @@ GetWinFileAttributes(
* We test for, and fix that case, here.
*/
- const char *str = TclGetString(fileName);
- size_t len = fileName->length;
+ size_t len;
+ const char *str = TclGetStringFromObj(fileName, &len);
if (len < 4) {
if (len == 0) {
@@ -1586,6 +1586,7 @@ ConvertFileNameFormat(
{
int pathc, i;
Tcl_Obj *splitPath;
+ size_t length;
splitPath = Tcl_FSSplitPath(fileName, &pathc);
@@ -1613,8 +1614,8 @@ ConvertFileNameFormat(
Tcl_ListObjIndex(NULL, splitPath, i, &elt);
- pathv = TclGetString(elt);
- if ((pathv[0] == '/') || ((elt->length == 3) && (pathv[1] == ':'))
+ pathv = TclGetStringFromObj(elt, &length);
+ if ((pathv[0] == '/') || ((length == 3) && (pathv[1] == ':'))
|| (strcmp(pathv, ".") == 0) || (strcmp(pathv, "..") == 0)) {
/*
* Handle "/", "//machine/export", "c:/", "." or ".." by just
@@ -1649,8 +1650,8 @@ ConvertFileNameFormat(
* likely to lead to infinite loops.
*/
- tempString = TclGetString(tempPath);
- nativeName = Tcl_WinUtfToTChar(tempString, tempPath->length, &ds);
+ tempString = TclGetStringFromObj(tempPath, &length);
+ nativeName = Tcl_WinUtfToTChar(tempString, length, &ds);
Tcl_DecrRefCount(tempPath);
handle = FindFirstFile(nativeName, &data);
if (handle == INVALID_HANDLE_VALUE) {
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 7ff8b9b..3910f3d 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -913,7 +913,8 @@ TclpMatchInDirectory(
DWORD attr;
WIN32_FILE_ATTRIBUTE_DATA data;
- const char *str = TclGetString(norm);
+ size_t length;
+ const char *str = TclGetStringFromObj(norm, &length);
native = Tcl_FSGetNativePath(pathPtr);
@@ -923,7 +924,7 @@ TclpMatchInDirectory(
}
attr = data.dwFileAttributes;
- if (NativeMatchType(WinIsDrive(str,norm->length), attr, native, types)) {
+ if (NativeMatchType(WinIsDrive(str, length), attr, native, types)) {
Tcl_ListObjAppendElement(interp, resultPtr, pathPtr);
}
}
@@ -2733,12 +2734,13 @@ TclpObjNormalizePath(
char *path;
Tcl_Obj *tmpPathPtr;
+ size_t length;
tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
nextCheckpoint);
Tcl_AppendToObj(tmpPathPtr, lastValidPathEnd, -1);
- path = TclGetString(tmpPathPtr);
- Tcl_SetStringObj(pathPtr, path, tmpPathPtr->length);
+ path = TclGetStringFromObj(tmpPathPtr, &length);
+ Tcl_SetStringObj(pathPtr, path, length);
Tcl_DecrRefCount(tmpPathPtr);
} else {
/*
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index e7ecd72..80bb210 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -268,7 +268,7 @@ AppendEnvironment(
for (shortlib = (char *) &lib[strlen(lib)-1]; shortlib>lib ; shortlib--) {
if (*shortlib == '/') {
- if ((unsigned)(shortlib - lib) == strlen(lib) - 1) {
+ if ((size_t)(shortlib - lib) == strlen(lib) - 1) {
Tcl_Panic("last character in lib cannot be '/'");
}
shortlib++;
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index bd97c6c..5d0004d 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -1834,7 +1834,7 @@ TclGetAndDetachPids(
TclNewObj(pidsObj);
for (i = 0; i < pipePtr->numPids; i++) {
Tcl_ListObjAppendElement(NULL, pidsObj,
- Tcl_NewWideIntObj((unsigned)
+ Tcl_NewWideIntObj(
TclpGetPid(pipePtr->pidPtr[i])));
Tcl_DetachPids(1, &pipePtr->pidPtr[i]);
}