diff options
| -rw-r--r-- | .travis.yml | 109 | ||||
| -rw-r--r-- | generic/tclEncoding.c | 12 | ||||
| -rw-r--r-- | tests/execute.test | 3 |
3 files changed, 95 insertions, 29 deletions
diff --git a/.travis.yml b/.travis.yml index e8ff497..4409ca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: dist: xenial compiler: gcc env: - - CFGOPT=--disable-shared + - CFGOPT="--disable-shared" - BUILD_DIR=unix - name: "Linux/GCC/Shared: UTF_MAX=6" os: linux @@ -32,15 +32,13 @@ matrix: - BUILD_DIR=unix - CFGOPT=CFLAGS=-DTCL_UTF_MAX=3 # Debug build. Running test-cases disabled, because it is currently failing. - - name: "Linux/GCC/Debug/no test" + - name: "Linux/GCC/Debug" os: linux dist: xenial compiler: gcc env: - BUILD_DIR=unix - - CFGOPT=--enable-symbols=all - script: - - make all tcltest + - CFGOPT="--enable-symbols" # Older versions of GCC... - name: "Linux/GCC 7/Shared" os: linux @@ -102,18 +100,15 @@ matrix: dist: xenial compiler: clang env: - - CFGOPT=--disable-shared + - CFGOPT="--disable-shared" - BUILD_DIR=unix -# Debug build. Running test-cases disabled, because it is currently failing. - - name: "Linux/Clang/Debug/no test" + - name: "Linux/Clang/Debug" os: linux dist: xenial compiler: clang env: - BUILD_DIR=unix - - CFGOPT=--enable-symbols=all - script: - - make all tcltest + - CFGOPT="--enable-symbols" # Testing on Mac, various styles - name: "macOS/Xcode 11/Shared/Unix-like" os: osx @@ -132,7 +127,7 @@ matrix: - make test styles=develop - name: "macOS/Xcode 10/Shared" os: osx - osx_image: xcode10.2 + osx_image: xcode10.3 env: - BUILD_DIR=macosx install: [] @@ -305,6 +300,43 @@ matrix: script: - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc all tcltest' - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc test' +# Test on Windows with MSVC native (32-bit) + - name: "Windows/MSVC-x86/Shared" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc test' + - name: "Windows/MSVC/Shared: UTF_MAX=6" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=utfmax -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=utfmax -f makefile.vc test' + - name: "Windows/MSVC-x86/Static" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc test' + - name: "Windows/MSVC-x86/Debug" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=symbols -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=symbols -f makefile.vc test' # Test on Windows with GCC native - name: "Windows/GCC/Shared" os: windows @@ -312,7 +344,7 @@ matrix: env: - BUILD_DIR=win - CFGOPT="--enable-64bit" - before_install: + before_install: &makepreinst - choco install make - cd ${BUILD_DIR} - name: "Windows/GCC/Shared: UTF_MAX=6" @@ -321,36 +353,63 @@ matrix: env: - BUILD_DIR=win - CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=6" - before_install: - - choco install make - - cd ${BUILD_DIR} + before_install: *makepreinst - name: "Windows/GCC/Shared: UTF_MAX=3" os: windows compiler: gcc env: - BUILD_DIR=win - CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=3" - before_install: - - choco install make - - cd ${BUILD_DIR} + before_install: *makepreinst - name: "Windows/GCC/Static" os: windows compiler: gcc env: - BUILD_DIR=win - CFGOPT="--enable-64bit --disable-shared" - before_install: - - choco install make - - cd ${BUILD_DIR} + before_install: *makepreinst - name: "Windows/GCC/Debug" os: windows compiler: gcc env: - BUILD_DIR=win - CFGOPT="--enable-64bit --enable-symbols" - before_install: - - choco install make - - cd ${BUILD_DIR} + before_install: *makepreinst +# Test on Windows with GCC native (32-bit) + - name: "Windows/GCC-x86/Shared" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + before_install: *makepreinst + - name: "Windows/GCC-x86/Shared: UTF_MAX=6" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="CFLAGS=-DTCL_UTF_MAX=6" + before_install: *makepreinst + - name: "Windows/GCC-x86/Shared: UTF_MAX=3" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="CFLAGS=-DTCL_UTF_MAX=3" + before_install: *makepreinst + - name: "Windows/GCC-x86/Static" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="--disable-shared" + before_install: *makepreinst + - name: "Windows/GCC-x86/Debug" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="--enable-symbols" + before_install: *makepreinst before_install: - cd ${BUILD_DIR} install: diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 2d4001d..93c1c59 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2423,10 +2423,16 @@ Utf16ToUtfProc( charLimit = *dstCharsPtr; } result = TCL_OK; - if ((srcLen % sizeof(unsigned short)) != 0) { + + /* check alignment with utf-16 (2 == sizeof(UTF-16)) */ + if ((srcLen % 2) != 0) { + result = TCL_CONVERT_MULTIBYTE; + srcLen--; + } + /* If last code point is a high surrogate, we cannot handle that yet */ + if ((srcLen >= 2) && ((src[srcLen - (clientData?1:2)] & 0xFC) == 0xD8)) { result = TCL_CONVERT_MULTIBYTE; - srcLen /= sizeof(unsigned short); - srcLen *= sizeof(unsigned short); + srcLen-= 2; } srcStart = src; diff --git a/tests/execute.test b/tests/execute.test index 18e7fc6..19ca463 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -1050,7 +1050,7 @@ test execute-8.7 {Compile epoch bump in global level (bug [fa6bf38d07]), excepti test execute-9.1 {Interp result resetting [Bug 1522803]} { set c 0 catch { - catch {set foo} + catch {error foo} expr {1/$c} } if {[string match *foo* $::errorInfo]} { @@ -1085,6 +1085,7 @@ test execute-10.3 {Bug 3072640} -setup { proc t {args} { incr ::foo } + set ::foo 0 trace add execution ::generate enterstep ::t } -body { coroutine coro generate 5 |
