Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package opencc for openSUSE:Factory checked in at 2022-02-17 00:29:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/opencc (Old) and /work/SRC/openSUSE:Factory/.opencc.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "opencc" Thu Feb 17 00:29:53 2022 rev:20 rq:954418 version:1.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/opencc/opencc.changes 2021-03-16 15:43:12.888922956 +0100 +++ /work/SRC/openSUSE:Factory/.opencc.new.1956/opencc.changes 2022-02-17 00:29:56.853439329 +0100 @@ -1,0 +2,11 @@ +Mon Feb 14 21:28:26 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.1.3: + * Fix some header files cannot be used alone (#550). + * Fix the method of introducing system pybind11 (#566). + * Support Node.js 16 (#597). + * Support Python 3.9 (#603). + * Fixed conversion errors. + * Several other small fixes. + +------------------------------------------------------------------- Old: ---- OpenCC-ver.1.1.2.tar.gz New: ---- OpenCC-ver.1.1.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ opencc.spec ++++++ --- /var/tmp/diff_new_pack.km3Ibc/_old 2022-02-17 00:29:57.617439197 +0100 +++ /var/tmp/diff_new_pack.km3Ibc/_new 2022-02-17 00:29:57.625439196 +0100 @@ -1,7 +1,7 @@ # # spec file for package opencc # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: opencc -Version: 1.1.2 +Version: 1.1.3 Release: 0 Summary: Open Chinese Convert License: Apache-2.0 ++++++ OpenCC-ver.1.1.2.tar.gz -> OpenCC-ver.1.1.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/.appveyor.yml new/OpenCC-ver.1.1.3/.appveyor.yml --- old/OpenCC-ver.1.1.2/.appveyor.yml 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/.appveyor.yml 2021-09-03 16:26:10.000000000 +0200 @@ -9,6 +9,7 @@ matrix: # Build Node.js - nodejs_version: stable + - nodejs_version: 16 - nodejs_version: 14 - nodejs_version: 12 - nodejs_version: 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/.github/workflows/nodejs.yml new/OpenCC-ver.1.1.3/.github/workflows/nodejs.yml --- old/OpenCC-ver.1.1.2/.github/workflows/nodejs.yml 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/.github/workflows/nodejs.yml 2021-09-03 16:26:10.000000000 +0200 @@ -13,7 +13,7 @@ strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x, 16.x] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/.github/workflows/python.yml new/OpenCC-ver.1.1.3/.github/workflows/python.yml --- old/OpenCC-ver.1.1.2/.github/workflows/python.yml 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/.github/workflows/python.yml 2021-09-03 16:26:10.000000000 +0200 @@ -12,7 +12,7 @@ runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/.travis.yml new/OpenCC-ver.1.1.3/.travis.yml --- old/OpenCC-ver.1.1.2/.travis.yml 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/.travis.yml 2021-09-03 16:26:10.000000000 +0200 @@ -6,6 +6,7 @@ node_js: - stable + - 16 - 14 - 12 - 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/CMakeLists.txt new/OpenCC-ver.1.1.3/CMakeLists.txt --- old/OpenCC-ver.1.1.2/CMakeLists.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/CMakeLists.txt 2021-09-03 16:26:10.000000000 +0200 @@ -42,7 +42,7 @@ set (PACKAGE_BUGREPORT https://github.com/BYVoid/Opencc/issues) set (OPENCC_VERSION_MAJOR 1) set (OPENCC_VERSION_MINOR 1) -set (OPENCC_VERSION_REVISION 2) +set (OPENCC_VERSION_REVISION 3) if (CMAKE_BUILD_TYPE MATCHES Debug) set (version_suffix .Debug) @@ -219,9 +219,7 @@ if (BUILD_PYTHON) if(USE_SYSTEM_PYBIND11) - include(pybind11Config) - include(pybind11Common) - include(pybind11Tools) + find_package(pybind11 CONFIG) else() add_subdirectory(deps/pybind11-2.5.0) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/NEWS.md new/OpenCC-ver.1.1.3/NEWS.md --- old/OpenCC-ver.1.1.2/NEWS.md 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/NEWS.md 2021-09-03 16:26:10.000000000 +0200 @@ -1,5 +1,16 @@ # Change History of OpenCC +## Version 1.1.3 + +2021???9???3??? + +* ???????????????????????????????????????????????????#550?????? +* ??????????????????pybind11????????????#566?????? +* ??????Node.js 16???#597?????? +* ??????Python 3.9???#603?????? +* ????????????????????? +* ???????????????????????? + ## Version 1.1.2 2021???3???2??? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/README.md new/OpenCC-ver.1.1.3/README.md --- old/OpenCC-ver.1.1.2/README.md 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/README.md 2021-09-03 16:26:10.000000000 +0200 @@ -2,7 +2,9 @@ [](https://travis-ci.org/BYVoid/OpenCC) [](https://ci.appveyor.com/project/Carbo/OpenCC) -[](https://github.com/BYVoid/OpenCC/actions?query=workflow%3A%22Python+package%22) +[](https://github.com/BYVoid/OpenCC/actions/workflows/cmake.yml) +[](https://github.com/BYVoid/OpenCC/actions/workflows/nodejs.yml) +[](https://github.com/BYVoid/OpenCC/actions/workflows/python.yml) ## Introduction ?????? @@ -113,6 +115,7 @@ * PHP: [opencc4php](https://github.com/nauxliu/opencc4php) * Pure JavaScript: [opencc-js](https://github.com/nk2028/opencc-js) * WebAssembly: [wasm-opencc](https://github.com/oyyd/wasm-opencc) +* Browser Extension: [opencc-extension](https://github.com/tnychn/opencc-extension) ### Configurations ???????????? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/data/dictionary/JPVariants.txt new/OpenCC-ver.1.1.3/data/dictionary/JPVariants.txt --- old/OpenCC-ver.1.1.2/data/dictionary/JPVariants.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/data/dictionary/JPVariants.txt 2021-09-03 16:26:10.000000000 +0200 @@ -174,7 +174,7 @@ ??? ??? ??? ??? ??? ??? -??? ??? +??? ??? ??? ??? ??? ??? ??? ??? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/data/dictionary/STPhrases.txt new/OpenCC-ver.1.1.3/data/dictionary/STPhrases.txt --- old/OpenCC-ver.1.1.2/data/dictionary/STPhrases.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/data/dictionary/STPhrases.txt 2021-09-03 16:26:10.000000000 +0200 @@ -7048,7 +7048,7 @@ ??????????????? ??????????????? ???????????? ???????????? ?????? ?????? -????????? ????????? +????????? ????????? ?????? ?????? ?????? ?????? ?????? ?????? @@ -15533,7 +15533,7 @@ ?????? ?????? ?????? ?????? ?????? ?????? -?????? ?????? +?????? ?????? ?????? ?????? ?????? ?????? ?????? ?????? @@ -19794,9 +19794,9 @@ ????????????????????? ????????????????????? ?????? ?????? ????????? ????????? -???????????? ???????????? -??????????????????????????? ??????????????????????????? -??????????????? ??????????????? +???????????? ???????????? +??????????????????????????? ??????????????????????????? +??????????????? ??????????????? ????????? ????????? ?????????????????? ?????????????????? ????????? ????????? @@ -27267,6 +27267,7 @@ ?????? ?????? ????????? ????????? ?????? ?????? +?????? ?????? ???????????? ???????????? ???????????? ???????????? ?????? ?????? @@ -28851,7 +28852,7 @@ ???????????? ???????????? ?????? ?????? ????????? ????????? -????????????????????? ????????????????????? +????????????????????? ????????????????????? ?????? ?????? ?????? ?????? ?????? ?????? @@ -29319,6 +29320,7 @@ ?????? ?????? ????????? ????????? ????????? ????????? +?????? ?????? ????????? ????????? ????????? ????????? ????????? ????????? @@ -33301,7 +33303,7 @@ ?????????????????? ?????????????????? ?????????????????? ?????????????????? ?????? ?????? -????????? ????????? +????????? ????????? ?????? ?????? ?????? ?????? ?????? ?????? @@ -33413,7 +33415,7 @@ ???????????? ???????????? ?????? ?????? ????????? ????????? -???????????? ???????????? +???????????? ???????????? ???????????? ???????????? ???????????? ???????????? ???????????? ???????????? @@ -41968,6 +41970,7 @@ ???????????? ???????????? ???????????? ???????????? ?????? ?????? +?????? ?????? ????????? ????????? ???????????? ???????????? ???????????? ???????????? @@ -48217,7 +48220,7 @@ ?????? ?????? ?????? ?????? ???????????? ???????????? -??????????????? ??????????????? +??????????????? ??????????????? ????????????????????? ????????????????????? ???????????? ???????????? ?????????????????? ?????????????????? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/data/dictionary/TWPhrasesIT.txt new/OpenCC-ver.1.1.3/data/dictionary/TWPhrasesIT.txt --- old/OpenCC-ver.1.1.2/data/dictionary/TWPhrasesIT.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/data/dictionary/TWPhrasesIT.txt 2021-09-03 16:26:10.000000000 +0200 @@ -300,6 +300,8 @@ ????????? ???????????? ?????? ?????? ?????? ?????? ?????? +???????????? ???????????? +???????????? ???????????? ????????? ????????? ?????? ?????? ????????? ??????????????? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/node/global.gypi new/OpenCC-ver.1.1.3/node/global.gypi --- old/OpenCC-ver.1.1.2/node/global.gypi 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/node/global.gypi 2021-09-03 16:26:10.000000000 +0200 @@ -1,6 +1,6 @@ { "variables": { - "opencc_version": "1.1.2" + "opencc_version": "1.1.3" }, "target_defaults": { "defines": [ @@ -18,7 +18,7 @@ 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'MACOSX_DEPLOYMENT_TARGET': '10.7', - 'OTHER_CPLUSPLUSFLAGS': ["-std=c++11", "-stdlib=libc++"], + 'OTHER_CPLUSPLUSFLAGS': ["-std=c++14", "-stdlib=libc++"], 'OTHER_LDFLAGS': ["-stdlib=libc++"] } }], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/node/node_opencc.gypi new/OpenCC-ver.1.1.3/node/node_opencc.gypi --- old/OpenCC-ver.1.1.2/node/node_opencc.gypi 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/node/node_opencc.gypi 2021-09-03 16:26:10.000000000 +0200 @@ -6,6 +6,7 @@ "../node/opencc.cc", ], "include_dirs": [ + "../node", "../src", "../deps/rapidjson-1.1.0", "../deps/marisa-0.2.6/include", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/node/opencc_config.h new/OpenCC-ver.1.1.3/node/opencc_config.h --- old/OpenCC-ver.1.1.2/node/opencc_config.h 1970-01-01 01:00:00.000000000 +0100 +++ new/OpenCC-ver.1.1.3/node/opencc_config.h 2021-09-03 16:26:10.000000000 +0200 @@ -0,0 +1,21 @@ +/* + * Open Chinese Convert + * + * Copyright 2021 Carbo Kuo <byv...@byvoid.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/* #undef OPENCC_ENABLE_DARTS */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/package.json new/OpenCC-ver.1.1.3/package.json --- old/OpenCC-ver.1.1.2/package.json 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/package.json 2021-09-03 16:26:10.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "opencc", - "version": "1.1.2", + "version": "1.1.3", "description": "Conversion between Traditional and Simplified Chinese", "author": "Carbo Kuo <byv...@byvoid.com>", "license": "Apache-2.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/release-pypi-linux.sh new/OpenCC-ver.1.1.3/release-pypi-linux.sh --- old/OpenCC-ver.1.1.2/release-pypi-linux.sh 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/release-pypi-linux.sh 2021-09-03 16:26:10.000000000 +0200 @@ -25,7 +25,7 @@ export PATH=$HOME/miniconda3/bin:$PATH eval "$(conda shell.bash hook)" -for VERSION in 2.7 3.5 3.6 3.7 3.8; do +for VERSION in 2.7 3.5 3.6 3.7 3.8 3.9; do # Create and activate environment conda create -y -n py$VERSION python=$VERSION conda activate py$VERSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/release-pypi-macos.sh new/OpenCC-ver.1.1.3/release-pypi-macos.sh --- old/OpenCC-ver.1.1.2/release-pypi-macos.sh 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/release-pypi-macos.sh 2021-09-03 16:26:10.000000000 +0200 @@ -12,7 +12,7 @@ export PATH=$HOME/miniconda3/bin:$PATH eval "$(conda shell.bash hook)" -for VERSION in 2.7 3.5 3.6 3.7 3.8; do +for VERSION in 2.7 3.5 3.6 3.7 3.8 3.9; do # Create and activate environment conda create -y -n py$VERSION python=$VERSION conda activate py$VERSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/release-pypi-windows.cmd new/OpenCC-ver.1.1.3/release-pypi-windows.cmd --- old/OpenCC-ver.1.1.2/release-pypi-windows.cmd 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/release-pypi-windows.cmd 2021-09-03 16:26:10.000000000 +0200 @@ -1,7 +1,7 @@ @echo off setlocal EnableDelayedExpansion -SET VERSIONS=2.7 3.5 3.6 3.7 3.8 +SET VERSIONS=2.7 3.5 3.6 3.7 3.8 3.9 SET SOURCEDIR=%cd% REM Build packages diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/CMakeLists.txt new/OpenCC-ver.1.1.3/src/CMakeLists.txt --- old/OpenCC-ver.1.1.2/src/CMakeLists.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/CMakeLists.txt 2021-09-03 16:26:10.000000000 +0200 @@ -1,4 +1,8 @@ include (GenerateExportHeader) + +include_directories("${PROJECT_BINARY_DIR}/src") +include_directories("${PROJECT_SOURCE_DIR}/src") + if(NOT USE_SYSTEM_MARISA) include_directories(../deps/marisa-0.2.6/include) endif() @@ -38,6 +42,7 @@ UTF8StringSlice.hpp UTF8Util.hpp opencc.h + "${PROJECT_BINARY_DIR}/src/opencc_config.h" ) set( @@ -78,6 +83,7 @@ ) if (ENABLE_DARTS) + set(OPENCC_ENABLE_DARTS 1) if(NOT USE_SYSTEM_DARTS) include_directories(../deps/darts-clone) endif() @@ -101,6 +107,10 @@ ) endif() +configure_file( + "${PROJECT_SOURCE_DIR}/src/opencc_config.h.in" + "${PROJECT_BINARY_DIR}/src/opencc_config.h") + add_library(libopencc ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS}) set_target_properties(libopencc PROPERTIES POSITION_INDEPENDENT_CODE ON) source_group(libopencc FILES ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS}) @@ -122,7 +132,7 @@ OUTPUT_NAME opencc VERSION - 1.1.2 + 1.1.3 SOVERSION 1.1 ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/Common.hpp new/OpenCC-ver.1.1.3/src/Common.hpp --- old/OpenCC-ver.1.1.2/src/Common.hpp 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/Common.hpp 2021-09-03 16:26:10.000000000 +0200 @@ -30,6 +30,7 @@ #include "Export.hpp" #include "Optional.hpp" +#include "opencc_config.h" // Forward decalarations and alias namespace opencc { @@ -61,7 +62,7 @@ typedef std::shared_ptr<SerializableDict> SerializableDictPtr; typedef std::shared_ptr<TextDict> TextDictPtr; -#ifdef ENABLE_DARTS +#ifdef OPENCC_ENABLE_DARTS class BinaryDict; class DartsDict; typedef std::shared_ptr<BinaryDict> BinaryDictPtr; @@ -79,6 +80,3 @@ #ifndef VERSION #define VERSION "1.0.*" #endif // ifndef VERSION - -// The following definitions are provided by CMake -// #define ENABLE_DARTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/DictGroup.cpp new/OpenCC-ver.1.1.3/src/DictGroup.cpp --- old/OpenCC-ver.1.1.2/src/DictGroup.cpp 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/DictGroup.cpp 2021-09-03 16:26:10.000000000 +0200 @@ -16,6 +16,7 @@ * limitations under the License. */ +#include <algorithm> #include <map> #include "DictGroup.hpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/benchmark/CMakeLists.txt new/OpenCC-ver.1.1.3/src/benchmark/CMakeLists.txt --- old/OpenCC-ver.1.1.2/src/benchmark/CMakeLists.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/benchmark/CMakeLists.txt 2021-09-03 16:26:10.000000000 +0200 @@ -1,5 +1,3 @@ -include_directories(..) - add_executable(performance Performance.cpp) target_link_libraries(performance benchmark libopencc) add_test(BenchmarkTest performance) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/opencc_config.h.in new/OpenCC-ver.1.1.3/src/opencc_config.h.in --- old/OpenCC-ver.1.1.2/src/opencc_config.h.in 1970-01-01 01:00:00.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/opencc_config.h.in 2021-09-03 16:26:10.000000000 +0200 @@ -0,0 +1,21 @@ +/* + * Open Chinese Convert + * + * Copyright 2021 Carbo Kuo <byv...@byvoid.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#cmakedefine OPENCC_ENABLE_DARTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/tools/CMakeLists.txt new/OpenCC-ver.1.1.3/src/tools/CMakeLists.txt --- old/OpenCC-ver.1.1.2/src/tools/CMakeLists.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/tools/CMakeLists.txt 2021-09-03 16:26:10.000000000 +0200 @@ -1,5 +1,3 @@ -include_directories(..) - # Executables ## opencc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/src/tools/CommandLine.cpp new/OpenCC-ver.1.1.3/src/tools/CommandLine.cpp --- old/OpenCC-ver.1.1.2/src/tools/CommandLine.cpp 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/src/tools/CommandLine.cpp 2021-09-03 16:26:10.000000000 +0200 @@ -86,8 +86,30 @@ bool needToRemove = false; if (!outputFileName.IsNull() && fileName == outputFileName.Get()) { // Special case: input == output - const std::string tempFileName = std::tmpnam(nullptr); std::ifstream src(fileName, std::ios::binary); +#ifdef _WIN32 + const std::string tempFileName = std::tmpnam(nullptr); +#else + // std::tmpnam is deprecated + std::string tempFileName; + const char* tmpDirEnv = std::getenv("TMPDIR"); + if (tmpDirEnv != nullptr) { + tempFileName = tmpDirEnv; + } +#ifdef P_tmpdir + if (tempFileName.empty()) { + tempFileName = P_tmpdir; + } +#endif + if (tempFileName.empty()) { + tempFileName = "/tmp"; + } + tempFileName += "/openccXXXXXX"; + int fd = mkstemp(const_cast<char*>(tempFileName.c_str())); + if (fd == 0) { + throw FileNotWritable(tempFileName); + } +#endif std::ofstream dst(tempFileName, std::ios::binary); dst << src.rdbuf(); dst.close(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/test/CMakeLists.txt new/OpenCC-ver.1.1.3/test/CMakeLists.txt --- old/OpenCC-ver.1.1.2/test/CMakeLists.txt 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/test/CMakeLists.txt 2021-09-03 16:26:10.000000000 +0200 @@ -1,4 +1,5 @@ -include_directories(../src) +include_directories("${PROJECT_BINARY_DIR}/src") +include_directories("${PROJECT_SOURCE_DIR}/src") set(CONFIG_TEST config_test/config_test.json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OpenCC-ver.1.1.2/test/CommandLineConvertTest.cpp new/OpenCC-ver.1.1.3/test/CommandLineConvertTest.cpp --- old/OpenCC-ver.1.1.2/test/CommandLineConvertTest.cpp 2021-03-01 16:08:08.000000000 +0100 +++ new/OpenCC-ver.1.1.3/test/CommandLineConvertTest.cpp 2021-09-03 16:26:10.000000000 +0200 @@ -17,6 +17,7 @@ */ #include <fstream> +#include <iostream> #include "Common.hpp" #include "gtest/gtest.h" @@ -76,6 +77,10 @@ return CMAKE_SOURCE_DIR "/data/config/"; } + std::string InputFile(const char* config) const { + return std::string(InputDirectory()) + config + ".in"; + } + std::string OutputFile(const char* config) const { return std::string(OutputDirectory()) + config + ".out"; } @@ -84,10 +89,10 @@ return std::string(AnswerDirectory()) + config + ".ans"; } - std::string TestCommand(const char* config) const { - return OpenccCommand() + std::string("") + " -i " + InputDirectory() + - config + ".in" + " -o " + OutputFile(config) + " -c " + - ConfigurationDirectory() + config + ".json"; + std::string TestCommand(const char* config, const std::string& inputFile, + const std::string& outputFile) const { + return OpenccCommand() + std::string("") + " -i " + inputFile + " -o " + + outputFile + " -c " + ConfigurationDirectory() + config + ".json"; } char* originalWorkingDirectory; @@ -98,15 +103,35 @@ TEST_P(ConfigurationTest, Convert) { const char* config = GetParam(); - ASSERT_EQ(0, system(TestCommand(config).c_str())); - const std::string& output = GetFileContents(OutputFile(config)); - const std::string& answer = GetFileContents(AnswerFile(config)); + const std::string inputFile = InputFile(config); + const std::string outputFile = OutputFile(config); + ASSERT_EQ(0, system(TestCommand(config, inputFile, outputFile).c_str())); + const std::string output = GetFileContents(OutputFile(config)); + const std::string answer = GetFileContents(AnswerFile(config)); + ASSERT_EQ(answer, output); +} + +TEST_P(ConfigurationTest, InPlaceConvert) { + const char* config = GetParam(); + // Copy input to output + const std::string inputFile = InputFile(config); + const std::string outputFile = OutputFile(config); + std::ifstream source(inputFile, std::ios::binary); + std::ofstream dest(outputFile, std::ios::binary); + dest << source.rdbuf(); + source.close(); + dest.close(); + // Test in-place convert (same file) + ASSERT_EQ(0, system(TestCommand(config, outputFile, outputFile).c_str())); + const std::string output = GetFileContents(OutputFile(config)); + const std::string answer = GetFileContents(AnswerFile(config)); ASSERT_EQ(answer, output); } -INSTANTIATE_TEST_CASE_P(CommandLine, ConfigurationTest, - ::testing::Values("hk2s", "hk2t", "jp2t", "s2hk", "s2t", - "s2tw", "s2twp", "t2hk", "t2jp", - "t2s", "tw2s", "tw2sp", "tw2t")); +INSTANTIATE_TEST_SUITE_P(CommandLine, ConfigurationTest, + ::testing::Values("hk2s", "hk2t", "jp2t", "s2hk", + "s2t", "s2tw", "s2twp", "t2hk", + "t2jp", "t2s", "tw2s", "tw2sp", + "tw2t")); } // namespace opencc