summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-11-22 08:06:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-11-22 08:06:26 (GMT)
commit802d3d1aa0b9c547056aa924a20fb7c49f69abb4 (patch)
treeeda983a297686f2e46d335069c56074df9532afa
parent02d514946365467a42f4975cae649d248396f7f5 (diff)
parent0e7af6107e1f3b060581d8eb6bacb968c314314d (diff)
downloadtcl-802d3d1aa0b9c547056aa924a20fb7c49f69abb4.zip
tcl-802d3d1aa0b9c547056aa924a20fb7c49f69abb4.tar.gz
tcl-802d3d1aa0b9c547056aa924a20fb7c49f69abb4.tar.bz2
Merge 8.7
-rw-r--r--generic/tclEncoding.c9
-rw-r--r--generic/tclScan.c2
-rw-r--r--generic/tclTrace.c16
-rw-r--r--tools/installVfs.tcl54
-rw-r--r--win/Makefile.in2
-rw-r--r--win/tclWinSerial.c2
6 files changed, 68 insertions, 17 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 413f2f2..9fda613 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1677,7 +1677,9 @@ LoadTableEncoding(
};
Tcl_DStringInit(&lineString);
- Tcl_Gets(chan, &lineString);
+ if (Tcl_Gets(chan, &lineString) != TCL_IO_FAILURE) {
+ return NULL;
+ }
line = Tcl_DStringValue(&lineString);
fallback = (int) strtol(line, &line, 16);
@@ -1717,8 +1719,11 @@ LoadTableEncoding(
for (i = 0; i < numPages; i++) {
int ch;
const char *p;
+ int expected = 3 + 16 * (16 * 4 + 1);
- Tcl_ReadChars(chan, objPtr, 3 + 16 * (16 * 4 + 1), 0);
+ if (Tcl_ReadChars(chan, objPtr, expected, 0) != expected) {
+ return NULL;
+ }
p = TclGetString(objPtr);
hi = (staticHex[UCHAR(p[0])] << 4) + staticHex[UCHAR(p[1])];
dataPtr->toUnicode[hi] = pageMemPtr;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 65d8144..65c15da 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -135,7 +135,7 @@ BuildCharSet(
* as well as the dash.
*/
- if (*format == ']') {
+ if (*format == ']' || !cset->ranges) {
cset->chars[cset->nchars++] = start;
cset->chars[cset->nchars++] = ch;
} else {
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index ed50c91..7064975 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -538,9 +538,7 @@ TraceExecutionObjCmd(
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- if (tcmdPtr->startCmd != NULL) {
- Tcl_Free(tcmdPtr->startCmd);
- }
+ Tcl_Free(tcmdPtr->startCmd);
}
if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) {
/*
@@ -1350,9 +1348,7 @@ TraceCommandProc(
if (tcmdPtr->stepTrace != NULL) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- if (tcmdPtr->startCmd != NULL) {
- Tcl_Free(tcmdPtr->startCmd);
- }
+ Tcl_Free(tcmdPtr->startCmd);
}
if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) {
/*
@@ -1815,9 +1811,7 @@ TraceExecutionProc(
&& (strcmp(command, tcmdPtr->startCmd) == 0)) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- if (tcmdPtr->startCmd != NULL) {
- Tcl_Free(tcmdPtr->startCmd);
- }
+ Tcl_Free(tcmdPtr->startCmd);
}
/*
@@ -1942,9 +1936,7 @@ TraceExecutionProc(
if (tcmdPtr->stepTrace != NULL) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- if (tcmdPtr->startCmd != NULL) {
- Tcl_Free(tcmdPtr->startCmd);
- }
+ Tcl_Free(tcmdPtr->startCmd);
}
}
if (call) {
diff --git a/tools/installVfs.tcl b/tools/installVfs.tcl
new file mode 100644
index 0000000..ad1f5c7
--- /dev/null
+++ b/tools/installVfs.tcl
@@ -0,0 +1,54 @@
+#!/bin/sh
+#\
+exec tclsh "$0" ${1+"$@"}
+
+#----------------------------------------------------------------------
+#
+# installVfs.tcl --
+#
+# This file wraps the /library file system around a binary
+#
+#----------------------------------------------------------------------
+#
+# Copyright (c) 2018 by Sean Woods. All rights reserved.
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#----------------------------------------------------------------------
+
+proc mapDir {resultvar prefix filepath} {
+ upvar 1 $resultvar result
+ if {![info exists result]} {
+ set result {}
+ }
+ set queue [list $prefix $filepath]
+ while {[llength $queue]} {
+ set queue [lassign $queue qprefix qpath]
+ foreach ftail [glob -directory $qpath -nocomplain -tails *] {
+ set f [file join $qpath $ftail]
+ if {[file isdirectory $f]} {
+ if {$ftail eq "CVS"} continue
+ lappend queue [file join $qprefix $ftail] $f
+ } elseif {[file isfile $f]} {
+ if {$ftail eq "pkgIndex.tcl"} continue
+ if {$ftail eq "manifest.txt"} {
+ lappend result $f [file join $qprefix pkgIndex.tcl]
+ } else {
+ lappend result $f [file join $qprefix $ftail]
+ }
+ }
+ }
+ }
+}
+if {[llength $argv]<4} {
+ error "Usage: [file tail [info script]] IMG_OUTPUT IMG_INPUT PREFIX FILE_SYSTEM ?PREFIX FILE_SYSTEM?..."
+}
+
+set paths [lassign $argv DLL_OUTPUT DLL_INPUT]
+foreach {prefix fpath} $paths {
+ mapDir files $prefix [file normalize $fpath]
+}
+if {$DLL_INPUT != {}} {
+ zipfs lmkzip $DLL_OUTPUT $files
+} else {
+ zipfs lmkimg $DLL_OUTPUT $files {} $DLL_INPUT
+}
diff --git a/win/Makefile.in b/win/Makefile.in
index ecb4d8a..f065c0b 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -487,7 +487,7 @@ ${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} ${DDE_DLL_FILE} ${REG_DLL_FILE}
rm -rf ${TCL_VFS_ROOT}
mkdir -p ${TCL_VFS_PATH}
$(COPY) -a $(TOP_DIR)/library/* ${TCL_VFS_PATH}
- $(COPY) -a ${TCL_VFS_PATH}/manfest.txt ${TCL_VFS_PATH}/pkgIndex.tcl
+ $(COPY) -a ${TCL_VFS_PATH}/manifest.txt ${TCL_VFS_PATH}/pkgIndex.tcl
$(COPY) ${DDE_DLL_FILE} ${TCL_VFS_PATH}/dde
$(COPY) ${REG_DLL_FILE} ${TCL_VFS_PATH}/reg
cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH}
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index fd1060b..ac569e4 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -1849,7 +1849,7 @@ SerialSetOptionProc(
* -sysbuffer 4096 or -sysbuffer {64536 4096}
*/
- size_t inSize = (size_t) -1, outSize = (size_t) -1;
+ int inSize = -1, outSize = -1;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;