From cd72d108bf14caa354d011a2ce41426ea011da2a Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 4 Jun 2024 15:35:14 +0000 Subject: Space before tab is an extremely unlikely to be correct indentation pattern --- generic/tcl.h | 6 +-- generic/tclArithSeries.c | 102 +++++++++++++++++++---------------------------- generic/tclAssembly.c | 4 +- generic/tclBasic.c | 8 ++-- generic/tclClock.c | 18 ++++----- generic/tclClockFmt.c | 14 +++---- generic/tclCmdAH.c | 2 +- generic/tclCmdMZ.c | 4 +- generic/tclCompCmds.c | 14 +++---- generic/tclCompile.h | 10 ++--- generic/tclDictObj.c | 4 +- generic/tclEncoding.c | 2 +- generic/tclExecute.c | 2 +- generic/tclIO.c | 30 +++++++------- generic/tclIO.h | 6 +-- generic/tclIOCmd.c | 2 +- generic/tclIORTrans.c | 4 +- generic/tclIOUtil.c | 2 +- generic/tclInt.h | 26 ++++++------ generic/tclListObj.c | 28 ++++++------- generic/tclProc.c | 2 +- generic/tclResult.c | 2 +- generic/tclStrToD.c | 10 ++--- generic/tclStringObj.c | 78 ++++++++++++++++++------------------ generic/tclUtf.c | 22 +++++----- generic/tclUtil.c | 22 +++++----- generic/tclVar.c | 4 +- generic/tclZipfs.c | 6 +-- generic/tclZlib.c | 2 +- macosx/tclMacOSXNotify.c | 4 +- unix/tclEpollNotfy.c | 2 +- unix/tclKqueueNotfy.c | 2 +- unix/tclLoadDl.c | 8 ++-- unix/tclLoadDyld.c | 8 ++-- unix/tclUnixFCmd.c | 14 +++---- unix/tclUnixNotfy.c | 6 +-- unix/tclUnixSock.c | 10 ++--- unix/tclUnixTime.c | 2 +- win/tclWinConsole.c | 2 +- win/tclWinPipe.c | 14 +++---- win/tclWinPort.h | 2 +- win/tclWinSerial.c | 2 +- win/tclWinSock.c | 4 +- win/tclWinTime.c | 22 +++++----- 44 files changed, 256 insertions(+), 282 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 41e68a8..b5630cc 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1105,7 +1105,7 @@ struct Tcl_HashEntry { * allocated for the hash table that is not for an * entry will use the system heap. * TCL_HASH_KEY_DIRECT_COMPARE - - * Allows fast comparison for hash keys directly + * Allows fast comparison for hash keys directly * by compare of their key.oneWordValue values, * before call of compareKeysProc (much slower * than a direct compare, so it is speed-up only @@ -1250,7 +1250,7 @@ typedef struct Tcl_HashSearch { typedef struct { void *next; /* Search position for underlying hash * table. */ - TCL_HASH_TYPE epoch; /* Epoch marker for dictionary being searched, + TCL_HASH_TYPE epoch; /* Epoch marker for dictionary being searched, * or 0 if search has terminated. */ Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ } Tcl_DictSearch; @@ -1998,7 +1998,7 @@ typedef struct Tcl_EncodingType { * buffer contains the entire input stream to be * converted, this flag should be set. * TCL_ENCODING_STOPONERROR - Not used any more. - * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf does not append a + * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf does not append a * terminating NUL byte. Since it does not need * an extra byte for a terminating NUL, it fills * all dstLen bytes with encoded UTF-8 content if diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index fd1014c..4b4b892 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -231,21 +231,19 @@ maxPrecision( * * ArithSeriesLen -- * - * Compute the length of the equivalent list where - * every element is generated starting from *start*, - * and adding *step* to generate every successive element - * that's < *end* for positive steps, or > *end* for negative - * steps. + * Compute the length of the equivalent list where + * every element is generated starting from *start*, + * and adding *step* to generate every successive element + * that's < *end* for positive steps, or > *end* for negative + * steps. * * Results: - * - * The length of the list generated by the given range, - * that may be zero. - * The function returns -1 if the list is of length infinite. + * The length of the list generated by the given range, + * that may be zero. + * The function returns -1 if the list is of length infinite. * * Side effects: - * - * None. + * None. * *---------------------------------------------------------------------- */ @@ -383,12 +381,11 @@ FreeArithSeriesInternalRep( * refcount = 0. * * Results: - * - * A Tcl_Obj pointer to the created ArithSeries object. - * A NULL pointer of the range is invalid. + * A Tcl_Obj pointer to the created ArithSeries object. + * A NULL pointer of the range is invalid. * * Side Effects: - * None. + * None. * *---------------------------------------------------------------------- */ @@ -425,7 +422,7 @@ NewArithSeriesInt( arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL; arithSeriesObj->typePtr = &arithSeriesType; if (length > 0) { - Tcl_InvalidateStringRep(arithSeriesObj); + Tcl_InvalidateStringRep(arithSeriesObj); } return arithSeriesObj; @@ -440,16 +437,13 @@ NewArithSeriesInt( * refcount = 0. * * Results: - * - * A Tcl_Obj pointer to the created ArithSeries object. - * A NULL pointer of the range is invalid. + * A Tcl_Obj pointer to the created ArithSeries object. + * A NULL pointer of the range is invalid. * * Side Effects: - * - * None. + * None. *---------------------------------------------------------------------- */ - static Tcl_Obj * NewArithSeriesDbl( double start, @@ -485,7 +479,7 @@ NewArithSeriesDbl( arithSeriesObj->typePtr = &arithSeriesType; if (length > 0) { - Tcl_InvalidateStringRep(arithSeriesObj); + Tcl_InvalidateStringRep(arithSeriesObj); } return arithSeriesObj; @@ -501,13 +495,10 @@ NewArithSeriesDbl( * refcount = 0. * * Results: - * - * A Tcl_Obj pointer. - * No assignment on error. + * A Tcl_Obj pointer. No assignment on error. * * Side Effects: - * - * None. + * None. *---------------------------------------------------------------------- */ static void @@ -549,16 +540,13 @@ assignNumber( * refcount = 0. * * Results: - * - * A Tcl_Obj pointer to the created ArithSeries object. - * An empty Tcl_Obj if the range is invalid. + * A Tcl_Obj pointer to the created ArithSeries object. + * An empty Tcl_Obj if the range is invalid. * * Side Effects: - * - * None. + * None. *---------------------------------------------------------------------- */ - int TclNewArithSeriesObj( Tcl_Interp *interp, /* For error reporting */ @@ -664,13 +652,11 @@ TclNewArithSeriesObj( * element is stored in *element. * * Results: - * - * TCL_OK on success. + * TCL_OK on success. * * Side Effects: - * - * On success, the integer pointed by *element is modified. - * An empty string ("") is assigned if index is out-of-bounds. + * On success, the integer pointed by *element is modified. + * An empty string ("") is assigned if index is out-of-bounds. * *---------------------------------------------------------------------- */ @@ -705,12 +691,10 @@ TclArithSeriesObjIndex( * Returns the length of the arithmetic series. * * Results: - * - * The length of the series as Tcl_WideInt. + * The length of the series as Tcl_WideInt. * * Side Effects: - * - * None. + * None. * *---------------------------------------------------------------------- */ @@ -732,13 +716,11 @@ ArithSeriesObjLength( * refcount = 0. * * Results: - * - * A Tcl_Obj pointer to the created ArithSeries object. - * A NULL pointer of the range is invalid. + * A Tcl_Obj pointer to the created ArithSeries object. + * A NULL pointer of the range is invalid. * * Side Effects: - * - * None. + * None. *---------------------------------------------------------------------- */ @@ -762,19 +744,17 @@ TclArithSeriesObjStep( * * SetArithSeriesFromAny -- * - * The Arithmetic Series object is just an way to optimize - * Lists space complexity, so no one should try to convert - * a string to an Arithmetic Series object. + * The Arithmetic Series object is just an way to optimize + * Lists space complexity, so no one should try to convert + * a string to an Arithmetic Series object. * - * This function is here just to populate the Type structure. + * This function is here just to populate the Type structure. * * Results: - * - * The result is always TCL_ERROR. But see Side Effects. + * The result is always TCL_ERROR. But see Side Effects. * * Side effects: - * - * Tcl Panic if called. + * Tcl Panic if called. * *---------------------------------------------------------------------- */ @@ -1119,11 +1099,11 @@ TclArithSeriesObjReverse( * should not be NULL and we assume it is not NULL. * * Notes: - * At the cost of overallocation it's possible to estimate - * the length of the string representation and make this procedure - * much faster. Because the programmer shouldn't expect the - * string conversion of a big arithmetic sequence to be fast - * this version takes more care of space than time. + * At the cost of overallocation it's possible to estimate + * the length of the string representation and make this procedure + * much faster. Because the programmer shouldn't expect the + * string conversion of a big arithmetic sequence to be fast + * this version takes more care of space than time. * *---------------------------------------------------------------------- */ diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 1d09317..7283b0a 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -51,7 +51,7 @@ typedef enum BasicBlockCatchState { BBCS_UNKNOWN = 0, /* Catch context has not yet been identified */ BBCS_NONE, /* Block is outside of any catch */ BBCS_INCATCH, /* Block is within a catch context */ - BBCS_CAUGHT /* Block is within a catch context and + BBCS_CAUGHT /* Block is within a catch context and * may be executed after an exception fires */ } BasicBlockCatchState; @@ -1930,7 +1930,7 @@ MoveExceptionRangesToBasicBlock( curr_bb->foreignExceptionBase = savedExceptArrayNext; curr_bb->foreignExceptionCount = exceptionCount; curr_bb->foreignExceptions = - (ExceptionRange*)Tcl_Alloc(exceptionCount * sizeof(ExceptionRange)); + (ExceptionRange*)Tcl_Alloc(exceptionCount * sizeof(ExceptionRange)); memcpy(curr_bb->foreignExceptions, envPtr->exceptArrayPtr + savedExceptArrayNext, exceptionCount * sizeof(ExceptionRange)); diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 16721b1..9b6708d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -319,7 +319,7 @@ static const CmdInfo builtInCmds[] = { {"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, CMD_IS_SAFE}, {"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, CMD_IS_SAFE}, {"concat", Tcl_ConcatObjCmd, TclCompileConcatCmd, NULL, CMD_IS_SAFE}, - {"const", Tcl_ConstObjCmd, TclCompileConstCmd, NULL, CMD_IS_SAFE}, + {"const", Tcl_ConstObjCmd, TclCompileConstCmd, NULL, CMD_IS_SAFE}, {"continue", Tcl_ContinueObjCmd, TclCompileContinueCmd, NULL, CMD_IS_SAFE}, {"coroinject", NULL, NULL, TclNRCoroInjectObjCmd, CMD_IS_SAFE}, {"coroprobe", NULL, NULL, TclNRCoroProbeObjCmd, CMD_IS_SAFE}, @@ -345,7 +345,7 @@ static const CmdInfo builtInCmds[] = { {"lmap", Tcl_LmapObjCmd, TclCompileLmapCmd, TclNRLmapCmd, CMD_IS_SAFE}, {"lpop", Tcl_LpopObjCmd, NULL, NULL, CMD_IS_SAFE}, {"lrange", Tcl_LrangeObjCmd, TclCompileLrangeCmd, NULL, CMD_IS_SAFE}, - {"lremove", Tcl_LremoveObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"lremove", Tcl_LremoveObjCmd, NULL, NULL, CMD_IS_SAFE}, {"lrepeat", Tcl_LrepeatObjCmd, NULL, NULL, CMD_IS_SAFE}, {"lreplace", Tcl_LreplaceObjCmd, TclCompileLreplaceCmd, NULL, CMD_IS_SAFE}, {"lreverse", Tcl_LreverseObjCmd, NULL, NULL, CMD_IS_SAFE}, @@ -749,7 +749,7 @@ buildInfoObjCmd2( p += len; q = strchr(++p, '.'); if (!q) { - q = p + strlen(p); + q = p + strlen(p); } memcpy(buf, p, q - p); buf[q - p] = '\0'; @@ -8868,7 +8868,7 @@ TclNRTailcallObjCmd( nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE); listPtr = Tcl_NewListObj(objc, objv); - TclListObjSetElement(interp, listPtr, 0, nsObjPtr); + TclListObjSetElement(interp, listPtr, 0, nsObjPtr); iPtr->varFramePtr->tailcallPtr = listPtr; } diff --git a/generic/tclClock.c b/generic/tclClock.c index 3b07b51..2496243 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -128,7 +128,7 @@ struct ClockCommand { * to it, but may well ignore this data. */ CompileProc *compileProc; /* The compiler for the command. */ void *clientData; /* Any clientData to give the command (if NULL - * a reference to ClockClientData will be sent) */ + * a reference to ClockClientData will be sent) */ }; static const struct ClockCommand clockCommands[] = { @@ -257,7 +257,7 @@ TclClockInit( #define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */ memcpy(cmdName, "::tcl::clock::", TCL_CLOCK_PREFIX_LEN); for (clockCmdPtr=clockCommands ; clockCmdPtr->name!=NULL ; clockCmdPtr++) { - void *clientData; + void *clientData; strcpy(cmdName + TCL_CLOCK_PREFIX_LEN, clockCmdPtr->name); if (!(clientData = clockCmdPtr->clientData)) { @@ -438,7 +438,7 @@ NormTimezoneObj( } if (timezoneObj == dataPtr->prevSetupTimeZoneUnnorm && dataPtr->prevSetupTimeZone != NULL) { - return dataPtr->prevSetupTimeZone; + return dataPtr->prevSetupTimeZone; } if (timezoneObj == dataPtr->gmtSetupTimeZoneUnnorm && dataPtr->gmtSetupTimeZone != NULL) { @@ -648,7 +648,7 @@ NormLocaleObj( if ((localeObj->length == 1 /* C */ && strcasecmp(loc, Literals[LIT_C]) == 0) || (dataPtr->defaultLocale && (loc2 = TclGetString(dataPtr->defaultLocale)) - && localeObj->length == dataPtr->defaultLocale->length + && localeObj->length == dataPtr->defaultLocale->length && strcasecmp(loc, loc2) == 0)) { *mcDictObj = dataPtr->defaultLocaleDict; return dataPtr->defaultLocale ? @@ -1323,8 +1323,8 @@ ClockSetupTimeZone( /* before setup just take a look in TZData variable */ if (Tcl_ObjGetVar2(interp, dataPtr->literals[LIT_TZDATA], timezoneObj, 0)) { - /* put it to last slot and return normalized */ - TimezoneLoaded(dataPtr, callargs[1], timezoneObj); + /* put it to last slot and return normalized */ + TimezoneLoaded(dataPtr, callargs[1], timezoneObj); return callargs[1]; } /* setup now */ @@ -3305,10 +3305,10 @@ ClockParseFmtScnArgs( Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ if (operation == CLC_OP_SCN) { - /* default flags (from configure) */ - opts->flags |= dataPtr->defFlags & CLF_VALIDATE; + /* default flags (from configure) */ + opts->flags |= dataPtr->defFlags & CLF_VALIDATE; } else { - /* clock value (as current base) */ + /* clock value (as current base) */ opts->baseObj = objv[(baseIdx = 1)]; saw |= 1 << CLC_ARGS_BASE; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index b3401a0..ea5f0a5 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -758,7 +758,7 @@ ClockFmtObj_UpdateString( * Returns tcl object with key or format object if not localizable. * * Side effects: - * Converts given format object to ClockFmtObjType on demand for caching + * Converts given format object to ClockFmtObjType on demand for caching * the key inside its internal representation. * *---------------------------------------------------------------------- @@ -804,7 +804,7 @@ ClockFrmObjGetLocFmtKey( * Returns scan/format storage pointer to ClockFmtScnStorage. * * Side effects: - * Converts given format object to ClockFmtObjType on demand for caching + * Converts given format object to ClockFmtObjType on demand for caching * the format storage reference inside its internal representation. * Increments objRefCount of the ClockFmtScnStorage reference. * @@ -1416,7 +1416,7 @@ ClockMCGetMultiListIdxTree( * Results: * TCL_OK - match found and the index stored in *val, * TCL_RETURN - not matched or ambigous, - * TCL_ERROR - in error case. + * TCL_ERROR - in error case. * * Side effects: * Input points to end of the found token in string. @@ -1770,7 +1770,7 @@ ClockScnToken_JDN_Proc( } s = p; while (p < end && isdigit(UCHAR(*p))) { - fractJDDiv *= 10; + fractJDDiv *= 10; p++; } if (Clock_str2int(&fractJD, s, p, 1) != TCL_OK) { @@ -2649,7 +2649,7 @@ ClockScan( } if (flags & (CLF_ISO8601WEEK | CLF_ISO8601YEAR)) { if ((flags & (CLF_ISO8601YEAR | CLF_YEAR)) == CLF_YEAR) { - /* for calculations expected iso year */ + /* for calculations expected iso year */ info->date.iso8601Year = yyYear; } else if (info->date.iso8601Year < 100) { if (!(flags & CLF_ISO8601CENTURY)) { @@ -2662,7 +2662,7 @@ ClockScan( } } if ((flags & (CLF_ISO8601YEAR | CLF_YEAR)) == CLF_ISO8601YEAR) { - /* for calculations expected year (e. g. CLF_ISO8601WEEK not set) */ + /* for calculations expected year (e. g. CLF_ISO8601WEEK not set) */ yyYear = info->date.iso8601Year; } } @@ -2862,7 +2862,7 @@ ClockFmtToken_JDN_Proc( fractJD = dateFmt->date.secondOfDay - (int)tok->map->offs; /* 0 for calendar or 43200 for astro JD */ if (fractJD < 0) { - intJD--; + intJD--; fractJD += SECONDS_PER_DAY; } if (fractJD && intJD < 0) { /* avoid jump over 0, by negative JD's */ diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index d2f30dd..cab20b8 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -30,7 +30,7 @@ struct ForeachState { Tcl_Size j, maxj; /* Number of loop iterations. */ Tcl_Size numLists; /* Count of value lists. */ Tcl_Size *index; /* Array of value list indices. */ - Tcl_Size *varcList; /* # loop variables per list. */ + Tcl_Size *varcList; /* # loop variables per list. */ Tcl_Obj ***varvList; /* Array of var name lists. */ Tcl_Obj **vCopyList; /* Copies of var name list arguments. */ Tcl_Size *argcList; /* Array of value list sizes. */ diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2a9d316..a36e349 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2765,9 +2765,9 @@ StringCmpOpts( return TCL_ERROR; } if ((Tcl_WideUInt)wreqlength > TCL_SIZE_MAX) { - *reqlength = -1; + *reqlength = -1; } else { - *reqlength = wreqlength; + *reqlength = wreqlength; } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 6d3eabd..001310b 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -379,9 +379,9 @@ TclCompileArraySetCmd( localIndex = TclFindCompiledLocal(varTokenPtr->start, varTokenPtr->size, 1, envPtr); PushStringLiteral(envPtr, "0"); - TclEmitInstInt4(INST_REVERSE, 2, envPtr); - TclEmitInstInt4(INST_UPVAR, localIndex, envPtr); - TclEmitOpcode(INST_POP, envPtr); + TclEmitInstInt4(INST_REVERSE, 2, envPtr); + TclEmitInstInt4(INST_UPVAR, localIndex, envPtr); + TclEmitOpcode(INST_POP, envPtr); } /* @@ -3415,10 +3415,10 @@ TclCompileFormatCmd( * to a local scalar variable name. * * Results: - * Returns the non-negative integer index value into the table of - * compiled locals corresponding to a local scalar variable name. - * If the arguments passed in do not identify a local scalar variable - * then return TCL_INDEX_NONE. + * Returns the non-negative integer index value into the table of + * compiled locals corresponding to a local scalar variable name. + * If the arguments passed in do not identify a local scalar variable + * then return TCL_INDEX_NONE. * * Side effects: * May add an entry into the table of compiled locals. diff --git a/generic/tclCompile.h b/generic/tclCompile.h index a20f81e..0a9f2a3 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -34,7 +34,7 @@ struct ByteCode; /* Forward declaration. */ * This variable is linked to the Tcl variable "tcl_traceCompile". */ -MODULE_SCOPE int tclTraceCompile; +MODULE_SCOPE int tclTraceCompile; /* * Variable that controls whether execution tracing is enabled and, if so, @@ -46,7 +46,7 @@ MODULE_SCOPE int tclTraceCompile; * This variable is linked to the Tcl variable "tcl_traceExec". */ -MODULE_SCOPE int tclTraceExec; +MODULE_SCOPE int tclTraceExec; #endif /* @@ -325,13 +325,13 @@ typedef struct CompileEnv { * exceptArrayPtr points in heap, else 0. */ #endif LiteralEntry *literalArrayPtr; - /* Points to start of LiteralEntry array. */ + /* Points to start of LiteralEntry array. */ Tcl_Size literalArrayNext; /* Index of next free object array entry. */ Tcl_Size literalArrayEnd; /* Index just after last obj array entry. */ int mallocedLiteralArray; /* 1 if object array was expanded and objArray * points into the heap, else 0. */ ExceptionRange *exceptArrayPtr; - /* Points to start of the ExceptionRange + /* Points to start of the ExceptionRange * array. */ Tcl_Size exceptArrayNext; /* Next free ExceptionRange array index. * exceptArrayNext is the number of ranges and @@ -482,7 +482,7 @@ typedef struct ByteCode { * array. This is just after the last code * byte. */ ExceptionRange *exceptArrayPtr; - /* Points to the start of the ExceptionRange + /* Points to the start of the ExceptionRange * array. This is just after the last object * in the object array. */ AuxData *auxDataArrayPtr; /* Points to the start of the auxiliary data diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index a0016df..428a3a6 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -80,7 +80,7 @@ static const EnsembleImplMap implementationMap[] = { {"info", DictInfoCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0 }, {"keys", DictKeysCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 }, {"lappend", DictLappendCmd, TclCompileDictLappendCmd, NULL, NULL, 0 }, - {"map", NULL, TclCompileDictMapCmd, DictMapNRCmd, NULL, 0 }, + {"map", NULL, TclCompileDictMapCmd, DictMapNRCmd, NULL, 0 }, {"merge", DictMergeCmd, TclCompileDictMergeCmd, NULL, NULL, 0 }, {"remove", DictRemoveCmd, TclCompileBasicMin1ArgCmd, NULL, NULL, 0 }, {"replace", DictReplaceCmd, NULL, NULL, NULL, 0 }, @@ -129,7 +129,7 @@ typedef struct Dict { * the dictionary. Used for doing traversal of * the entries in the order that they are * created. */ - size_t epoch; /* Epoch counter */ + size_t epoch; /* Epoch counter */ size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 176838d..f48bf63 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -4291,7 +4291,7 @@ int TclEncodingProfileNameToId( Tcl_Interp *interp, /* For error messages. May be NULL */ const char *profileName, /* Name of profile */ - int *profilePtr) /* Output */ + int *profilePtr) /* Output */ { size_t i; size_t numProfiles = sizeof(encodingProfiles) / sizeof(encodingProfiles[0]); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 4b0284f..a0d04e8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -3951,7 +3951,7 @@ TEBCresume( varPtr = TclObjLookupVarEx(interp, part1Ptr, NULL, 0, NULL, /*createPart1*/1, /*createPart2*/0, &arrayPtr); doConst: - if (TclIsVarConstant(varPtr)) { + if (TclIsVarConstant(varPtr)) { TRACE_APPEND(("\n")); NEXT_INST_V(pcAdjustment, cleanup, 0); } diff --git a/generic/tclIO.c b/generic/tclIO.c index 96a6d33..2000573 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -1530,8 +1530,8 @@ TclGetChannelFromObj( ChanGetInternalRep(objPtr, resPtr); if (resPtr) { /* - * Confirm validity of saved lookup results. - */ + * Confirm validity of saved lookup results. + */ statePtr = resPtr->statePtr; if ((resPtr->interp == interp) /* Same interp context */ @@ -4514,15 +4514,15 @@ Write( flushed += statePtr->bufSize; /* - * We just flushed. So if we have needNlFlush set to record that - * we need to flush because there is a (translated) newline in the - * buffer, that's likely not true any more. But there is a tricky - * exception. If we have saved bytes that did not really get - * flushed and those bytes came from a translation of a newline as - * the last thing taken from the src array, then needNlFlush needs - * to remain set to flag that the next buffer still needs a - * newline flush. - */ + * We just flushed. So if we have needNlFlush set to record that + * we need to flush because there is a (translated) newline in the + * buffer, that's likely not true any more. But there is a tricky + * exception. If we have saved bytes that did not really get + * flushed and those bytes came from a translation of a newline as + * the last thing taken from the src array, then needNlFlush needs + * to remain set to flag that the next buffer still needs a + * newline flush. + */ if (needNlFlush && (saved == 0 || src[-1] != '\n')) { needNlFlush = 0; @@ -10006,12 +10006,12 @@ CopyData( * * Results: * The number of bytes actually stored (<= bytesToRead), - * or TCL_INDEX_NONE if there is an error in reading the channel. Use - * Tcl_GetErrno() to retrieve the error code for the error + * or TCL_INDEX_NONE if there is an error in reading the channel. Use + * Tcl_GetErrno() to retrieve the error code for the error * that occurred. * * The number of bytes stored can be less than the number - * requested when + * requested when * - EOF is reached on the channel; or * - the channel is non-blocking, and we've read all we can * without blocking. @@ -10090,7 +10090,7 @@ DoRead( */ while (!bufPtr || /* We got no buffer! OR */ - (!IsBufferFull(bufPtr) && /* Our buffer has room AND */ + (!IsBufferFull(bufPtr) && /* Our buffer has room AND */ ((Tcl_Size) BytesLeft(bufPtr) < bytesToRead))) { /* Not enough bytes in it yet * to fill the dst */ diff --git a/generic/tclIO.h b/generic/tclIO.h index 8823e06..d1f4a0a 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -39,12 +39,12 @@ typedef struct ChannelBuffer { Tcl_Size refCount; /* Current uses count */ Tcl_Size nextAdded; /* The next position into which a character * will be put in the buffer. */ - Tcl_Size nextRemoved; /* Position of next byte to be removed from + Tcl_Size nextRemoved; /* Position of next byte to be removed from * the buffer. */ Tcl_Size bufLength; /* How big is the buffer? */ struct ChannelBuffer *nextPtr; - /* Next buffer in chain. */ - char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real + /* Next buffer in chain. */ + char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real * buffer occupies this space + bufSize-1 * bytes. This must be the last field in the * structure. */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 2f3f48e..c7ecb76 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -39,7 +39,7 @@ static Tcl_ThreadDataKey dataKey; */ static Tcl_ExitProc FinalizeIOCmdTSD; -static Tcl_TcpAcceptProc AcceptCallbackProc; +static Tcl_TcpAcceptProc AcceptCallbackProc; static Tcl_ObjCmdProc ChanPendingObjCmd; static Tcl_ObjCmdProc ChanTruncateObjCmd; static void RegisterTcpServerInterpCleanup( diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 2ad6ecf0..0fe9d97 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -1374,8 +1374,8 @@ ReflectSeekWide( *errorCodePtr = EINVAL; curPos = -1; } else { - curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData, offset, - seekMode, errorCodePtr); + curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData, offset, + seekMode, errorCodePtr); } if (curPos == -1) { Tcl_SetErrno(*errorCodePtr); diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index c3131cd..3ead628 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -3464,7 +3464,7 @@ Tcl_LoadFile( static void * DivertFindSymbol( - Tcl_Interp *interp, /* The relevant interpreter. */ + Tcl_Interp *interp, /* The relevant interpreter. */ Tcl_LoadHandle loadHandle, /* A handle to the diverted module. */ const char *symbol) /* The name of symbol to resolve. */ { diff --git a/generic/tclInt.h b/generic/tclInt.h index bb6c4d0..c9ff923 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1091,10 +1091,10 @@ typedef struct ActiveInterpTrace { * related flag values. * * TCL_TRACE_ENTER_EXEC - triggers enter/enterstep traces. - * - passed to Tcl_CreateObjTrace to set up + * - passed to Tcl_CreateObjTrace to set up * "enterstep" traces. * TCL_TRACE_LEAVE_EXEC - triggers leave/leavestep traces. - * - passed to Tcl_CreateObjTrace to set up + * - passed to Tcl_CreateObjTrace to set up * "leavestep" traces. */ @@ -1546,15 +1546,15 @@ struct CompileEnv; * be one of the following: * * TCL_OK Compilation completed normally. - * TCL_ERROR Compilation could not be completed. This can be just a - * judgment by the CompileProc that the command is too - * complex to compile effectively, or it can indicate - * that in the current state of the interp, the command - * would raise an error. The bytecode compiler will not - * do any error reporting at compiler time. Error - * reporting is deferred until the actual runtime, - * because by then changes in the interp state may allow - * the command to be successfully evaluated. + * TCL_ERROR Compilation could not be completed. This can be just a + * judgment by the CompileProc that the command is too + * complex to compile effectively, or it can indicate + * that in the current state of the interp, the command + * would raise an error. The bytecode compiler will not + * do any error reporting at compiler time. Error + * reporting is deferred until the actual runtime, + * because by then changes in the interp state may allow + * the command to be successfully evaluated. */ typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr, @@ -2924,7 +2924,7 @@ typedef struct ProcessGlobalValue { Tcl_Encoding encoding; /* system encoding when global string was * initialized. */ TclInitProcessGlobalValueProc *proc; - /* A procedure to initialize the global string + /* A procedure to initialize the global string * copy when a "get" request comes in before * any "set" request has been received. */ Tcl_Mutex mutex; /* Enforce orderly access from multiple @@ -3486,7 +3486,7 @@ MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string, MODULE_SCOPE Tcl_Size TclParseAllWhiteSpace(const char *src, Tcl_Size numBytes); MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp, int code, int level, Tcl_Obj *returnOpts); -MODULE_SCOPE void TclUndoRefCount(Tcl_Obj *objPtr); +MODULE_SCOPE void TclUndoRefCount(Tcl_Obj *objPtr); MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); MODULE_SCOPE Tcl_Obj * TclpTempFileName(void); MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 20e85dd..2ffaf87 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1668,7 +1668,7 @@ Tcl_ListObjGetElements( return TclObjTypeGetElements(interp, objPtr, objcPtr, objvPtr); } if (TclListObjGetRep(interp, objPtr, &listRep) != TCL_OK) { - return TCL_ERROR; + return TCL_ERROR; } ListRepElements(&listRep, *objcPtr, *objvPtr); return TCL_OK; @@ -1730,8 +1730,8 @@ Tcl_ListObjAppendList( * the passed Tcl_Obj is not a list object, it will be converted to one * and an error raised if the conversion fails. * - * The Tcl_Obj must not be shared though the internal representation - * may be. + * The Tcl_Obj must not be shared though the internal representation + * may be. * * Results: * On success, TCL_OK is returned with the specified elements appended. @@ -1918,27 +1918,23 @@ Tcl_ListObjAppendElement( * * Tcl_ListObjIndex -- * - * Retrieve a pointer to the element of 'listPtr' at 'index'. The index - * of the first element is 0. - * - * Value - * - * TCL_OK + * Retrieve a pointer to the element of 'listPtr' at 'index'. The index + * of the first element is 0. * + * Returns: + * TCL_OK * A pointer to the element at 'index' is stored in 'objPtrPtr'. If * 'index' is out of range, NULL is stored in 'objPtrPtr'. This * object should be treated as readonly and its 'refCount' is _not_ * incremented. The caller must do that if it holds on to the * reference. * - * TCL_ERROR - * - * 'listPtr' is not a valid list. An error message is left in the - * interpreter's result if 'interp' is not NULL. - * - * Effect + * TCL_ERROR + * 'listPtr' is not a valid list. An error message is left in the + * interpreter's result if 'interp' is not NULL. * - * If 'listPtr' is not already of type 'tclListType', it is converted. + * Effect: + * If 'listPtr' is not already of type 'tclListType', it is converted. * *---------------------------------------------------------------------- */ diff --git a/generic/tclProc.c b/generic/tclProc.c index 8e752ed..17f3c06 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1635,7 +1635,7 @@ static int NRInterpProc( void *clientData, /* Record describing procedure to be * interpreted. */ - Tcl_Interp *interp, /* Interpreter in which procedure was + Tcl_Interp *interp, /* Interpreter in which procedure was * invoked. */ int objc, /* Count of number of arguments to this * procedure. */ diff --git a/generic/tclResult.c b/generic/tclResult.c index f205b47..2baa32c 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -760,7 +760,7 @@ TclProcessReturn( Tcl_ListObjReplace(interp, iPtr->errorStack, 0, len, valueObjc, valueObjv); - } + } Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORCODE], &valuePtr); if (valuePtr != NULL) { diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 59decd9..f6e0e3c 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -124,7 +124,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); * Definitions of the parts of an IEEE754-format floating point number. */ -#define SIGN_BIT 0x80000000 +#define SIGN_BIT 0x80000000 /* Mask for the sign bit in the first word of * a double. */ #define EXP_MASK 0x7FF00000 @@ -308,7 +308,7 @@ static double MakeNaN(int signum, Tcl_WideUInt tag); static double RefineApproximation(double approx, mp_int *exactSignificand, int exponent); static mp_err MulPow5(mp_int *, unsigned, mp_int *) MP_WUR; -static int NormalizeRightward(Tcl_WideUInt *); +static int NormalizeRightward(Tcl_WideUInt *); static int RequiredPrecision(Tcl_WideUInt); static void DoubleToExpAndSig(double, Tcl_WideUInt *, int *, int *); @@ -2209,7 +2209,7 @@ RefineApproximation( static inline mp_err MulPow5( - mp_int *base, /* Number to multiply. */ + mp_int *base, /* Number to multiply. */ unsigned n, /* Power of 5 to multiply by. */ mp_int *result) /* Place to store the result. */ { @@ -2706,7 +2706,7 @@ SetPrecisionLimits( static inline char * BumpUp( - char *s, /* Cursor pointing one past the end of the + char *s, /* Cursor pointing one past the end of the * string. */ char *retval, /* Start of the string of digits. */ int *kPtr) /* Position of the decimal point. */ @@ -4154,7 +4154,7 @@ StrictBignumConversion( } err = mp_mul_2d(&b, b2, &b); if (err == MP_OKAY) { - err = mp_init_set(&S, 1); + err = mp_init_set(&S, 1); } if (err == MP_OKAY) { err = MulPow5(&S, s5, &S); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 5793f65..8b6b719 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1,24 +1,24 @@ /* * tclStringObj.c -- * - * This file contains functions that implement string operations on Tcl - * objects. Some string operations work with UTF-8 encoding forms. - * Functions that require knowledge of the width of each character, - * such as indexing, operate on fixed width encoding forms such as UTF-32. + * This file contains functions that implement string operations on Tcl + * objects. Some string operations work with UTF-8 encoding forms. + * Functions that require knowledge of the width of each character, + * such as indexing, operate on fixed width encoding forms such as UTF-32. * - * Conceptually, a string is a sequence of Unicode code points. Internally - * it may be stored in an encoding form such as a modified version of - * UTF-8 or UTF-32. + * Conceptually, a string is a sequence of Unicode code points. Internally + * it may be stored in an encoding form such as a modified version of + * UTF-8 or UTF-32. * * The String object is optimized for the case where each UTF char * in a string is only one byte. In this case, we store the value of * numChars, but we don't store the fixed form encoding (unless - * Tcl_GetUnicode is explicitly called). + * Tcl_GetUnicode is explicitly called). * - * The String object type stores one or both formats. The default - * behavior is to store UTF-8. Once UTF-16/UTF32 is calculated, it is - * stored in the internal rep for future access (without an additional - * O(n) cost). + * The String object type stores one or both formats. The default + * behavior is to store UTF-8. Once UTF-16/UTF32 is calculated, it is + * stored in the internal rep for future access (without an additional + * O(n) cost). * * To allow many appends to be done to an object without constantly * reallocating space, we allocate double the space and use the @@ -1322,7 +1322,7 @@ Tcl_AppendUnicodeToObj( const Tcl_UniChar *unicode, /* The Unicode string to append to the * object. */ Tcl_Size length) /* Number of chars in Unicode. Negative - * lengths means nul terminated */ + * lengths means nul terminated */ { String *stringPtr; @@ -2161,7 +2161,7 @@ Tcl_AppendFormatToObj( goto error; } if ((unsigned)code > 0x10FFFF) { - code = 0xFFFD; + code = 0xFFFD; } length = Tcl_UniCharToUtf(code, buf); segment = Tcl_NewStringObj(buf, length); @@ -2989,11 +2989,11 @@ TclGetStringStorage( * Performs the [string repeat] function. * * Results: - * A (Tcl_Obj *) pointing to the result value, or NULL in case of an - * error. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * On error, when interp is not NULL, error information is left in it. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ @@ -3016,8 +3016,8 @@ TclStringRepeat( /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. - * Produce pure bytearray when possible. - * Error on overflow. + * Produce pure bytearray when possible. + * Error on overflow. */ if (!binary) { @@ -3144,11 +3144,11 @@ TclStringRepeat( * Performs the [string cat] function. * * Results: - * A (Tcl_Obj *) pointing to the result value, or NULL in case of an - * error. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * On error, when interp is not NULL, error information is left in it. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ @@ -3182,8 +3182,8 @@ TclStringCat( /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. - * Produce pure bytearray when possible. - * Error on overflow. + * Produce pure bytearray when possible. + * Error on overflow. */ ov = objv, oc = objc; @@ -3200,10 +3200,10 @@ TclStringCat( * create a pure bytearray. */ - binary = 0; - if (ov > objv+1 && ISCONTINUATION(TclGetString(objPtr))) { - forceUniChar = 1; - } else if ((objPtr->typePtr) && TclHasInternalRep(objPtr, &tclStringType)) { + binary = 0; + if (ov > objv+1 && ISCONTINUATION(TclGetString(objPtr))) { + forceUniChar = 1; + } else if ((objPtr->typePtr) && TclHasInternalRep(objPtr, &tclStringType)) { /* Prevent shimmer of non-string types. */ allowUniChar = 0; } @@ -3302,11 +3302,11 @@ TclStringCat( } while (--oc && (length == 0) && (pendingPtr == NULL)); /* - * Either we found a possibly non-empty value, and we remember - * this index as the first and last such value so far seen, + * Either we found a possibly non-empty value, and we remember + * this index as the first and last such value so far seen, * or (oc == 0) and all values are known empty, - * so first = last = objc - 1 signals the right quick return. - */ + * so first = last = objc - 1 signals the right quick return. + */ first = last = objc - oc - 1; @@ -3417,7 +3417,7 @@ TclStringCat( if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); @@ -3434,7 +3434,7 @@ TclStringCat( Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); @@ -3466,7 +3466,7 @@ TclStringCat( if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", + "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); } @@ -3481,7 +3481,7 @@ TclStringCat( Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", + "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); } @@ -3957,10 +3957,10 @@ TclStringLast( if (ln == 0) { /* - * We don't find empty substrings. Bizarre! + * We don't find empty substrings. Bizarre! * - * TODO: When we one day make this a true substring - * finder, change this to "return last", after limitation. + * TODO: When we one day make this a true substring + * finder, change this to "return last", after limitation. */ goto lastEnd; } diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 03ea8b6..a0cb936 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -206,13 +206,11 @@ Invalid( Tcl_Size Tcl_UniCharToUtf( - int ch, /* The Tcl_UniChar to be stored in the - * buffer. Can be or'ed with flag TCL_COMBINE. - */ - char *buf) /* Buffer in which the UTF-8 representation of - * ch is stored. Must be large enough to hold the UTF-8 - * character (at most 4 bytes). - */ + int ch, /* The Tcl_UniChar to be stored in the buffer. + * Can be or'ed with flag TCL_COMBINE. */ + char *buf) /* Buffer in which the UTF-8 representation of + * ch is stored. Must be large enough to hold + * the UTF-8 character (at most 4 bytes). */ { int flags = ch; @@ -309,9 +307,9 @@ three: char * Tcl_UniCharToUtfDString( - const int *uniStr, /* Unicode string to convert to UTF-8. */ + const int *uniStr, /* Unicode string to convert to UTF-8. */ Tcl_Size uniLength, /* Length of Unicode string. Negative for nul - * terminated string */ + * terminated string */ Tcl_DString *dsPtr) /* UTF-8 representation of string is appended * to this previously initialized DString. */ { @@ -440,9 +438,9 @@ static const unsigned short cp1252[32] = { Tcl_Size Tcl_UtfToUniChar( - const char *src, /* The UTF-8 string. */ - int *chPtr)/* Filled with the Unicode character represented by - * the UTF-8 string. */ + const char *src, /* The UTF-8 string. */ + int *chPtr) /* Filled with the Unicode character + * represented by the UTF-8 string. */ { int byte; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index c2fa64f..e82eea2 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -158,7 +158,7 @@ TclLengthOne( * \u000A \n NEWLINE * \u000B \v VERTICAL TAB * \u000C \f FORM FEED - * \u000D \r CARRIAGE RETURN + * \u000D \r CARRIAGE RETURN * \u0020 SPACE * * NOTE: differences between this and other places where Tcl defines a role @@ -276,7 +276,7 @@ TclLengthOne( * * The command terminating character, * \u003b ; SEMICOLON * must be BRACEd, QUOTEd, or escaped so that it does not terminate the - * command prematurely. + * command prematurely. * * Any of the characters that begin substitutions in scripts, * \u0024 $ DOLLAR * \u005b [ OPEN BRACKET @@ -1672,7 +1672,7 @@ TclTrimRight( pp = Tcl_UtfPrev(p, bytes); do { pp += pInc; - pInc = TclUtfToUniChar(pp, &ch1); + pInc = TclUtfToUniChar(pp, &ch1); } while (pp + pInc < p); /* @@ -1881,7 +1881,7 @@ Tcl_Concat( for (i = 0; i < argc; i++) { bytesNeeded += strlen(argv[i]); - if (bytesNeeded < 0) { + if (bytesNeeded < 0) { Tcl_Panic("Tcl_Concat: max size of Tcl value exceeded"); } } @@ -3413,19 +3413,19 @@ GetWideForIndex( * list. * * Results: - * TCL_OK + * TCL_OK * - * The index is stored at the address given by by 'indexPtr'. + * The index is stored at the address given by by 'indexPtr'. * - * TCL_ERROR + * TCL_ERROR * - * The value of 'objPtr' does not have one of the expected formats. If - * 'interp' is non-NULL, an error message is left in the interpreter's - * result object. + * The value of 'objPtr' does not have one of the expected formats. If + * 'interp' is non-NULL, an error message is left in the interpreter's + * result object. * * Side effects: * - * The internal representation contained within objPtr may shimmer. + * The internal representation contained within objPtr may shimmer. * *---------------------------------------------------------------------- */ diff --git a/generic/tclVar.c b/generic/tclVar.c index 41bfa39..68d467a 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -6572,7 +6572,7 @@ AppendLocals( && (includeLinks || !TclIsVarLink(varPtr))) { varName = TclGetString(*varNamePtr); if ((pattern == NULL) || Tcl_StringMatch(varName, pattern)) { - if (!justConstants || TclIsVarConstant(varPtr)) { + if (!justConstants || TclIsVarConstant(varPtr)) { Tcl_ListObjAppendElement(interp, listPtr, *varNamePtr); } if (includeLinks) { @@ -6626,7 +6626,7 @@ AppendLocals( objNamePtr = VarHashGetKey(varPtr); varName = TclGetString(objNamePtr); if ((pattern == NULL) || Tcl_StringMatch(varName, pattern)) { - if (!justConstants || TclIsVarConstant(varPtr)) { + if (!justConstants || TclIsVarConstant(varPtr)) { Tcl_ListObjAppendElement(interp, listPtr, objNamePtr); } if (includeLinks) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f09030a..b41126e 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -217,9 +217,9 @@ typedef struct ZipEntry { ZipFile *zipFilePtr; /* The ZIP file holding this virtual file */ size_t offset; /* Data offset into memory mapped ZIP file */ int numBytes; /* Uncompressed size of the virtual file. - * -1 for zip64 */ + * -1 for zip64 */ int numCompressedBytes; /* Compressed size of the virtual file. - * -1 for zip64 */ + * -1 for zip64 */ int compressMethod; /* Compress method */ int isDirectory; /* 0 if file, 1 if directory, -1 if root */ int depth; /* Number of slashes in path. */ @@ -258,7 +258,7 @@ typedef struct ZipChannel { Tcl_Size cursor; /* Seek position for next read or write*/ unsigned char *ubuf; /* Pointer to the uncompressed data */ unsigned char *ubufToFree; /* NULL if ubuf points to memory that does not - need freeing. Else memory to free (ubuf + need freeing. Else memory to free (ubuf may point *inside* the block) */ Tcl_Size ubufSize; /* Size of allocated ubufToFree */ int iscompr; /* True if data is compressed */ diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 0c11bb4..f3a2623 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3111,7 +3111,7 @@ ZlibTransformInput( gotBytes = 0; readBytes = chanDataPtr->inStream.avail_in; /* how many bytes in buffer now */ while (!HaveFlag(chanDataPtr, STREAM_DONE) && toRead > 0) { - unsigned int n; + unsigned int n; int decBytes; /* if starting from scratch or continuation after full decompression */ diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index d8af241..f7a2324 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -1683,7 +1683,7 @@ Tcl_Sleep( SInt32 runLoopStatus; waitTime = vdelay.sec + 1.0e-6 * vdelay.usec; - now = CFAbsoluteTimeGetCurrent(); + now = CFAbsoluteTimeGetCurrent(); waitEnd = now + waitTime; if (runLoopTimer) { @@ -1713,7 +1713,7 @@ Tcl_Sleep( } } while (waitTime > 0); tsdPtr->sleeping = 0; - if (runLoopTimer) { + if (runLoopTimer) { CFRunLoopTimerSetNextFireDate(runLoopTimer, nextTimerFire); } } else { diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 2a1733a..8cb9166 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -263,7 +263,7 @@ PlatformEventsControl( * None. * * Side effects: - * While tsdPtr->notifierMutex is held: + * While tsdPtr->notifierMutex is held: * - The per-thread eventfd(2) is closed, if non-zero, and set to -1. * - The per-thread epoll(7) fd is closed, if non-zero, and set to 0. * - The per-thread epoll_event structs are freed, if any, and set to 0. diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index ba49842..a99f7bd 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -261,7 +261,7 @@ PlatformEventsControl( * None. * * Side effects: - * While tsdPtr->notifierMutex is held: + * While tsdPtr->notifierMutex is held: * The per-thread pipe(2) fds are closed, if non-zero, and set to -1. * The per-thread kqueue(2) fd is closed, if non-zero, and set to 0. * The per-thread kevent structs are freed, if any, and set to 0. diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 23565c5..07bbc16 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -88,14 +88,14 @@ TclpDlopen( * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070] */ if (flags & TCL_LOAD_GLOBAL) { - dlopenflags |= RTLD_GLOBAL; + dlopenflags |= RTLD_GLOBAL; } else { - dlopenflags |= RTLD_LOCAL; + dlopenflags |= RTLD_LOCAL; } if (flags & TCL_LOAD_LAZY) { - dlopenflags |= RTLD_LAZY; + dlopenflags |= RTLD_LAZY; } else { - dlopenflags |= RTLD_NOW; + dlopenflags |= RTLD_NOW; } handle = dlopen(native, dlopenflags); if (handle == NULL) { diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 54290ec..5b1062e 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -197,14 +197,14 @@ TclpDlopen( */ if (flags & TCL_LOAD_GLOBAL) { - dlopenflags |= RTLD_GLOBAL; + dlopenflags |= RTLD_GLOBAL; } else { - dlopenflags |= RTLD_LOCAL; + dlopenflags |= RTLD_LOCAL; } if (flags & TCL_LOAD_LAZY) { - dlopenflags |= RTLD_LAZY; + dlopenflags |= RTLD_LAZY; } else { - dlopenflags |= RTLD_NOW; + dlopenflags |= RTLD_NOW; } dlHandle = dlopen(nativePath, dlopenflags); if (!dlHandle) { diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index b65cdb1..fab9c32 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -809,7 +809,7 @@ TclpObjCopyDirectory( * EEXIST: path is a non-empty directory. * EINVAL: path is a root directory. * ENOENT: path doesn't exist or is "". - * ENOTDIR: path is not a directory. + * ENOTDIR: path is not a directory. * * Side effects: * Directory removed. If an error occurs, the error will be returned @@ -953,12 +953,12 @@ TraverseUnixTree( * filled with UTF-8 name of file causing * error. */ int doRewind) /* Flag indicating that to ensure complete - * traversal of source hierarchy, the readdir - * loop should be rewound whenever - * traverseProc has returned TCL_OK; this is - * required when traverseProc modifies the - * source hierarchy, e.g. by deleting - * files. */ + * traversal of source hierarchy, the readdir + * loop should be rewound whenever + * traverseProc has returned TCL_OK; this is + * required when traverseProc modifies the + * source hierarchy, e.g. by deleting + * files. */ { Tcl_StatBuf statBuf; const char *source, *errfile; diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 984ee2f..8ffea58 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -360,12 +360,12 @@ AlertSingleThread( */ if (tsdPtr->prevPtr) { - tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; + tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; } else { - waitingListPtr = tsdPtr->nextPtr; + waitingListPtr = tsdPtr->nextPtr; } if (tsdPtr->nextPtr) { - tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; + tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; } tsdPtr->nextPtr = tsdPtr->prevPtr = NULL; tsdPtr->onList = 0; diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 78ed008..11193b7 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -204,8 +204,8 @@ printaddrinfo( * * InitializeHostName -- * - * This routine sets the process global value of the name of the local - * host on which the process is running. + * This routine sets the process global value of the name of the local + * host on which the process is running. * * Results: * None. @@ -400,8 +400,8 @@ TcpBlockModeProc( * return any error code. * * Results: - * 0 if the connection has completed, -1 if still in progress or there is - * an error. + * 0 if the connection has completed, -1 if still in progress or there is + * an error. * * Side effects: * Processes socket events off the system queue. May process @@ -1183,7 +1183,7 @@ TcpWatchProc( * from interfering with the -accept behavior (bug #3394732). */ - return; + return; } if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 20b9a67..29146aa 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -246,7 +246,7 @@ TclpWideClicksToNanoseconds( * and back. * * Results: - * 1 click in microseconds as double. + * 1 click in microseconds as double. * * Side effects: * None. diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 8b289b1..d7be807 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -176,7 +176,7 @@ typedef struct ConsoleHandleInfo { * is queued and dropped on receipt. */ typedef struct ConsoleChannelInfo { - HANDLE handle; /* Console handle */ + HANDLE handle; /* Console handle */ Tcl_ThreadId threadId; /* Id of owning thread */ struct ConsoleChannelInfo *nextWatchingChannelPtr; /* Pointer to next channel watching events. */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index dbf3324..c4b60b9 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1462,7 +1462,7 @@ QuoteCmdLineBackslash( Tcl_DStringAppend(dsPtr, start, (int) (current - start)); } } else { - if (bspos > start) { /* part before first backslash */ + if (bspos > start) { /* part before first backslash */ Tcl_DStringAppend(dsPtr, start, (int) (bspos - start)); } while (bspos++ < current) { /* each backslash twice */ @@ -1505,7 +1505,7 @@ QuoteCmdLinePart( TclDStringAppendLiteral(dsPtr, "\""); /* opening escape quote-char */ do { - *bspos = NULL; + *bspos = NULL; special++; if (*special == '\\') { /* @@ -1810,7 +1810,7 @@ TclpCreateCommandChannel( SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; } else { - infoPtr->readTI = NULL; + infoPtr->readTI = NULL; infoPtr->readThread = 0; } if (writeFile != NULL) { @@ -1825,8 +1825,8 @@ TclpCreateCommandChannel( SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } else { - infoPtr->writeTI = NULL; - infoPtr->writeThread = 0; + infoPtr->writeTI = NULL; + infoPtr->writeThread = 0; } /* @@ -3397,10 +3397,10 @@ TclPipeThreadWaitForSignal( if (state != PTI_STATE_STOP) { *pipeTIPtr = NULL; } else { - pipeTI->evWakeUp = NULL; + pipeTI->evWakeUp = NULL; } if (wakeEvent) { - SetEvent(wakeEvent); + SetEvent(wakeEvent); } return 0; } diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 8ab4548..0f22138 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -114,7 +114,7 @@ typedef DWORD_PTR * PDWORD_PTR; */ #ifndef ENOTEMPTY -# define ENOTEMPTY 41 /* Directory not empty */ +# define ENOTEMPTY 41 /* Directory not empty */ #endif #ifndef EREMOTE # define EREMOTE 66 /* The object is remote */ diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index e27937e..2ce432c 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -620,7 +620,7 @@ SerialCloseProc( serialPtr->validMask &= ~TCL_READABLE; if (serialPtr->writeThread) { - TclPipeThreadStop(&serialPtr->writeTI, serialPtr->writeThread); + TclPipeThreadStop(&serialPtr->writeTI, serialPtr->writeThread); CloseHandle(serialPtr->osWrite.hEvent); CloseHandle(serialPtr->evWritable); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index c05f550..5239cd3 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -618,8 +618,8 @@ TcpBlockModeProc( * return any error code. * * Results: - * 0 if the connection has completed, -1 if still in progress or there is - * an error. + * 0 if the connection has completed, -1 if still in progress or there is + * an error. * * Side effects: * Processes socket events off the system queue. May process diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 5636dc0..8cc4489 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -35,7 +35,7 @@ typedef struct { HANDLE readyEvent; /* System event used to trigger the requesting * thread when the clock calibration procedure * is initialized for the first time. */ - HANDLE exitEvent; /* Event to signal out of an exit handler to + HANDLE exitEvent; /* Event to signal out of an exit handler to * tell the calibration loop to terminate. */ LARGE_INTEGER nominalFreq; /* Nominal frequency of the system performance * counter, that is, the value returned from @@ -109,7 +109,7 @@ static struct { static void StopCalibration(void *clientData); static DWORD WINAPI CalibrationThread(LPVOID arg); -static void UpdateTimeEachSecond(void); +static void UpdateTimeEachSecond(void); static void ResetCounterSamples(unsigned long long fileTime, long long perfCounter, long long perfFreq); static long long AccumulateSample(long long perfCounter, @@ -278,7 +278,7 @@ TclpGetWideClicks(void) wideClick.microsecsScale = 1; return TclpGetMicroseconds(); } else { - return TclpGetMicroseconds(); + return TclpGetMicroseconds(); } } @@ -292,7 +292,7 @@ TclpGetWideClicks(void) * and back. * * Results: - * 1 click in microseconds as double. + * 1 click in microseconds as double. * * Side effects: * None. @@ -304,7 +304,7 @@ double TclpWideClickInMicrosec(void) { if (!wideClick.initialized) { - (void) TclpGetWideClicks(); /* initialize */ + (void) TclpGetWideClicks(); /* initialize */ } return wideClick.microsecsScale; } @@ -870,7 +870,7 @@ UpdateTimeEachSecond(void) if (curFileTime.QuadPart > lastFileTime.QuadPart && curFileTime.QuadPart < lastFileTime.QuadPart + (timeInfo.calibrationInterv * 10000000)) { - /* + /* * Look again in next one second. */ @@ -940,13 +940,13 @@ UpdateTimeEachSecond(void) tdiff = vt0 - curFileTime.QuadPart; if (tdiff > 10000000 || tdiff < -10000000) { - /* + /* * Jump to current system time, use curent estimated frequency. */ - vt0 = curFileTime.QuadPart; + vt0 = curFileTime.QuadPart; } else { - /* + /* * Calculate new frequency and estimate drift to the next second. */ @@ -1015,11 +1015,11 @@ UpdateTimeEachSecond(void) vt1 = vt0 - curFileTime.QuadPart; if (vt1 > 10000000 || vt1 < -10000000) { - /* + /* * Larger jump resp. shift relative new file-time. */ - vt0 = curFileTime.QuadPart; + vt0 = curFileTime.QuadPart; } } } -- cgit v0.12 From ca3ac898ea7724652c49e3cb7f57fcf974b22a16 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 4 Jun 2024 15:54:35 +0000 Subject: Make function definitions have right argument style --- generic/tclClockFmt.c | 10 +++++++--- generic/tclDictObj.c | 3 ++- generic/tclEncoding.c | 3 ++- generic/tclExecute.c | 6 ++++-- generic/tclListObj.c | 26 +++++++++++++++++++------- generic/tclZipfs.c | 12 +++++++----- unix/tclUnixFile.c | 5 +++-- win/tclWinConsole.c | 3 ++- 8 files changed, 46 insertions(+), 22 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ea5f0a5..fead7fd 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1241,9 +1241,13 @@ ObjListSearch( /* currently unused */ static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, - int minLen, int maxLen) +LocaleListSearch( + ClockFmtScnCmdArgs *opts, + DateInfo *info, + int mcKey, + int *val, + int minLen, + int maxLen) { Tcl_Obj **lstv; Tcl_Size lstc; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 428a3a6..ea989be 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -1058,7 +1058,8 @@ Tcl_DictObjRemove( */ Tcl_Size -TclDictGetSize(Tcl_Obj *dictPtr) +TclDictGetSize( + Tcl_Obj *dictPtr) { Dict *dict; DictGetInternalRep(dictPtr, dict); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index f48bf63..129ca51 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -4373,7 +4373,8 @@ TclEncodingProfileIdToName( *------------------------------------------------------------------------ */ void -TclGetEncodingProfiles(Tcl_Interp *interp) +TclGetEncodingProfiles( + Tcl_Interp *interp) { size_t i, n; Tcl_Obj *objPtr; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a0d04e8..5d4bff3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -7865,8 +7865,10 @@ FinalizeOONextFilter( * Helper to calculate small powers of integers whose result is wide. */ static inline Tcl_WideInt -WidePwrSmallExpon(Tcl_WideInt w1, long exponent) { - +WidePwrSmallExpon( + Tcl_WideInt w1, + long exponent) +{ Tcl_WideInt wResult; wResult = w1 * w1; /* b**2 */ diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 2ffaf87..683a0e7 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -266,7 +266,8 @@ ListSpanNew( *------------------------------------------------------------------------ */ static inline void -ListSpanDecrRefs(ListSpan *spanPtr) +ListSpanDecrRefs( + ListSpan *spanPtr) { if (spanPtr->refCount <= 1) { Tcl_Free(spanPtr); @@ -343,7 +344,8 @@ ListSpanMerited( *------------------------------------------------------------------------ */ static inline void -ListRepFreeUnreferenced(const ListRep *repPtr) +ListRepFreeUnreferenced( + const ListRep *repPtr) { if (! ListRepIsShared(repPtr) && repPtr->spanPtr) { /* T:listrep-1.5.1 */ @@ -492,7 +494,8 @@ MemoryAllocationError( *------------------------------------------------------------------------ */ static int -ListLimitExceededError(Tcl_Interp *interp) +ListLimitExceededError( + Tcl_Interp *interp) { if (interp != NULL) { Tcl_SetObjResult( @@ -523,7 +526,9 @@ ListLimitExceededError(Tcl_Interp *interp) *------------------------------------------------------------------------ */ static inline void -ListRepUnsharedShiftDown(ListRep *repPtr, Tcl_Size shiftCount) +ListRepUnsharedShiftDown( + ListRep *repPtr, + Tcl_Size shiftCount) { ListStore *storePtr; @@ -578,7 +583,9 @@ ListRepUnsharedShiftDown(ListRep *repPtr, Tcl_Size shiftCount) */ #if 0 static inline void -ListRepUnsharedShiftUp(ListRep *repPtr, Tcl_Size shiftCount) +ListRepUnsharedShiftUp( + ListRep *repPtr, + Tcl_Size shiftCount) { ListStore *storePtr; @@ -624,7 +631,10 @@ ListRepUnsharedShiftUp(ListRep *repPtr, Tcl_Size shiftCount) *------------------------------------------------------------------------ */ static void -ListRepValidate(const ListRep *repPtr, const char *file, int lineNum) +ListRepValidate( + const ListRep *repPtr, + const char *file, + int lineNum) { ListStore *storePtr = repPtr->storePtr; const char *condition; @@ -689,7 +699,9 @@ failure: *------------------------------------------------------------------------ */ void -TclListObjValidate(Tcl_Interp *interp, Tcl_Obj *listObj) +TclListObjValidate( + Tcl_Interp *interp, + Tcl_Obj *listObj) { ListRep listRep; if (TclListObjGetRep(interp, listObj, &listRep) != TCL_OK) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b41126e..4fef38c 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -875,7 +875,7 @@ static char * DecodeZipEntryText( const unsigned char *inputBytes, unsigned int inputLength, - Tcl_DString *dstPtr) /* Must have been initialized by caller! */ + Tcl_DString *dstPtr) /* Must have been initialized by caller! */ { Tcl_Encoding encoding; const char *src; @@ -980,9 +980,10 @@ DecodeZipEntryText( *------------------------------------------------------------------------ */ static int -NormalizeMountPoint(Tcl_Interp *interp, - const char *mountPath, - Tcl_DString *dsPtr) /* Must be initialized by caller! */ +NormalizeMountPoint( + Tcl_Interp *interp, + const char *mountPath, + Tcl_DString *dsPtr) /* Must be initialized by caller! */ { const char *joiner[2]; char *joinedPath; @@ -2230,7 +2231,8 @@ ListMountPoints( *------------------------------------------------------------------------ */ static void -CleanupMount(ZipFile *zf) /* Mount point */ +CleanupMount( + ZipFile *zf) /* Mount point */ { ZipEntry *z, *znext; Tcl_HashEntry *hPtr; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 93f6aa8..e91ed41 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -13,8 +13,9 @@ #include "tclInt.h" #include "tclFileSystem.h" -static int NativeMatchType(Tcl_Interp *interp, const char* nativeEntry, - const char* nativeName, Tcl_GlobTypeData *types); +static int NativeMatchType(Tcl_Interp *interp, + const char* nativeEntry, const char* nativeName, + Tcl_GlobTypeData *types); /* *--------------------------------------------------------------------------- diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index d7be807..a498200 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -2067,7 +2067,8 @@ AllocateConsoleHandleInfo( *------------------------------------------------------------------------ */ static ConsoleHandleInfo * -FindConsoleInfo(const ConsoleChannelInfo *chanInfoPtr) +FindConsoleInfo( + const ConsoleChannelInfo *chanInfoPtr) { ConsoleHandleInfo *handleInfoPtr; for (handleInfoPtr = gConsoleHandleInfoList; handleInfoPtr; handleInfoPtr = handleInfoPtr->nextPtr) { -- cgit v0.12 From 11b6f21176cba94c19eed9eb519155ba7de004d3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 5 Jun 2024 13:10:11 +0000 Subject: More of the same: Space before tab is an extremely unlikely to be correct indentation pattern. --- compat/fake-rfc2553.c | 38 +++++++++++++++---------------- generic/regc_color.c | 6 ++--- generic/regc_locale.c | 36 +++++++++++++++--------------- generic/regc_nfa.c | 54 ++++++++++++++++++++++----------------------- generic/regcomp.c | 8 +++---- generic/rege_dfa.c | 6 ++--- generic/tclDate.c | 2 +- generic/tclGetDate.y | 2 +- generic/tclScan.c | 2 +- generic/tclTest.c | 27 +++++++++++------------ generic/tclThreadTest.c | 2 +- library/auto.tcl | 12 +++++----- library/clock.tcl | 20 ++++++++--------- library/history.tcl | 2 +- library/http/http.tcl | 8 +++---- library/opt/optparse.tcl | 2 +- library/package.tcl | 4 ++-- library/platform/shell.tcl | 44 ++++++++++++++++++------------------ library/tcltest/tcltest.tcl | 6 ++--- tools/index.tcl | 6 ++--- tools/makeTestCases.tcl | 4 ++-- tools/tclOOScript.tcl | 6 ++--- tools/tcltk-man2html.tcl | 4 ++-- unix/Makefile.in | 2 +- unix/configure | 4 ++-- unix/configure.ac | 2 +- unix/dltest/embtest.c | 2 +- unix/tcl.m4 | 2 +- unix/tclUnixTest.c | 4 ++-- win/Makefile.in | 10 ++++----- win/makefile.vc | 2 +- win/rules.vc | 2 +- win/tcl.rc | 14 ++++++------ win/tclsh.rc | 14 ++++++------ win/tcltest.rc | 14 ++++++------ 35 files changed, 186 insertions(+), 187 deletions(-) diff --git a/compat/fake-rfc2553.c b/compat/fake-rfc2553.c index cfe4c39..066f83f 100644 --- a/compat/fake-rfc2553.c +++ b/compat/fake-rfc2553.c @@ -43,32 +43,32 @@ TCL_DECLARE_MUTEX(netdbMutex) static size_t strlcpy(char *dst, const char *src, size_t siz) { - char *d = dst; - const char *s = src; - size_t n = siz; + char *d = dst; + const char *s = src; + size_t n = siz; - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } - return(s - src - 1); /* count does not include NUL */ + return(s - src - 1); /* count does not include NUL */ } #endif int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, - size_t hostlen, char *serv, size_t servlen, int flags) + size_t hostlen, char *serv, size_t servlen, int flags) { struct sockaddr_in *sin = (struct sockaddr_in *)sa; struct hostent *hp; diff --git a/generic/regc_color.c b/generic/regc_color.c index f1e25d2..ccb1826 100644 --- a/generic/regc_color.c +++ b/generic/regc_color.c @@ -430,7 +430,7 @@ newsub( /* - subrange - allocate new subcolors to this range of chrs, fill in arcs ^ static void subrange(struct vars *, pchr, pchr, struct state *, - ^ struct state *); + ^ struct state *); */ static void subrange( @@ -689,7 +689,7 @@ uncolorchain( /* - rainbow - add arcs of all full colors (but one) between specified states ^ static void rainbow(struct nfa *, struct colormap *, int, pcolor, - ^ struct state *, struct state *); + ^ struct state *, struct state *); */ static void rainbow( @@ -716,7 +716,7 @@ rainbow( - colorcomplement - add arcs of complementary colors * The calling sequence ought to be reconciled with cloneouts(). ^ static void colorcomplement(struct nfa *, struct colormap *, int, - ^ struct state *, struct state *, struct state *); + ^ struct state *, struct state *, struct state *); */ static void colorcomplement( diff --git a/generic/regc_locale.c b/generic/regc_locale.c index b6687f3..6613e69 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -1187,24 +1187,24 @@ cclass( } break; case CC_PRINT: - cv = getcvec(v, NUM_SPACE_CHAR + NUM_GRAPH_CHAR, NUM_SPACE_RANGE + NUM_GRAPH_RANGE - 1); - if (cv) { - for (i=1 ; ifrom->no > bb->from->no) { - return 1; + return 1; } if (aa->co < bb->co) { - return -1; + return -1; } if (aa->co > bb->co) { - return 1; + return 1; } if (aa->type < bb->type) { - return -1; + return -1; } if (aa->type > bb->type) { - return 1; + return 1; } return 0; } @@ -1118,7 +1118,7 @@ copyouts( cparc(nfa, a, newState, a->to); } } else { - /* + /* * With many arcs, use a sort-merge approach. Note that createarc() * will put new arcs onto the front of newState's chain, so it does * not break our walk through the sorted part of the chain. @@ -1177,7 +1177,7 @@ copyouts( /* - cloneouts - copy out arcs of a state to another state pair, modifying type ^ static void cloneouts(struct nfa *, struct state *, struct state *, - ^ struct state *, int); + ^ struct state *, int); */ static void cloneouts( @@ -1267,7 +1267,7 @@ deltraverse( * well as mark already-seen states. (You knew there was a reason why it's a * state pointer, didn't you? :-)) ^ static void dupnfa(struct nfa *, struct state *, struct state *, - ^ struct state *, struct state *); + ^ struct state *, struct state *); */ static void dupnfa( @@ -1599,10 +1599,10 @@ pull( s->tmp = *intermediates; *intermediates = s; } - cparc(nfa, con, a->from, s); + cparc(nfa, con, a->from, s); cparc(nfa, a, s, to); - freearc(nfa, a); - break; + freearc(nfa, a); + break; default: assert(NOTREACHED); break; @@ -1779,9 +1779,9 @@ push( *intermediates = s; } cparc(nfa, con, s, a->to); - cparc(nfa, a, from, s); - freearc(nfa, a); - break; + cparc(nfa, a, from, s); + freearc(nfa, a); + break; default: assert(NOTREACHED); break; @@ -2021,11 +2021,11 @@ fixempties( } } - /* Reset the tmp fields as we walk back */ - nexts = s2->tmp; - s2->tmp = NULL; - } - s->tmp = NULL; + /* Reset the tmp fields as we walk back */ + nexts = s2->tmp; + s2->tmp = NULL; + } + s->tmp = NULL; assert(arccount <= totalinarcs); /* Remember how many original inarcs this state has */ @@ -2185,12 +2185,12 @@ fixconstraintloops( freearc(nfa, a); } else { hasconstraints = 1; - } + } } } - /* If we removed all the outarcs, the state is useless. */ - if (s->nouts == 0 && !s->flag) { - dropstate(nfa, s); + /* If we removed all the outarcs, the state is useless. */ + if (s->nouts == 0 && !s->flag) { + dropstate(nfa, s); } } @@ -2235,7 +2235,7 @@ fixconstraintloops( } if (f != NULL) { - dumpnfa(nfa, f); + dumpnfa(nfa, f); } } @@ -2725,7 +2725,7 @@ cleanup( /* - markreachable - recursive marking of reachable states ^ static void markreachable(struct nfa *, struct state *, struct state *, - ^ struct state *); + ^ struct state *); */ static void markreachable( @@ -2749,7 +2749,7 @@ markreachable( /* - markcanreach - recursive marking of states which can reach here ^ static void markcanreach(struct nfa *, struct state *, struct state *, - ^ struct state *); + ^ struct state *); */ static void markcanreach( diff --git a/generic/regcomp.c b/generic/regcomp.c index 012e37c..949f397 100644 --- a/generic/regcomp.c +++ b/generic/regcomp.c @@ -644,7 +644,7 @@ makesearch( * together with '|'. They appear in the tree as the left children of a chain * of '|' subres. ^ static struct subre *parse(struct vars *, int, int, struct state *, - ^ struct state *); + ^ struct state *); */ static struct subre * parse( @@ -726,7 +726,7 @@ parse( * Concatenated things are bundled up as much as possible, with separate * ',' nodes introduced only when necessary due to substructure. ^ static struct subre *parsebranch(struct vars *, int, int, struct state *, - ^ struct state *, int); + ^ struct state *, int); */ static struct subre * parsebranch( @@ -775,7 +775,7 @@ parsebranch( * particular, it contains a recursion that can involve parsing the rest of * the branch, making this function's name somewhat inaccurate. ^ static void parseqatom(struct vars *, int, int, struct state *, - ^ struct state *, struct subre *); + ^ struct state *, struct subre *); */ static void parseqatom( @@ -1649,7 +1649,7 @@ onechr( /* - dovec - fill in arcs for each element of a cvec ^ static void dovec(struct vars *, struct cvec *, struct state *, - ^ struct state *); + ^ struct state *); */ static void dovec( diff --git a/generic/rege_dfa.c b/generic/rege_dfa.c index 5d49aa5..c8c74f0 100644 --- a/generic/rege_dfa.c +++ b/generic/rege_dfa.c @@ -159,7 +159,7 @@ longest( /* - shortest - shortest-preferred matching engine ^ static chr *shortest(struct vars *, struct dfa *, chr *, chr *, chr *, - ^ chr **, int *); + ^ chr **, int *); */ static chr * /* endpoint, or NULL */ shortest( @@ -308,7 +308,7 @@ lastCold( /* - newDFA - set up a fresh DFA ^ static struct dfa *newDFA(struct vars *, struct cnfa *, - ^ struct colormap *, struct smalldfa *); + ^ struct colormap *, struct smalldfa *); */ static struct dfa * newDFA( @@ -477,7 +477,7 @@ initialize( /* - miss - handle a cache miss ^ static struct sset *miss(struct vars *, struct dfa *, struct sset *, - ^ pcolor, chr *, chr *); + ^ pcolor, chr *, chr *); */ static struct sset * /* NULL if goes to empty set */ miss( diff --git a/generic/tclDate.c b/generic/tclDate.c index a22168f..312a000 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2649,7 +2649,7 @@ TclClockFreeScan( /* parse */ status = yyparse(info); if (status == 1) { - const char *msg = NULL; + const char *msg = NULL; if (info->errFlags & CLF_HAVEDATE) { msg = "more than one date in string"; } else if (info->errFlags & CLF_TIME) { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 3b04de4..301bf9d 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -1025,7 +1025,7 @@ TclClockFreeScan( /* parse */ status = yyparse(info); if (status == 1) { - const char *msg = NULL; + const char *msg = NULL; if (info->errFlags & CLF_HAVEDATE) { msg = "more than one date in string"; } else if (info->errFlags & CLF_TIME) { diff --git a/generic/tclScan.c b/generic/tclScan.c index 9a9e773..4ffe177 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -368,7 +368,7 @@ ValidateFormat( ull, (Tcl_Size)TCL_SIZE_MAX-1)); Tcl_SetErrorCode( - interp, "TCL", "FORMAT", "WIDTHLIMIT", (void *)NULL); + interp, "TCL", "FORMAT", "WIDTHLIMIT", (char *)NULL); goto error; } flags |= SCAN_WIDTH; diff --git a/generic/tclTest.c b/generic/tclTest.c index 795310d..0bb09f6 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -2070,7 +2070,7 @@ static void SpecialFree( * these functions (i/o command cannot test all combinations) * The arguments at the script level are roughly those of the above * functions: - * encodingname srcbytes flags state dstlen ?srcreadvar? ?dstwrotevar? ?dstcharsvar? + * encodingname srcbytes flags state dstlen ?srcreadvar? ?dstwrotevar? ?dstcharsvar? * * Results: * TCL_OK or TCL_ERROR. This any errors running the test, NOT the @@ -3754,7 +3754,7 @@ TestlinkarrayCmd( i++; } if (Tcl_GetIndexFromObj(interp, objv[i++], LinkType, "type", 0, - &typeIndex) != TCL_OK) { + &typeIndex) != TCL_OK) { return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[i++], &size) == TCL_ERROR) { @@ -3769,7 +3769,7 @@ TestlinkarrayCmd( if (i < objc) { if (Tcl_GetWideIntFromObj(interp, objv[i], &addr) == TCL_ERROR) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( + Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong address value", -1)); return TCL_ERROR; } @@ -8531,15 +8531,15 @@ InterpCompiledVarResolver( Tcl_ResolvedVarInfo **rPtr) { if (*name == 'T') { - MyResolvedVarInfo *resVarInfo = (MyResolvedVarInfo *)Tcl_Alloc(sizeof(MyResolvedVarInfo)); - - resVarInfo->vInfo.fetchProc = MyCompiledVarFetch; - resVarInfo->vInfo.deleteProc = MyCompiledVarFree; - resVarInfo->var = NULL; - resVarInfo->nameObj = Tcl_NewStringObj(name, -1); - Tcl_IncrRefCount(resVarInfo->nameObj); - *rPtr = &resVarInfo->vInfo; - return TCL_OK; + MyResolvedVarInfo *resVarInfo = (MyResolvedVarInfo *)Tcl_Alloc(sizeof(MyResolvedVarInfo)); + + resVarInfo->vInfo.fetchProc = MyCompiledVarFetch; + resVarInfo->vInfo.deleteProc = MyCompiledVarFree; + resVarInfo->var = NULL; + resVarInfo->nameObj = Tcl_NewStringObj(name, -1); + Tcl_IncrRefCount(resVarInfo->nameObj); + *rPtr = &resVarInfo->vInfo; + return TCL_OK; } return TCL_CONTINUE; } @@ -8656,8 +8656,7 @@ int TestApplyLambdaObjCmd ( * - The body of the lambda (lambdaObjs[1]) ALREADY has internal * representation of ByteCode and thus will not be compiled again */ - evalObjs[1] = lambdaObj; /* lambdaObj already has a ref count so - no need for IncrRef */ + evalObjs[1] = lambdaObj; /* lambdaObj already has a ref count so no need for IncrRef */ result = Tcl_EvalObjv(interp, 2, evalObjs, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(evalObjs[0]); Tcl_DecrRefCount(lambdaObj); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index e4a9312..49d9cf2 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -985,7 +985,7 @@ ThreadCancel( Tcl_MutexUnlock(&threadMutex); Tcl_ResetResult(interp); return Tcl_CancelEval(tsdPtr->interp, - (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags); + (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags); } /* diff --git a/library/auto.tcl b/library/auto.tcl index 824cdac..cc779cf 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -45,7 +45,7 @@ proc auto_reset {} { # initialization script and set a global library variable. # # Arguments: -# basename Prefix of the directory name, (e.g., "tk") +# basename Prefix of the directory name, (e.g., "tk") # version Version number of the package, (e.g., "8.0") # patch Patchlevel of the package, (e.g., "8.0.3") # initScript Initialization script to source (e.g., tk.tcl) @@ -130,7 +130,7 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { } else { catch {zipfs unmount $mountpoint} } - } + } } } } @@ -480,9 +480,9 @@ proc auto_mkindex_parser::childhook {cmd} { # "tclIndex" file for auto-loading. # # Arguments: -# name Name of command recognized in Tcl files. +# name Name of command recognized in Tcl files. # arglist Argument list for command. -# body Implementation of command to handle indexing. +# body Implementation of command to handle indexing. proc auto_mkindex_parser::command {name arglist body} { hook [list auto_mkindex_parser::commandInit $name $arglist $body] @@ -494,9 +494,9 @@ proc auto_mkindex_parser::command {name arglist body} { # called when the interpreter used by the parser is created. # # Arguments: -# name Name of command recognized in Tcl files. +# name Name of command recognized in Tcl files. # arglist Argument list for command. -# body Implementation of command to handle indexing. +# body Implementation of command to handle indexing. proc auto_mkindex_parser::commandInit {name arglist body} { variable parser diff --git a/library/clock.tcl b/library/clock.tcl index ef82372..83c6e61 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -140,9 +140,9 @@ proc ::tcl::clock::Initialize {} { Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec } MONTHS_FULL { - January February March - April May June - July August September + January February March + April May June + July August September October November December } PM {pm} @@ -292,7 +292,7 @@ proc ::tcl::clock::Initialize {} { # The keys are long lists of values obtained from the time zone # information in the Registry. In order, the list elements are: - # Bias StandardBias DaylightBias + # Bias StandardBias DaylightBias # StandardDate.wYear StandardDate.wMonth StandardDate.wDayOfWeek # StandardDate.wDay StandardDate.wHour StandardDate.wMinute # StandardDate.wSecond StandardDate.wMilliseconds @@ -339,7 +339,7 @@ proc ::tcl::clock::Initialize {} { {3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :CET {7200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Harare {7200 0 3600 0 9 4 5 23 59 59 0 0 4 4 5 23 59 59 0} - :Africa/Cairo + :Africa/Cairo {7200 0 3600 0 10 0 5 4 0 0 0 0 3 0 5 3 0 0 0} :Europe/Helsinki {7200 0 3600 0 9 0 3 2 0 0 0 0 3 5 5 2 0 0 0} :Asia/Jerusalem {7200 0 3600 0 9 0 5 1 0 0 0 0 3 0 5 0 0 0 0} :Europe/Bucharest @@ -480,9 +480,9 @@ proc ::tcl::clock::Initialize {} { variable LocFmtMap [dict create]; # Dictionary with localized format maps variable TimeZoneBad [dict create]; # Dictionary whose keys are time zone - # names and whose values are 1 if + # names and whose values are 1 if # the time zone is unknown and 0 - # if it is known. + # if it is known. variable TZData; # Array whose keys are time zone names # and whose values are lists of quads # comprising start time, UTC offset, @@ -518,7 +518,7 @@ proc ::tcl::clock::mcget {loc} { set loc [mclocale] } if {$loc ne {}} { - set loc [string tolower $loc] + set loc [string tolower $loc] } # try to retrieve now if already available: @@ -651,7 +651,7 @@ proc ::tcl::clock::GetSystemLocale {} { proc ::tcl::clock::EnterLocale { locale } { switch -- $locale system { - set locale [GetSystemLocale] + set locale [GetSystemLocale] } current { set locale [mclocale] } @@ -1001,7 +1001,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { LoadZoneinfoFile [string range $timezone 1 end] }] } then { - dict set TimeZoneBad $timezone 1 + dict set TimeZoneBad $timezone 1 return -code error \ -errorcode [list CLOCK badTimeZone $timezone] \ "time zone \"$timezone\" not found" diff --git a/library/history.tcl b/library/history.tcl index e3d3fe4..ec59ac7 100644 --- a/library/history.tcl +++ b/library/history.tcl @@ -89,7 +89,7 @@ trace add command ::history delete [list apply {{oldName newName op} { # exec (optional) a substring of "exec" causes the command to # be evaled. # Results: -# If executing, then the results of the command are returned +# If executing, then the results of the command are returned # # Side Effects: # Adds to the history list diff --git a/library/http/http.tcl b/library/http/http.tcl index d53ecef..63c2403 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -2449,7 +2449,7 @@ proc http::Connected {token proto phost srvurl} { if {[info exists state(reusing)] && $state(reusing)} { # The socket was closed at the server end, and closed at # this end by http::CheckEof. - if {[TestForReplay $token write $err a]} { + if {[TestForReplay $token write $err a]} { return } else { Finish $token {failed to re-use socket} @@ -3396,7 +3396,7 @@ proc http::cleanup {token} { # # Side Effects # Sets the status of the connection, which unblocks -# the waiting geturl call +# the waiting geturl call proc http::Connect {token proto phost srvurl} { variable $token @@ -4925,7 +4925,7 @@ proc http::ReceiveChunked {chan command} { } # http::SplitCommaSeparatedFieldValue -- -# Return the individual values of a comma-separated field value. +# Return the individual values of a comma-separated field value. # # Arguments: # fieldValue Comma-separated header field value. @@ -4942,7 +4942,7 @@ proc http::SplitCommaSeparatedFieldValue {fieldValue} { # http::GetFieldValue -- -# Return the value of a header field. +# Return the value of a header field. # # Arguments: # headers Headers key-value list diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index 0a6cdfa..d8883fe 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -811,7 +811,7 @@ proc ::tcl::OptCheckType {arg type {typeArgs ""}} { # Auto magic lazy type determination proc OptGuessType {arg} { - if { $arg == "true" || $arg == "false" } { + if { $arg == "true" || $arg == "false" } { return boolean } if {[string is integer -strict $arg]} { diff --git a/library/package.tcl b/library/package.tcl index 17ace66..118beef 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -504,7 +504,7 @@ proc tclPkgUnknown {name args} { # In case of version conflict, silently ignore continue } - tclLog "error reading package index file $file: $msg" + tclLog "error reading package index file $file: $msg" } on ok {} { set procdDirs($dir) 1 } @@ -612,7 +612,7 @@ proc tcl::MacOSXPkgUnknown {original name args} { continue } on error msg { if {[regexp {version conflict for package} $msg]} { - # In case of version conflict, silently ignore + # In case of version conflict, silently ignore continue } tclLog "error reading package index file $file: $msg" diff --git a/library/platform/shell.tcl b/library/platform/shell.tcl index 60d5b37..a91849c 100644 --- a/library/platform/shell.tcl +++ b/library/platform/shell.tcl @@ -163,34 +163,34 @@ proc ::platform::shell::TEMP {} { set checked_dir_writable 0 set mypid [pid] for {set i 0} {$i < $maxtries} {incr i} { - set newname $prefix - for {set j 0} {$j < $nrand_chars} {incr j} { - append newname [string index $chars \ + set newname $prefix + for {set j 0} {$j < $nrand_chars} {incr j} { + append newname [string index $chars \ [expr {int(rand()*62)}]] - } + } set newname [file join $tmpdir $newname] - if {[file exists $newname]} { - after 1 - } else { - if {[catch {open $newname $access $permission} channel]} { - if {!$checked_dir_writable} { - set dirname [file dirname $newname] - if {![file writable $dirname]} { - return -code error "Directory $dirname is not writable" - } - set checked_dir_writable 1 - } - } else { - # Success + if {[file exists $newname]} { + after 1 + } else { + if {[catch {open $newname $access $permission} channel]} { + if {!$checked_dir_writable} { + set dirname [file dirname $newname] + if {![file writable $dirname]} { + return -code error "Directory $dirname is not writable" + } + set checked_dir_writable 1 + } + } else { + # Success close $channel - return [file normalize $newname] - } - } + return [file normalize $newname] + } + } } if {$channel ne ""} { - return -code error "Failed to open a temporary file: $channel" + return -code error "Failed to open a temporary file: $channel" } else { - return -code error "Failed to find an unused temporary file name" + return -code error "Failed to find an unused temporary file name" } } diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 2fc5838..3cb5e2d 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -515,7 +515,7 @@ namespace eval tcltest { unset $varName } namespace eval [namespace current] \ - [list upvar 0 Option($option) $varName] + [list upvar 0 Option($option) $varName] # Workaround for Bug (now Feature Request) 572889. Grrrr.... # Track all the variables tied to options lappend OptionControlledVariables $varName @@ -1914,7 +1914,7 @@ proc tcltest::SubstArguments {argList} { # Arguments: # name - Name of test, in the form foo-1.2. # description - Short textual description of the test, to -# help humans understand what it does. +# help humans understand what it does. # # Results: # None. @@ -2128,7 +2128,7 @@ proc tcltest::test {name description args} { # check if the answer matched the expected answer # Only check if we ran the body of the test (no setup failure) if {!$processTest} { - set scriptFailure 0 + set scriptFailure 0 } elseif {$setupFailure || $codeFailure} { set scriptFailure 0 } elseif {[set scriptCompare [catch { diff --git a/tools/index.tcl b/tools/index.tcl index 07f5868..5426ee6 100644 --- a/tools/index.tcl +++ b/tools/index.tcl @@ -14,12 +14,12 @@ # state - state variable that controls action of text proc. # # topics - array indexed by (package,section,topic) with value -# of topic ID. +# of topic ID. # # keywords - array indexed by keyword string with value of topic ID. # -# curID - current topic ID, starts at 0 and is incremented for -# each new topic file. +# curID - current topic ID, starts at 0 and is incremented for +# each new topic file. # # curPkg - current package name (e.g. Tcl). # diff --git a/tools/makeTestCases.tcl b/tools/makeTestCases.tcl index 1eae645..d1221b8 100755 --- a/tools/makeTestCases.tcl +++ b/tools/makeTestCases.tcl @@ -215,7 +215,7 @@ proc testcases2 { f2 } { # Define the roman numerals set roman { - ? i ii iii iv v vi vii viii ix + ? i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx xxi xxii xxiii xxiv xxv xxvi xxvii xxviii xxix xxx xxxi xxxii xxxiii xxxiv xxxv xxxvi xxxvii xxxviii xxxix @@ -228,7 +228,7 @@ proc testcases2 { f2 } { c } set romanc { - ? c cc ccc cd d dc dcc dccc cm + ? c cc ccc cd d dc dcc dccc cm m mc mcc mccc mcd md mdc mdcc mdccc mcm mm mmc mmcc mmccc mmcd mmd mmdc mmdcc mmdccc mmcm mmm mmmc mmmcc mmmccc mmmcd mmmd mmmdc mmmdcc mmmdccc mmmcm diff --git a/tools/tclOOScript.tcl b/tools/tclOOScript.tcl index 0b75882..0cbe5b7 100644 --- a/tools/tclOOScript.tcl +++ b/tools/tclOOScript.tcl @@ -1,8 +1,8 @@ # tclOOScript.h -- # -# This file contains support scripts for TclOO. They are defined here so -# that the code can be definitely run even in safe interpreters; TclOO's -# core setup is safe. +# This file contains support scripts for TclOO. They are defined here so +# that the code can be definitely run even in safe interpreters; TclOO's +# core setup is safe. # # Copyright © 2012-2019 Donal K. Fellows # Copyright © 2013 Andreas Kupries diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 7b3558d..01478aa 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -610,8 +610,8 @@ array set remap_link_target { Tcl_Obj Tcl_NewObj Tcl_ObjType Tcl_RegisterObjType Tcl_OpenFileChannelProc Tcl_FSOpenFileChannel - errorinfo env - errorcode env + errorinfo env + errorcode env tcl_pkgpath env Tcl_Command Tcl_CreateObjCommand Tcl_CmdProc Tcl_CreateObjCommand diff --git a/unix/Makefile.in b/unix/Makefile.in index 093edf8..29d3228 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. -VERSION = @TCL_VERSION@ +VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ MINOR_VERSION = @TCL_MINOR_VERSION@ PATCH_LEVEL = @TCL_PATCH_LEVEL@ diff --git a/unix/configure b/unix/configure index b470e3c..2ef18ad 100755 --- a/unix/configure +++ b/unix/configure @@ -5796,7 +5796,7 @@ then : ;; *) # Make sure only first arg gets _r - CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` + CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5 @@ -10016,7 +10016,7 @@ int main (void) { - socklen_t foo; + socklen_t foo; ; return 0; diff --git a/unix/configure.ac b/unix/configure.ac index 766392e..f2a1b58 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -404,7 +404,7 @@ AC_CACHE_CHECK([for socklen_t], tcl_cv_type_socklen_t, [ #include #include ]], [[ - socklen_t foo; + socklen_t foo; ]])],[tcl_cv_type_socklen_t=yes],[tcl_cv_type_socklen_t=no])]) if test $tcl_cv_type_socklen_t = no; then AC_DEFINE(socklen_t, int, [Define as int if socklen_t is not available]) diff --git a/unix/dltest/embtest.c b/unix/dltest/embtest.c index ff58cc4..33f77a0 100644 --- a/unix/dltest/embtest.c +++ b/unix/dltest/embtest.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) { exitcode = 1; } if (!exitcode) { - printf("All OK!\n"); + printf("All OK!\n"); } return exitcode; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 7b84923..2b2299e 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -990,7 +990,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ;; *) # Make sure only first arg gets _r - CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'` + CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'` ;; esac AC_MSG_RESULT([Using $CC for compiling with threads]) diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index b204c77..26c590d 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -549,7 +549,7 @@ TestalarmCmd( * None. * * Side effects: - * Calls the Tcl Async handler. + * Calls the Tcl Async handler. * *---------------------------------------------------------------------- */ @@ -566,7 +566,7 @@ AlarmHandler( * * TestgotsigCmd -- * - * Verify the signal was handled after the testalarm command. + * Verify the signal was handled after the testalarm command. * * Results: * None. diff --git a/win/Makefile.in b/win/Makefile.in index 18ce10d..0773bce 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -79,10 +79,10 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ # To change the compiler switches, for example to change from optimization to # debugging symbols, change the following line: -#CFLAGS = $(CFLAGS_DEBUG) -#CFLAGS = $(CFLAGS_OPTIMIZE) -#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DMP_FIXED_CUTOFFS -D__USE_MINGW_ANSI_STDIO=0 +#CFLAGS = $(CFLAGS_DEBUG) +#CFLAGS = $(CFLAGS_OPTIMIZE) +#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DMP_FIXED_CUTOFFS -D__USE_MINGW_ANSI_STDIO=0 # To compile without backward compatibility and deprecated code uncomment the # following @@ -162,7 +162,7 @@ TEST_LOAD_FACILITIES = package ifneeded tcl::test ${VERSION}@TCL_PATCH_LEVEL@ [l ZLIB_DLL_FILE = zlib1.dll TOMMATH_DLL_FILE = libtommath.dll -SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ @TOMMATH_DLL_FILE@ +SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ @TOMMATH_DLL_FILE@ STATIC_LIBRARIES = $(TCL_LIB_FILE) TCLSH = tclsh$(VER)${EXESUFFIX} diff --git a/win/makefile.vc b/win/makefile.vc index 2a35668..d2826ea 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -57,7 +57,7 @@ # Any combination of the above may be used (comma separated). # 'none' will over-ride everything to nothing. # -# noembed = Without this option, the Tcl core library scripts +# noembed = Without this option, the Tcl core library scripts # are embedded into the executable if "static" is # specified in OPTS, or into the DLL otherwise. If # "noembed" is specified, the scripts are not embedded diff --git a/win/rules.vc b/win/rules.vc index 143ea9e..f1bcf4c 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1248,7 +1248,7 @@ TKSTUBLIBNAME = tkstub.lib !endif !if $(DOING_TK) -WISH = $(OUT_DIR)\$(WISHNAME) +WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) diff --git a/win/tcl.rc b/win/tcl.rc index 3d125f2..1ea6208 100644 --- a/win/tcl.rc +++ b/win/tcl.rc @@ -19,17 +19,17 @@ LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO - FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL + FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL - FILEFLAGSMASK 0x3fL + FILEFLAGSMASK 0x3fL #ifdef DEBUG - FILEFLAGS VS_FF_DEBUG + FILEFLAGS VS_FF_DEBUG #else - FILEFLAGS 0x0L + FILEFLAGS 0x0L #endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0x0L + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN diff --git a/win/tclsh.rc b/win/tclsh.rc index f439d08..77d2d73 100644 --- a/win/tclsh.rc +++ b/win/tclsh.rc @@ -26,17 +26,17 @@ LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO - FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL + FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL - FILEFLAGSMASK 0x3fL + FILEFLAGSMASK 0x3fL #ifdef DEBUG - FILEFLAGS VS_FF_DEBUG + FILEFLAGS VS_FF_DEBUG #else - FILEFLAGS 0x0L + FILEFLAGS 0x0L #endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN diff --git a/win/tcltest.rc b/win/tcltest.rc index 847a250..ea55a62 100644 --- a/win/tcltest.rc +++ b/win/tcltest.rc @@ -26,17 +26,17 @@ LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO - FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL + FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL - FILEFLAGSMASK 0x3fL + FILEFLAGSMASK 0x3fL #ifdef DEBUG - FILEFLAGS VS_FF_DEBUG + FILEFLAGS VS_FF_DEBUG #else - FILEFLAGS 0x0L + FILEFLAGS 0x0L #endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN -- cgit v0.12 From 3891a78d8c67a61b6cb8710671c1207e4e4aa815 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2024 14:12:19 +0000 Subject: A clearer way of writing what parity options are available --- unix/tclUnixChan.c | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index edb1edb..12366ac 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -162,15 +162,15 @@ static int TtySetOptionProc(void *instanceData, static const Tcl_ChannelType fileChannelType = { "file", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ + NULL, /* Deprecated close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ - NULL, + NULL, NULL, /* Set option proc. */ FileGetOptionProc, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - FileCloseProc, /* close2proc. */ + FileCloseProc, /* Close proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -188,7 +188,7 @@ static const Tcl_ChannelType fileChannelType = { static const Tcl_ChannelType ttyChannelType = { "tty", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ + NULL, /* Deprecated close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ NULL, /* Seek proc. */ @@ -196,7 +196,7 @@ static const Tcl_ChannelType ttyChannelType = { TtyGetOptionProc, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - TtyCloseProc, /* close2proc. */ + TtyCloseProc, /* Close proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -225,7 +225,7 @@ static const Tcl_ChannelType ttyChannelType = { static int FileBlockModeProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ int mode) /* The mode to set. Can be TCL_MODE_BLOCKING * or TCL_MODE_NONBLOCKING. */ { @@ -258,7 +258,7 @@ FileBlockModeProc( static int FileInputProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ @@ -308,7 +308,7 @@ FileInputProc( static int FileOutputProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ @@ -355,7 +355,7 @@ FileOutputProc( static int FileCloseProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ TCL_UNUSED(Tcl_Interp *), int flags) { @@ -448,7 +448,7 @@ TtyCloseProc( static long long FileWideSeekProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ long long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_CUR or SEEK_END. */ @@ -496,7 +496,7 @@ FileWatchNotifyChannelWrapper( static void FileWatchProc( - void *instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ @@ -536,9 +536,9 @@ FileWatchProc( static int FileGetHandleProc( - void *instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - void **handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { FileState *fsPtr = (FileState *)instanceData; @@ -758,7 +758,7 @@ TtyModemStatusStr( static int TtySetOptionProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Which option to set? */ const char *value) /* New value for option. */ @@ -1098,7 +1098,7 @@ TtySetOptionProc( static int TtyGetOptionProc( - void *instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Option to get. */ Tcl_DString *dsPtr) /* Where to store value(s). */ @@ -1637,22 +1637,18 @@ TtyParseMode( * not allow preprocessor directives in their arguments. */ - if ( -#if defined(PAREXT) - strchr("noems", parity) +#ifdef PAREXT +#define PARITY_CHARS "noems" +#define PARITY_MSG "n, o, e, m, or s" #else - strchr("noe", parity) +#define PARITY_CHARS "noe" +#define PARITY_MSG "n, o, or e" #endif /* PAREXT */ - == NULL) { + + if (strchr(PARITY_CHARS, parity) == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "%s parity: should be %s", bad, -#if defined(PAREXT) - "n, o, e, m, or s" -#else - "n, o, or e" -#endif /* PAREXT */ - )); + "%s parity: should be %s", bad, PARITY_MSG)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL); } return TCL_ERROR; @@ -2054,7 +2050,7 @@ Tcl_GetOpenFile( * Ignored, we always check that * the channel is open for the requested * mode. */ - void **filePtr) /* Store pointer to FILE structure here. */ + void **filePtr) /* Store pointer to FILE structure here. */ { Tcl_Channel chan; int chanMode, fd; -- cgit v0.12 From 43d2194943b8bb2c3080092a8219e3923b51f9bf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Jun 2024 09:07:44 +0000 Subject: Fix [57daa91ea]: Tcl_GetIntForIndex handling of n-m (m > n). With testcases. --- generic/tclUtil.c | 2 -- tests/indexObj.test | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 9c1bb93..0119243 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3972,8 +3972,6 @@ GetEndOffsetFromObj( if (offset == WIDE_MAX) { *widePtr = (endValue == -1) ? WIDE_MAX : endValue + 1; - } else if (offset == WIDE_MIN) { - *widePtr = -1; } else if (endValue == -1) { *widePtr = offset; } else if (offset < 0) { diff --git a/tests/indexObj.test b/tests/indexObj.test index eec5485..29fc616 100644 --- a/tests/indexObj.test +++ b/tests/indexObj.test @@ -238,6 +238,12 @@ test indexObj-8.16 {Tcl_GetIntForIndex integer} testgetintforindex { test indexObj-8.17 {Tcl_GetIntForIndex integer} testgetintforindex { testgetintforindex -2 -1 } -2147483648 +test indexObj-8.18 {Tcl_GetIntForIndex n-m} testgetintforindex { + testgetintforindex 2-3 -1 +} -2147483648 +test indexObj-8.19 {Tcl_GetIntForIndex n-m} testgetintforindex { + testgetintforindex 2-3 0 +} -1 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From b54632928e8d3ebda479a7e8e56fa3b53a22f1ce Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 6 Jun 2024 10:03:52 +0000 Subject: Fix one int -> Tcl_Size --- generic/tclListObj.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 683a0e7..483426d 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -2925,7 +2925,7 @@ TclLsetFlat( result = TCL_OK; /* Allocate if static array for pending invalidations is too small */ - if (indexCount > (int) (sizeof(pendingInvalidates) / + if (indexCount > (Tcl_Size) (sizeof(pendingInvalidates) / sizeof(pendingInvalidates[0]))) { pendingInvalidatesPtr = (Tcl_Obj **) Tcl_Alloc(indexCount * sizeof(*pendingInvalidatesPtr)); @@ -3032,9 +3032,8 @@ TclLsetFlat( * value of the lset variable. Later on, when we set valueObj * in its proper place, then all containing lists will have * their values changed, and will need their string reps - * spoiled. We maintain a list of all those Tcl_Obj's (via a - * little internalrep surgery) so we can spoil them at that - * time. + * spoiled. We maintain a list of all those Tcl_Obj's + * pendingInvalidatesPtr[] so we can spoil them at that time. */ pendingInvalidatesPtr[numPendingInvalidates] = parentList; -- cgit v0.12 From 2d102748011f7b0e8376a4a5a8d420d18fd3cd58 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 7 Jun 2024 10:32:05 +0000 Subject: Fix for [d5b45c23f4]: file tildeexpand and file home not disabled in safe base interp --- generic/tclBasic.c | 2 ++ tests/interp.test | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4cf24e4..507d987 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -440,6 +440,7 @@ static const UnsafeEnsembleInfo unsafeEnsembleCommands[] = { {"file", "executable"}, {"file", "exists"}, {"file", "extension"}, + {"file", "home"}, {"file", "isdirectory"}, {"file", "isfile"}, {"file", "link"}, @@ -458,6 +459,7 @@ static const UnsafeEnsembleInfo unsafeEnsembleCommands[] = { {"file", "tail"}, {"file", "tempdir"}, {"file", "tempfile"}, + {"file", "tildeexpand"}, {"file", "type"}, {"file", "volumes"}, {"file", "writable"}, diff --git a/tests/interp.test b/tests/interp.test index 7c56f78..f190d62 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -20,7 +20,7 @@ catch [list package require -exact tcl::test [info patchlevel]] testConstraint testinterpdelete [llength [info commands testinterpdelete]] -set hidden_cmds {cd encoding exec exit fconfigure file glob load open pwd socket source tcl:encoding:dirs tcl:encoding:system tcl:file:atime tcl:file:attributes tcl:file:copy tcl:file:delete tcl:file:dirname tcl:file:executable tcl:file:exists tcl:file:extension tcl:file:isdirectory tcl:file:isfile tcl:file:link tcl:file:lstat tcl:file:mkdir tcl:file:mtime tcl:file:nativename tcl:file:normalize tcl:file:owned tcl:file:readable tcl:file:readlink tcl:file:rename tcl:file:rootname tcl:file:size tcl:file:stat tcl:file:tail tcl:file:tempdir tcl:file:tempfile tcl:file:type tcl:file:volumes tcl:file:writable tcl:info:cmdtype tcl:info:nameofexecutable tcl:process:autopurge tcl:process:list tcl:process:purge tcl:process:status tcl:zipfs:lmkimg tcl:zipfs:lmkzip tcl:zipfs:mkimg tcl:zipfs:mkkey tcl:zipfs:mkzip tcl:zipfs:mount tcl:zipfs:mount_data tcl:zipfs:unmount unload} +set hidden_cmds {cd encoding exec exit fconfigure file glob load open pwd socket source tcl:encoding:dirs tcl:encoding:system tcl:file:atime tcl:file:attributes tcl:file:copy tcl:file:delete tcl:file:dirname tcl:file:executable tcl:file:exists tcl:file:extension tcl:file:home tcl:file:isdirectory tcl:file:isfile tcl:file:link tcl:file:lstat tcl:file:mkdir tcl:file:mtime tcl:file:nativename tcl:file:normalize tcl:file:owned tcl:file:readable tcl:file:readlink tcl:file:rename tcl:file:rootname tcl:file:size tcl:file:stat tcl:file:tail tcl:file:tempdir tcl:file:tempfile tcl:file:tildeexpand tcl:file:type tcl:file:volumes tcl:file:writable tcl:info:cmdtype tcl:info:nameofexecutable tcl:process:autopurge tcl:process:list tcl:process:purge tcl:process:status tcl:zipfs:lmkimg tcl:zipfs:lmkzip tcl:zipfs:mkimg tcl:zipfs:mkkey tcl:zipfs:mkzip tcl:zipfs:mount tcl:zipfs:mount_data tcl:zipfs:unmount unload} proc _ms_limit_args {ms {t0 {}}} { if {$t0 eq {}} { set t0 [clock milliseconds] } -- cgit v0.12 From cb42cbf6513f2f586059d4b4620d6b8c54b79b16 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 7 Jun 2024 11:26:32 +0000 Subject: Fix CFLAGS=-ftrapv build --- generic/tclUtil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b87b5d6..a3bfc09 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3706,6 +3706,8 @@ GetEndOffsetFromObj( * as endValue will have to adjust accordingly. */ *widePtr = (endValue == -1) ? WIDE_MAX : endValue + 1; + } else if (offset == WIDE_MIN) { + *widePtr = (endValue == -1) ? WIDE_MIN : -1; } else if (offset < 0) { /* end-(n-1) - Different signs, sum cannot overflow */ *widePtr = endValue + offset + 1; -- cgit v0.12 From 6c3e36dd5cdd1722d0786499671a6b1df3d2b7e9 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Jun 2024 10:33:06 +0000 Subject: Simpler commenting of Tcl_ChannelType instances; make zip channel type const --- generic/tclIO.c | 7 +++--- generic/tclIO.h | 9 ++++---- generic/tclIOGT.c | 38 +++++++++++++++---------------- generic/tclIORChan.c | 46 +++++++++++++++++++------------------- generic/tclIORTrans.c | 36 +++++++++++++++--------------- generic/tclZipfs.c | 40 ++++++++++++++++----------------- generic/tclZlib.c | 14 ++++++------ unix/tclUnixChan.c | 62 +++++++++++++++++++++++++-------------------------- unix/tclUnixPipe.c | 30 ++++++++++++------------- unix/tclUnixSock.c | 32 +++++++++++++------------- win/tclWinChan.c | 32 +++++++++++++------------- win/tclWinConsole.c | 34 ++++++++++++++-------------- win/tclWinPipe.c | 30 ++++++++++++------------- win/tclWinSerial.c | 32 +++++++++++++------------- win/tclWinSock.c | 32 +++++++++++++------------- 15 files changed, 237 insertions(+), 237 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 2000573..4859bc1 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -1599,7 +1599,7 @@ Tcl_Channel Tcl_CreateChannel( const Tcl_ChannelType *typePtr, /* The channel type record. */ const char *chanName, /* Name of channel to record. */ - void *instanceData, /* Instance specific data. */ + void *instanceData, /* Instance specific data. */ int mask) /* TCL_READABLE & TCL_WRITABLE to indicate if * the channel is readable, writable. */ { @@ -1809,7 +1809,7 @@ Tcl_StackChannel( const Tcl_ChannelType *typePtr, /* The channel type record for the new * channel. */ - void *instanceData, /* Instance specific data for the new + void *instanceData, /* Instance specific data for the new * channel. */ int mask, /* TCL_READABLE & TCL_WRITABLE to indicate if * the channel is readable, writable. */ @@ -10762,7 +10762,8 @@ Tcl_IsChannelExisting( const char * Tcl_ChannelName( - const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ + const Tcl_ChannelType *chanTypePtr) + /* Pointer to channel type. */ { return chanTypePtr->typeName; } diff --git a/generic/tclIO.h b/generic/tclIO.h index d1f4a0a..711863b 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -96,7 +96,7 @@ typedef struct EventScriptRecord { typedef struct Channel { struct ChannelState *state; /* Split out state information */ - void *instanceData; /* Instance-specific data provided by creator + void *instanceData; /* Instance-specific data provided by creator * of channel. */ const Tcl_ChannelType *typePtr; /* Pointer to channel type structure. */ struct Channel *downChanPtr;/* Refers to channel this one was stacked @@ -160,7 +160,8 @@ typedef struct ChannelState { * input. */ #if TCL_MAJOR_VERSION < 9 int outEofChar; /* If nonzero, append this to the channel when - * it is closed if it is open for writing. For Tcl 8.x only */ + * it is closed if it is open for writing. + * For Tcl 8.x only */ #endif int unreportedError; /* Non-zero if an error report was deferred * because it happened in the background. The @@ -214,8 +215,8 @@ typedef struct ChannelState { * precedence over a Posix error code returned by a channel operation. */ - Tcl_Obj* chanMsg; - Tcl_Obj* unreportedMsg; /* Non-NULL if an error report was deferred + Tcl_Obj *chanMsg; + Tcl_Obj *unreportedMsg; /* Non-NULL if an error report was deferred * because it happened in the background. The * value is the chanMg, if any. #219's * companion to 'unreportedError'. */ diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index aa63cd0..a1ba9f9 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -115,23 +115,23 @@ static inline void ResultAdd(ResultBuffer *r, unsigned char *buf, */ static const Tcl_ChannelType transformChannelType = { - "transform", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - TransformInputProc, /* Input proc. */ - TransformOutputProc, /* Output proc. */ - NULL, /* Seek proc. */ - TransformSetOptionProc, /* Set option proc. */ - TransformGetOptionProc, /* Get option proc. */ - TransformWatchProc, /* Initialize notifier. */ - TransformGetFileHandleProc, /* Get OS handles out of channel. */ - TransformCloseProc, /* close2proc */ - TransformBlockModeProc, /* Set blocking/nonblocking mode.*/ + "transform", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + TransformInputProc, + TransformOutputProc, + NULL, /* Deprecated. */ + TransformSetOptionProc, + TransformGetOptionProc, + TransformWatchProc, + TransformGetFileHandleProc, + TransformCloseProc, + TransformBlockModeProc, NULL, /* Flush proc. */ - TransformNotifyProc, /* Handling of events bubbling up. */ - TransformWideSeekProc, /* Wide seek proc. */ - NULL, /* Thread action. */ - NULL /* Truncate. */ + TransformNotifyProc, + TransformWideSeekProc, + NULL, /* Thread action proc. */ + NULL /* Truncate proc. */ }; /* @@ -850,14 +850,14 @@ TransformOutputProc( static long long TransformWideSeekProc( - void *instanceData, /* The channel to manipulate. */ + void *instanceData, /* The channel to manipulate. */ long long offset, /* Size of movement. */ int mode, /* How to move. */ int *errorCodePtr) /* Location of error flag. */ { TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); - const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); + const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); Tcl_DriverWideSeekProc *parentWideSeekProc = Tcl_ChannelWideSeekProc(parentType); void *parentData = Tcl_GetChannelInstanceData(parent); @@ -905,7 +905,7 @@ TransformWideSeekProc( *errorCodePtr = EINVAL; return -1; } - return parentWideSeekProc(parentData, offset, mode, errorCodePtr); + return parentWideSeekProc(parentData, offset, mode, errorCodePtr); } /* diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index e8a243b..c8449aa 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -59,28 +59,28 @@ static int ReflectTruncate(void *clientData, * The C layer channel type/driver definition used by the reflection. */ -static const Tcl_ChannelType tclRChannelType = { - "tclrchannel", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Old close API */ - ReflectInput, /* Handle read request */ - ReflectOutput, /* Handle write request */ - NULL, - ReflectSetOption, /* Set options. */ - ReflectGetOption, /* Get options. */ - ReflectWatch, /* Initialize notifier */ - NULL, /* Get OS handle from the channel. */ - ReflectClose, /* Close channel. Clean instance data */ - ReflectBlock, /* Set blocking/nonblocking. */ - NULL, /* Flush channel. */ - NULL, /* Handle events. */ - ReflectSeekWide, /* Move access point (64 bit). */ +static const Tcl_ChannelType reflectedChannelType = { + "tclrchannel", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated */ + ReflectInput, + ReflectOutput, + NULL, /* Deprecated */ + ReflectSetOption, + ReflectGetOption, + ReflectWatch, + NULL, /* Get OS handle from the channel. */ + ReflectClose, + ReflectBlock, + NULL, /* Flush channel. */ + NULL, /* Handle bubbled events. */ + ReflectSeekWide, #if TCL_THREADS - ReflectThread, /* thread action, tracking owner */ + ReflectThread, #else - NULL, /* thread action */ + NULL, /* Thread action proc */ #endif - ReflectTruncate /* Truncate. */ + ReflectTruncate /* Truncate proc. */ }; /* @@ -667,7 +667,7 @@ TclChanCreateObjCmd( * Everything is fine now. */ - chan = Tcl_CreateChannel(&tclRChannelType, TclGetString(rcId), rcPtr, + chan = Tcl_CreateChannel(&reflectedChannelType, TclGetString(rcId), rcPtr, mode); rcPtr->chan = chan; TclChannelPreserve(chan); @@ -682,7 +682,7 @@ TclChanCreateObjCmd( Tcl_ChannelType *clonePtr = (Tcl_ChannelType *)Tcl_Alloc(sizeof(Tcl_ChannelType)); - memcpy(clonePtr, &tclRChannelType, sizeof(Tcl_ChannelType)); + memcpy(clonePtr, &reflectedChannelType, sizeof(Tcl_ChannelType)); if (!(methods & FLAG(METH_CONFIGURE))) { clonePtr->setOptionProc = NULL; @@ -1179,7 +1179,7 @@ ReflectClose( #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; - if (tctPtr && tctPtr != &tclRChannelType) { + if (tctPtr && tctPtr != &reflectedChannelType) { Tcl_Free((void *)tctPtr); ((Channel *)rcPtr->chan)->typePtr = NULL; } @@ -1248,7 +1248,7 @@ ReflectClose( } #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; - if (tctPtr && tctPtr != &tclRChannelType) { + if (tctPtr && tctPtr != &reflectedChannelType) { Tcl_Free((void *)tctPtr); ((Channel *)rcPtr->chan)->typePtr = NULL; } diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 0fe9d97..c151448 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -55,24 +55,24 @@ static int ReflectNotify(void *clientData, int mask); * The C layer channel type/driver definition used by the reflection. */ -static const Tcl_ChannelType tclRTransformType = { - "tclrtransform", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel. */ - NULL, - ReflectInput, /* Handle read request. */ - ReflectOutput, /* Handle write request. */ - NULL, /* Move location of access point. */ - ReflectSetOption, /* Set options. */ - ReflectGetOption, /* Get options. */ - ReflectWatch, /* Initialize notifier. */ - ReflectHandle, /* Get OS handle from the channel. */ - ReflectClose, /* Close channel, clean instance data. */ - ReflectBlock, /* Set blocking/nonblocking. */ +static const Tcl_ChannelType reflectedTransformType = { + "tclrtransform", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + ReflectInput, + ReflectOutput, + NULL, /* Deprecated. */ + ReflectSetOption, + ReflectGetOption, + ReflectWatch, + ReflectHandle, + ReflectClose, + ReflectBlock, NULL, /* Flush channel. Not used by core. */ - ReflectNotify, /* Handle events. */ - ReflectSeekWide, /* Move access point (64 bit). */ - NULL, /* thread action */ - NULL /* truncate */ + ReflectNotify, + ReflectSeekWide, + NULL, /* Thread action proc. */ + NULL /* Truncate proc. */ }; /* @@ -678,7 +678,7 @@ TclChanPushObjCmd( rtPtr->methods = methods; rtPtr->mode = mode; - rtPtr->chan = Tcl_StackChannel(interp, &tclRTransformType, rtPtr, mode, + rtPtr->chan = Tcl_StackChannel(interp, &reflectedTransformType, rtPtr, mode, rtPtr->parent); /* diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 4fef38c..683e4ff 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -433,28 +433,26 @@ static const Tcl_Filesystem zipfsFilesystem = { /* * The channel type/driver definition used for ZIP archive members. */ - -static Tcl_ChannelType ZipChannelType = { - "zip", /* Type name. */ +static const Tcl_ChannelType zipChannelType = { + "zip", TCL_CHANNEL_VERSION_5, - NULL, /* Close channel, clean instance data */ - ZipChannelRead, /* Handle read request */ - ZipChannelWrite, /* Handle write request */ - NULL, /* Move location of access point, NULL'able */ - NULL, /* Set options, NULL'able */ - NULL, /* Get options, NULL'able */ - ZipChannelWatchChannel, /* Initialize notifier */ - ZipChannelGetFile, /* Get OS handle from the channel */ - ZipChannelClose, /* 2nd version of close channel, NULL'able */ - NULL, /* Set blocking mode for raw channel, - * NULL'able */ - NULL, /* Function to flush channel, NULL'able */ - NULL, /* Function to handle event, NULL'able */ - ZipChannelWideSeek, /* Wide seek function, NULL'able */ - NULL, /* Thread action function, NULL'able */ - NULL, /* Truncate function, NULL'able */ + NULL, /* Deprecated. */ + ZipChannelRead, + ZipChannelWrite, + NULL, /* Deprecated. */ + NULL, /* Set options proc. */ + NULL, /* Get options proc. */ + ZipChannelWatchChannel, + ZipChannelGetFile, + ZipChannelClose, + NULL, /* Set blocking mode for raw channel. */ + NULL, /* Function to flush channel. */ + NULL, /* Function to handle bubbled events. */ + ZipChannelWideSeek, + NULL, /* Thread action function. */ + NULL, /* Truncate function. */ }; - + /* *------------------------------------------------------------------------ * @@ -4903,7 +4901,7 @@ ZipChannelOpen( ZipFS.idCount++); z->zipFilePtr->numOpen++; Unlock(); - return Tcl_CreateChannel(&ZipChannelType, cname, info, flags); + return Tcl_CreateChannel(&zipChannelType, cname, info, flags); error: Unlock(); diff --git a/generic/tclZlib.c b/generic/tclZlib.c index f3a2623..a1f4f12 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -208,21 +208,21 @@ static void ZlibTransformTimerRun(void *clientData); static const Tcl_ChannelType zlibChannelType = { "zlib", TCL_CHANNEL_VERSION_5, - NULL, + NULL, /* Deprecated. */ ZlibTransformInput, ZlibTransformOutput, - NULL, /* seekProc */ + NULL, /* Deprecated. */ ZlibTransformSetOption, ZlibTransformGetOption, ZlibTransformWatch, ZlibTransformGetHandle, - ZlibTransformClose, /* close2Proc */ + ZlibTransformClose, ZlibTransformBlockMode, - NULL, /* flushProc */ + NULL, /* Flush proc. */ ZlibTransformEventHandler, - NULL, /* wideSeekProc */ - NULL, - NULL + NULL, /* Seek proc. */ + NULL, /* Thread action proc. */ + NULL /* Truncate proc. */ }; /* diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 12366ac..693720c 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -161,22 +161,22 @@ static int TtySetOptionProc(void *instanceData, static const Tcl_ChannelType fileChannelType = { "file", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Deprecated close proc. */ - FileInputProc, /* Input proc. */ - FileOutputProc, /* Output proc. */ - NULL, + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + FileInputProc, + FileOutputProc, + NULL, /* Deprecated. */ NULL, /* Set option proc. */ - FileGetOptionProc, /* Get option proc. */ - FileWatchProc, /* Initialize notifier. */ - FileGetHandleProc, /* Get OS handles out of channel. */ - FileCloseProc, /* Close proc. */ - FileBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - FileWideSeekProc, /* wide seek proc. */ - NULL, - FileTruncateProc /* truncate proc. */ + FileGetOptionProc, + FileWatchProc, + FileGetHandleProc, + FileCloseProc, + FileBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ + FileWideSeekProc, + NULL, /* Thread action proc. */ + FileTruncateProc }; #ifdef SUPPORTS_TTY @@ -186,23 +186,23 @@ static const Tcl_ChannelType fileChannelType = { */ static const Tcl_ChannelType ttyChannelType = { - "tty", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Deprecated close proc. */ - FileInputProc, /* Input proc. */ - FileOutputProc, /* Output proc. */ + "tty", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + FileInputProc, + FileOutputProc, + NULL, /* Deprecated. */ + TtySetOptionProc, + TtyGetOptionProc, + FileWatchProc, + FileGetHandleProc, + TtyCloseProc, + FileBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ NULL, /* Seek proc. */ - TtySetOptionProc, /* Set option proc. */ - TtyGetOptionProc, /* Get option proc. */ - FileWatchProc, /* Initialize notifier. */ - FileGetHandleProc, /* Get OS handles out of channel. */ - TtyCloseProc, /* Close proc. */ - FileBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc. */ - NULL, /* thread action proc. */ - NULL /* truncate proc. */ + NULL, /* Thread action proc. */ + NULL /* Truncate proc. */ }; #endif /* SUPPORTS_TTY */ diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index ea1636e..78bba4f 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -78,23 +78,23 @@ static int SetupStdFile(TclFile file, int type); */ static const Tcl_ChannelType pipeChannelType = { - "pipe", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - PipeInputProc, /* Input proc. */ - PipeOutputProc, /* Output proc. */ - NULL, /* Seek proc. */ + "pipe", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + PipeInputProc, + PipeOutputProc, + NULL, /* Deprecated. */ NULL, /* Set option proc. */ NULL, /* Get option proc. */ - PipeWatchProc, /* Initialize notifier. */ - PipeGetHandleProc, /* Get OS handles out of channel. */ - PipeClose2Proc, /* close2proc. */ - PipeBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc */ - NULL, /* thread action proc */ - NULL /* truncation */ + PipeWatchProc, + PipeGetHandleProc, + PipeClose2Proc, + PipeBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ + NULL, /* Seek proc. */ + NULL, /* Thread action proc. */ + NULL /* Truncation proc. */ }; /* diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 11193b7..d518453 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -154,23 +154,23 @@ static Tcl_FileProc WrapNotify; */ static const Tcl_ChannelType tcpChannelType = { - "tcp", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - TcpInputProc, /* Input proc. */ - TcpOutputProc, /* Output proc. */ + "tcp", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + TcpInputProc, + TcpOutputProc, + NULL, /* Deprecated. */ + TcpSetOptionProc, + TcpGetOptionProc, + TcpWatchProc, + TcpGetHandleProc, + TcpClose2Proc, + TcpBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ NULL, /* Seek proc. */ - TcpSetOptionProc, /* Set option proc. */ - TcpGetOptionProc, /* Get option proc. */ - TcpWatchProc, /* Initialize notifier. */ - TcpGetHandleProc, /* Get OS handles out of channel. */ - TcpClose2Proc, /* Close2 proc. */ - TcpBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc. */ - TcpThreadActionProc, /* thread action proc. */ - NULL /* truncate proc. */ + TcpThreadActionProc, + NULL /* Truncate proc. */ }; /* diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 248ca5b..b81af7e 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -106,23 +106,23 @@ static Tcl_Channel OpenFileChannel(HANDLE handle, char *channelName, */ static const Tcl_ChannelType fileChannelType = { - "file", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - FileInputProc, /* Input proc. */ - FileOutputProc, /* Output proc. */ - NULL, + "file", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + FileInputProc, + FileOutputProc, + NULL, /* Deprecated. */ NULL, /* Set option proc. */ - FileGetOptionProc, /* Get option proc. */ - FileWatchProc, /* Set up the notifier to watch the channel. */ - FileGetHandleProc, /* Get an OS handle from channel. */ - FileCloseProc, /* close2proc. */ - FileBlockProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - FileWideSeekProc, /* Wide seek proc. */ - FileThreadActionProc, /* Thread action proc. */ - FileTruncateProc /* Truncate proc. */ + FileGetOptionProc, + FileWatchProc, + FileGetHandleProc, + FileCloseProc, + FileBlockProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ + FileWideSeekProc, + FileThreadActionProc, + FileTruncateProc }; /* diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index a498200..ee04b05 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -298,23 +298,23 @@ static ConsoleChannelInfo *gWatchingChannelList; */ static const Tcl_ChannelType consoleChannelType = { - "console", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - ConsoleInputProc, /* Input proc. */ - ConsoleOutputProc, /* Output proc. */ - NULL, /* Seek proc. */ - ConsoleSetOptionProc, /* Set option proc. */ - ConsoleGetOptionProc, /* Get option proc. */ - ConsoleWatchProc, /* Set up notifier to watch the channel. */ - ConsoleGetHandleProc, /* Get an OS handle from channel. */ - ConsoleCloseProc, /* close2proc. */ - ConsoleBlockModeProc, /* Set blocking or non-blocking mode. */ - NULL, /* Flush proc. */ - NULL, /* Handler proc. */ - NULL, /* Wide seek proc. */ - ConsoleThreadActionProc, /* Thread action proc. */ - NULL /* Truncation proc. */ + "console", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + ConsoleInputProc, + ConsoleOutputProc, + NULL, /* Deprecated. */ + ConsoleSetOptionProc, + ConsoleGetOptionProc, + ConsoleWatchProc, + ConsoleGetHandleProc, + ConsoleCloseProc, + ConsoleBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ + NULL, /* Seek proc. */ + ConsoleThreadActionProc, + NULL /* Truncation proc. */ }; /* diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index c4b60b9..eeb06f8 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -201,23 +201,23 @@ static void PipeThreadActionProc(void *instanceData, */ static const Tcl_ChannelType pipeChannelType = { - "pipe", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - PipeInputProc, /* Input proc. */ - PipeOutputProc, /* Output proc. */ - NULL, /* Seek proc. */ + "pipe", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + PipeInputProc, + PipeOutputProc, + NULL, /* Deprecated. */ NULL, /* Set option proc. */ NULL, /* Get option proc. */ - PipeWatchProc, /* Set up notifier to watch the channel. */ - PipeGetHandleProc, /* Get an OS handle from channel. */ - PipeClose2Proc, /* close2proc */ - PipeBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc */ - PipeThreadActionProc, /* thread action proc */ - NULL /* truncate */ + PipeWatchProc, + PipeGetHandleProc, + PipeClose2Proc, + PipeBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ + NULL, /* Seek proc. */ + PipeThreadActionProc, + NULL /* Truncate proc. */ }; /* diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 2ce432c..fe35c36 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -202,23 +202,23 @@ static int SerialBlockingWrite(SerialInfo *infoPtr, LPVOID buf, */ static const Tcl_ChannelType serialChannelType = { - "serial", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Close proc. */ - SerialInputProc, /* Input proc. */ - SerialOutputProc, /* Output proc. */ + "serial", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + SerialInputProc, + SerialOutputProc, + NULL, /* Deprecated. */ + SerialSetOptionProc, + SerialGetOptionProc, + SerialWatchProc, + SerialGetHandleProc, + SerialCloseProc, + SerialBlockProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ NULL, /* Seek proc. */ - SerialSetOptionProc, /* Set option proc. */ - SerialGetOptionProc, /* Get option proc. */ - SerialWatchProc, /* Set up notifier to watch the channel. */ - SerialGetHandleProc, /* Get an OS handle from channel. */ - SerialCloseProc, /* close2proc. */ - SerialBlockProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc */ - SerialThreadActionProc, /* thread action proc */ - NULL /* truncate */ + SerialThreadActionProc, + NULL /* Truncate proc. */ }; /* diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 5239cd3..11c43f0 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -270,23 +270,23 @@ static Tcl_DriverGetHandleProc TcpGetHandleProc; */ static const Tcl_ChannelType tcpChannelType = { - "tcp", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v5 channel */ - NULL, /* Old close proc. Deprecated. */ - TcpInputProc, /* Input proc. */ - TcpOutputProc, /* Output proc. */ + "tcp", + TCL_CHANNEL_VERSION_5, + NULL, /* Deprecated. */ + TcpInputProc, + TcpOutputProc, + NULL, /* Deprecated. */ + TcpSetOptionProc, + TcpGetOptionProc, + TcpWatchProc, + TcpGetHandleProc, + TcpClose2Proc, + TcpBlockModeProc, + NULL, /* Flush proc. */ + NULL, /* Bubbled event handler proc. */ NULL, /* Seek proc. */ - TcpSetOptionProc, /* Set option proc. */ - TcpGetOptionProc, /* Get option proc. */ - TcpWatchProc, /* Initialize notifier. */ - TcpGetHandleProc, /* Get OS handles out of channel. */ - TcpClose2Proc, /* New close2 proc. */ - TcpBlockModeProc, /* Set blocking or non-blocking mode.*/ - NULL, /* flush proc. */ - NULL, /* handler proc. */ - NULL, /* wide seek proc. */ - TcpThreadActionProc, /* thread action proc. */ - NULL /* truncate proc. */ + TcpThreadActionProc, + NULL /* Truncate proc. */ }; /* -- cgit v0.12 From cb5681ab7e2d246497da845670f3cc9367e2ce2f Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Jun 2024 12:13:40 +0000 Subject: Put ClockFmtScnStorageHashKeyType in read-only memory --- generic/tclClockFmt.c | 23 +++++++++++++---------- generic/tclHash.c | 33 +++++++++++++++------------------ generic/tclInt.h | 2 ++ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index fead7fd..0dfc9bb 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -22,20 +22,28 @@ static void ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); static int ClockFmtObj_SetFromAny(Tcl_Interp *, Tcl_Obj *objPtr); static void ClockFmtObj_UpdateString(Tcl_Obj *objPtr); +static Tcl_HashEntry * ClockFmtScnStorageAllocProc(Tcl_HashTable *, void *keyPtr); +static void ClockFmtScnStorageFreeProc(Tcl_HashEntry *hPtr); +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ -static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); - #ifndef TCL_CLOCK_FULL_COMPAT #define TCL_CLOCK_FULL_COMPAT 1 #endif /* - * Derivation of tclStringHashKeyType with another allocEntryProc + * Derivation of tclStringHashKeyType with extra memory management trickery. */ -static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; +static const Tcl_HashKeyType ClockFmtScnStorageHashKeyType = { + TCL_HASH_KEY_TYPE_VERSION, /* version */ + 0, /* flags */ + TclHashStringKey, /* hashKeyProc */ + TclCompareStringKeys, /* compareKeysProc */ + ClockFmtScnStorageAllocProc, /* allocEntryProc */ + ClockFmtScnStorageFreeProc /* freeEntryProc */ +}; #define IntFieldAt(info, offset) \ ((int *) (((char *) (info)) + (offset))) @@ -543,7 +551,7 @@ FmtScn4HashEntry( static Tcl_HashEntry * ClockFmtScnStorageAllocProc( - TCL_UNUSED(Tcl_HashTable *), /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *),/* Hash table. */ void *keyPtr) /* Key to store in the hash table entry. */ { ClockFmtScnStorage *fss; @@ -825,11 +833,6 @@ FindOrCreateFmtScnStorage( /* if not yet initialized */ if (!initialized) { - /* initialize type */ - memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); - ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; - ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - /* initialize hash table */ Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, &ClockFmtScnStorageHashKeyType); diff --git a/generic/tclHash.c b/generic/tclHash.c index 89807e2..9bdb079 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -44,8 +44,6 @@ static size_t HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr); static Tcl_HashEntry * AllocStringEntry(Tcl_HashTable *tablePtr, void *keyPtr); -static int CompareStringKeys(void *keyPtr, Tcl_HashEntry *hPtr); -static size_t HashStringKey(Tcl_HashTable *tablePtr, void *keyPtr); /* * Function prototypes for static functions in this file: @@ -80,8 +78,8 @@ const Tcl_HashKeyType tclOneWordHashKeyType = { const Tcl_HashKeyType tclStringHashKeyType = { TCL_HASH_KEY_TYPE_VERSION, /* version */ 0, /* flags */ - HashStringKey, /* hashKeyProc */ - CompareStringKeys, /* compareKeysProc */ + TclHashStringKey, /* hashKeyProc */ + TclCompareStringKeys, /* compareKeysProc */ AllocStringEntry, /* allocEntryProc */ NULL /* freeEntryProc */ }; @@ -556,8 +554,7 @@ Tcl_FirstHashEntry( Tcl_HashEntry * Tcl_NextHashEntry( - Tcl_HashSearch *searchPtr) - /* Place to store information about progress + Tcl_HashSearch *searchPtr) /* Place to store information about progress * through the table. Must have been * initialized by calling * Tcl_FirstHashEntry. */ @@ -671,7 +668,7 @@ Tcl_HashStats( static Tcl_HashEntry * AllocArrayEntry( Tcl_HashTable *tablePtr, /* Hash table. */ - void *keyPtr) /* Key to store in the hash table entry. */ + void *keyPtr) /* Key to store in the hash table entry. */ { Tcl_HashEntry *hPtr; size_t count = tablePtr->keyType * sizeof(int); @@ -707,7 +704,7 @@ AllocArrayEntry( static int CompareArrayKeys( - void *keyPtr, /* New key to compare. */ + void *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { size_t count = hPtr->tablePtr->keyType * sizeof(int); @@ -736,7 +733,7 @@ CompareArrayKeys( static size_t HashArrayKey( Tcl_HashTable *tablePtr, /* Hash table. */ - void *keyPtr) /* Key from which to compute hash value. */ + void *keyPtr) /* Key from which to compute hash value. */ { const int *array = (const int *) keyPtr; size_t result; @@ -768,7 +765,7 @@ HashArrayKey( static Tcl_HashEntry * AllocStringEntry( TCL_UNUSED(Tcl_HashTable *), - void *keyPtr) /* Key to store in the hash table entry. */ + void *keyPtr) /* Key to store in the hash table entry. */ { const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; @@ -788,7 +785,7 @@ AllocStringEntry( /* *---------------------------------------------------------------------- * - * CompareStringKeys -- + * TclCompareStringKeys -- * * Compares two string keys. * @@ -802,9 +799,9 @@ AllocStringEntry( *---------------------------------------------------------------------- */ -static int -CompareStringKeys( - void *keyPtr, /* New key to compare. */ +int +TclCompareStringKeys( + void *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { return !strcmp((char *)keyPtr, hPtr->key.string); @@ -813,7 +810,7 @@ CompareStringKeys( /* *---------------------------------------------------------------------- * - * HashStringKey -- + * TclHashStringKey -- * * Compute a one-word summary of a text string, which can be used to * generate a hash index. @@ -827,10 +824,10 @@ CompareStringKeys( *---------------------------------------------------------------------- */ -static size_t -HashStringKey( +size_t +TclHashStringKey( TCL_UNUSED(Tcl_HashTable *), - void *keyPtr) /* Key from which to compute hash value. */ + void *keyPtr) /* Key from which to compute hash value. */ { const char *string = (const char *)keyPtr; size_t result; diff --git a/generic/tclInt.h b/generic/tclInt.h index c9ff923..70bc4b8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3405,6 +3405,8 @@ MODULE_SCOPE int TclGetLoadedLibraries(Tcl_Interp *interp, const char *packageName); MODULE_SCOPE int TclGetWideBitsFromObj(Tcl_Interp *, Tcl_Obj *, Tcl_WideInt *); +MODULE_SCOPE int TclCompareStringKeys(void *keyPtr, Tcl_HashEntry *hPtr); +MODULE_SCOPE size_t TclHashStringKey(Tcl_HashTable *tablePtr, void *keyPtr); MODULE_SCOPE int TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr, Tcl_Obj *incrPtr); MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, -- cgit v0.12 From 69de26c1b45a218d5eae22bc0136b116bb42f994 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Jun 2024 14:06:20 +0000 Subject: Another record that ought to be read-only --- generic/tclLink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index 3bd855b..2e7d3b0 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -109,7 +109,7 @@ static int SetInvalidRealFromAny(Tcl_Interp *interp, * A marker type used to flag weirdnesses so we can pass them around right. */ -static Tcl_ObjType invalidRealType = { +static const Tcl_ObjType invalidRealType = { "invalidReal", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ -- cgit v0.12 From 5abc5a13387207ec3a15e9ca49d13d48ed96b75a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 9 Jun 2024 16:19:58 +0000 Subject: (cherry-pick) Put ClockFmtScnStorageHashKeyType (and some more) in read-only memory --- generic/tclClockFmt.c | 47 ++++++---- generic/tclHash.c | 44 ++++----- generic/tclInt.h | 2 + generic/tclLink.c | 30 +++--- generic/tclZipfs.c | 255 ++++++++++++++++++++++++++------------------------ 5 files changed, 194 insertions(+), 184 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index faf0d87..c9b30bf 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -22,20 +22,28 @@ static void ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); static int ClockFmtObj_SetFromAny(Tcl_Interp *, Tcl_Obj *objPtr); static void ClockFmtObj_UpdateString(Tcl_Obj *objPtr); +static Tcl_HashEntry * ClockFmtScnStorageAllocProc(Tcl_HashTable *, void *keyPtr); +static void ClockFmtScnStorageFreeProc(Tcl_HashEntry *hPtr); +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ -static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); - #ifndef TCL_CLOCK_FULL_COMPAT #define TCL_CLOCK_FULL_COMPAT 1 #endif /* - * Derivation of tclStringHashKeyType with another allocEntryProc + * Derivation of tclStringHashKeyType with extra memory management trickery. */ -static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; +static const Tcl_HashKeyType ClockFmtScnStorageHashKeyType = { + TCL_HASH_KEY_TYPE_VERSION, /* version */ + 0, /* flags */ + TclHashStringKey, /* hashKeyProc */ + TclCompareStringKeys, /* compareKeysProc */ + ClockFmtScnStorageAllocProc, /* allocEntryProc */ + ClockFmtScnStorageFreeProc /* freeEntryProc */ +}; #define IntFieldAt(info, offset) \ ((int *) (((char *) (info)) + (offset))) @@ -543,7 +551,7 @@ FmtScn4HashEntry( static Tcl_HashEntry * ClockFmtScnStorageAllocProc( - TCL_UNUSED(Tcl_HashTable *), /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *),/* Hash table. */ void *keyPtr) /* Key to store in the hash table entry. */ { ClockFmtScnStorage *fss; @@ -757,7 +765,7 @@ ClockFmtObj_UpdateString( * Returns tcl object with key or format object if not localizable. * * Side effects: - * Converts given format object to ClockFmtObjType on demand for caching + * Converts given format object to ClockFmtObjType on demand for caching * the key inside its internal representation. * *---------------------------------------------------------------------- @@ -803,7 +811,7 @@ ClockFrmObjGetLocFmtKey( * Returns scan/format storage pointer to ClockFmtScnStorage. * * Side effects: - * Converts given format object to ClockFmtObjType on demand for caching + * Converts given format object to ClockFmtObjType on demand for caching * the format storage reference inside its internal representation. * Increments objRefCount of the ClockFmtScnStorage reference. * @@ -824,11 +832,6 @@ FindOrCreateFmtScnStorage( /* if not yet initialized */ if (!initialized) { - /* initialize type */ - memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); - ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; - ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - /* initialize hash table */ Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, &ClockFmtScnStorageHashKeyType); @@ -1240,9 +1243,13 @@ ObjListSearch( /* currently unused */ static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, - int minLen, int maxLen) +LocaleListSearch( + ClockFmtScnCmdArgs *opts, + DateInfo *info, + int mcKey, + int *val, + int minLen, + int maxLen) { Tcl_Obj **lstv; Tcl_Size lstc; @@ -1415,7 +1422,7 @@ ClockMCGetMultiListIdxTree( * Results: * TCL_OK - match found and the index stored in *val, * TCL_RETURN - not matched or ambigous, - * TCL_ERROR - in error case. + * TCL_ERROR - in error case. * * Side effects: * Input points to end of the found token in string. @@ -1769,7 +1776,7 @@ ClockScnToken_JDN_Proc( } s = p; while (p < end && isdigit(UCHAR(*p))) { - fractJDDiv *= 10; + fractJDDiv *= 10; p++; } if (Clock_str2int(&fractJD, s, p, 1) != TCL_OK) { @@ -2648,7 +2655,7 @@ ClockScan( } if (flags & (CLF_ISO8601WEEK | CLF_ISO8601YEAR)) { if ((flags & (CLF_ISO8601YEAR | CLF_YEAR)) == CLF_YEAR) { - /* for calculations expected iso year */ + /* for calculations expected iso year */ info->date.iso8601Year = yyYear; } else if (info->date.iso8601Year < 100) { if (!(flags & CLF_ISO8601CENTURY)) { @@ -2661,7 +2668,7 @@ ClockScan( } } if ((flags & (CLF_ISO8601YEAR | CLF_YEAR)) == CLF_ISO8601YEAR) { - /* for calculations expected year (e. g. CLF_ISO8601WEEK not set) */ + /* for calculations expected year (e. g. CLF_ISO8601WEEK not set) */ yyYear = info->date.iso8601Year; } } @@ -2861,7 +2868,7 @@ ClockFmtToken_JDN_Proc( fractJD = dateFmt->date.secondOfDay - (int)tok->map->offs; /* 0 for calendar or 43200 for astro JD */ if (fractJD < 0) { - intJD--; + intJD--; fractJD += SECONDS_PER_DAY; } if (fractJD && intJD < 0) { /* avoid jump over 0, by negative JD's */ diff --git a/generic/tclHash.c b/generic/tclHash.c index c72dc6d..3e8f89c 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -51,8 +51,6 @@ static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr); static Tcl_HashEntry * AllocStringEntry(Tcl_HashTable *tablePtr, void *keyPtr); -static int CompareStringKeys(void *keyPtr, Tcl_HashEntry *hPtr); -static TCL_HASH_TYPE HashStringKey(Tcl_HashTable *tablePtr, void *keyPtr); /* * Function prototypes for static functions in this file: @@ -87,8 +85,8 @@ const Tcl_HashKeyType tclOneWordHashKeyType = { const Tcl_HashKeyType tclStringHashKeyType = { TCL_HASH_KEY_TYPE_VERSION, /* version */ 0, /* flags */ - HashStringKey, /* hashKeyProc */ - CompareStringKeys, /* compareKeysProc */ + TclHashStringKey, /* hashKeyProc */ + TclCompareStringKeys, /* compareKeysProc */ AllocStringEntry, /* allocEntryProc */ NULL /* freeEntryProc */ }; @@ -229,7 +227,6 @@ FindHashEntry( { return CreateHashEntry(tablePtr, key, NULL); } - /* *---------------------------------------------------------------------- @@ -312,8 +309,7 @@ CreateHashEntry( } /* if keys pointers or values are equal */ if ((key == hPtr->key.oneWordValue) - || compareKeysProc((void *) key, hPtr) - ) { + || compareKeysProc((void *) key, hPtr)) { if (newPtr) { *newPtr = 0; } @@ -328,8 +324,7 @@ CreateHashEntry( } /* if needle pointer equals content pointer or values equal */ if ((key == hPtr->key.string) - || compareKeysProc((void *) key, hPtr) - ) { + || compareKeysProc((void *) key, hPtr)) { if (newPtr) { *newPtr = 0; } @@ -481,7 +476,7 @@ Tcl_DeleteHashTable( { Tcl_HashEntry *hPtr, *nextPtr; const Tcl_HashKeyType *typePtr; - int i; + Tcl_Size i; if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; @@ -585,8 +580,7 @@ Tcl_FirstHashEntry( Tcl_HashEntry * Tcl_NextHashEntry( - Tcl_HashSearch *searchPtr) - /* Place to store information about progress + Tcl_HashSearch *searchPtr) /* Place to store information about progress * through the table. Must have been * initialized by calling * Tcl_FirstHashEntry. */ @@ -630,7 +624,7 @@ Tcl_HashStats( Tcl_HashTable *tablePtr) /* Table for which to produce stats. */ { #define NUM_COUNTERS 10 - int i; + Tcl_Size i; TCL_HASH_TYPE count[NUM_COUNTERS], overflow, j; double average, tmp; Tcl_HashEntry *hPtr; @@ -700,7 +694,7 @@ Tcl_HashStats( static Tcl_HashEntry * AllocArrayEntry( Tcl_HashTable *tablePtr, /* Hash table. */ - void *keyPtr) /* Key to store in the hash table entry. */ + void *keyPtr) /* Key to store in the hash table entry. */ { Tcl_HashEntry *hPtr; TCL_HASH_TYPE count = tablePtr->keyType * sizeof(int); @@ -736,7 +730,7 @@ AllocArrayEntry( static int CompareArrayKeys( - void *keyPtr, /* New key to compare. */ + void *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { size_t count = hPtr->tablePtr->keyType * sizeof(int); @@ -765,7 +759,7 @@ CompareArrayKeys( static TCL_HASH_TYPE HashArrayKey( Tcl_HashTable *tablePtr, /* Hash table. */ - void *keyPtr) /* Key from which to compute hash value. */ + void *keyPtr) /* Key from which to compute hash value. */ { const int *array = (const int *) keyPtr; TCL_HASH_TYPE result; @@ -797,7 +791,7 @@ HashArrayKey( static Tcl_HashEntry * AllocStringEntry( TCL_UNUSED(Tcl_HashTable *), - void *keyPtr) /* Key to store in the hash table entry. */ + void *keyPtr) /* Key to store in the hash table entry. */ { const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; @@ -817,7 +811,7 @@ AllocStringEntry( /* *---------------------------------------------------------------------- * - * CompareStringKeys -- + * TclCompareStringKeys -- * * Compares two string keys. * @@ -831,9 +825,9 @@ AllocStringEntry( *---------------------------------------------------------------------- */ -static int -CompareStringKeys( - void *keyPtr, /* New key to compare. */ +int +TclCompareStringKeys( + void *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { return !strcmp((char *)keyPtr, hPtr->key.string); @@ -842,7 +836,7 @@ CompareStringKeys( /* *---------------------------------------------------------------------- * - * HashStringKey -- + * TclHashStringKey -- * * Compute a one-word summary of a text string, which can be used to * generate a hash index. @@ -856,10 +850,10 @@ CompareStringKeys( *---------------------------------------------------------------------- */ -static TCL_HASH_TYPE -HashStringKey( +TCL_HASH_TYPE +TclHashStringKey( TCL_UNUSED(Tcl_HashTable *), - void *keyPtr) /* Key from which to compute hash value. */ + void *keyPtr) /* Key from which to compute hash value. */ { const char *string = (const char *)keyPtr; TCL_HASH_TYPE result; diff --git a/generic/tclInt.h b/generic/tclInt.h index 4dd481c..6f06120 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3240,6 +3240,8 @@ MODULE_SCOPE int TclGetLoadedLibraries(Tcl_Interp *interp, const char *packageName); MODULE_SCOPE int TclGetWideBitsFromObj(Tcl_Interp *, Tcl_Obj *, Tcl_WideInt *); +MODULE_SCOPE int TclCompareStringKeys(void *keyPtr, Tcl_HashEntry *hPtr); +MODULE_SCOPE TCL_HASH_TYPE TclHashStringKey(Tcl_HashTable *tablePtr, void *keyPtr); MODULE_SCOPE int TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr, Tcl_Obj *incrPtr); MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, diff --git a/generic/tclLink.c b/generic/tclLink.c index 8bc738f..fc4741b 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -25,7 +25,7 @@ * variable. */ -typedef struct Link { +typedef struct { Tcl_Interp *interp; /* Interpreter containing Tcl variable. */ Namespace *nsPtr; /* Namespace containing Tcl variable */ Tcl_Obj *varName; /* Name of variable (must be global). This is @@ -33,10 +33,10 @@ typedef struct Link { * actual variable may be aliased at that time * via upvar. */ void *addr; /* Location of C variable. */ - int bytes; /* Size of C variable array. This is 0 when + Tcl_Size bytes; /* Size of C variable array. This is 0 when * single variables, and >0 used for array * variables. */ - int numElems; /* Number of elements in C variable array. + Tcl_Size numElems; /* Number of elements in C variable array. * Zero for single variables. */ int type; /* Type of link (TCL_LINK_INT, etc.). */ union { @@ -109,7 +109,7 @@ static int SetInvalidRealFromAny(Tcl_Interp *interp, * A marker type used to flag weirdnesses so we can pass them around right. */ -static Tcl_ObjType invalidRealType = { +static const Tcl_ObjType invalidRealType = { "invalidReal", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ @@ -245,7 +245,7 @@ Tcl_LinkArray( * interpreter result. */ int type, /* Type of C variable: TCL_LINK_INT, etc. Also * may have TCL_LINK_READ_ONLY OR'ed in. */ - int size) /* Size of C variable array, >1 if array */ + Tcl_Size size) /* Size of C variable array, >1 if array */ { Tcl_Obj *objPtr; Link *linkPtr; @@ -510,7 +510,7 @@ GetWide( Tcl_Obj *objPtr, Tcl_WideInt *widePtr) { - if (Tcl_GetWideIntFromObj(NULL, objPtr, widePtr) != TCL_OK) { + if (TclGetWideIntFromObj(NULL, objPtr, widePtr) != TCL_OK) { int intValue; if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) { @@ -591,7 +591,7 @@ SetInvalidRealFromAny( { const char *str; const char *endPtr; - int length; + Tcl_Size length; str = TclGetStringFromObj(objPtr, &length); if ((length == 1) && (str[0] == '.')) { @@ -637,7 +637,7 @@ GetInvalidIntFromObj( Tcl_Obj *objPtr, int *intPtr) { - int length; + Tcl_Size length; const char *str = TclGetStringFromObj(objPtr, &length); if ((length == 0) || ((length == 2) && (str[0] == '0') @@ -714,7 +714,7 @@ LinkTraceProc( { Link *linkPtr = (Link *)clientData; int changed; - int valueLength; + Tcl_Size valueLength; const char *value; char **pp; Tcl_Obj *valueObj; @@ -722,9 +722,8 @@ LinkTraceProc( Tcl_WideInt valueWide; Tcl_WideUInt valueUWide; double valueDouble; - int objc; + Tcl_Size objc, i; Tcl_Obj **objv; - int i; /* * If the variable is being unset, then just re-create it (with a trace) @@ -857,10 +856,9 @@ LinkTraceProc( switch (linkPtr->type) { case TCL_LINK_STRING: value = TclGetStringFromObj(valueObj, &valueLength); - valueLength++; /* include end of string char */ pp = (char **) linkPtr->addr; - *pp = (char *)ckrealloc(*pp, valueLength); + *pp = (char *)ckrealloc(*pp, ++valueLength); memcpy(*pp, value, valueLength); return NULL; @@ -916,7 +914,7 @@ LinkTraceProc( switch (linkPtr->type) { case TCL_LINK_INT: if (linkPtr->flags & LINK_ALLOC_LAST) { - for (i=0; i < objc; i++) { + for (i = 0; i < objc; i++) { int *varPtr = &linkPtr->lastValue.iPtr[i]; if (GetInt(objv[i], varPtr)) { @@ -1248,7 +1246,7 @@ ObjValue( { char *p; Tcl_Obj *resultObj, **objv; - int i; + Tcl_Size i; switch (linkPtr->type) { case TCL_LINK_INT: @@ -1493,7 +1491,7 @@ LinkFree( if (linkPtr->flags & LINK_ALLOC_LAST) { ckfree(linkPtr->lastValue.aryPtr); } - ckfree((char *) linkPtr); + ckfree((char *)linkPtr); } /* diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index fdfc56d..52ff689 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -217,9 +217,9 @@ typedef struct ZipEntry { ZipFile *zipFilePtr; /* The ZIP file holding this virtual file */ size_t offset; /* Data offset into memory mapped ZIP file */ int numBytes; /* Uncompressed size of the virtual file. - -1 for zip64 */ + * -1 for zip64 */ int numCompressedBytes; /* Compressed size of the virtual file. - -1 for zip64 */ + * -1 for zip64 */ int compressMethod; /* Compress method */ int isDirectory; /* 0 if file, 1 if directory, -1 if root */ int depth; /* Number of slashes in path. */ @@ -258,7 +258,7 @@ typedef struct ZipChannel { Tcl_Size cursor; /* Seek position for next read or write*/ unsigned char *ubuf; /* Pointer to the uncompressed data */ unsigned char *ubufToFree; /* NULL if ubuf points to memory that does not - need freeing. Else memory to free (ubuf + need freeing. Else memory to free (ubuf may point *inside* the block) */ Tcl_Size ubufSize; /* Size of allocated ubufToFree */ int iscompr; /* True if data is compressed */ @@ -267,7 +267,11 @@ typedef struct ZipChannel { int mode; /* O_WRITE, O_APPEND, O_TRUNC etc.*/ unsigned long keys[3]; /* Key for decryption */ } ZipChannel; -static inline int ZipChannelWritable(ZipChannel *info) { + +static inline int +ZipChannelWritable( + ZipChannel *info) +{ return (info->mode & (O_WRONLY | O_RDWR)) != 0; } @@ -434,29 +438,28 @@ static const Tcl_Filesystem zipfsFilesystem = { * The channel type/driver definition used for ZIP archive members. */ -static Tcl_ChannelType ZipChannelType = { - "zip", /* Type name. */ +static const Tcl_ChannelType zipChannelType = { + "zip", TCL_CHANNEL_VERSION_5, TCL_CLOSE2PROC, /* Close channel, clean instance data */ - ZipChannelRead, /* Handle read request */ - ZipChannelWrite, /* Handle write request */ + ZipChannelRead, + ZipChannelWrite, #if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) ZipChannelSeek, /* Move location of access point, NULL'able */ #else NULL, /* Move location of access point, NULL'able */ #endif - NULL, /* Set options, NULL'able */ - NULL, /* Get options, NULL'able */ - ZipChannelWatchChannel, /* Initialize notifier */ - ZipChannelGetFile, /* Get OS handle from the channel */ - ZipChannelClose, /* 2nd version of close channel, NULL'able */ - NULL, /* Set blocking mode for raw channel, - * NULL'able */ - NULL, /* Function to flush channel, NULL'able */ - NULL, /* Function to handle event, NULL'able */ - ZipChannelWideSeek, /* Wide seek function, NULL'able */ - NULL, /* Thread action function, NULL'able */ - NULL, /* Truncate function, NULL'able */ + NULL, /* Set options proc. */ + NULL, /* Get options proc. */ + ZipChannelWatchChannel, + ZipChannelGetFile, + ZipChannelClose, + NULL, /* Set blocking mode for raw channel. */ + NULL, /* Function to flush channel. */ + NULL, /* Function to handle bubbled events. */ + ZipChannelWideSeek, + NULL, /* Thread action function. */ + NULL, /* Truncate function. */ }; /* @@ -481,7 +484,9 @@ static Tcl_ChannelType ZipChannelType = { * *------------------------------------------------------------------------ */ -int TclIsZipfsPath (const char *path) +int +TclIsZipfsPath( + const char *path) { #ifdef _WIN32 return strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) ? 0 : ZIPFS_VOLUME_LEN; @@ -489,7 +494,7 @@ int TclIsZipfsPath (const char *path) int i; for (i = 0; i < ZIPFS_VOLUME_LEN; ++i) { if (path[i] != ZIPFS_VOLUME[i] && - (path[i] != '\\' || ZIPFS_VOLUME[i] != '/')) { + (path[i] != '\\' || ZIPFS_VOLUME[i] != '/')) { return 0; } } @@ -769,10 +774,10 @@ CountSlashes( * *------------------------------------------------------------------------ */ -static int IsCryptHeaderValid( - ZipEntry *z, - unsigned char cryptHeader[ZIP_CRYPT_HDR_LEN] - ) +static int +IsCryptHeaderValid( + ZipEntry *z, + unsigned char cryptHeader[ZIP_CRYPT_HDR_LEN]) { /* * There are multiple possibilities. The last one or two bytes of the @@ -818,11 +823,13 @@ static int IsCryptHeaderValid( *------------------------------------------------------------------------ */ static int -DecodeCryptHeader(Tcl_Interp *interp, - ZipEntry *z, - unsigned long keys[3],/* Updated on success. Must have been - initialized by caller. */ - unsigned char cryptHeader[ZIP_CRYPT_HDR_LEN]) /* From zip file content */ +DecodeCryptHeader( + Tcl_Interp *interp, + ZipEntry *z, + unsigned long keys[3], /* Updated on success. Must have been + * initialized by caller. */ + unsigned char cryptHeader[ZIP_CRYPT_HDR_LEN]) + /* From zip file content */ { int i; int ch; @@ -881,7 +888,7 @@ static char * DecodeZipEntryText( const unsigned char *inputBytes, unsigned int inputLength, - Tcl_DString *dstPtr) /* Must have been initialized by caller! */ + Tcl_DString *dstPtr) /* Must have been initialized by caller! */ { Tcl_Encoding encoding; const char *src; @@ -987,9 +994,10 @@ DecodeZipEntryText( *------------------------------------------------------------------------ */ static int -NormalizeMountPoint(Tcl_Interp *interp, - const char *mountPath, - Tcl_DString *dsPtr) /* Must be initialized by caller! */ +NormalizeMountPoint( + Tcl_Interp *interp, + const char *mountPath, + Tcl_DString *dsPtr) /* Must be initialized by caller! */ { const char *joiner[2]; char *joinedPath; @@ -1044,8 +1052,8 @@ NormalizeMountPoint(Tcl_Interp *interp, invalidMountPath: if (interp) { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("Invalid mount path \"%s\"", mountPath)); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "Invalid mount path \"%s\"", mountPath)); ZIPFS_ERROR_CODE(interp, "MOUNT_PATH"); } @@ -1074,11 +1082,12 @@ errorReturn: *------------------------------------------------------------------------ */ static char * -MapPathToZipfs(Tcl_Interp *interp, - const char *mountPath, /* Must be fully normalized */ - const char *path, /* Archive content path to map */ - Tcl_DString *dsPtr) /* Must be initialized and cleared - by caller */ +MapPathToZipfs( + Tcl_Interp *interp, + const char *mountPath, /* Must be fully normalized */ + const char *path, /* Archive content path to map */ + Tcl_DString *dsPtr) /* Must be initialized and cleared + * by caller */ { const char *joiner[2]; char *joinedPath; @@ -1214,7 +1223,9 @@ ZipFSLookupZip( *------------------------------------------------------------------------ */ static int -ContainsMountPoint (const char *path, int pathLen) +ContainsMountPoint( + const char *path, + int pathLen) { Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -1222,15 +1233,16 @@ ContainsMountPoint (const char *path, int pathLen) if (ZipFS.zipHash.numEntries == 0) { return 0; } - if (pathLen < 0) + if (pathLen < 0) { pathLen = strlen(path); + } /* * We are looking for the case where the path is //zipfs:/a/b * and there is a mount point //zipfs:/a/b/c/.. below it */ for (hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); hPtr; - hPtr = Tcl_NextHashEntry(&search)) { + hPtr = Tcl_NextHashEntry(&search)) { ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (zf->mountPointLen == 0) { @@ -1244,8 +1256,8 @@ ContainsMountPoint (const char *path, int pathLen) for (z = zf->topEnts; z; z = z->tnext) { int lenz = (int) strlen(z->name); if ((lenz >= pathLen) && - (z->name[pathLen] == '/' || z->name[pathLen] == '\0') && - (strncmp(z->name, path, pathLen) == 0)) { + (z->name[pathLen] == '/' || z->name[pathLen] == '\0') && + (strncmp(z->name, path, pathLen) == 0)) { return 1; } } @@ -1492,7 +1504,7 @@ ZipFSFindTOC( * the EOCD. Note this automatically means cdirZipOffset+cdirSize < zf->length. */ if (!(cdirZipOffset <= (size_t)eocdDataOffset && - cdirSize <= eocdDataOffset - cdirZipOffset)) { + cdirSize <= eocdDataOffset - cdirZipOffset)) { if (!needZip) { /* Simply point to end od data */ zf->directoryOffset = zf->baseOffset = zf->passOffset = zf->length; @@ -1540,7 +1552,7 @@ ZipFSFindTOC( size_t localhdr_off = ZipReadInt(start, end, dirEntry + ZIP_CENTRAL_LOCALHDR_OFFS); const unsigned char *localP = zf->data + zf->baseOffset + localhdr_off; if (localP > (cdirStart - ZIP_LOCAL_HEADER_LEN) || - ZipReadInt(start, end, localP) != ZIP_LOCAL_HEADER_SIG) { + ZipReadInt(start, end, localP) != ZIP_LOCAL_HEADER_SIG) { ZIPFS_ERROR(interp, "Failed to find local header"); ZIPFS_ERROR_CODE(interp, "LCL_HDR"); goto error; @@ -1665,8 +1677,8 @@ ZipFSOpenArchive( } /* What's the magic about 64 * 1024 * 1024 ? */ if ((zf->length <= ZIP_CENTRAL_END_LEN) || - (zf->length - ZIP_CENTRAL_END_LEN) > - (64 * 1024 * 1024 - ZIP_CENTRAL_END_LEN)) { + (zf->length - ZIP_CENTRAL_END_LEN) > + (64 * 1024 * 1024 - ZIP_CENTRAL_END_LEN)) { ZIPFS_ERROR(interp, "illegal file size"); ZIPFS_ERROR_CODE(interp, "FILE_SIZE"); goto error; @@ -2233,7 +2245,8 @@ ListMountPoints( *------------------------------------------------------------------------ */ static void -CleanupMount(ZipFile *zf) /* Mount point */ +CleanupMount( + ZipFile *zf) /* Mount point */ { ZipEntry *z, *znext; Tcl_HashEntry *hPtr; @@ -2359,27 +2372,24 @@ TclZipfs_Mount( Tcl_IncrRefCount(zipPathObj); normZipPathObj = Tcl_FSGetNormalizedPath(interp, zipPathObj); if (normZipPathObj == NULL) { - Tcl_SetObjResult( - interp, - Tcl_ObjPrintf("could not normalize zip filename \"%s\"", zipname)); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "could not normalize zip filename \"%s\"", zipname)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NORMALIZE", (char *)NULL); ret = TCL_ERROR; } else { Tcl_IncrRefCount(normZipPathObj); const char *normPath = TclGetString(normZipPathObj); if (passwd == NULL || - (ret = IsPasswordValid(interp, passwd, strlen(passwd))) == - TCL_OK) { + (ret = IsPasswordValid(interp, passwd, + strlen(passwd))) == TCL_OK) { zf = AllocateZipFile(interp, strlen(mountPoint)); if (zf == NULL) { ret = TCL_ERROR; - } - else { + } else { ret = ZipFSOpenArchive(interp, normPath, 1, zf); if (ret != TCL_OK) { ckfree(zf); - } - else { + } else { ret = ZipFSCatalogFilesystem( interp, zf, mountPoint, passwd, normPath); /* Note zf is already freed on error! */ @@ -2455,8 +2465,8 @@ TclZipfs_MountBuffer( */ ret = TCL_ERROR; if ((datalen <= ZIP_CENTRAL_END_LEN) || - (datalen - ZIP_CENTRAL_END_LEN) > - (64 * 1024 * 1024 - ZIP_CENTRAL_END_LEN)) { + (datalen - ZIP_CENTRAL_END_LEN) > + (64 * 1024 * 1024 - ZIP_CENTRAL_END_LEN)) { ZIPFS_ERROR(interp, "illegal file size"); ZIPFS_ERROR_CODE(interp, "FILE_SIZE"); goto done; @@ -2478,16 +2488,14 @@ TclZipfs_MountBuffer( } memcpy(zf->data, data, datalen); zf->ptrToFree = zf->data; - } - else { + } else { zf->data = (unsigned char *)data; zf->ptrToFree = NULL; } ret = ZipFSFindTOC(interp, 1, zf); if (ret != TCL_OK) { ckfree(zf); - } - else { + } else { /* Note ZipFSCatalogFilesystem will free zf on error */ ret = ZipFSCatalogFilesystem( interp, zf, mountPoint, NULL, "Memory Buffer"); @@ -3355,7 +3363,7 @@ ZipFSMkZipOrImg( { Tcl_Channel out; int count, ret = TCL_ERROR; - int pwlen = 0, slen = 0, lobjc; + Tcl_Size pwlen = 0, slen = 0, lobjc; size_t len, i = 0; long long directoryStartOffset; /* The overall file offset of the start of the @@ -4093,10 +4101,9 @@ ZipFSInfoObjCmd( } else { Tcl_SetErrno(ENOENT); if (interp) { - Tcl_SetObjResult( - interp, - Tcl_ObjPrintf("path \"%s\" not found in any zipfs volume", - filename)); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "path \"%s\" not found in any zipfs volume", + filename)); } ret = TCL_ERROR; } @@ -4300,7 +4307,7 @@ TclZipfs_TclLibrary(void) #elif !defined(NO_DLFCN_H) Dl_info dlinfo; if (dladdr((const void *)TclZipfs_TclLibrary, &dlinfo) && (dlinfo.dli_fname != NULL) - && (ZipfsAppHookFindTclInit(dlinfo.dli_fname) == TCL_OK)) { + && (ZipfsAppHookFindTclInit(dlinfo.dli_fname) == TCL_OK)) { return ScriptLibrarySetup(zipfs_literal_tcl_library); } #else @@ -4765,9 +4772,9 @@ ZipChannelOpen( if ((ZipFS.wrmax <= 0) && wr) { Tcl_SetErrno(EACCES); if (interp) { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("writes not permitted: %s", - Tcl_PosixError(interp))); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "writes not permitted: %s", + Tcl_PosixError(interp))); } return NULL; } @@ -4775,11 +4782,10 @@ ZipChannelOpen( if ((mode & (O_APPEND|O_TRUNC)) && !wr) { Tcl_SetErrno(EINVAL); if (interp) { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("Invalid flags 0x%x. O_APPEND and " - "O_TRUNC require write access: %s", - mode, - Tcl_PosixError(interp))); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "Invalid flags 0x%x. O_APPEND and " + "O_TRUNC require write access: %s", + mode, Tcl_PosixError(interp))); } return NULL; } @@ -4793,17 +4799,16 @@ ZipChannelOpen( if (!z) { Tcl_SetErrno(wr ? ENOTSUP : ENOENT); if (interp) { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("file \"%s\" not %s: %s", - filename, - wr ? "created" : "found", - Tcl_PosixError(interp))); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "file \"%s\" not %s: %s", + filename, wr ? "created" : "found", + Tcl_PosixError(interp))); } goto error; } if (z->numBytes < 0 || z->numCompressedBytes < 0 || - z->offset >= z->zipFilePtr->length) { + z->offset >= z->zipFilePtr->length) { /* Normally this should only happen for zip64. */ ZIPFS_ERROR(interp, "file size error (may be zip64)"); ZIPFS_ERROR_CODE(interp, "FILE_SIZE"); @@ -4834,8 +4839,9 @@ ZipChannelOpen( goto error; } flags = TCL_WRITABLE; - if (mode & O_RDWR) + if (mode & O_RDWR) { flags |= TCL_READABLE; + } } else { /* Read-only */ flags |= TCL_READABLE; @@ -4915,7 +4921,7 @@ ZipChannelOpen( ZipFS.idCount++); z->zipFilePtr->numOpen++; Unlock(); - return Tcl_CreateChannel(&ZipChannelType, cname, info, flags); + return Tcl_CreateChannel(&zipChannelType, cname, info, flags); error: Unlock(); @@ -4968,9 +4974,8 @@ InitWritableChannel( if (z->isEncrypted) { assert(z->numCompressedBytes >= ZIP_CRYPT_HDR_LEN); /* caller should have checked*/ - if (DecodeCryptHeader( - interp, z, info->keys, z->zipFilePtr->data + z->offset) != - TCL_OK) { + if (DecodeCryptHeader(interp, z, info->keys, + z->zipFilePtr->data + z->offset) != TCL_OK) { goto error_cleanup; } } @@ -5036,12 +5041,13 @@ InitWritableChannel( err = inflate(&stream, Z_SYNC_FLUSH); inflateEnd(&stream); if ((err != Z_STREAM_END) && - ((err != Z_OK) || (stream.avail_in != 0))) { + ((err != Z_OK) || (stream.avail_in != 0))) { goto corruptionError; } /* Even if decompression succeeded, counts should be as expected */ - if ((int) stream.total_out != z->numBytes) + if ((int) stream.total_out != z->numBytes) { goto corruptionError; + } info->numBytes = z->numBytes; if (cbuf) { ckfree(cbuf); @@ -5051,8 +5057,9 @@ InitWritableChannel( * Need to decrypt some otherwise-simple stored data. */ if (z->numCompressedBytes <= ZIP_CRYPT_HDR_LEN || - (z->numCompressedBytes - ZIP_CRYPT_HDR_LEN) != z->numBytes) + (z->numCompressedBytes - ZIP_CRYPT_HDR_LEN) != z->numBytes) { goto corruptionError; + } int len = z->numCompressedBytes - ZIP_CRYPT_HDR_LEN; assert(len <= info->ubufSize); for (i = 0; i < len; i++) { @@ -5060,8 +5067,7 @@ InitWritableChannel( info->ubuf[i] = zdecode(info->keys, crc32tab, ch); } info->numBytes = len; - } - else { + } else { /* * Simple stored data. Copy into our working buffer. */ @@ -5222,8 +5228,9 @@ InitReadableChannel( * on it, and it can be randomly accessed later. */ if (z->numCompressedBytes <= ZIP_CRYPT_HDR_LEN || - (z->numCompressedBytes - ZIP_CRYPT_HDR_LEN) != z->numBytes) + (z->numCompressedBytes - ZIP_CRYPT_HDR_LEN) != z->numBytes) { goto corruptionError; + } len = z->numCompressedBytes - ZIP_CRYPT_HDR_LEN; ubuf = (unsigned char *) attemptckalloc(len); if (ubuf == NULL) { @@ -5499,7 +5506,7 @@ AppendWithPrefix( Tcl_DString *prefix, /* The prefix to add to the element, or NULL * for don't do that. */ const char *name, /* The name to append. */ - Tcl_Size nameLen) /* The length of the name. May be < 0 for + size_t nameLen) /* The length of the name. May be TCL_INDEX_NONE for * append-up-to-NUL-byte. */ { if (prefix) { @@ -5564,14 +5571,13 @@ ZipFSMatchInDirectoryProc( return TCL_ERROR; } if ((wanted & (TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE | - TCL_GLOB_TYPE_MOUNT)) == 0) { + TCL_GLOB_TYPE_MOUNT)) == 0) { /* Not looking for files,dirs,mounts. zipfs cannot have others */ return TCL_OK; } wanted &= (TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE | TCL_GLOB_TYPE_MOUNT); - } - else { + } else { wanted = TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE; } @@ -5628,8 +5634,8 @@ ZipFSMatchInDirectoryProc( /* TODO - can't seem to get to this code from script for tests. */ /* Follow logic of what tclUnixFile.c does */ if ((wanted == (TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE)) || - (wanted == TCL_GLOB_TYPE_DIR && z->isDirectory) || - (wanted == TCL_GLOB_TYPE_FILE && !z->isDirectory)) { + (wanted == TCL_GLOB_TYPE_DIR && z->isDirectory) || + (wanted == TCL_GLOB_TYPE_FILE && !z->isDirectory)) { Tcl_ListObjAppendElement(NULL, result, pathPtr); } goto end; @@ -5674,17 +5680,17 @@ ZipFSMatchInDirectoryProc( Tcl_HashSearch search; if (foundInHash) { for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); hPtr; - hPtr = Tcl_NextHashEntry(&search)) { + hPtr = Tcl_NextHashEntry(&search)) { z = (ZipEntry *)Tcl_GetHashValue(hPtr); if ((wanted == (TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE)) || - (wanted == TCL_GLOB_TYPE_DIR && z->isDirectory) || - (wanted == TCL_GLOB_TYPE_FILE && !z->isDirectory)) { + (wanted == TCL_GLOB_TYPE_DIR && z->isDirectory) || + (wanted == TCL_GLOB_TYPE_FILE && !z->isDirectory)) { if ((z->depth == scnt) && - ((z->flags & ZE_F_VOLUME) == 0) /* Bug 14db54d81e */ - && Tcl_StringCaseMatch(z->name, pat, 0)) { - Tcl_CreateHashEntry( - &duplicates, z->name + strip, ¬Duplicate); + ((z->flags & ZE_F_VOLUME) == 0) /* Bug 14db54d81e */ + && Tcl_StringCaseMatch(z->name, pat, 0)) { + Tcl_CreateHashEntry(&duplicates, z->name + strip, + ¬Duplicate); assert(notDuplicate); AppendWithPrefix(result, prefixBuf, z->name + strip, -1); } @@ -5701,16 +5707,16 @@ ZipFSMatchInDirectoryProc( Tcl_DString ds; Tcl_DStringInit(&ds); for (hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); hPtr; - hPtr = Tcl_NextHashEntry(&search)) { + hPtr = Tcl_NextHashEntry(&search)) { ZipFile *zf = (ZipFile *)Tcl_GetHashValue(hPtr); if (Tcl_StringCaseMatch(zf->mountPoint, pat, 0)) { const char *tail = zf->mountPoint + len; - if (*tail == '\0') + if (*tail == '\0') { continue; + } const char *end = strchr(tail, '/'); - Tcl_DStringAppend(&ds, - zf->mountPoint + strip, - end ? (Tcl_Size)(end - zf->mountPoint) : -1); + Tcl_DStringAppend(&ds, zf->mountPoint + strip, + end ? (Tcl_Size)(end - zf->mountPoint) : -1); const char *matchedPath = Tcl_DStringValue(&ds); (void)Tcl_CreateHashEntry( &duplicates, matchedPath, ¬Duplicate); @@ -6346,7 +6352,8 @@ ZipfsAppHookFindTclInit( * *------------------------------------------------------------------------ */ -void TclZipfsFinalize(void) +void +TclZipfsFinalize(void) { WriteLock(); if (!ZipFS.initialized) { @@ -6401,7 +6408,7 @@ TclZipfs_AppHook( #endif /* _WIN32 */ { const char *archive; - const char *version = Tcl_InitSubsystems(); + const char *result = Tcl_InitSubsystems(); #ifdef _WIN32 Tcl_FindExecutable(NULL); @@ -6444,7 +6451,7 @@ TclZipfs_AppHook( Tcl_DecrRefCount(vfsInitScript); if (found == TCL_OK) { zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return version; + return result; } } #ifdef SUPPORT_BUILTIN_ZIP_INSTALL @@ -6477,7 +6484,7 @@ TclZipfs_AppHook( if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) { Tcl_SetStartupScript(vfsInitScript, NULL); } - return version; + return result; } else if (!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; Tcl_Obj *vfsInitScript; @@ -6501,7 +6508,7 @@ TclZipfs_AppHook( Tcl_DecrRefCount(vfsInitScript); if (found == TCL_OK) { zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return version; + return result; } } #ifdef _WIN32 @@ -6509,7 +6516,7 @@ TclZipfs_AppHook( #endif /* _WIN32 */ #endif /* SUPPORT_BUILTIN_ZIP_INSTALL */ } - return version; + return result; } #else /* !HAVE_ZLIB */ @@ -6578,7 +6585,9 @@ TclZipfs_TclLibrary(void) return NULL; } -int TclIsZipfsPath (const char *path) +int +TclIsZipfsPath( + TCL_UNUSED(const char *)) /* path */ { return 0; } -- cgit v0.12