diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-18 14:06:17 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-18 14:06:17 (GMT) |
commit | d7364d1f4bcb025930cf6d91cb2fe5787918bc41 (patch) | |
tree | 2d6a5d0e295ff78acb9fc9b3d15b6d340b6a8b21 /generic | |
parent | 303fbfc4be38a234f52db032c7cb87d0482e9cdc (diff) | |
parent | 176431f58481aeaba56e3463648fd85990236de4 (diff) | |
download | tcl-d7364d1f4bcb025930cf6d91cb2fe5787918bc41.zip tcl-d7364d1f4bcb025930cf6d91cb2fe5787918bc41.tar.gz tcl-d7364d1f4bcb025930cf6d91cb2fe5787918bc41.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r-- | generic/regcustom.h | 4 | ||||
-rw-r--r-- | generic/regguts.h | 4 | ||||
-rw-r--r-- | generic/tclAlloc.c | 8 | ||||
-rw-r--r-- | generic/tclAssembly.c | 16 | ||||
-rw-r--r-- | generic/tclBasic.c | 12 | ||||
-rw-r--r-- | generic/tclBinary.c | 54 | ||||
-rw-r--r-- | generic/tclCkalloc.c | 4 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 4 | ||||
-rw-r--r-- | generic/tclDisassemble.c | 10 | ||||
-rw-r--r-- | generic/tclEncoding.c | 26 | ||||
-rw-r--r-- | generic/tclEnv.c | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 2 | ||||
-rw-r--r-- | generic/tclInt.h | 4 | ||||
-rw-r--r-- | generic/tclObj.c | 4 | ||||
-rw-r--r-- | generic/tclParse.c | 2 | ||||
-rw-r--r-- | generic/tclStrToD.c | 46 | ||||
-rw-r--r-- | generic/tclStubLib.c | 4 | ||||
-rw-r--r-- | generic/tclTest.c | 2 | ||||
-rw-r--r-- | generic/tclUtf.c | 26 | ||||
-rw-r--r-- | generic/tclUtil.c | 8 |
20 files changed, 120 insertions, 122 deletions
diff --git a/generic/regcustom.h b/generic/regcustom.h index 8c86e49..1d55671 100644 --- a/generic/regcustom.h +++ b/generic/regcustom.h @@ -87,11 +87,11 @@ typedef int celt; /* Type to hold chr, or NOCELT */ #if TCL_UTF_MAX > 3 #define CHRBITS 32 /* Bits in a chr; must not use sizeof */ #define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */ -#define CHR_MAX 0x10ffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */ +#define CHR_MAX 0x10FFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */ #else #define CHRBITS 16 /* Bits in a chr; must not use sizeof */ #define CHR_MIN 0x0000 /* Smallest and largest chr; the value */ -#define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */ +#define CHR_MAX 0xFFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */ #endif /* diff --git a/generic/regguts.h b/generic/regguts.h index da38ef2..de5d18e 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -74,7 +74,7 @@ #define DUPMAX _POSIX2_RE_DUP_MAX #define DUPINF (DUPMAX+1) -#define REMAGIC 0xfed7 /* magic number for main struct */ +#define REMAGIC 0xFED7 /* magic number for main struct */ /* * debugging facilities @@ -390,7 +390,7 @@ struct fns { struct guts { int magic; -#define GUTSMAGIC 0xfed9 +#define GUTSMAGIC 0xFED9 int cflags; /* copy of compile flags */ long info; /* copy of re_info */ size_t nsub; /* copy of re_nsub */ diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 8e3d3b8..07742d2 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -68,7 +68,7 @@ union overhead { }; -#define MAGIC 0xef /* magic # on accounting info */ +#define MAGIC 0xEF /* magic # on accounting info */ #define RMAGIC 0x5555 /* magic # on range info */ #ifndef NDEBUG @@ -288,7 +288,7 @@ TclpAlloc( overPtr = (union overhead *) (bigBlockPtr + 1); overPtr->overMagic0 = overPtr->overMagic1 = MAGIC; - overPtr->bucketIndex = 0xff; + overPtr->bucketIndex = 0xFF; #ifdef MSTATS numMallocs[NBUCKETS]++; #endif @@ -468,7 +468,7 @@ TclpFree( RANGE_ASSERT(overPtr->rangeCheckMagic == RMAGIC); RANGE_ASSERT(BLOCK_END(overPtr) == RMAGIC); size = overPtr->bucketIndex; - if (size == 0xff) { + if (size == 0xFF) { #ifdef MSTATS numMallocs[NBUCKETS]--; #endif @@ -542,7 +542,7 @@ TclpRealloc( * If the block isn't in a bin, just realloc it. */ - if (i == 0xff) { + if (i == 0xFF) { struct block *prevPtr, *nextPtr; bigBlockPtr = (struct block *) overPtr - 1; prevPtr = bigBlockPtr->prevPtr; diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index fb0326d..97642f6 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -674,7 +674,7 @@ BBEmitOpcode( /* Compilation environment */ BasicBlock* bbPtr = assemEnvPtr->curr_bb; /* Current basic block */ - int op = TalInstructionTable[tblIdx].tclInstCode & 0xff; + int op = TalInstructionTable[tblIdx].tclInstCode & 0xFF; /* * If this is the first instruction in a basic block, record its line @@ -736,13 +736,13 @@ BBEmitInst1or4( /* Current basic block */ int op = TalInstructionTable[tblIdx].tclInstCode; - if (param <= 0xff) { + if (param <= 0xFF) { op >>= 8; } else { - op &= 0xff; + op &= 0xFF; } TclEmitInt1(op, envPtr); - if (param <= 0xff) { + if (param <= 0xFF) { TclEmitInt1(param, envPtr); } else { TclEmitInt4(param, envPtr); @@ -2231,7 +2231,7 @@ GetIntegerOperand( * TCL_ERROR (with an appropriate error message) if the parse fails. * * Side effects: - * Stores the list index at '*index'. Values between -1 and 0x7fffffff + * Stores the list index at '*index'. Values between -1 and 0x7FFFFFFF * have their natural meaning; values between -2 and -0x80000000 * represent 'end-2-N'. * @@ -2394,7 +2394,7 @@ CheckOneByte( { Tcl_Obj* result; /* Error message */ - if (value < 0 || value > 0xff) { + if (value < 0 || value > 0xFF) { result = Tcl_NewStringObj("operand does not fit in one byte", -1); Tcl_SetObjResult(interp, result); Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL); @@ -2429,7 +2429,7 @@ CheckSignedOneByte( { Tcl_Obj* result; /* Error message */ - if (value > 0x7f || value < -0x80) { + if (value > 0x7F || value < -0x80) { result = Tcl_NewStringObj("operand does not fit in one byte", -1); Tcl_SetObjResult(interp, result); Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL); @@ -2843,7 +2843,7 @@ CalculateJumpRelocations( if (bbPtr->flags & BB_JUMP1) { offset = jumpTarget->startOffset - (bbPtr->jumpOffset + motion); - if (offset < -0x80 || offset > 0x7f) { + if (offset < -0x80 || offset > 0x7F) { opcode = TclGetUInt1AtPtr(envPtr->codeStart + bbPtr->jumpOffset); ++opcode; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 5d434bd..24ffe3c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7426,8 +7426,8 @@ ExprRandFunc( * Make sure 1 <= randSeed <= (2^31) - 2. See below. */ - iPtr->randSeed &= 0x7fffffff; - if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) { + iPtr->randSeed &= 0x7FFFFFFF; + if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) { iPtr->randSeed ^= 123459876; } } @@ -7595,8 +7595,8 @@ ExprSrandFunc( */ iPtr->flags |= RAND_SEED_INITIALIZED; - iPtr->randSeed = (long) w & 0x7fffffff; - if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) { + iPtr->randSeed = (long) w & 0x7FFFFFFF; + if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) { iPtr->randSeed ^= 123459876; } @@ -7689,9 +7689,9 @@ ClassifyDouble( * Shifts and masks to use with the doubleMeaning variable above. */ -#define EXPONENT_MASK 0x7ff /* 11 bits (after shifting) */ +#define EXPONENT_MASK 0x7FF /* 11 bits (after shifting) */ #define EXPONENT_SHIFT 20 /* Moves exponent to bottom of word */ -#define MANTISSA_MASK 0xfffff /* 20 bits (plus 32 from other word) */ +#define MANTISSA_MASK 0xFFFFF /* 20 bits (plus 32 from other word) */ /* * Extract the exponent (11 bits) and mantissa (52 bits). Note that we diff --git a/generic/tclBinary.c b/generic/tclBinary.c index d368594..b18b795 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1267,7 +1267,7 @@ BinaryFormatCmd( if (c > 16) { c += ('A' - 'a'); } - value |= (c & 0xf); + value |= (c & 0xF); if (offset % 2) { *cursor++ = (char) value; value = 0; @@ -1289,9 +1289,9 @@ BinaryFormatCmd( if (c > 16) { c += ('A' - 'a'); } - value |= ((c << 4) & 0xf0); + value |= ((c << 4) & 0xF0); if (offset % 2) { - *cursor++ = UCHAR(value & 0xff); + *cursor++ = UCHAR(value & 0xFF); value = 0; } } @@ -1625,7 +1625,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[value & 0xf]; + *dest++ = hexdigit[value & 0xF]; } } else { for (i = 0; (size_t)i < count; i++) { @@ -1634,7 +1634,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[(value >> 4) & 0xf]; + *dest++ = hexdigit[(value >> 4) & 0xF]; } } @@ -2525,8 +2525,8 @@ BinaryEncodeHex( data = TclGetByteArrayFromObj(objv[1], &count); cursor = Tcl_SetByteArrayLength(resultObj, count * 2); for (offset = 0; offset < count; ++offset) { - *cursor++ = HexDigits[(data[offset] >> 4) & 0x0f]; - *cursor++ = HexDigits[data[offset] & 0x0f]; + *cursor++ = HexDigits[(data[offset] >> 4) & 0x0F]; + *cursor++ = HexDigits[data[offset] & 0x0F]; } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2610,7 +2610,7 @@ BinaryDecodeHex( if (c > 16) { c += ('A' - 'a'); } - value |= c & 0xf; + value |= c & 0xF; } if (i < 2) { cut++; @@ -2740,12 +2740,12 @@ BinaryEncode64( OUTPUT(B64Digits[d[0] >> 2]); OUTPUT(B64Digits[((d[0] & 0x03) << 4) | (d[1] >> 4)]); if (offset + 1 < count) { - OUTPUT(B64Digits[((d[1] & 0x0f) << 2) | (d[2] >> 6)]); + OUTPUT(B64Digits[((d[1] & 0x0F) << 2) | (d[2] >> 6)]); } else { OUTPUT(B64Digits[64]); } if (offset+2 < count) { - OUTPUT(B64Digits[d[2] & 0x3f]); + OUTPUT(B64Digits[d[2] & 0x3F]); } else { OUTPUT(B64Digits[64]); } @@ -2854,12 +2854,12 @@ BinaryEncodeUu( n <<= 8; n |= data[offset++]; for (bits += 8; bits > 6 ; bits -= 6) { - *cursor++ = UueDigits[(n >> (bits - 6)) & 0x3f]; + *cursor++ = UueDigits[(n >> (bits - 6)) & 0x3F]; } } if (bits > 0) { n <<= 8; - *cursor++ = UueDigits[(n >> (bits + 2)) & 0x3f]; + *cursor++ = UueDigits[(n >> (bits + 2)) & 0x3F]; bits = 0; } for (j = 0 ; j < wrapcharlen ; ++j) { @@ -2951,7 +2951,7 @@ BinaryDecodeUu( i--; continue; } - lineLen = (c - 32) & 0x3f; + lineLen = (c - 32) & 0x3F; } /* @@ -2980,14 +2980,14 @@ BinaryDecodeUu( */ if (lineLen > 0) { - *cursor++ = (((d[0] - 0x20) & 0x3f) << 2) - | (((d[1] - 0x20) & 0x3f) >> 4); + *cursor++ = (((d[0] - 0x20) & 0x3F) << 2) + | (((d[1] - 0x20) & 0x3F) >> 4); if (--lineLen > 0) { - *cursor++ = (((d[1] - 0x20) & 0x3f) << 4) - | (((d[2] - 0x20) & 0x3f) >> 2); + *cursor++ = (((d[1] - 0x20) & 0x3F) << 4) + | (((d[2] - 0x20) & 0x3F) >> 2); if (--lineLen > 0) { - *cursor++ = (((d[2] - 0x20) & 0x3f) << 6) - | (((d[3] - 0x20) & 0x3f)); + *cursor++ = (((d[2] - 0x20) & 0x3F) << 6) + | (((d[3] - 0x20) & 0x3F)); lineLen--; } } @@ -3147,15 +3147,15 @@ BinaryDecode64( goto bad64; } } else if (c >= 'A' && c <= 'Z') { - value = (value << 6) | ((c - 'A') & 0x3f); + value = (value << 6) | ((c - 'A') & 0x3F); } else if (c >= 'a' && c <= 'z') { - value = (value << 6) | ((c - 'a' + 26) & 0x3f); + value = (value << 6) | ((c - 'a' + 26) & 0x3F); } else if (c >= '0' && c <= '9') { - value = (value << 6) | ((c - '0' + 52) & 0x3f); + value = (value << 6) | ((c - '0' + 52) & 0x3F); } else if (c == '+') { - value = (value << 6) | 0x3e; + value = (value << 6) | 0x3E; } else if (c == '/') { - value = (value << 6) | 0x3f; + value = (value << 6) | 0x3F; } else if (c == '=' && (!strict || i > 1)) { /* * "=" and "a=" is rather bad64 error case in strict mode. @@ -3171,9 +3171,9 @@ BinaryDecode64( i--; } } - *cursor++ = UCHAR((value >> 16) & 0xff); - *cursor++ = UCHAR((value >> 8) & 0xff); - *cursor++ = UCHAR(value & 0xff); + *cursor++ = UCHAR((value >> 16) & 0xFF); + *cursor++ = UCHAR((value >> 8) & 0xFF); + *cursor++ = UCHAR(value & 0xFF); /* * Since = is only valid within the final block, if it was encountered diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 340be80..9896d96 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -244,7 +244,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "low guard byte %" TCL_Z_MODIFIER "u is 0x%x \t%c\n", idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } @@ -265,7 +265,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "hi guard byte %" TCL_Z_MODIFIER "u is 0x%x \t%c\n", idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index f8cdb04..5504fa8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1225,7 +1225,7 @@ Tcl_SplitObjCmd( #if TCL_UTF_MAX <= 3 if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(stringPtr + len, &ch); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif @@ -1917,7 +1917,7 @@ StringIsCmd( #if TCL_UTF_MAX <= 3 if ((ch >= 0xD800) && (length2 < 3)) { length2 += TclUtfToUniChar(string1 + length2, &ch); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif if (!chcomp(fullchar)) { diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 602473c..3fd2e8f 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -900,23 +900,23 @@ PrintSourceToObj( continue; default: #if TCL_UTF_MAX > 3 - if (ch > 0xffff) { + if (ch > 0xFFFF) { Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch); i += 10; } else #else - /* If len == 0, this means we have a char > 0xffff, resulting in + /* If len == 0, this means we have a char > 0xFFFF, resulting in * TclUtfToUniChar producing a surrogate pair. We want to output * this pair as a single Unicode character. */ if (len == 0) { - int upper = ((ch & 0x3ff) + 1) << 10; + int upper = ((ch & 0x3FF) + 1) << 10; len = TclUtfToUniChar(p, &ch); - Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3ff)); + Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3FF)); i += 10; } else #endif - if (ch < 0x20 || ch >= 0x7f) { + if (ch < 0x20 || ch >= 0x7F) { Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch); i += 6; } else { diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 71a4cc4..2753785 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1713,7 +1713,7 @@ LoadTableEncoding( dataPtr->toUnicode[hi] = pageMemPtr; p += 2; for (lo = 0; lo < 256; lo++) { - if ((lo & 0x0f) == 0) { + if ((lo & 0x0F) == 0) { p++; } ch = (staticHex[UCHAR(p[0])] << 12) + (staticHex[UCHAR(p[1])] << 8) @@ -1774,7 +1774,7 @@ LoadTableEncoding( pageMemPtr += 256; dataPtr->fromUnicode[ch >> 8] = page; } - page[ch & 0xff] = (unsigned short) ((hi << 8) + lo); + page[ch & 0xFF] = (unsigned short) ((hi << 8) + lo); } } } @@ -1880,7 +1880,7 @@ LoadTableEncoding( if (from == 0) { continue; } - dataPtr->fromUnicode[from >> 8][from & 0xff] = to; + dataPtr->fromUnicode[from >> 8][from & 0xFF] = to; } } doneParse: @@ -2095,7 +2095,7 @@ BinaryProc( * UtfIntToUtfExtProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the - * Tcl's internal representation (0xc0, 0x80) to the official + * Tcl's internal representation (0xC0, 0x80) to the official * representation (0x00). See UtfToUtfProc for details. * * Results: @@ -2144,7 +2144,7 @@ UtfIntToUtfExtProc( * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8 while converting null-bytes from the - * official representation (0x00) to Tcl's internal representation (0xc0, + * official representation (0x00) to Tcl's internal representation (0xC0, * 0x80). See UtfToUtfProc for details. * * Results: @@ -2275,14 +2275,14 @@ UtfToUtfProc( if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) { /* * Copy 7bit characters, but skip null-bytes when we are in input - * mode, so that they get converted to 0xc080. + * mode, so that they get converted to 0xC080. */ *dst++ = *src++; - } else if (pureNullMode == 1 && UCHAR(*src) == 0xc0 && + } else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 && (src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) { /* - * Convert 0xc080 to real nulls when we are in output mode. + * Convert 0xC080 to real nulls when we are in output mode. */ *dst++ = 0; @@ -2831,7 +2831,7 @@ TableFromUtfProc( * full support of int Tcl_UniChar. [Bug 1004065] */ - if (ch & 0xffff0000) { + if (ch & 0xFFFF0000) { word = 0; } else #else @@ -2839,7 +2839,7 @@ TableFromUtfProc( word = 0; } else #endif - word = fromUnicode[(ch >> 8)][ch & 0xff]; + word = fromUnicode[(ch >> 8)][ch & 0xFF]; if ((word == 0) && (ch != 0)) { if (flags & TCL_ENCODING_STOPONERROR) { @@ -3025,7 +3025,7 @@ Iso88591FromUtfProc( * Check for illegal characters. */ - if (ch > 0xff + if (ch > 0xFF #if TCL_UTF_MAX <= 3 || ((ch >= 0xD800) && (len < 3)) #endif @@ -3412,7 +3412,7 @@ EscapeFromUtfProc( break; } len = TclUtfToUniChar(src, &ch); - word = tableFromUnicode[(ch >> 8)][ch & 0xff]; + word = tableFromUnicode[(ch >> 8)][ch & 0xFF]; if ((word == 0) && (ch != 0)) { int oldState; @@ -3422,7 +3422,7 @@ EscapeFromUtfProc( for (state = 0; state < dataPtr->numSubTables; state++) { encodingPtr = GetTableEncoding(dataPtr, state); tableDataPtr = (const TableEncodingData *)encodingPtr->clientData; - word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xff]; + word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xFF]; if (word != 0) { break; } diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 869f92a..5be6488 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -45,7 +45,7 @@ static struct { * need to track this in case another * subsystem swaps around the environ array * like we do. */ - int ourEnvironSize; /* Non-zero means that the environ array was + size_t ourEnvironSize; /* Non-zero means that the environ array was * malloced and has this many total entries * allocated to it (not all may be in use at * once). Zero means that the environment diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 60532ee..84cd1ad 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8105,7 +8105,7 @@ ExecuteExtendedBinaryMathOp( /* * We refuse to accept exponent arguments that exceed one mp_digit - * which means the max exponent value is 2**28-1 = 0x0fffffff = + * which means the max exponent value is 2**28-1 = 0x0FFFFFFF = * 268435455, which fits into a signed 32 bit int which is within the * range of the long int type. This means any numeric Tcl_Obj value * not using TCL_NUMBER_INT type must hold a value larger than we diff --git a/generic/tclInt.h b/generic/tclInt.h index 1f9bd11..30736b1 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4513,8 +4513,8 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; } else { \ (bignum).dp = (mp_digit *)bignumObj->internalRep.twoPtrValue.ptr1; \ (bignum).sign = bignumPayload >> 30; \ - (bignum).alloc = (bignumPayload >> 15) & 0x7fff; \ - (bignum).used = bignumPayload & 0x7fff; \ + (bignum).alloc = (bignumPayload >> 15) & 0x7FFF; \ + (bignum).used = bignumPayload & 0x7FFF; \ } \ } while (0) diff --git a/generic/tclObj.c b/generic/tclObj.c index c552ff3..48e0c1d 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -177,12 +177,12 @@ static Tcl_ThreadDataKey pendingObjDataKey; */ #define PACK_BIGNUM(bignum, objPtr) \ - if ((bignum).used > 0x7fff) { \ + if ((bignum).used > 0x7FFF) { \ mp_int *temp = (mp_int *) Tcl_Alloc(sizeof(mp_int)); \ *temp = bignum; \ (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \ - } else if (((bignum).alloc <= 0x7fff) || (mp_shrink(&(bignum))) == MP_OKAY) { \ + } else if (((bignum).alloc <= 0x7FFF) || (mp_shrink(&(bignum))) == MP_OKAY) { \ (objPtr)->internalRep.twoPtrValue.ptr1 = (bignum).dp; \ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \ | ((bignum).alloc << 15) | ((bignum).used)); \ diff --git a/generic/tclParse.c b/generic/tclParse.c index 0de091e..3bf05f7 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -735,7 +735,7 @@ TclParseHex( while (numBytes--) { unsigned char digit = UCHAR(*p); - if (!isxdigit(digit) || (result > 0x10fff)) { + if (!isxdigit(digit) || (result > 0x10FFF)) { break; } diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 94d378a..ac14649 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -50,7 +50,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) #define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) -# define FPU_IEEE_ROUNDING 0x027f +# define FPU_IEEE_ROUNDING 0x027F # define ADJUST_FPU_CONTROL_WORD #define TCL_IEEE_DOUBLE_ROUNDING \ fpu_control_t roundTo53Bits = FPU_IEEE_ROUNDING; \ @@ -99,10 +99,10 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); */ #ifdef __hppa -# define NAN_START 0x7ff4 +# define NAN_START 0x7FF4 # define NAN_MASK (((Tcl_WideUInt) 1) << 50) #else -# define NAN_START 0x7ff8 +# define NAN_START 0x7FF8 # define NAN_MASK (((Tcl_WideUInt) 1) << 51) #endif @@ -124,23 +124,23 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define SIGN_BIT 0x80000000 /* Mask for the sign bit in the first word of * a double. */ -#define EXP_MASK 0x7ff00000 +#define EXP_MASK 0x7FF00000 /* Mask for the exponent field in the first * word of a double. */ #define EXP_SHIFT 20 /* Shift count to make the exponent an * integer. */ #define HIDDEN_BIT (((Tcl_WideUInt) 0x00100000) << 32) /* Hidden 1 bit for the significand. */ -#define HI_ORDER_SIG_MASK 0x000fffff +#define HI_ORDER_SIG_MASK 0x000FFFFF /* Mask for the high-order part of the * significand in the first word of a * double. */ #define SIG_MASK (((Tcl_WideUInt) HI_ORDER_SIG_MASK << 32) \ - | 0xffffffff) + | 0xFFFFFFFF) /* Mask for the 52-bit significand. */ #define FP_PRECISION 53 /* Number of bits of significand plus the * hidden bit. */ -#define EXPONENT_BIAS 0x3ff /* Bias of the exponent 0. */ +#define EXPONENT_BIAS 0x3FF /* Bias of the exponent 0. */ /* * Derived quantities. @@ -2100,16 +2100,16 @@ NormalizeRightward( int rv = 0; Tcl_WideUInt w = *wPtr; - if (!(w & (Tcl_WideUInt) 0xffffffff)) { + if (!(w & (Tcl_WideUInt) 0xFFFFFFFF)) { w >>= 32; rv += 32; } - if (!(w & (Tcl_WideUInt) 0xffff)) { + if (!(w & (Tcl_WideUInt) 0xFFFF)) { w >>= 16; rv += 16; } - if (!(w & (Tcl_WideUInt) 0xff)) { + if (!(w & (Tcl_WideUInt) 0xFF)) { w >>= 8; rv += 8; } - if (!(w & (Tcl_WideUInt) 0xf)) { + if (!(w & (Tcl_WideUInt) 0xF)) { w >>= 4; rv += 4; } if (!(w & 0x3)) { @@ -2143,21 +2143,21 @@ RequiredPrecision( int rv; unsigned long wi; - if (w & ((Tcl_WideUInt) 0xffffffff << 32)) { + if (w & ((Tcl_WideUInt) 0xFFFFFFFF << 32)) { wi = (unsigned long) (w >> 32); rv = 32; } else { wi = (unsigned long) w; rv = 0; } - if (wi & 0xffff0000) { + if (wi & 0xFFFF0000) { wi >>= 16; rv += 16; } - if (wi & 0xff00) { + if (wi & 0xFF00) { wi >>= 8; rv += 8; } - if (wi & 0xf0) { + if (wi & 0xF0) { wi >>= 4; rv += 4; } - if (wi & 0xc) { + if (wi & 0xC) { wi >>= 2; rv += 2; } if (wi & 0x2) { @@ -2595,7 +2595,7 @@ AdjustRange( * The number must be reduced to bring it into range. */ - ds = tens[k & 0xf]; + ds = tens[k & 0xF]; j = k >> 4; if (j & BLETCH) { j &= (BLETCH-1); @@ -2616,7 +2616,7 @@ AdjustRange( * The number must be increased to bring it into range. */ - d *= tens[j1 & 0xf]; + d *= tens[j1 & 0xF]; i = 0; for (j = j1>>4; j; j>>=1) { if (j & 1) { @@ -4559,9 +4559,9 @@ TclInitDoubleConversion(void) #ifdef IEEE_FLOATING_POINT bitwhack.dv = 1.000000238418579; /* 3ff0 0000 4000 0000 */ - if ((bitwhack.iv >> 32) == 0x3ff00000) { + if ((bitwhack.iv >> 32) == 0x3FF00000) { n770_fp = 0; - } else if ((bitwhack.iv & 0xffffffff) == 0x3ff00000) { + } else if ((bitwhack.iv & 0xFFFFFFFF) == 0x3FF00000) { n770_fp = 1; } else { Tcl_Panic("unknown floating point word order on this machine"); @@ -5015,7 +5015,7 @@ Pow10TimesFrExp( * Multiply by 10**exponent. */ - retval = frexp(retval * pow10vals[exponent & 0xf], &j); + retval = frexp(retval * pow10vals[exponent & 0xF], &j); expt += j; for (i=4; i<9; ++i) { if (exponent & (1<<i)) { @@ -5028,7 +5028,7 @@ Pow10TimesFrExp( * Divide by 10**-exponent. */ - retval = frexp(retval / pow10vals[(-exponent) & 0xf], &j); + retval = frexp(retval / pow10vals[(-exponent) & 0xF], &j); expt += j; for (i=4; i<9; ++i) { if ((-exponent) & (1<<i)) { @@ -5144,7 +5144,7 @@ static Tcl_WideUInt Nokia770Twiddle( Tcl_WideUInt w) /* Number to transpose. */ { - return (((w >> 32) & 0xffffffff) | (w << 32)); + return (((w >> 32) & 0xFFFFFFFF) | (w << 32)); } #endif diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index b26fb01..9381532 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -65,7 +65,7 @@ Tcl_InitStubs( * times. [Bug 615304] */ - if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) { + if (!stubsPtr || (stubsPtr->magic != (((exact&0xFF00) >= 0x900) ? magic : TCL_STUB_MAGIC))) { iPtr->legacyResult = "interpreter uses an incompatible stubs mechanism"; iPtr->legacyFreeProc = 0; /* TCL_STATIC */ return NULL; @@ -101,7 +101,7 @@ Tcl_InitStubs( } } } - if (((exact&0xff00) < 0x900)) { + if (((exact&0xFF00) < 0x900)) { /* We are running Tcl 8.x */ stubsPtr = (TclStubs *)pkgData; } diff --git a/generic/tclTest.c b/generic/tclTest.c index a1429fd..7804c35 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -2737,7 +2737,7 @@ TestlinkCmd( static unsigned char ucharVar = 130; static short shortVar = 3000; static unsigned short ushortVar = 60000; - static unsigned int uintVar = 0xbeeffeed; + static unsigned int uintVar = 0xBEEFFEED; static long longVar = 123456789L; static unsigned long ulongVar = 3456789012UL; static float floatVar = 4.5; diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 0173d78..51a368b 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -353,7 +353,7 @@ Tcl_Char16ToUtfDString( */ static const unsigned short cp1252[32] = { - 0x20ac, 0x81, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x20AC, 0x81, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x8D, 0x017D, 0x8F, 0x90, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x2DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x9D, 0x017E, 0x0178 @@ -526,7 +526,7 @@ Tcl_UtfToChar16( unsigned short high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2) | ((src[2] & 0x3F) >> 4)) - 0x40; if (high >= 0x400) { - /* out of range, < 0x10000 or > 0x10ffff */ + /* out of range, < 0x10000 or > 0x10FFFF */ } else { /* produce high surrogate, advance source pointer */ *chPtr = 0xD800 + high; @@ -791,7 +791,7 @@ Tcl_UtfFindFirst( #if TCL_UTF_MAX <= 3 if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &find); - fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (find & 0x3FF)) + 0x10000; } #endif if (fullchar == ch) { @@ -840,7 +840,7 @@ Tcl_UtfFindLast( #if TCL_UTF_MAX <= 3 if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &find); - fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (find & 0x3FF)) + 0x10000; } #endif if (fullchar == ch) { @@ -979,7 +979,7 @@ Tcl_UniCharAtIndex( if ((ch >= 0xD800) && (len < 3)) { /* If last Tcl_UniChar was a high surrogate, combine with low surrogate */ (void)TclUtfToUniChar(src, &ch); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif return fullchar; @@ -1123,7 +1123,7 @@ Tcl_UtfToUpper( if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &ch); /* Combine surrogates */ - upChar = (((upChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + upChar = (((upChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif upChar = Tcl_UniCharToUpper(upChar); @@ -1185,7 +1185,7 @@ Tcl_UtfToLower( if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &ch); /* Combine surrogates */ - lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif lowChar = Tcl_UniCharToLower(lowChar); @@ -1250,7 +1250,7 @@ Tcl_UtfToTitle( if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &ch); /* Combine surrogates */ - titleChar = (((titleChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + titleChar = (((titleChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif titleChar = Tcl_UniCharToTitle(titleChar); @@ -1270,7 +1270,7 @@ Tcl_UtfToTitle( if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(src + len, &ch); /* Combine surrogates */ - lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif /* Special exception for Georgian Asomtavruli chars, no titlecase. */ @@ -1830,7 +1830,7 @@ Tcl_UniCharIsControl( { if (UNICODE_OUT_OF_RANGE(ch)) { ch &= 0x1FFFFF; - if ((ch == 0xE0001) || ((ch >= 0xE0020) && (ch <= 0xE007f))) { + if ((ch == 0xE0001) || ((ch >= 0xE0020) && (ch <= 0xE007F))) { return 1; } if ((ch >= 0xF0000) && ((ch & 0xFFFF) <= 0xFFFD)) { @@ -1888,8 +1888,7 @@ Tcl_UniCharIsGraph( int ch) /* Unicode character to test. */ { if (UNICODE_OUT_OF_RANGE(ch)) { - ch &= 0x1FFFFF; - return (ch >= 0xE0100) && (ch <= 0xE01EF); + return ((unsigned)((ch & 0x1FFFFF) - 0xE0100) <= 0xEF); } return ((GRAPH_BITS >> GetCategory(ch)) & 1); } @@ -1941,8 +1940,7 @@ Tcl_UniCharIsPrint( int ch) /* Unicode character to test. */ { if (UNICODE_OUT_OF_RANGE(ch)) { - ch &= 0x1FFFFF; - return (ch >= 0xE0100) && (ch <= 0xE01EF); + return ((unsigned)((ch & 0x1FFFFF) - 0xE0100) <= 0xEF); } return (((GRAPH_BITS|SPACE_BITS) >> GetCategory(ch)) & 1); } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 3348b90..96287bd 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3729,11 +3729,11 @@ GetEndOffsetFromObj( * collection, and can be encoded as after. The end-relative * expressions that indicate an index less than or equal to end * are encoded relative to the value TCL_INDEX_END (-2). The - * index "end" is encoded as -2, down to the index "end-0x7ffffffe" + * index "end" is encoded as -2, down to the index "end-0x7FFFFFFE" * which is encoded as INT_MIN. Since the largest index into a - * string possible in Tcl 8 is 0x7ffffffe, the interpretation of - * "end-0x7ffffffe" for that largest string would be 0. Thus, - * if the tokens "end-0x7fffffff" or "end+-0x80000000" are parsed, + * string possible in Tcl 8 is 0x7FFFFFFE, the interpretation of + * "end-0x7FFFFFFE" for that largest string would be 0. Thus, + * if the tokens "end-0x7FFFFFFF" or "end+-0x80000000" are parsed, * they can be encoded with the before value. * * These details will require re-examination whenever string and |