diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-18 13:54:06 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-18 13:54:06 (GMT) |
commit | 176431f58481aeaba56e3463648fd85990236de4 (patch) | |
tree | acd54df49d264cc7ceef526685b300026bcf7ed7 | |
parent | ae243c85b7e7b470ea541cce41e76cd2cd7474f6 (diff) | |
parent | af7fa225c1d0ec592c7af29ead5922f45c1c15fb (diff) | |
download | tcl-176431f58481aeaba56e3463648fd85990236de4.zip tcl-176431f58481aeaba56e3463648fd85990236de4.tar.gz tcl-176431f58481aeaba56e3463648fd85990236de4.tar.bz2 |
Merge 8.6
-rw-r--r-- | compat/fake-rfc2553.c | 2 | ||||
-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/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 | ||||
-rw-r--r-- | tools/encoding/txt2enc.c | 6 | ||||
-rw-r--r-- | unix/tclUnixFCmd.c | 8 |
22 files changed, 127 insertions, 129 deletions
diff --git a/compat/fake-rfc2553.c b/compat/fake-rfc2553.c index 29e2b56..cfe4c39 100644 --- a/compat/fake-rfc2553.c +++ b/compat/fake-rfc2553.c @@ -218,7 +218,7 @@ fake_getaddrinfo(const char *hostname, const char *servname, } if (!hostname) { - *res = malloc_ai(port, htonl(0x7f000001), hints); + *res = malloc_ai(port, htonl(0x7F000001), hints); if (*res == NULL) return (EAI_MEMORY); return (0); diff --git a/generic/regcustom.h b/generic/regcustom.h index a6c19a3..5bda852 100644 --- a/generic/regcustom.h +++ b/generic/regcustom.h @@ -91,11 +91,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 c1e7b28..3a76469 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 @@ -469,7 +469,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 @@ -543,7 +543,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 4491d9b..9e5e947 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -676,7 +676,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 @@ -738,13 +738,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); @@ -2233,7 +2233,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'. * @@ -2396,7 +2396,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); @@ -2431,7 +2431,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); @@ -2845,7 +2845,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 8597370..6c14f45 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8182,8 +8182,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; } } @@ -8351,8 +8351,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; } @@ -8445,9 +8445,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 b27a790..0775296 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1281,7 +1281,7 @@ BinaryFormatCmd( if (c > 16) { c += ('A' - 'a'); } - value |= (c & 0xf); + value |= (c & 0xF); if (offset % 2) { *cursor++ = (char) value; value = 0; @@ -1303,9 +1303,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; } } @@ -1638,7 +1638,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[value & 0xf]; + *dest++ = hexdigit[value & 0xF]; } } else { for (i = 0; i < count; i++) { @@ -1647,7 +1647,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[(value >> 4) & 0xf]; + *dest++ = hexdigit[(value >> 4) & 0xF]; } } @@ -2538,8 +2538,8 @@ BinaryEncodeHex( data = Tcl_GetByteArrayFromObj(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; @@ -2622,7 +2622,7 @@ BinaryDecodeHex( if (c > 16) { c += ('A' - 'a'); } - value |= c & 0xf; + value |= c & 0xF; } if (i < 2) { cut++; @@ -2751,12 +2751,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]); } @@ -2865,12 +2865,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) { @@ -2961,7 +2961,7 @@ BinaryDecodeUu( i--; continue; } - lineLen = (c - 32) & 0x3f; + lineLen = (c - 32) & 0x3F; } /* @@ -2990,14 +2990,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--; } } @@ -3156,15 +3156,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. @@ -3180,9 +3180,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 6fd2f40..d81a281 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -246,7 +246,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", (int)idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } @@ -267,7 +267,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", (int)idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 645b852..03f9823 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1224,7 +1224,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 @@ -1914,7 +1914,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 e30499f..1ff42f6 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -901,23 +901,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 4b99f27..2e4c3f7 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1775,7 +1775,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) @@ -1836,7 +1836,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); } } } @@ -1942,7 +1942,7 @@ LoadTableEncoding( if (from == 0) { continue; } - dataPtr->fromUnicode[from >> 8][from & 0xff] = to; + dataPtr->fromUnicode[from >> 8][from & 0xFF] = to; } } doneParse: @@ -2157,7 +2157,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: @@ -2206,7 +2206,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: @@ -2337,14 +2337,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; @@ -2893,7 +2893,7 @@ TableFromUtfProc( * full support of int Tcl_UniChar. [Bug 1004065] */ - if (ch & 0xffff0000) { + if (ch & 0xFFFF0000) { word = 0; } else #else @@ -2901,7 +2901,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) { @@ -3087,7 +3087,7 @@ Iso88591FromUtfProc( * Check for illegal characters. */ - if (ch > 0xff + if (ch > 0xFF #if TCL_UTF_MAX <= 3 || ((ch >= 0xD800) && (len < 3)) #endif @@ -3474,7 +3474,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; @@ -3484,7 +3484,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/tclExecute.c b/generic/tclExecute.c index 169aece..69ddfab 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8476,7 +8476,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 a2de2e9..be6f26e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4553,8 +4553,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 efa63dc..f9b5c6b 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 *) ckalloc(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 = (void *) (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 3bc6722..dbffed0 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -734,7 +734,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 7964b68..c4b9211 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. @@ -2163,16 +2163,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)) { @@ -2206,21 +2206,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) { @@ -2658,7 +2658,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); @@ -2679,7 +2679,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) { @@ -4623,9 +4623,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"); @@ -5079,7 +5079,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)) { @@ -5092,7 +5092,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)) { @@ -5208,7 +5208,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 5261591..22e8b9b 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->result = (char *)"interpreter uses an incompatible stubs mechanism"; iPtr->freeProc = 0; 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 403e6d6..0166522 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -2736,7 +2736,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 9522f11..75552f6 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -352,7 +352,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 @@ -525,7 +525,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; @@ -790,7 +790,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) { @@ -838,7 +838,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) { @@ -976,7 +976,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; @@ -1114,7 +1114,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); @@ -1176,7 +1176,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); @@ -1241,7 +1241,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); @@ -1261,7 +1261,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. */ @@ -1821,7 +1821,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)) { @@ -1879,8 +1879,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); } @@ -1932,8 +1931,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 6a6f6ae..842c55a 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -4029,11 +4029,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 diff --git a/tools/encoding/txt2enc.c b/tools/encoding/txt2enc.c index 7ce85ef..7ee797b 100644 --- a/tools/encoding/txt2enc.c +++ b/tools/encoding/txt2enc.c @@ -176,7 +176,7 @@ main(int argc, char **argv) } hi = enc >> 8; - lo = enc & 0xff; + lo = enc & 0xFF; if (toUnicode[hi] == NULL) { toUnicode[hi] = (Rune *) malloc(256 * sizeof(Rune)); memset(toUnicode[hi], 0, 256 * sizeof(Rune)); @@ -208,7 +208,7 @@ main(int argc, char **argv) toUnicode[0][i] = i; } if (fixmissing) { - for (i = 0x7F; i < 0xa0; i++) { + for (i = 0x7F; i < 0xA0; i++) { if (toUnicode[i] == NULL && toUnicode[0][i] == 0) { toUnicode[0][i] = i; } @@ -234,7 +234,7 @@ main(int argc, char **argv) printf("%02X\n", hi); for (lo = 0; lo < 256; lo++) { printf("%04X", toUnicode[hi][lo]); - if ((lo & 0x0f) == 0x0f) { + if ((lo & 0x0F) == 0x0F) { putchar('\n'); } } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 2ea98a0..b188f21 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1833,7 +1833,7 @@ GetModeFromPermString( /* who */ switch (*(modeStringPtr+n+i)) { case 'u': - who |= 0x9c0; + who |= 0x9C0; continue; case 'g': who |= 0x438; @@ -1842,13 +1842,13 @@ GetModeFromPermString( who |= 0x207; continue; case 'a': - who |= 0xfff; + who |= 0xFFF; continue; } } who_found = 1; if (who == 0) { - who = 0xfff; + who = 0xFFF; } if (!op_found) { /* op */ @@ -1881,7 +1881,7 @@ GetModeFromPermString( what |= 0x49; continue; case 's': - what |= 0xc00; + what |= 0xC00; continue; case 't': what |= 0x200; |