Skip to content

Commit 556ed22

Browse files
committed
Add back Config::NewFromFile with one argument to maintain the ABI compatibility.
It was changed in v1.1.8.
1 parent 0caa2ae commit 556ed22

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/Config.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ Config::Config() : internal(new ConfigInternal()) {}
222222

223223
Config::~Config() { delete reinterpret_cast<ConfigInternal*>(internal); }
224224

225+
ConverterPtr Config::NewFromFile(const std::string& fileName) {
226+
return NewFromFile(fileName, std::vector<std::string>{}, nullptr);
227+
}
228+
225229
ConverterPtr Config::NewFromFile(const std::string& fileName,
226230
const std::vector<std::string>& paths,
227231
const char* argv0) {

src/Config.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ class OPENCC_EXPORT Config {
3737
ConverterPtr NewFromString(const std::string& json,
3838
const std::vector<std::string>& paths);
3939

40+
ConverterPtr NewFromFile(const std::string& fileName);
41+
4042
ConverterPtr NewFromFile(const std::string& fileName,
41-
const std::vector<std::string>& paths = {},
42-
const char* argv0 = nullptr);
43+
const std::vector<std::string>& paths,
44+
const char* argv0);
4345

4446
private:
4547
void* internal;

src/SimpleConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct InternalData {
5555
paths_with_runfiles.push_back(
5656
bazel_runfiles->Rlocation("_main/data/dictionary"));
5757
return new InternalData(
58-
config.NewFromFile(configFileName, paths_with_runfiles));
58+
config.NewFromFile(configFileName, paths_with_runfiles, argv0));
5959
}
6060
#endif
6161
return new InternalData(config.NewFromFile(configFileName, paths, argv0));

src/tools/CommandLine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ int main(int argc, const char* argv[]) {
197197
outputFileName = Optional<std::string>(outputArg.getValue());
198198
noFlush = true;
199199
}
200-
converter = config.NewFromFile(configFileName, pathArg.getValue());
200+
converter = config.NewFromFile(configFileName, pathArg.getValue(), argv[0]);
201201
bool lineByLine = inputFileName.IsNull();
202202
if (lineByLine) {
203203
ConvertLineByLine();

0 commit comments

Comments
 (0)