diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-04-10 15:26:21 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-04-10 15:26:21 (GMT) |
| commit | 62a628d51f30fb7754f907d87ef28b3e8a9938a3 (patch) | |
| tree | 01f7adcaadf8875893ea59d7b147f3d465b7886a | |
| parent | f8cdc473a5a725577e81aaa05b166b710559c62a (diff) | |
| parent | 9ac22a9200db4d034922f3f15194cc1f3568e230 (diff) | |
| download | tcl-62a628d51f30fb7754f907d87ef28b3e8a9938a3.zip tcl-62a628d51f30fb7754f907d87ef28b3e8a9938a3.tar.gz tcl-62a628d51f30fb7754f907d87ef28b3e8a9938a3.tar.bz2 | |
Merge 8.7
| -rwxr-xr-x | generic/tclArithSeries.c | 2 | ||||
| -rw-r--r-- | generic/tclClock.c | 6 | ||||
| -rw-r--r-- | generic/tclDictObj.c | 2 | ||||
| -rw-r--r-- | generic/tclExecute.c | 2 | ||||
| -rw-r--r-- | generic/tclIOCmd.c | 2 | ||||
| -rw-r--r-- | generic/tclIOUtil.c | 13 | ||||
| -rw-r--r-- | generic/tclInt.h | 26 | ||||
| -rw-r--r-- | generic/tclMain.c | 2 | ||||
| -rw-r--r-- | generic/tclObj.c | 64 | ||||
| -rw-r--r-- | generic/tclStringObj.c | 4 | ||||
| -rw-r--r-- | generic/tclTest.c | 4 | ||||
| -rw-r--r-- | unix/tclUnixChan.c | 2 | ||||
| -rw-r--r-- | win/tclWinChan.c | 2 | ||||
| -rw-r--r-- | win/tclWinPipe.c | 2 |
14 files changed, 65 insertions, 68 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index 5f10603..2770639 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -879,7 +879,7 @@ TclArithSeriesGetElements( Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of * pointers to the list's objects. */ { - if (TclHasInternalRep(objPtr,&arithSeriesType)) { + if (TclHasInternalRep(objPtr, &arithSeriesType)) { ArithSeries *arithSeriesRepPtr; Tcl_Obj **objv; int i, objc; diff --git a/generic/tclClock.c b/generic/tclClock.c index 619a310..391a839 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3456,7 +3456,7 @@ ClockParseFmtScnArgs( goto baseNow; } - if (baseObj->typePtr == &tclBignumType) { + if (TclHasInternalRep(baseObj, &tclBignumType)) { goto baseOverflow; } @@ -3472,7 +3472,7 @@ ClockParseFmtScnArgs( * Note the year is currently an integer, thus avoid to overflow it also. */ - if ( baseObj->typePtr == &tclBignumType + if (TclHasInternalRep(baseObj, &tclBignumType) || baseVal < TCL_MIN_SECONDS || baseVal > TCL_MAX_SECONDS ) { baseOverflow: @@ -4463,7 +4463,7 @@ ClockAddObjCmd( &unitIndex) != TCL_OK) { goto done; } - if (objv[i]->typePtr == &tclBignumType + if (TclHasInternalRep(objv[i], &tclBignumType) || offs > (unitIndex < CLC_ADD_HOURS ? 0x7fffffff : TCL_MAX_SECONDS) || offs < (unitIndex < CLC_ADD_HOURS ? -0x7fffffff : TCL_MIN_SECONDS) ) { diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 7128e9c..df9a88c 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2109,7 +2109,7 @@ TclDictObjSmartRef( Tcl_Obj *result; Dict *dict; - if (dictPtr->typePtr != &tclDictType + if (!TclHasInternalRep(dictPtr, &tclDictType) && SetDictFromAny(interp, dictPtr) != TCL_OK) { return NULL; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6027e10..da08f3a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8495,7 +8495,7 @@ ExecuteExtendedBinaryMathOp( overflowExpon: if ((TclGetWideIntFromObj(NULL, value2Ptr, &w2) != TCL_OK) - || (value2Ptr->typePtr != &tclIntType) + || !TclHasInternalRep(value2Ptr, &tclIntType) || (Tcl_WideUInt)w2 >= (1<<28)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "exponent too large", -1)); diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index e64b2de..430b22e 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1147,7 +1147,7 @@ Tcl_OpenObjCmd( } else { int flags = TCL_STDERR | TCL_ENFORCE_MODE; - switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { + switch (mode & O_ACCMODE) { case O_RDONLY: flags |= TCL_STDOUT; break; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 5a07533..b0b847e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1484,7 +1484,6 @@ TclGetOpenModeEx( int mode, c, gotRW; Tcl_Size modeArgc, i; const char **modeArgv, *flag; -#define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) /* * Check for the simpler fopen-like access modes like "r" which are @@ -1494,7 +1493,7 @@ TclGetOpenModeEx( *seekFlagPtr = 0; *binaryPtr = 0; - mode = 0; + mode = O_RDONLY; /* * Guard against wide characters before using byte-oriented routines. @@ -1504,7 +1503,6 @@ TclGetOpenModeEx( && islower(UCHAR(modeString[0]))) { /* INTL: ISO only. */ switch (modeString[0]) { case 'r': - mode = O_RDONLY; break; case 'w': mode = O_WRONLY|O_CREAT|O_TRUNC; @@ -1533,8 +1531,7 @@ TclGetOpenModeEx( * 1773127] */ - mode &= ~(O_RDONLY|O_WRONLY|O_APPEND); - mode |= O_RDWR; + mode = (mode & ~(O_ACCMODE|O_APPEND)) | O_RDWR; break; case 'b': *binaryPtr = 1; @@ -1579,13 +1576,13 @@ TclGetOpenModeEx( flag = modeArgv[i]; c = flag[0]; if ((c == 'R') && (strcmp(flag, "RDONLY") == 0)) { - mode = (mode & ~RW_MODES) | O_RDONLY; + mode = (mode & ~O_ACCMODE) | O_RDONLY; gotRW = 1; } else if ((c == 'W') && (strcmp(flag, "WRONLY") == 0)) { - mode = (mode & ~RW_MODES) | O_WRONLY; + mode = (mode & ~O_ACCMODE) | O_WRONLY; gotRW = 1; } else if ((c == 'R') && (strcmp(flag, "RDWR") == 0)) { - mode = (mode & ~RW_MODES) | O_RDWR; + mode = (mode & ~O_ACCMODE) | O_RDWR; gotRW = 1; } else if ((c == 'A') && (strcmp(flag, "APPEND") == 0)) { mode |= O_APPEND; diff --git a/generic/tclInt.h b/generic/tclInt.h index 8ccad81..910aa86 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2710,7 +2710,7 @@ typedef struct ListRep { * converted to a list. */ #define TclListObjGetElements(interp_, listObj_, objcPtr_, objvPtr_) \ - (((listObj_)->typePtr == &tclListType) \ + ((TclHasInternalRep((listObj_), &tclListType)) \ ? ((ListObjGetElements((listObj_), *(objcPtr_), *(objvPtr_))), \ TCL_OK) \ : Tcl_ListObjGetElements( \ @@ -2722,12 +2722,12 @@ typedef struct ListRep { * Tcl_Obj cannot be converted to a list. */ #define TclListObjLength(interp_, listObj_, lenPtr_) \ - (((listObj_)->typePtr == &tclListType) \ + ((TclHasInternalRep((listObj_), &tclListType)) \ ? ((ListObjLength((listObj_), *(lenPtr_))), TCL_OK) \ : Tcl_ListObjLength((interp_), (listObj_), (lenPtr_))) #define TclListObjIsCanonical(listObj_) \ - (((listObj_)->typePtr == &tclListType) ? ListObjIsCanonical((listObj_)) : 0) + ((TclHasInternalRep((listObj_), &tclListType)) ? ListObjIsCanonical((listObj_)) : 0) /* * Modes for collecting (or not) in the implementations of TclNRForeachCmd, @@ -2747,27 +2747,27 @@ typedef struct ListRep { #if TCL_MAJOR_VERSION > 8 #define TclGetBooleanFromObj(interp, objPtr, intPtr) \ - (((objPtr)->typePtr == &tclIntType \ - || (objPtr)->typePtr == &tclBooleanType) \ + ((TclHasInternalRep((objPtr), &tclIntType) \ + || TclHasInternalRep((objPtr), &tclBooleanType)) \ ? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \ : Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr))) #else #define TclGetBooleanFromObj(interp, objPtr, intPtr) \ - (((objPtr)->typePtr == &tclIntType) \ + ((TclHasInternalRep((objPtr), &tclIntType)) \ ? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \ - : ((objPtr)->typePtr == &tclBooleanType) \ + : (TclHasInternalRep((objPtr), &tclBooleanType)) \ ? (*(intPtr) = ((objPtr)->internalRep.longValue!=0), TCL_OK) \ : Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr))) #endif #ifdef TCL_WIDE_INT_IS_LONG #define TclGetLongFromObj(interp, objPtr, longPtr) \ - (((objPtr)->typePtr == &tclIntType) \ + ((TclHasInternalRep((objPtr), &tclIntType)) \ ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetLongFromObj((interp), (objPtr), (longPtr))) #else #define TclGetLongFromObj(interp, objPtr, longPtr) \ - (((objPtr)->typePtr == &tclIntType \ + ((TclHasInternalRep((objPtr), &tclIntType) \ && (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(LONG_MIN) \ && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(LONG_MAX)) \ ? ((*(longPtr) = (long)(objPtr)->internalRep.wideValue), TCL_OK) \ @@ -2775,13 +2775,13 @@ typedef struct ListRep { #endif #define TclGetIntFromObj(interp, objPtr, intPtr) \ - (((objPtr)->typePtr == &tclIntType \ + ((TclHasInternalRep((objPtr), &tclIntType) \ && (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(INT_MIN) \ && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \ ? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) #define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ - ((((objPtr)->typePtr == &tclIntType) && ((objPtr)->internalRep.wideValue >= 0) \ + (((TclHasInternalRep((objPtr), &tclIntType)) && ((objPtr)->internalRep.wideValue >= 0) \ && ((objPtr)->internalRep.wideValue <= endValue)) \ ? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) @@ -2795,7 +2795,7 @@ typedef struct ListRep { */ #define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ - (((objPtr)->typePtr == &tclIntType) \ + ((TclHasInternalRep((objPtr), &tclIntType)) \ ? (*(wideIntPtr) = \ ((objPtr)->internalRep.wideValue), TCL_OK) : \ Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) @@ -4613,7 +4613,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); #define TclIsPureDict(objPtr) \ - (((objPtr)->bytes==NULL) && ((objPtr)->typePtr==&tclDictType)) + (((objPtr)->bytes==NULL) && TclHasInternalRep((objPtr), &tclDictType)) #define TclHasInternalRep(objPtr, type) \ ((objPtr)->typePtr == (type)) #define TclFetchInternalRep(objPtr, type) \ diff --git a/generic/tclMain.c b/generic/tclMain.c index a93aabd..a7cb7fb 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -360,7 +360,7 @@ Tcl_MainEx( is.tty = isatty(0); Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, - Tcl_NewWideIntObj(!path && is.tty), TCL_GLOBAL_ONLY); + Tcl_NewBooleanObj(!path && is.tty), TCL_GLOBAL_ONLY); /* * Invoke application-specific initialization. diff --git a/generic/tclObj.c b/generic/tclObj.c index 66cfd3c..1070e87 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2021,11 +2021,11 @@ Tcl_GetBoolFromObj( return TCL_ERROR; } do { - if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclBooleanType) { + if (TclHasInternalRep(objPtr, &tclIntType) || TclHasInternalRep(objPtr, &tclBooleanType)) { result = (objPtr->internalRep.wideValue != 0); goto boolEnd; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { /* * Caution: Don't be tempted to check directly for the "double" * Tcl_ObjType and then compare the internalrep to 0.0. This isn't @@ -2042,7 +2042,7 @@ Tcl_GetBoolFromObj( result = (d != 0.0); goto boolEnd; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { result = 1; boolEnd: if (charPtr != NULL) { @@ -2110,18 +2110,18 @@ TclSetBooleanFromAny( */ if (objPtr->bytes == NULL) { - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { if ((Tcl_WideUInt)objPtr->internalRep.wideValue < 2) { return TCL_OK; } goto badBoolean; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { goto badBoolean; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { goto badBoolean; } } @@ -2423,7 +2423,7 @@ Tcl_GetDoubleFromObj( double *dblPtr) /* Place to store resulting double. */ { do { - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (isnan(objPtr->internalRep.doubleValue)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -2436,11 +2436,11 @@ Tcl_GetDoubleFromObj( *dblPtr = (double) objPtr->internalRep.doubleValue; return TCL_OK; } - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { *dblPtr = (double) objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { mp_int big; TclUnpackBignum(objPtr, big); @@ -2654,12 +2654,12 @@ Tcl_GetLongFromObj( { do { #ifdef TCL_WIDE_INT_IS_LONG - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { *longPtr = objPtr->internalRep.wideValue; return TCL_OK; } #else - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { /* * We return any integer in the range LONG_MIN to ULONG_MAX * converted to a long, ignoring overflow. The rule preserves @@ -2678,7 +2678,7 @@ Tcl_GetLongFromObj( goto tooLarge; } #endif - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", @@ -2687,7 +2687,7 @@ Tcl_GetLongFromObj( } return TCL_ERROR; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { /* * Must check for those bignum values that can fit in a long, even * when auto-narrowing is enabled. Only those values in the signed @@ -2915,11 +2915,11 @@ Tcl_GetWideIntFromObj( /* Place to store resulting long. */ { do { - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { *wideIntPtr = objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", @@ -2928,7 +2928,7 @@ Tcl_GetWideIntFromObj( } return TCL_ERROR; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { /* * Must check for those bignum values that can fit in a * Tcl_WideInt, even when auto-narrowing is enabled. @@ -3000,7 +3000,7 @@ Tcl_GetWideUIntFromObj( /* Place to store resulting long. */ { do { - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { if (objPtr->internalRep.wideValue < 0) { wideUIntOutOfRange: if (interp != NULL) { @@ -3014,10 +3014,10 @@ Tcl_GetWideUIntFromObj( *wideUIntPtr = (Tcl_WideUInt)objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { goto wideUIntOutOfRange; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { /* * Must check for those bignum values that can fit in a * Tcl_WideUInt, even when auto-narrowing is enabled. @@ -3084,11 +3084,11 @@ TclGetWideBitsFromObj( Tcl_WideInt *wideIntPtr) /* Place to store resulting wide integer. */ { do { - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { *wideIntPtr = objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", @@ -3097,7 +3097,7 @@ TclGetWideBitsFromObj( } return TCL_ERROR; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { mp_int big; mp_err err; @@ -3380,7 +3380,7 @@ GetBignumFromObj( mp_int *bignumValue) /* Returned bignum value. */ { do { - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { if (copy || Tcl_IsShared(objPtr)) { mp_int temp; @@ -3405,14 +3405,14 @@ GetBignumFromObj( } return TCL_OK; } - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { if (mp_init_i64(bignumValue, objPtr->internalRep.wideValue) != MP_OKAY) { return TCL_ERROR; } return TCL_OK; } - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", @@ -3615,7 +3615,7 @@ Tcl_GetNumberFromObj( int *typePtr) { do { - if (objPtr->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objPtr, &tclDoubleType)) { if (isnan(objPtr->internalRep.doubleValue)) { *typePtr = TCL_NUMBER_NAN; } else { @@ -3624,12 +3624,12 @@ Tcl_GetNumberFromObj( *clientDataPtr = &objPtr->internalRep.doubleValue; return TCL_OK; } - if (objPtr->typePtr == &tclIntType) { + if (TclHasInternalRep(objPtr, &tclIntType)) { *typePtr = TCL_NUMBER_INT; *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclBignumType) { + if (TclHasInternalRep(objPtr, &tclBignumType)) { static Tcl_ThreadDataKey bignumKey; mp_int *bigPtr = (mp_int *)Tcl_GetThreadData(&bignumKey, sizeof(mp_int)); @@ -4269,7 +4269,7 @@ Tcl_GetCommandFromObj( */ resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1; - if (objPtr->typePtr == &tclCmdNameType) { + if (TclHasInternalRep(objPtr, &tclCmdNameType)) { Command *cmdPtr = resPtr->cmdPtr; if ((cmdPtr->cmdEpoch == resPtr->cmdEpoch) @@ -4384,7 +4384,7 @@ TclSetCmdNameObj( { ResolvedCmdName *resPtr; - if (objPtr->typePtr == &tclCmdNameType) { + if (TclHasInternalRep(objPtr, &tclCmdNameType)) { resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1; if (resPtr != NULL && resPtr->cmdPtr == cmdPtr) { return; @@ -4531,7 +4531,7 @@ SetCmdNameFromAny( } resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1; - if ((objPtr->typePtr == &tclCmdNameType) && (resPtr->refCount == 1)) { + if (TclHasInternalRep(objPtr, &tclCmdNameType) && (resPtr->refCount == 1)) { /* * Re-use existing ResolvedCmdName struct when possible. * Cleanup the old fields that need it. @@ -4592,7 +4592,7 @@ Tcl_RepresentationCmd( objv[1]->refCount, objv[1]); if (objv[1]->typePtr) { - if (objv[1]->typePtr == &tclDoubleType) { + if (TclHasInternalRep(objv[1], &tclDoubleType)) { Tcl_AppendPrintfToObj(descObj, ", internal representation %g", objv[1]->internalRep.doubleValue); } else { diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6f289c8..81e6b18 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -129,7 +129,7 @@ GrowStringBuffer( { /* * Preconditions: - * objPtr->typePtr == &tclStringType + * TclHasInternalRep(objPtr, &tclStringType) * needed > stringPtr->allocated * flag || objPtr->bytes != NULL */ @@ -167,7 +167,7 @@ GrowUnicodeBuffer( { /* * Preconditions: - * objPtr->typePtr == &tclStringType + * TclHasInternalRep(objPtr, &tclStringType) * needed > stringPtr->maxChars */ diff --git a/generic/tclTest.c b/generic/tclTest.c index 10c17c7..d8fbb00 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7430,7 +7430,7 @@ SimpleOpenFileChannel( Tcl_Obj *tempPtr; Tcl_Channel chan; - if ((mode != 0) && !(mode & O_RDONLY)) { + if ((mode & O_ACCMODE) != O_RDONLY) { Tcl_AppendResult(interp, "read-only", (char *)NULL); return NULL; } @@ -8317,7 +8317,7 @@ TestparseargsCmd( const Tcl_ArgvInfo argTable[] = { {TCL_ARGV_CONSTANT, "-bool", INT2PTR(1), &foo, "booltest", NULL}, {TCL_ARGV_STRING, "-colormode" , NULL, &color, "color mode", NULL}, - {TCL_ARGV_GENFUNC, "-media", ParseMedia, &media, "media page size", NULL}, + {TCL_ARGV_GENFUNC, "-media", (void *)ParseMedia, &media, "media page size", NULL}, TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 2718044..3f972ae 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -1768,7 +1768,7 @@ TclpOpenFileChannel( char channelName[16 + TCL_INTEGER_SPACE]; const Tcl_ChannelType *channelTypePtr; - switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { + switch (mode & O_ACCMODE) { case O_RDONLY: channelPermissions = TCL_READABLE; break; diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 73b61ab..8715b4d 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -1019,7 +1019,7 @@ TclpOpenFileChannel( return NULL; } - switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { + switch (mode & O_ACCMODE) { case O_RDONLY: accessMode = GENERIC_READ; channelPermissions = TCL_READABLE; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d587dda..3f0269c 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -538,7 +538,7 @@ TclpOpenFile( * Map the access bits to the NT access mode. */ - switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { + switch (mode & O_ACCMODE) { case O_RDONLY: accessMode = GENERIC_READ; break; |
