Skip to content

Commit

Permalink
japanese/mozc-server: Fix build with protobuf 3.18.0+
Browse files Browse the repository at this point in the history
Deprecated 2-parameter SetTotalBytesLimit() has be removed since protobuf 3.18.0.

Reference:	protocolbuffers/protobuf@cda7954
  • Loading branch information
sunpoet committed Feb 28, 2022
1 parent dfce603 commit 4f0d214
Showing 1 changed file with 18 additions and 16 deletions.
@@ -1,10 +1,12 @@
--- src/dictionary/user_dictionary_storage.cc.orig 2019-03-04 18:35:55 UTC
--- src/dictionary/user_dictionary_storage.cc.orig 2020-08-14 17:09:18 UTC
+++ src/dictionary/user_dictionary_storage.cc
@@ -109,7 +109,7 @@ bool UserDictionaryStorage::LoadInternal
@@ -108,8 +108,8 @@ bool UserDictionaryStorage::LoadInternal() {
// wants to use more than 512MB.
mozc::protobuf::io::IstreamInputStream zero_copy_input(&ifs);
mozc::protobuf::io::CodedInputStream decoder(&zero_copy_input);
decoder.SetTotalBytesLimit(kDefaultTotalBytesLimit, -1);
- decoder.SetTotalBytesLimit(kDefaultTotalBytesLimit, -1);
- if (!ParseFromCodedStream(&decoder)) {
+ decoder.SetTotalBytesLimit(kDefaultTotalBytesLimit);
+ if (!user_dictionary_storage_base.ParseFromCodedStream(&decoder)) {
LOG(ERROR) << "Failed to parse";
if (!decoder.ConsumedEntireMessage() || !ifs.eof()) {
Expand Down Expand Up @@ -34,7 +36,7 @@
LOG(ERROR) << "SerializeToString failed";
last_error_type_ = SYNC_FAILURE;
return false;
@@ -227,7 +227,7 @@ bool UserDictionaryStorage::ExportDictio
@@ -227,7 +227,7 @@ bool UserDictionaryStorage::ExportDictionary(
return false;
}

Expand All @@ -43,7 +45,7 @@
for (size_t i = 0; i < dic.entries_size(); ++i) {
const UserDictionaryEntry &entry = dic.entries(i);
ofs << entry.key() << "\t" << entry.value() << "\t"
@@ -241,7 +241,7 @@ bool UserDictionaryStorage::ExportDictio
@@ -241,7 +241,7 @@ bool UserDictionaryStorage::ExportDictionary(
bool UserDictionaryStorage::CreateDictionary(
const string &dic_name, uint64 *new_dic_id) {
UserDictionaryCommandStatus::Status status =
Expand All @@ -52,7 +54,7 @@
// Update last_error_type_
switch (status) {
case UserDictionaryCommandStatus::DICTIONARY_NAME_EMPTY:
@@ -273,7 +273,7 @@ bool UserDictionaryStorage::CreateDictio
@@ -273,7 +273,7 @@ bool UserDictionaryStorage::CreateDictionary(
}

bool UserDictionaryStorage::DeleteDictionary(uint64 dic_id) {
Expand All @@ -61,7 +63,7 @@
// Failed to delete dictionary.
last_error_type_ = INVALID_DICTIONARY_ID;
return false;
@@ -304,8 +304,8 @@ bool UserDictionaryStorage::RenameDictio
@@ -304,8 +304,8 @@ bool UserDictionaryStorage::RenameDictionary(uint64 di
return true;
}

Expand All @@ -72,7 +74,7 @@
last_error_type_ = DUPLICATED_DICTIONARY_NAME;
LOG(ERROR) << "duplicated dictionary name";
return false;
@@ -318,14 +318,14 @@ bool UserDictionaryStorage::RenameDictio
@@ -318,14 +318,14 @@ bool UserDictionaryStorage::RenameDictionary(uint64 di
}

int UserDictionaryStorage::GetUserDictionaryIndex(uint64 dic_id) const {
Expand All @@ -91,7 +93,7 @@
return true;
}
}
@@ -335,7 +335,7 @@ bool UserDictionaryStorage::GetUserDicti
@@ -335,7 +335,7 @@ bool UserDictionaryStorage::GetUserDictionaryId(const

user_dictionary::UserDictionary *UserDictionaryStorage::GetUserDictionary(
uint64 dic_id) {
Expand All @@ -100,7 +102,7 @@
}

UserDictionaryStorage::UserDictionaryStorageErrorType
@@ -352,8 +352,8 @@ bool UserDictionaryStorage::AddToAutoReg
@@ -352,8 +352,8 @@ bool UserDictionaryStorage::AddToAutoRegisteredDiction
}

int auto_index = -1;
Expand All @@ -111,7 +113,7 @@
auto_index = i;
break;
}
@@ -361,17 +361,17 @@ bool UserDictionaryStorage::AddToAutoReg
@@ -361,17 +361,17 @@ bool UserDictionaryStorage::AddToAutoRegisteredDiction

UserDictionary *dic = NULL;
if (auto_index == -1) {
Expand All @@ -133,7 +135,7 @@
}

if (dic == NULL) {
@@ -410,13 +410,13 @@ bool UserDictionaryStorage::AddToAutoReg
@@ -410,13 +410,13 @@ bool UserDictionaryStorage::AddToAutoRegisteredDiction
}

bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
Expand All @@ -150,7 +152,7 @@
if (!dic->syncable()) {
continue;
}
@@ -433,10 +433,10 @@ bool UserDictionaryStorage::ConvertSyncD
@@ -433,10 +433,10 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToN

// Delete removed or unused sync dictionaries.
if (dic->removed() || dic->entries_size() == 0) {
Expand All @@ -164,7 +166,7 @@
continue;
}

@@ -445,7 +445,7 @@ bool UserDictionaryStorage::ConvertSyncD
@@ -445,7 +445,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToN
kDictionaryNameConvertedFromSyncableDictionary;
int index = 0;
while (UserDictionaryUtil::ValidateDictionaryName(
Expand All @@ -173,7 +175,7 @@
!= UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
++index;
new_dictionary_name = Util::StringPrintf(
@@ -456,7 +456,7 @@ bool UserDictionaryStorage::ConvertSyncD
@@ -456,7 +456,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToN
dic->set_syncable(false);
}

Expand All @@ -182,7 +184,7 @@

return true;
}
@@ -487,7 +487,7 @@ size_t UserDictionaryStorage::max_dictio
@@ -487,7 +487,7 @@ size_t UserDictionaryStorage::max_dictionary_size() {
bool UserDictionaryStorage::IsValidDictionaryName(const string &name) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::ValidateDictionaryName(
Expand Down

0 comments on commit 4f0d214

Please sign in to comment.