summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2022-08-31 14:28:57 (GMT)
committerkjnash <k.j.nash@usa.net>2022-08-31 14:28:57 (GMT)
commit19f8c3bb6b2aa8d571a7534b588ddacfb49952d3 (patch)
tree5051f34456c20c798d30e7741fae52575927fd7a /generic/tclEncoding.c
parentd9b5be0959a8ee2b81ba519ff3d4c70b2da9a6ce (diff)
parentff1e919a1bae9ff88ab6dbc094b18cfadedfe8af (diff)
downloadtcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.zip
tcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.tar.gz
tcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.tar.bz2
Merge old 8.7 674a6ad0472c7
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index ae02821..ff3c44c 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -116,7 +116,7 @@ typedef struct {
* entry in this array is 1, otherwise it is
* 0. */
int numSubTables; /* Length of following array. */
- EscapeSubTable subTables[1];/* Information about each EscapeSubTable used
+ EscapeSubTable subTables[TCLFLEXARRAY];/* Information about each EscapeSubTable used
* by this encoding type. The actual size is
* as large as necessary to hold all
* EscapeSubTables. */
@@ -469,12 +469,13 @@ FillEncodingFileMap(void)
*/
int j, numFiles;
- Tcl_Obj *directory, *matchFileList = Tcl_NewObj();
+ Tcl_Obj *directory, *matchFileList;
Tcl_Obj **filev;
Tcl_GlobTypeData readableFiles = {
TCL_GLOB_TYPE_FILE, TCL_GLOB_PERM_R, NULL, NULL
};
+ TclNewObj(matchFileList);
Tcl_ListObjIndex(NULL, searchPath, i, &directory);
Tcl_IncrRefCount(directory);
Tcl_IncrRefCount(matchFileList);
@@ -915,10 +916,11 @@ Tcl_GetEncodingNames(
Tcl_HashTable table;
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- Tcl_Obj *map, *name, *result = Tcl_NewObj();
+ Tcl_Obj *map, *name, *result;
Tcl_DictSearch mapSearch;
int dummy, done = 0;
+ TclNewObj(result);
Tcl_InitObjHashTable(&table);
/*
@@ -2053,7 +2055,7 @@ LoadEscapeEncoding(
Tcl_DStringFree(&lineString);
}
- size = sizeof(EscapeEncodingData) - sizeof(EscapeSubTable)
+ size = offsetof(EscapeEncodingData, subTables)
+ Tcl_DStringLength(&escapeData);
dataPtr = (EscapeEncodingData *)ckalloc(size);
dataPtr->initLen = strlen(init);
@@ -2568,7 +2570,7 @@ UtfToUtf16Proc(
*dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
*dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
*dst++ = (*chPtr & 0xFF);
- *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC;
+ *dst++ = ((*chPtr >> 8) & 0x3) | 0xDC;
}
#else
*dst++ = (*chPtr & 0xFF);
@@ -2580,10 +2582,10 @@ UtfToUtf16Proc(
*dst++ = (*chPtr >> 8);
*dst++ = (*chPtr & 0xFF);
} else {
- *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC;
- *dst++ = (*chPtr & 0xFF);
*dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
*dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
+ *dst++ = ((*chPtr >> 8) & 0x3) | 0xDC;
+ *dst++ = (*chPtr & 0xFF);
}
#else
*dst++ = (*chPtr >> 8);