Skip to content

Commit

Permalink
Fix runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahansu committed Feb 20, 2024
1 parent e5d6c5f commit b3778e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include (CTest)

######## Options
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
option(BUILD_SHARED_LIBS "Build opencc as shared library" ON)
option(BUILD_SHARED_LIBS "Build opencc as shared library" OFF)
option(ENABLE_GTEST "Build all tests." OFF)
option(ENABLE_BENCHMARK "Build benchmark tests." OFF)
option(ENABLE_DARTS "Build DartsDict (ocd format)." ON)
Expand All @@ -34,7 +34,7 @@ option(USE_SYSTEM_GOOGLE_BENCHMARK "Use system version of Google Benchmark" OFF)
option(USE_SYSTEM_GTEST "Use system version of GoogleTest" OFF)
option(USE_SYSTEM_MARISA "Use system version of Marisa" OFF)
option(USE_SYSTEM_PYBIND11 "Use system version of pybind11" OFF)
option(USE_SYSTEM_RAPIDJSON "Use system version of RapidJSON" OFF)
option(USE_SYSTEM_RAPIDJSON "Use system version of RapidJSON" ON)
option(USE_SYSTEM_TCLAP "Use system version of TCLAP" OFF)

######## Package information
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ if(NOT USE_SYSTEM_MARISA)
endif()
if(NOT USE_SYSTEM_RAPIDJSON)
include_directories(../deps/rapidjson-1.1.0)
else()
find_package(RapidJSON REQUIRED)
include_directories(${RAPIDJSON_INCLUDE_DIRS})
endif()
if(NOT USE_SYSTEM_TCLAP)
include_directories(../deps/tclap-1.2.2)
Expand Down
3 changes: 2 additions & 1 deletion src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ ConverterPtr Config::NewFromString(const std::string& json,
const std::string& configDirectory) {
rapidjson::Document doc;

doc.ParseInsitu<0>(const_cast<char*>(json.c_str()));
doc.Parse(json.c_str());
//doc.ParseInsitu<0>(const_cast<char*>(json.c_str()));
if (doc.HasParseError()) {
throw InvalidFormat("Error parsing JSON"); // doc.GetErrorOffset()
}
Expand Down

0 comments on commit b3778e1

Please sign in to comment.