From cf2289dd006cf8960813d308551da6f06e96d0e6 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 28 Jul 2008 21:31:13 +0000 Subject: * doc/FileSystem.3: CONSTified many functions using Tcl_FileSystem * generic/tcl.decls: which all are supposed to be a constant, but * generic/tclDecls.h: this was not reflected in the API: * generic/tclFileSystem.h: Tcl_FSGetInternalRep * generic/tclIOUtil.c: Tcl_FSNewNativePath, Tcl_FSData * generic/tclPathObj.c: Tcl_FSRegister, Tcl_FSUnregister * generic/tclTest.c: Tcl_FSGetFileSystemForPath ... This change complies with TIP #24. ***POTENTIAL INCOMPATIBILITY*** --- ChangeLog | 12 ++++ doc/FileSystem.3 | 8 +-- generic/tcl.decls | 16 ++--- generic/tclDecls.h | 32 +++++----- generic/tclFileSystem.h | 18 +++--- generic/tclIOUtil.c | 164 ++++++++++++++++++++++++------------------------ generic/tclPathObj.c | 12 ++-- generic/tclTest.c | 6 +- 8 files changed, 141 insertions(+), 127 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41d5930..0e12f05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-07-28 Jan Nijtmans + + * doc/FileSystem.3: CONSTified many functions using Tcl_FileSystem + * generic/tcl.decls: which all are supposed to be a constant, but + * generic/tclDecls.h: this was not reflected in the API: + * generic/tclFileSystem.h: Tcl_FSGetInternalRep + * generic/tclIOUtil.c: Tcl_FSNewNativePath, Tcl_FSData + * generic/tclPathObj.c: Tcl_FSRegister, Tcl_FSUnregister + * generic/tclTest.c: Tcl_FSGetFileSystemForPath ... + This change complies with TIP #24. + ***POTENTIAL INCOMPATIBILITY*** + 2008-07-28 Andreas Kupries * generic/tclBasic.c: Added missing ref count when creating an diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index bf38dc2..9201d00 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: FileSystem.3,v 1.63 2008/06/29 22:28:24 dkf Exp $ +'\" RCS: @(#) $Id: FileSystem.3,v 1.64 2008/07/28 21:31:13 nijtmans Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" @@ -27,7 +27,7 @@ ClientData void \fBTcl_FSMountsChanged\fR(\fIfsPtr\fR) .sp -Tcl_Filesystem * +const Tcl_Filesystem * \fBTcl_FSGetFileSystemForPath\fR(\fIpathPtr\fR) .sp Tcl_PathType @@ -143,7 +143,7 @@ Tcl_StatBuf * \fBTcl_AllocStatBuf\fR() .SH ARGUMENTS .AS Tcl_FSUnloadFileProc **unloadProcPtr out -.AP Tcl_Filesystem *fsPtr in +.AP "const Tcl_Filesystem" *fsPtr in Points to a structure containing the addresses of procedures that can be called to perform the various filesystem operations. .AP Tcl_Obj *pathPtr in @@ -714,7 +714,7 @@ further categorization of files. A valid list object is returned, unless the path object is not recognized, when NULL will be returned. .PP -\fBTcl_FSGetFileSystemForPath\fR returns the a pointer to the +\fBTcl_FSGetFileSystemForPath\fR returns a pointer to the \fBTcl_Filesystem\fR which accepts this path as valid. .PP If no filesystem will accept the path, NULL is returned. diff --git a/generic/tcl.decls b/generic/tcl.decls index 8fc52ac..9700497 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tcl.decls,v 1.140 2008/07/27 22:18:21 nijtmans Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.141 2008/07/28 21:31:15 nijtmans Exp $ library tcl @@ -1651,7 +1651,7 @@ declare 464 generic { } declare 465 generic { ClientData Tcl_FSGetInternalRep(Tcl_Obj* pathPtr, - Tcl_Filesystem *fsPtr) + CONST86 Tcl_Filesystem *fsPtr) } declare 466 generic { Tcl_Obj* Tcl_FSGetTranslatedPath(Tcl_Interp *interp, Tcl_Obj* pathPtr) @@ -1660,7 +1660,7 @@ declare 467 generic { int Tcl_FSEvalFile(Tcl_Interp *interp, Tcl_Obj *fileName) } declare 468 generic { - Tcl_Obj* Tcl_FSNewNativePath(Tcl_Filesystem* fromFilesystem, + Tcl_Obj* Tcl_FSNewNativePath(CONST86 Tcl_Filesystem* fromFilesystem, ClientData clientData) } declare 469 generic { @@ -1676,20 +1676,20 @@ declare 472 generic { Tcl_Obj* Tcl_FSListVolumes(void) } declare 473 generic { - int Tcl_FSRegister(ClientData clientData, Tcl_Filesystem *fsPtr) + int Tcl_FSRegister(ClientData clientData, CONST86 Tcl_Filesystem *fsPtr) } declare 474 generic { - int Tcl_FSUnregister(Tcl_Filesystem *fsPtr) + int Tcl_FSUnregister(CONST86 Tcl_Filesystem *fsPtr) } declare 475 generic { - ClientData Tcl_FSData(Tcl_Filesystem *fsPtr) + ClientData Tcl_FSData(CONST86 Tcl_Filesystem *fsPtr) } declare 476 generic { CONST char* Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp, Tcl_Obj* pathPtr) } declare 477 generic { - Tcl_Filesystem* Tcl_FSGetFileSystemForPath(Tcl_Obj* pathPtr) + CONST86_RETURN Tcl_Filesystem* Tcl_FSGetFileSystemForPath(Tcl_Obj* pathPtr) } declare 478 generic { Tcl_PathType Tcl_FSGetPathType(Tcl_Obj *pathPtr) @@ -1699,7 +1699,7 @@ declare 479 generic { int Tcl_OutputBuffered(Tcl_Channel chan) } declare 480 generic { - void Tcl_FSMountsChanged(Tcl_Filesystem *fsPtr) + void Tcl_FSMountsChanged(CONST86 Tcl_Filesystem *fsPtr) } # New function due to TIP#56 declare 481 generic { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 880e40c..138911f 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.142 2008/07/27 22:18:23 nijtmans Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.143 2008/07/28 21:31:21 nijtmans Exp $ */ #ifndef _TCLDECLS @@ -2827,7 +2827,7 @@ EXTERN Tcl_Obj* Tcl_FSJoinToPath (Tcl_Obj * pathPtr, int objc, #define Tcl_FSGetInternalRep_TCL_DECLARED /* 465 */ EXTERN ClientData Tcl_FSGetInternalRep (Tcl_Obj* pathPtr, - Tcl_Filesystem * fsPtr); + CONST86 Tcl_Filesystem * fsPtr); #endif #ifndef Tcl_FSGetTranslatedPath_TCL_DECLARED #define Tcl_FSGetTranslatedPath_TCL_DECLARED @@ -2844,7 +2844,8 @@ EXTERN int Tcl_FSEvalFile (Tcl_Interp * interp, #ifndef Tcl_FSNewNativePath_TCL_DECLARED #define Tcl_FSNewNativePath_TCL_DECLARED /* 468 */ -EXTERN Tcl_Obj* Tcl_FSNewNativePath (Tcl_Filesystem* fromFilesystem, +EXTERN Tcl_Obj* Tcl_FSNewNativePath ( + CONST86 Tcl_Filesystem* fromFilesystem, ClientData clientData); #endif #ifndef Tcl_FSGetNativePath_TCL_DECLARED @@ -2871,17 +2872,17 @@ EXTERN Tcl_Obj* Tcl_FSListVolumes (void); #define Tcl_FSRegister_TCL_DECLARED /* 473 */ EXTERN int Tcl_FSRegister (ClientData clientData, - Tcl_Filesystem * fsPtr); + CONST86 Tcl_Filesystem * fsPtr); #endif #ifndef Tcl_FSUnregister_TCL_DECLARED #define Tcl_FSUnregister_TCL_DECLARED /* 474 */ -EXTERN int Tcl_FSUnregister (Tcl_Filesystem * fsPtr); +EXTERN int Tcl_FSUnregister (CONST86 Tcl_Filesystem * fsPtr); #endif #ifndef Tcl_FSData_TCL_DECLARED #define Tcl_FSData_TCL_DECLARED /* 475 */ -EXTERN ClientData Tcl_FSData (Tcl_Filesystem * fsPtr); +EXTERN ClientData Tcl_FSData (CONST86 Tcl_Filesystem * fsPtr); #endif #ifndef Tcl_FSGetTranslatedStringPath_TCL_DECLARED #define Tcl_FSGetTranslatedStringPath_TCL_DECLARED @@ -2892,7 +2893,8 @@ EXTERN CONST char* Tcl_FSGetTranslatedStringPath (Tcl_Interp * interp, #ifndef Tcl_FSGetFileSystemForPath_TCL_DECLARED #define Tcl_FSGetFileSystemForPath_TCL_DECLARED /* 477 */ -EXTERN Tcl_Filesystem* Tcl_FSGetFileSystemForPath (Tcl_Obj* pathPtr); +EXTERN CONST86_RETURN Tcl_Filesystem* Tcl_FSGetFileSystemForPath ( + Tcl_Obj* pathPtr); #endif #ifndef Tcl_FSGetPathType_TCL_DECLARED #define Tcl_FSGetPathType_TCL_DECLARED @@ -2907,7 +2909,7 @@ EXTERN int Tcl_OutputBuffered (Tcl_Channel chan); #ifndef Tcl_FSMountsChanged_TCL_DECLARED #define Tcl_FSMountsChanged_TCL_DECLARED /* 480 */ -EXTERN void Tcl_FSMountsChanged (Tcl_Filesystem * fsPtr); +EXTERN void Tcl_FSMountsChanged (CONST86 Tcl_Filesystem * fsPtr); #endif #ifndef Tcl_EvalTokensStandard_TCL_DECLARED #define Tcl_EvalTokensStandard_TCL_DECLARED @@ -4089,22 +4091,22 @@ typedef struct TclStubs { int (*tcl_FSEqualPaths) (Tcl_Obj* firstPtr, Tcl_Obj* secondPtr); /* 462 */ Tcl_Obj* (*tcl_FSGetNormalizedPath) (Tcl_Interp * interp, Tcl_Obj* pathPtr); /* 463 */ Tcl_Obj* (*tcl_FSJoinToPath) (Tcl_Obj * pathPtr, int objc, Tcl_Obj *CONST objv[]); /* 464 */ - ClientData (*tcl_FSGetInternalRep) (Tcl_Obj* pathPtr, Tcl_Filesystem * fsPtr); /* 465 */ + ClientData (*tcl_FSGetInternalRep) (Tcl_Obj* pathPtr, CONST86 Tcl_Filesystem * fsPtr); /* 465 */ Tcl_Obj* (*tcl_FSGetTranslatedPath) (Tcl_Interp * interp, Tcl_Obj* pathPtr); /* 466 */ int (*tcl_FSEvalFile) (Tcl_Interp * interp, Tcl_Obj * fileName); /* 467 */ - Tcl_Obj* (*tcl_FSNewNativePath) (Tcl_Filesystem* fromFilesystem, ClientData clientData); /* 468 */ + Tcl_Obj* (*tcl_FSNewNativePath) (CONST86 Tcl_Filesystem* fromFilesystem, ClientData clientData); /* 468 */ CONST char* (*tcl_FSGetNativePath) (Tcl_Obj* pathPtr); /* 469 */ Tcl_Obj* (*tcl_FSFileSystemInfo) (Tcl_Obj* pathPtr); /* 470 */ Tcl_Obj* (*tcl_FSPathSeparator) (Tcl_Obj* pathPtr); /* 471 */ Tcl_Obj* (*tcl_FSListVolumes) (void); /* 472 */ - int (*tcl_FSRegister) (ClientData clientData, Tcl_Filesystem * fsPtr); /* 473 */ - int (*tcl_FSUnregister) (Tcl_Filesystem * fsPtr); /* 474 */ - ClientData (*tcl_FSData) (Tcl_Filesystem * fsPtr); /* 475 */ + int (*tcl_FSRegister) (ClientData clientData, CONST86 Tcl_Filesystem * fsPtr); /* 473 */ + int (*tcl_FSUnregister) (CONST86 Tcl_Filesystem * fsPtr); /* 474 */ + ClientData (*tcl_FSData) (CONST86 Tcl_Filesystem * fsPtr); /* 475 */ CONST char* (*tcl_FSGetTranslatedStringPath) (Tcl_Interp * interp, Tcl_Obj* pathPtr); /* 476 */ - Tcl_Filesystem* (*tcl_FSGetFileSystemForPath) (Tcl_Obj* pathPtr); /* 477 */ + CONST86_RETURN Tcl_Filesystem* (*tcl_FSGetFileSystemForPath) (Tcl_Obj* pathPtr); /* 477 */ Tcl_PathType (*tcl_FSGetPathType) (Tcl_Obj * pathPtr); /* 478 */ int (*tcl_OutputBuffered) (Tcl_Channel chan); /* 479 */ - void (*tcl_FSMountsChanged) (Tcl_Filesystem * fsPtr); /* 480 */ + void (*tcl_FSMountsChanged) (CONST86 Tcl_Filesystem * fsPtr); /* 480 */ int (*tcl_EvalTokensStandard) (Tcl_Interp * interp, Tcl_Token * tokenPtr, int count); /* 481 */ void (*tcl_GetTime) (Tcl_Time* timeBuf); /* 482 */ Tcl_Trace (*tcl_CreateObjTrace) (Tcl_Interp* interp, int level, int flags, Tcl_CmdObjTraceProc* objProc, ClientData clientData, Tcl_CmdObjTraceDeleteProc* delProc); /* 483 */ diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h index fee4d6e..b9ca8b9 100644 --- a/generic/tclFileSystem.h +++ b/generic/tclFileSystem.h @@ -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: tclFileSystem.h,v 1.12 2008/05/02 10:27:07 dkf Exp $ + * RCS: @(#) $Id: tclFileSystem.h,v 1.13 2008/07/28 21:31:21 nijtmans Exp $ */ #ifndef _TCLFILESYSTEM @@ -29,7 +29,7 @@ typedef struct FilesystemRecord { ClientData clientData; /* Client specific data for the new filesystem * (can be NULL) */ - Tcl_Filesystem *fsPtr; /* Pointer to filesystem dispatch table. */ + const Tcl_Filesystem *fsPtr; /* Pointer to filesystem dispatch table. */ int fileRefCount; /* How many Tcl_Obj's use this filesystem. */ struct FilesystemRecord *nextPtr; /* The next filesystem registered to Tcl, or @@ -72,11 +72,11 @@ MODULE_SCOPE int TclFSNormalizeToUniquePath(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclFSMakePathRelative(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_Obj *cwdPtr); MODULE_SCOPE Tcl_Obj * TclFSInternalToNormalized( - Tcl_Filesystem *fromFilesystem, + const Tcl_Filesystem *fromFilesystem, ClientData clientData, FilesystemRecord **fsRecPtrPtr); MODULE_SCOPE int TclFSEnsureEpochOk(Tcl_Obj *pathPtr, - Tcl_Filesystem **fsPtrPtr); + const Tcl_Filesystem **fsPtrPtr); MODULE_SCOPE void TclFSSetPathDetails(Tcl_Obj *pathPtr, FilesystemRecord *fsRecPtr, ClientData clientData); @@ -87,7 +87,7 @@ MODULE_SCOPE Tcl_Obj * TclFSNormalizeAbsolutePath(Tcl_Interp *interp, * Private shared variables for use by tclIOUtil.c and tclPathObj.c */ -MODULE_SCOPE Tcl_Filesystem tclNativeFilesystem; +MODULE_SCOPE const Tcl_Filesystem tclNativeFilesystem; MODULE_SCOPE Tcl_ThreadDataKey tclFsDataKey; /* @@ -96,13 +96,13 @@ MODULE_SCOPE Tcl_ThreadDataKey tclFsDataKey; */ MODULE_SCOPE Tcl_PathType TclFSGetPathType(Tcl_Obj *pathPtr, - Tcl_Filesystem **filesystemPtrPtr, + const Tcl_Filesystem **filesystemPtrPtr, int *driveNameLengthPtr); MODULE_SCOPE Tcl_PathType TclFSNonnativePathType(const char *pathPtr, - int pathLen, Tcl_Filesystem **filesystemPtrPtr, + int pathLen, const Tcl_Filesystem **filesystemPtrPtr, int *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE Tcl_PathType TclGetPathType(Tcl_Obj *pathPtr, - Tcl_Filesystem **filesystemPtrPtr, + const Tcl_Filesystem **filesystemPtrPtr, int *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE int TclFSEpochOk(int filesystemEpoch); MODULE_SCOPE int TclFSCwdIsNative(void); @@ -113,7 +113,7 @@ MODULE_SCOPE Tcl_FSPathInFilesystemProc TclNativePathInFilesystem; MODULE_SCOPE Tcl_FSCreateInternalRepProc TclNativeCreateNativeRep; #endif /* _TCLFILESYSTEM */ - + /* * Local Variables: * mode: c diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 89465a0..93bdc4b 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.154 2008/05/02 10:27:07 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.155 2008/07/28 21:31:15 nijtmans Exp $ */ #include "tclInt.h" @@ -57,7 +57,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; * removed in a future release (Tcl 9 would be a good time). */ - + /* Obsolete */ int Tcl_Stat( @@ -148,7 +148,7 @@ Tcl_Stat( } return ret; } - + /* Obsolete */ int Tcl_Access( @@ -164,7 +164,7 @@ Tcl_Access( return ret; } - + /* Obsolete */ Tcl_Channel Tcl_OpenFileChannel( @@ -185,7 +185,7 @@ Tcl_OpenFileChannel( return ret; } - + /* Obsolete */ int Tcl_Chdir( @@ -198,7 +198,7 @@ Tcl_Chdir( Tcl_DecrRefCount(pathPtr); return ret; } - + /* Obsolete */ char * Tcl_GetCwd( @@ -215,7 +215,7 @@ Tcl_GetCwd( Tcl_DecrRefCount(cwd); return Tcl_DStringValue(cwdPtr); } - + /* Obsolete */ int Tcl_EvalFile( @@ -231,7 +231,7 @@ Tcl_EvalFile( Tcl_DecrRefCount(pathPtr); return ret; } - + /* * The 3 hooks for Stat, Access and OpenFileChannel are obsolete. The * complete, general hooked filesystem APIs should be used instead. This @@ -245,7 +245,7 @@ Tcl_EvalFile( * support, I suggest all these hooks are removed. */ - + /* * Declare the native filesystem support. These functions should be considered @@ -301,7 +301,7 @@ Tcl_FSListVolumesProc TclpObjListVolumes; * delving inside here! */ -Tcl_Filesystem tclNativeFilesystem = { +const Tcl_Filesystem tclNativeFilesystem = { "native", sizeof(Tcl_Filesystem), TCL_FILESYSTEM_VERSION_2, @@ -408,7 +408,7 @@ typedef struct FsDivertLoad { const Tcl_Filesystem *divertedFilesystem; ClientData divertedFileNativeRep; } FsDivertLoad; - + /* * Now move on to the basic filesystem implementation */ @@ -446,7 +446,7 @@ FsThrExitProc( } tsdPtr->initialized = 0; } - + int TclFSCwdIsNative(void) { @@ -458,7 +458,7 @@ TclFSCwdIsNative(void) return 0; } } - + /* *---------------------------------------------------------------------- * @@ -542,7 +542,7 @@ TclFSCwdPointerEquals( } } } - + #ifdef TCL_THREADS static void FsRecacheFilesystemList(void) @@ -604,7 +604,7 @@ FsRecacheFilesystemList(void) } } #endif /* TCL_THREADS */ - + static FilesystemRecord * FsGetFirstFilesystem(void) { @@ -626,7 +626,7 @@ FsGetFirstFilesystem(void) #endif return fsRecPtr; } - + /* * The epoch can be changed both by filesystems being added or removed and by * env(HOME) changing. @@ -640,7 +640,7 @@ TclFSEpochOk( (void) FsGetFirstFilesystem(); return (filesystemEpoch == tsdPtr->filesystemEpoch); } - + /* * If non-NULL, clientData is owned by us and must be freed later. */ @@ -699,7 +699,7 @@ FsUpdateCwd( Tcl_IncrRefCount(tsdPtr->cwdPathPtr); } } - + /* *---------------------------------------------------------------------- * @@ -771,7 +771,7 @@ TclFinalizeFilesystem(void) TclWinEncodingsCleanup(); #endif } - + /* *---------------------------------------------------------------------- * @@ -807,7 +807,7 @@ TclResetFilesystem(void) TclWinResetInterfaces(); #endif } - + /* *---------------------------------------------------------------------- * @@ -841,7 +841,7 @@ TclResetFilesystem(void) int Tcl_FSRegister( ClientData clientData, /* Client specific data for this fs */ - Tcl_Filesystem *fsPtr) /* The filesystem record for the new fs. */ + const Tcl_Filesystem *fsPtr) /* The filesystem record for the new fs. */ { FilesystemRecord *newFilesystemPtr; @@ -893,7 +893,7 @@ Tcl_FSRegister( return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -920,7 +920,7 @@ Tcl_FSRegister( int Tcl_FSUnregister( - Tcl_Filesystem *fsPtr) /* The filesystem record to remove. */ + const Tcl_Filesystem *fsPtr) /* The filesystem record to remove. */ { int retVal = TCL_ERROR; FilesystemRecord *fsRecPtr; @@ -969,7 +969,7 @@ Tcl_FSUnregister( Tcl_MutexUnlock(&filesystemMutex); return retVal; } - + /* *---------------------------------------------------------------------- * @@ -1115,7 +1115,7 @@ Tcl_FSMatchInDirectory( Tcl_DecrRefCount(cwd); return ret; } - + /* *---------------------------------------------------------------------- * @@ -1220,7 +1220,7 @@ FsAddMountsToGlobResult( endOfMounts: Tcl_DecrRefCount(mounts); } - + /* *---------------------------------------------------------------------- * @@ -1270,7 +1270,7 @@ FsAddMountsToGlobResult( void Tcl_FSMountsChanged( - Tcl_Filesystem *fsPtr) + const Tcl_Filesystem *fsPtr) { /* * We currently don't do anything with this parameter. We could in the @@ -1289,7 +1289,7 @@ Tcl_FSMountsChanged( theFilesystemEpoch++; Tcl_MutexUnlock(&filesystemMutex); } - + /* *---------------------------------------------------------------------- * @@ -1311,7 +1311,7 @@ Tcl_FSMountsChanged( ClientData Tcl_FSData( - Tcl_Filesystem *fsPtr) /* The filesystem record to query. */ + const Tcl_Filesystem *fsPtr) /* The filesystem record to query. */ { ClientData retVal = NULL; FilesystemRecord *fsRecPtr = FsGetFirstFilesystem(); @@ -1331,7 +1331,7 @@ Tcl_FSData( return retVal; } - + /* *--------------------------------------------------------------------------- * @@ -1424,7 +1424,7 @@ TclFSNormalizeToUniquePath( return startAt; } - + /* *--------------------------------------------------------------------------- * @@ -1454,7 +1454,7 @@ TclGetOpenMode( int binary = 0; return TclGetOpenModeEx(interp, modeString, seekFlagPtr, &binary); } - + /* *--------------------------------------------------------------------------- * @@ -1661,7 +1661,7 @@ TclGetOpenModeEx( } return mode; } - + /* * Tcl_FSEvalFile is Tcl_FSEvalFileEx without encoding argument. */ @@ -1674,7 +1674,7 @@ Tcl_FSEvalFile( { return Tcl_FSEvalFileEx(interp, pathPtr, NULL); } - + /* *---------------------------------------------------------------------- * @@ -1807,7 +1807,7 @@ Tcl_FSEvalFileEx( Tcl_DecrRefCount(objPtr); return result; } - + /* *---------------------------------------------------------------------- * @@ -1837,7 +1837,7 @@ Tcl_GetErrno(void) return errno; } - + /* *---------------------------------------------------------------------- * @@ -1865,7 +1865,7 @@ Tcl_SetErrno( errno = err; } - + /* *---------------------------------------------------------------------- * @@ -1899,7 +1899,7 @@ Tcl_PosixError( } return msg; } - + /* *---------------------------------------------------------------------- * @@ -1932,7 +1932,7 @@ Tcl_FSStat( Tcl_SetErrno(ENOENT); return -1; } - + /* *---------------------------------------------------------------------- * @@ -1970,7 +1970,7 @@ Tcl_FSLstat( Tcl_SetErrno(ENOENT); return -1; } - + /* *---------------------------------------------------------------------- * @@ -2001,7 +2001,7 @@ Tcl_FSAccess( Tcl_SetErrno(ENOENT); return -1; } - + /* *---------------------------------------------------------------------- * @@ -2097,7 +2097,7 @@ Tcl_FSOpenFileChannel( } return NULL; } - + /* *---------------------------------------------------------------------- * @@ -2129,7 +2129,7 @@ Tcl_FSUtime( /* TODO: set errno here? Tcl_SetErrno(ENOENT); */ return -1; } - + /* *---------------------------------------------------------------------- * @@ -2157,7 +2157,7 @@ NativeFileAttrStrings( { return tclpFileAttrStrings; } - + /* *---------------------------------------------------------------------- * @@ -2190,7 +2190,7 @@ NativeFileAttrsGet( return (*tclpFileAttrProcs[index].getProc)(interp, index, pathPtr, objPtrRef); } - + /* *---------------------------------------------------------------------- * @@ -2219,7 +2219,7 @@ NativeFileAttrsSet( { return (*tclpFileAttrProcs[index].setProc)(interp, index, pathPtr, objPtr); } - + /* *---------------------------------------------------------------------- * @@ -2257,7 +2257,7 @@ Tcl_FSFileAttrStrings( Tcl_SetErrno(ENOENT); return NULL; } - + /* *---------------------------------------------------------------------- * @@ -2334,7 +2334,7 @@ TclFSFileAttrIndex( return TCL_ERROR; } } - + /* *---------------------------------------------------------------------- * @@ -2371,7 +2371,7 @@ Tcl_FSFileAttrsGet( Tcl_SetErrno(ENOENT); return -1; } - + /* *---------------------------------------------------------------------- * @@ -2405,7 +2405,7 @@ Tcl_FSFileAttrsSet( Tcl_SetErrno(ENOENT); return -1; } - + /* *---------------------------------------------------------------------- * @@ -2667,7 +2667,7 @@ Tcl_FSGetCwd( return tsdPtr->cwdPathPtr; } - + /* *---------------------------------------------------------------------- * @@ -2815,7 +2815,7 @@ Tcl_FSChdir( return retVal; } - + /* *---------------------------------------------------------------------- * @@ -2898,7 +2898,7 @@ Tcl_FSLoadFile( *handlePtr = clientData; return res; } - + /* *---------------------------------------------------------------------- * @@ -2957,7 +2957,7 @@ TclLoadFile( * file. */ { const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); - Tcl_Filesystem *copyFsPtr; + const Tcl_Filesystem *copyFsPtr; Tcl_Obj *copyToPtr; Tcl_LoadHandle newLoadHandle = NULL; ClientData newClientData = NULL; @@ -3265,7 +3265,7 @@ TclpLoadFile( *proc2Ptr = TclpFindSymbol(interp, handle, sym2); return TCL_OK; } - + /* *--------------------------------------------------------------------------- * @@ -3358,7 +3358,7 @@ FSUnloadTempFile( ckfree((char *) tvdlPtr); } - + /* *--------------------------------------------------------------------------- * @@ -3419,7 +3419,7 @@ Tcl_FSLink( #endif /* S_IFLNK */ return NULL; } - + /* *--------------------------------------------------------------------------- * @@ -3473,7 +3473,7 @@ Tcl_FSListVolumes(void) return resultPtr; } - + /* *--------------------------------------------------------------------------- * @@ -3523,7 +3523,7 @@ FsListMounts( return resultPtr; } - + /* *--------------------------------------------------------------------------- * @@ -3550,7 +3550,7 @@ Tcl_FSSplitPath( int *lenPtr) /* int to store number of path elements. */ { Tcl_Obj *result = NULL; /* Needed only to prevent gcc warnings. */ - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; char separator = '/'; int driveNameLength; char *p; @@ -3631,11 +3631,11 @@ Tcl_FSSplitPath( } return result; } - + /* Simple helper function */ Tcl_Obj * TclFSInternalToNormalized( - Tcl_Filesystem *fromFilesystem, + const Tcl_Filesystem *fromFilesystem, ClientData clientData, FilesystemRecord **fsRecPtrPtr) { @@ -3655,7 +3655,7 @@ TclFSInternalToNormalized( } return (*fromFilesystem->internalToNormalizedProc)(clientData); } - + /* *---------------------------------------------------------------------- * @@ -3678,7 +3678,7 @@ TclFSInternalToNormalized( Tcl_PathType TclGetPathType( Tcl_Obj *pathPtr, /* Path to determine type for */ - Tcl_Filesystem **filesystemPtrPtr, + const Tcl_Filesystem **filesystemPtrPtr, /* If absolute path and this is not NULL, then * set to the filesystem which claims this * path. */ @@ -3707,7 +3707,7 @@ TclGetPathType( } return type; } - + /* *---------------------------------------------------------------------- * @@ -3734,7 +3734,7 @@ Tcl_PathType TclFSNonnativePathType( const char *path, /* Path to determine type for */ int pathLen, /* Length of the path */ - Tcl_Filesystem **filesystemPtrPtr, + const Tcl_Filesystem **filesystemPtrPtr, /* If absolute path and this is not NULL, then * set to the filesystem which claims this * path. */ @@ -3837,7 +3837,7 @@ TclFSNonnativePathType( } return type; } - + /* *--------------------------------------------------------------------------- * @@ -3878,7 +3878,7 @@ Tcl_FSRenameFile( } return retVal; } - + /* *--------------------------------------------------------------------------- * @@ -3920,7 +3920,7 @@ Tcl_FSCopyFile( } return retVal; } - + /* *--------------------------------------------------------------------------- * @@ -3998,7 +3998,7 @@ TclCrossFilesystemCopy( done: return result; } - + /* *--------------------------------------------------------------------------- * @@ -4028,7 +4028,7 @@ Tcl_FSDeleteFile( Tcl_SetErrno(ENOENT); return -1; } - + /* *--------------------------------------------------------------------------- * @@ -4058,7 +4058,7 @@ Tcl_FSCreateDirectory( Tcl_SetErrno(ENOENT); return -1; } - + /* *--------------------------------------------------------------------------- * @@ -4100,7 +4100,7 @@ Tcl_FSCopyDirectory( } return retVal; } - + /* *--------------------------------------------------------------------------- * @@ -4170,7 +4170,7 @@ Tcl_FSRemoveDirectory( Tcl_SetErrno(ENOENT); return -1; } - + /* *--------------------------------------------------------------------------- * @@ -4190,12 +4190,12 @@ Tcl_FSRemoveDirectory( *--------------------------------------------------------------------------- */ -Tcl_Filesystem * +const Tcl_Filesystem * Tcl_FSGetFileSystemForPath( Tcl_Obj *pathPtr) { FilesystemRecord *fsRecPtr; - Tcl_Filesystem *retVal = NULL; + const Tcl_Filesystem *retVal = NULL; if (pathPtr == NULL) { Tcl_Panic("Tcl_FSGetFileSystemForPath called with NULL object"); @@ -4253,7 +4253,7 @@ Tcl_FSGetFileSystemForPath( return NULL; } - + /* *--------------------------------------------------------------------------- * @@ -4289,7 +4289,7 @@ Tcl_FSGetNativePath( { return (const char *) Tcl_FSGetInternalRep(pathPtr, &tclNativeFilesystem); } - + /* *--------------------------------------------------------------------------- * @@ -4312,7 +4312,7 @@ NativeFreeInternalRep( { ckfree((char *) clientData); } - + /* *--------------------------------------------------------------------------- * @@ -4356,7 +4356,7 @@ Tcl_FSFileSystemInfo( return resPtr; } - + /* *--------------------------------------------------------------------------- * @@ -4399,7 +4399,7 @@ Tcl_FSPathSeparator( return resultObj; } } - + /* *--------------------------------------------------------------------------- * @@ -4433,7 +4433,7 @@ NativeFilesystemSeparator( return Tcl_NewStringObj(separator,1); } - + /* * Local Variables: * mode: c diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 475bf7f..1ac1496 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.72 2008/06/29 19:09:28 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.73 2008/07/28 21:31:19 nijtmans Exp $ */ #include "tclInt.h" @@ -492,7 +492,7 @@ Tcl_FSGetPathType( Tcl_PathType TclFSGetPathType( Tcl_Obj *pathPtr, - Tcl_Filesystem **filesystemPtrPtr, + const Tcl_Filesystem **filesystemPtrPtr, int *driveNameLengthPtr) { FsPath *fsPathPtr; @@ -809,7 +809,7 @@ Tcl_FSJoinPath( { Tcl_Obj *res; int i; - Tcl_Filesystem *fsPtr = NULL; + const Tcl_Filesystem *fsPtr = NULL; if (elements < 0) { if (Tcl_ListObjLength(NULL, listObj, &elements) != TCL_OK) { @@ -1511,7 +1511,7 @@ TclFSMakePathFromNormalized( Tcl_Obj * Tcl_FSNewNativePath( - Tcl_Filesystem *fromFilesystem, + const Tcl_Filesystem *fromFilesystem, ClientData clientData) { Tcl_Obj *pathPtr; @@ -2026,7 +2026,7 @@ Tcl_FSGetNormalizedPath( ClientData Tcl_FSGetInternalRep( Tcl_Obj *pathPtr, - Tcl_Filesystem *fsPtr) + const Tcl_Filesystem *fsPtr) { FsPath *srcFsPathPtr; @@ -2128,7 +2128,7 @@ Tcl_FSGetInternalRep( int TclFSEnsureEpochOk( Tcl_Obj *pathPtr, - Tcl_Filesystem **fsPtrPtr) + const Tcl_Filesystem **fsPtrPtr) { FsPath *srcFsPathPtr; diff --git a/generic/tclTest.c b/generic/tclTest.c index 3d6e2fb..3052cc9 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.117 2008/07/21 21:25:21 nijtmans Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.118 2008/07/28 21:31:19 nijtmans Exp $ */ #define TCL_TEST @@ -403,7 +403,7 @@ static int TestHashSystemHashCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static Tcl_Filesystem testReportingFilesystem = { +static const Tcl_Filesystem testReportingFilesystem = { "reporting", sizeof(Tcl_Filesystem), TCL_FILESYSTEM_VERSION_1, @@ -437,7 +437,7 @@ static Tcl_Filesystem testReportingFilesystem = { &TestReportChdir }; -static Tcl_Filesystem simpleFilesystem = { +static const Tcl_Filesystem simpleFilesystem = { "simple", sizeof(Tcl_Filesystem), TCL_FILESYSTEM_VERSION_1, -- cgit v0.12