summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclFileName.c6
-rw-r--r--generic/tclIOUtil.c4
-rw-r--r--generic/tclInt.h8
-rw-r--r--generic/tclPathObj.c67
-rw-r--r--unix/tclUnixFile.c5
-rw-r--r--win/tclWinFile.c4
6 files changed, 14 insertions, 80 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 053812e..3419d7c 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2437,8 +2437,7 @@ DoGlob(
joinedPtr = TclDStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
- Tcl_DStringLength(&append),
- TclFSPathEncoding(interp, pathPtr));
+ Tcl_DStringLength(&append));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
@@ -2471,8 +2470,7 @@ DoGlob(
if (pathPtr == NULL) {
joinedPtr = Tcl_NewStringObj(pattern, p-pattern);
} else if (flags) {
- joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern,
- TclFSPathEncoding(interp, pathPtr));
+ joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern);
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, pattern[0]) == NULL) {
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index ba9c6bc..3773159 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1225,9 +1225,7 @@ FsAddMountsToGlobResult(
len--;
}
len++; /* account for '/' in the mElt [Bug 1602539] */
-
- mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len
- , TclFSPathEncoding(NULL, pathPtr));
+ mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len);
Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
}
/*
diff --git a/generic/tclInt.h b/generic/tclInt.h
index ddc58d6..1fe3822 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3009,12 +3009,6 @@ MODULE_SCOPE double TclFloor(const mp_int *a);
MODULE_SCOPE void TclFormatNaN(double value, char *buffer);
MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
const char *attributeName, int *indexPtr);
-MODULE_SCOPE
- Tcl_Encoding TclFSPathEncoding(
- Tcl_Interp *interp,
- Tcl_Obj *pathPtr
- );
-
MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc,
@@ -3138,7 +3132,7 @@ MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
- int len, Tcl_Encoding encoding);
+ int len);
MODULE_SCOPE int TclpDeleteFile(const void *path);
MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr);
MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 9d2637c..2fa93d8 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -87,7 +87,6 @@ typedef struct FsPath {
* epoch. The epoch changes when
* filesystem-mounts are changed. */
const Tcl_Filesystem *fsPtr;/* The Tcl_Filesystem that claims this path */
- Tcl_Encoding encoding;
} FsPath;
/*
@@ -663,18 +662,9 @@ TclPathPart(
* the tail.
*/
- /*
- * We don't know that the encoding of the fileName is the
- * same as the encoding of, but that's on the caller to
- * harmonize. In any case, if the encoding doesn't match
- * at the time it the FsPath object is used, the object is
- * ignored.
- */
-
Tcl_Obj *resultPtr =
- TclNewFSPathObj(fsPathPtr->cwdPtr, fileName,
- (int)(length - strlen(extension)),
- TclFSPathEncoding(interp, fsPathPtr->cwdPtr));
+ TclNewFSPathObj(fsPathPtr->cwdPtr, fileName,
+ (int)(length - strlen(extension)));
Tcl_IncrRefCount(resultPtr);
return resultPtr;
@@ -888,7 +878,6 @@ TclJoinPath(
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[1];
-
Tcl_PathType type;
/* if forceRelative - second path is relative */
@@ -930,17 +919,14 @@ TclJoinPath(
|| (strchr(Tcl_GetString(elt), '\\') == NULL)) {
if (PATHFLAGS(elt)) {
- return TclNewFSPathObj(elt, str, len,
- TclFSPathEncoding(NULL, elt));
+ return TclNewFSPathObj(elt, str, len);
}
if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
- return TclNewFSPathObj(
- elt, str, len, TclFSPathEncoding(NULL, elt));
+ return TclNewFSPathObj(elt, str, len);
}
(void) Tcl_FSGetNormalizedPath(NULL, elt);
if (elt == PATHOBJ(elt)->normPathPtr) {
- return TclNewFSPathObj(
- elt, str, len, TclFSPathEncoding(NULL, elt));
+ return TclNewFSPathObj(elt, str, len);
}
}
}
@@ -1272,9 +1258,7 @@ Tcl_Obj *
TclNewFSPathObj(
Tcl_Obj *dirPtr,
const char *addStrRep,
- int len,
- Tcl_Encoding encoding
-)
+ int len)
{
FsPath *fsPathPtr;
Tcl_Obj *pathPtr;
@@ -1320,7 +1304,6 @@ TclNewFSPathObj(
fsPathPtr->nativePathPtr = NULL;
fsPathPtr->fsPtr = NULL;
fsPathPtr->filesystemEpoch = 0;
- fsPathPtr->encoding = encoding;
SETPATHOBJ(pathPtr, fsPathPtr);
PATHFLAGS(pathPtr) = TCLPATH_APPENDED;
@@ -2177,39 +2160,6 @@ TclFSSetPathDetails(
/*
*---------------------------------------------------------------------------
*
- * TclFSPathEncoding --
- *
- * Produce the encoding, if any, associated with a filesystem path.
- *
- * Results:
- * NULL or a valid Tcl_Encoding.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-Tcl_Encoding
-TclFSPathEncoding(
- Tcl_Interp *interp,
- Tcl_Obj *pathPtr)
-{
- FsPath *fsPathPtr;
- Tcl_Encoding encoding = NULL;
-
- if (Tcl_FSConvertToPathType(interp, pathPtr) != TCL_OK) {
- return NULL;
- }
- if (TclFetchIntRep(pathPtr, &fsPathType)) {
- fsPathPtr = PATHOBJ(pathPtr);
- encoding = fsPathPtr->encoding;
- }
- return encoding;
-}
-/*
- *---------------------------------------------------------------------------
- *
* Tcl_FSEqualPaths --
*
* This function tests whether the two paths given are equal path
@@ -2294,10 +2244,7 @@ SetFsPathFromAny(
Tcl_Obj *transPtr;
const char *name;
- Tcl_Encoding sysencoding = Tcl_GetEncoding(interp, NULL);
-
- if (TclHasIntRep(pathPtr, &fsPathType)
- && TclFSPathEncoding(interp, pathPtr) == sysencoding) {
+ if (TclHasIntRep(pathPtr, &fsPathType)) {
return TCL_OK;
}
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index fec528e..8268132 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -365,8 +365,7 @@ TclpMatchInDirectory(
* and pattern. If so, add the file to the result.
*/
-
- utfname = Tcl_ExternalToUtfDString(encoding, entryPtr->d_name, -1,
+ utfname = Tcl_ExternalToUtfDString(NULL, entryPtr->d_name, -1,
&utfDs);
if (Tcl_StringCaseMatch(utfname, pattern, 0)) {
int typeOk = 1;
@@ -381,7 +380,7 @@ TclpMatchInDirectory(
if (typeOk) {
Tcl_ListObjAppendElement(interp, resultPtr,
TclNewFSPathObj(pathPtr, utfname,
- Tcl_DStringLength(&utfDs), encoding));
+ Tcl_DStringLength(&utfDs)));
}
}
Tcl_DStringFree(&utfDs);
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index d0720ab..880adc0 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1095,7 +1095,6 @@ TclpMatchInDirectory(
const char *utfname;
int checkDrive = 0, isDrive;
DWORD attr;
- Tcl_Encoding encoding;
native = data.cFileName;
attr = data.dwFileAttributes;
@@ -1133,7 +1132,6 @@ TclpMatchInDirectory(
* the system.
*/
- encoding = Tcl_GetEncoding(interp ,NULL);
if (Tcl_StringCaseMatch(utfname, pattern, 1)) {
/*
* If the file matches, then we need to process the remainder
@@ -1152,7 +1150,7 @@ TclpMatchInDirectory(
if (NativeMatchType(isDrive, attr, native, types)) {
Tcl_ListObjAppendElement(interp, resultPtr,
TclNewFSPathObj(pathPtr, utfname,
- Tcl_DStringLength(&ds), encoding));
+ Tcl_DStringLength(&ds)));
}
}