diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-24 16:16:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-24 16:16:53 (GMT) |
commit | ec4cf7a9950b3987b1736ee072b787c0b5494d7f (patch) | |
tree | f5f5977b8f48b84ef038bc6fbcf19f85b81dd85b /win/tclWinFile.c | |
parent | 9c802c440b678f7596b6167240964a4e5320565b (diff) | |
download | tcl-ec4cf7a9950b3987b1736ee072b787c0b5494d7f.zip tcl-ec4cf7a9950b3987b1736ee072b787c0b5494d7f.tar.gz tcl-ec4cf7a9950b3987b1736ee072b787c0b5494d7f.tar.bz2 |
Use some more TCL_INDEX_NONE and Tcl_Size
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 16c1d59..7e0a763 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -170,7 +170,7 @@ static int NativeWriteReparse(const WCHAR *LinkDirectory, static int NativeMatchType(int isDrive, DWORD attr, const WCHAR *nativeName, Tcl_GlobTypeData *types); static int WinIsDrive(const char *name, size_t nameLen); -static int WinIsReserved(const char *path); +static Tcl_Size WinIsReserved(const char *path); static Tcl_Obj * WinReadLink(const WCHAR *LinkSource); static Tcl_Obj * WinReadLinkDirectory(const WCHAR *LinkDirectory); static int WinLink(const WCHAR *LinkSource, @@ -938,9 +938,9 @@ TclpMatchInDirectory( * Match a single file directly. */ - int len; DWORD attr; WIN32_FILE_ATTRIBUTE_DATA data; + Tcl_Size len = 0; const char *str = TclGetStringFromObj(norm, &len); native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr); @@ -951,7 +951,7 @@ TclpMatchInDirectory( } attr = data.dwFileAttributes; - if (NativeMatchType(WinIsDrive(str,len), attr, native, types)) { + if (NativeMatchType(WinIsDrive(str, len), attr, native, types)) { Tcl_ListObjAppendElement(interp, resultPtr, pathPtr); } } @@ -962,7 +962,7 @@ TclpMatchInDirectory( WIN32_FIND_DATAW data; const char *dirName; /* UTF-8 dir name, later with pattern * appended. */ - int dirLength; + Tcl_Size dirLength; int matchSpecialDots; Tcl_DString ds; /* Native encoding of dir, also used * temporarily for other things. */ @@ -1030,7 +1030,7 @@ TclpMatchInDirectory( } Tcl_DStringInit(&ds); - native = Tcl_UtfToWCharDString(dirName, -1, &ds); + native = Tcl_UtfToWCharDString(dirName, TCL_INDEX_NONE, &ds); if ((types == NULL) || (types->type != TCL_GLOB_TYPE_DIR)) { handle = FindFirstFileW(native, &data); } else { @@ -1245,7 +1245,7 @@ WinIsDrive( * (not any trailing :). */ -static int +static Tcl_Size WinIsReserved( const char *path) /* Path in UTF-8 */ { @@ -1477,7 +1477,7 @@ TclpGetUserHome( Tcl_DStringFree(&ds); } else { Tcl_DStringInit(&ds); - wName = Tcl_UtfToWCharDString(domain + 1, -1, &ds); + wName = Tcl_UtfToWCharDString(domain + 1, TCL_INDEX_NONE, &ds); rc = NetGetDCName(NULL, wName, (LPBYTE *) &wDomain); Tcl_DStringFree(&ds); nameLen = domain - name; @@ -2362,9 +2362,9 @@ FromCTime( *---------------------------------------------------------------------- */ -ClientData +void * TclpGetNativeCwd( - ClientData clientData) + void *clientData) { WCHAR buffer[MAX_PATH]; @@ -2585,17 +2585,17 @@ TclpObjNormalizePath( */ if (isDrive) { - int len = WinIsReserved(path); + Tcl_Size len = WinIsReserved(path); if (len > 0) { /* * Actually it does exist - COM1, etc. */ - int i; + Tcl_Size i; for (i=0 ; i<len ; i++) { - WCHAR wc = ((WCHAR *) nativePath)[i]; + WCHAR wc = ((WCHAR *)nativePath)[i]; if (wc >= 'a') { wc -= ('a' - 'A'); @@ -2604,7 +2604,7 @@ TclpObjNormalizePath( } Tcl_DStringAppend(&dsNorm, (const char *)nativePath, - (int)(sizeof(WCHAR) * len)); + sizeof(WCHAR) * len); lastValidPathEnd = currentPathEndPosition; } else if (nextCheckpoint == 0) { /* @@ -2820,8 +2820,8 @@ TclpObjNormalizePath( * Not the end of the string. */ - int len; Tcl_Obj *tmpPathPtr; + Tcl_Size len; tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), nextCheckpoint); @@ -2910,7 +2910,7 @@ TclWinVolumeRelativeNormalize( * also on drive C. */ - int cwdLen; + Tcl_Size cwdLen; const char *drive = TclGetStringFromObj(useThisCwd, &cwdLen); char drive_cur = path[0]; @@ -2980,11 +2980,11 @@ TclWinVolumeRelativeNormalize( Tcl_Obj * TclpNativeToNormalized( - ClientData clientData) + void *clientData) { Tcl_DString ds; Tcl_Obj *objPtr; - int len; + Tcl_Size len; char *copy, *p; Tcl_DStringInit(&ds); @@ -3040,14 +3040,14 @@ TclpNativeToNormalized( *--------------------------------------------------------------------------- */ -ClientData +void * TclNativeCreateNativeRep( Tcl_Obj *pathPtr) { WCHAR *nativePathPtr = NULL; const char *str; Tcl_Obj *validPathPtr; - size_t len; + Tcl_Size len; WCHAR *wp; if (TclFSCwdIsNative()) { @@ -3084,10 +3084,9 @@ TclNativeCreateNativeRep( Tcl_IncrRefCount(validPathPtr); } - str = Tcl_GetString(validPathPtr); - len = validPathPtr->length; + str = TclGetStringFromObj(validPathPtr, &len); - if (strlen(str) != len) { + if (strlen(str) != (size_t)len) { /* * String contains NUL-bytes. This is invalid. */ @@ -3202,9 +3201,9 @@ TclNativeCreateNativeRep( *--------------------------------------------------------------------------- */ -ClientData +void * TclNativeDupInternalRep( - ClientData clientData) + void *clientData) { char *copy; size_t len; |