summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-08 18:34:09 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-08 18:34:09 (GMT)
commitee49fa81d90d8396e545d07c2f5a40a48130a9dc (patch)
treec319f2a6adec30276f52ed3c16da22e1f5498a75
parent3826a26f8a75540c7f3ff0b45f76498e85486dc9 (diff)
parentcc4dae5c0f418d304a44bb10c87c624b478b6441 (diff)
downloadtcl-ee49fa81d90d8396e545d07c2f5a40a48130a9dc.zip
tcl-ee49fa81d90d8396e545d07c2f5a40a48130a9dc.tar.gz
tcl-ee49fa81d90d8396e545d07c2f5a40a48130a9dc.tar.bz2
Merge 8.6
Also fix startup problems on win32, when the encoding path contains invalid UTF-8 (reported by François Vogel) Various other code cleanup, e.g. remove empty.zip file, as this didn't work quite as expected.
-rw-r--r--.fossil-settings/binary-glob1
-rw-r--r--.fossil-settings/crnl-glob19
-rw-r--r--generic/tclEncoding.c2
-rw-r--r--generic/tclStubInit.c14
-rw-r--r--generic/tclUtf.c8
-rw-r--r--generic/tclUtil.c2
-rw-r--r--generic/tclZipfs.c10
-rw-r--r--tools/empty.zipbin22 -> 0 bytes
-rw-r--r--unix/Makefile.in1
-rw-r--r--win/Makefile.in1
-rw-r--r--win/makefile.vc16
-rw-r--r--win/tclWin32Dll.c10
-rw-r--r--win/tclWinFCmd.c3
13 files changed, 28 insertions, 59 deletions
diff --git a/.fossil-settings/binary-glob b/.fossil-settings/binary-glob
index 5eebf07..ec574be 100644
--- a/.fossil-settings/binary-glob
+++ b/.fossil-settings/binary-glob
@@ -4,7 +4,6 @@ compat/zlib/win64/zdll.lib
compat/zlib/win64/zlib1.dll
compat/zlib/win64/libz.dll.a
compat/zlib/zlib.3.pdf
-tools/empty.zip
*.bmp
*.gif
*.png \ No newline at end of file
diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob
deleted file mode 100644
index 56f3a03..0000000
--- a/.fossil-settings/crnl-glob
+++ /dev/null
@@ -1,19 +0,0 @@
-compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
-compat/zlib/contrib/vstudio/readme.txt
-compat/zlib/contrib/vstudio/*/zlib.rc
-compat/zlib/win32/*.txt
-compat/zlib/win64/*.txt
-libtommath/*.dsp
-libtommath/*.sln
-libtommath/*.vcproj
-tools/tcl.hpj.in
-tools/tcl.wse.in
-win/buildall.vc.bat
-win/coffbase.txt
-win/makefile.vc
-win/rules.vc
-win/rules-ext.vc
-win/targets.vc
-win/tcl.dsp
-win/tcl.dsw
-win/tcl.hpj.in \ No newline at end of file
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index f6744e9..d5e8c9a 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2058,7 +2058,7 @@ LoadEscapeEncoding(
dataPtr->numSubTables =
Tcl_DStringLength(&escapeData) / sizeof(EscapeSubTable);
memcpy(dataPtr->subTables, Tcl_DStringValue(&escapeData),
- (size_t) Tcl_DStringLength(&escapeData));
+ Tcl_DStringLength(&escapeData));
Tcl_DStringFree(&escapeData);
memset(dataPtr->prefixBytes, 0, sizeof(dataPtr->prefixBytes));
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 2e2aa60..9a134f9 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -230,6 +230,9 @@ Tcl_WinUtfToTChar(
Tcl_DString *dsPtr)
{
Tcl_DStringInit(dsPtr);
+ if (!string) {
+ return NULL;
+ }
return (char *)Tcl_UtfToUniCharDString(string, len, dsPtr);
}
@@ -239,12 +242,15 @@ Tcl_WinTCharToUtf(
int len,
Tcl_DString *dsPtr)
{
- if (len > 0) {
- len /= 2;
- } else if (len == -1) {
+ Tcl_DStringInit(dsPtr);
+ if (!string) {
+ return NULL;
+ }
+ if (len < 0) {
len = wcslen((wchar_t *)string);
+ } else {
+ len /= 2;
}
- Tcl_DStringInit(dsPtr);
return Tcl_UniCharToUtfDString((Tcl_UniChar *)string, len, dsPtr);
}
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index d62586c..ce67db7 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -451,9 +451,9 @@ Tcl_UtfToUniCharDString(
if (Tcl_UtfCharComplete(p, end-p)) {
p += TclUtfToUniChar(p, &ch);
} else if ((unsigned)((UCHAR(*p)-0x80)) < (unsigned) 0x20) {
- ch = (Tcl_UniChar) cp1252[UCHAR(*p)-0x80];
+ ch = (Tcl_UniChar) cp1252[UCHAR(*p++)-0x80];
} else {
- ch = UCHAR(*p);
+ ch = UCHAR(*p++);
}
*w++ = ch;
}
@@ -783,8 +783,8 @@ Tcl_UniCharAtIndex(
*
* Returns a pointer to the specified character (not byte) position in
* the UTF-8 string. If TCL_UTF_MAX <= 4, characters > U+FFFF count as
- * 2 positions, but then the pointer should never be placed between
- * the two positions.
+ * 2 positions, but then the pointer should never be placed between
+ * the two positions.
*
* Results:
* As above.
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 48602c4..c488a42 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -4316,7 +4316,7 @@ TclGetProcessGlobalValue(
ckfree(pgvPtr->value);
pgvPtr->value = ckalloc(Tcl_DStringLength(&newValue) + 1);
memcpy(pgvPtr->value, Tcl_DStringValue(&newValue),
- (size_t) Tcl_DStringLength(&newValue) + 1);
+ Tcl_DStringLength(&newValue) + 1);
Tcl_DStringFree(&newValue);
Tcl_FreeEncoding(pgvPtr->encoding);
pgvPtr->encoding = current;
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index ff04971..829b5d2 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -19,17 +19,9 @@
#include "tclInt.h"
#include "tclFileSystem.h"
-#ifdef _WIN32
-#include <winbase.h>
-#else /* !_WIN32 */
+#ifndef _WIN32
#include <sys/mman.h>
#endif /* _WIN32*/
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <stdlib.h>
-#include <fcntl.h>
#ifndef MAP_FILE
#define MAP_FILE 0
diff --git a/tools/empty.zip b/tools/empty.zip
deleted file mode 100644
index 15cb0ec..0000000
--- a/tools/empty.zip
+++ /dev/null
Binary files differ
diff --git a/unix/Makefile.in b/unix/Makefile.in
index c44cc77..d5324dc 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -714,7 +714,6 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE}
${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} \
@TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \
${CC_SEARCH_FLAGS} -o ${TCL_EXE}
- cat ${TOOL_DIR}/empty.zip >> ${TCL_EXE}
# Must be empty so it doesn't conflict with rule for ${TCL_EXE} above
${NATIVE_TCLSH}:
diff --git a/win/Makefile.in b/win/Makefile.in
index f36c38b..e2acb1b 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -495,7 +495,6 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES)
$(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \
tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
@VC_MANIFEST_EMBED_EXE@
- cat ${TOOL_DIR}/empty.zip >> ${TCLSH}
cat32.$(OBJEXT): cat.c
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
diff --git a/win/makefile.vc b/win/makefile.vc
index 77d56b8..2554893 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -123,7 +123,6 @@ TCLDDELIBNAME = $(PROJECT)dde$(DDEVERSION)$(SUFX:t=).$(EXT)
TCLDDELIB = $(OUT_DIR)\$(TCLDDELIBNAME)
TCLTEST = $(OUT_DIR)\$(PROJECT)test.exe
-CAT32 = $(OUT_DIR)\cat32.exe
TCLSHOBJS = \
$(TMP_DIR)\tclAppInit.obj \
@@ -384,20 +383,20 @@ release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
core: setup $(TCLLIB) $(TCLSTUBLIB)
shell: setup $(TCLSH)
dlls: setup $(TCLREGLIB) $(TCLDDELIB)
-all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs
-tcltest: setup $(TCLTEST) dlls $(CAT32)
+all: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
+tcltest: setup $(TCLTEST) dlls
install: install-binaries install-libraries install-docs install-pkgs
setup: default-setup
test: test-core test-pkgs
-test-core: setup $(TCLTEST) dlls $(CAT32)
+test-core: setup $(TCLTEST) dlls
set TCL_LIBRARY=$(ROOT:\=/)/library
$(DEBUGGER) $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile <<
package ifneeded dde 1.4.0 [list load "$(TCLDDELIB:\=/)" dde]
package ifneeded registry 1.3.2 [list load "$(TCLREGLIB:\=/)" registry]
<<
-runtest: setup $(TCLTEST) dlls $(CAT32)
+runtest: setup $(TCLTEST) dlls
set TCL_LIBRARY=$(ROOT:\=/)/library
$(DEBUGGER) $(TCLTEST) $(SCRIPT)
@@ -419,11 +418,11 @@ $(TCLLIB): $(TCLOBJS)
$**
<<
$(_VC_MANIFEST_EMBED_DLL)
+
$(TCLIMPLIB): $(TCLLIB)
!endif # $(STATIC_BUILD)
-
$(TCLSTUBLIB): $(TCLSTUBOBJS)
$(LIBCMD) -nodefaultlib $(TCLSTUBOBJS)
@@ -485,11 +484,6 @@ clean-pkgs:
popd \
)
-$(CAT32): $(WINDIR)\cat.c
- $(cc32) $(cflags) $(crt) -D_CRT_NONSTDC_NO_DEPRECATE -DCONSOLE -Fo$(TMP_DIR)\ $?
- $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj
- $(_VC_MANIFEST_EMBED_EXE)
-
#---------------------------------------------------------------------
# Regenerate the stubs files. [Development use only]
#---------------------------------------------------------------------
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 04d27dd..dca6875 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -473,7 +473,7 @@ Tcl_WinUtfToTChar(
{
Tcl_DStringInit(dsPtr);
if (!string) {
- return (TCHAR *)Tcl_DStringValue(dsPtr);
+ return NULL;
}
return Tcl_UtfToUniCharDString(string, len, dsPtr);
}
@@ -488,12 +488,12 @@ Tcl_WinTCharToUtf(
{
Tcl_DStringInit(dsPtr);
if (!string) {
- return Tcl_DStringValue(dsPtr);
+ return NULL;
}
- if (len > 0) {
- len /= 2;
- } else if (len < 0) {
+ if (len < 0) {
len = wcslen(string);
+ } else {
+ len /= 2;
}
return Tcl_UniCharToUtfDString(string, len, dsPtr);
}
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index a69dbe5..c3ced34 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -337,7 +337,7 @@ DoRenameFile(
* character is either end-of-string or a directory separator
*/
- if ((strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString))==0)
+ if ((strncmp(src, dst, Tcl_DStringLength(&srcString))==0)
&& (dst[Tcl_DStringLength(&srcString)] == '\\'
|| dst[Tcl_DStringLength(&srcString)] == '/'
|| dst[Tcl_DStringLength(&srcString)] == '\0')) {
@@ -1649,7 +1649,6 @@ ConvertFileNameFormat(
* likely to lead to infinite loops.
*/
- Tcl_DStringInit(&ds);
tempString = TclGetString(tempPath);
nativeName = Tcl_WinUtfToTChar(tempString, tempPath->length, &ds);
Tcl_DecrRefCount(tempPath);