git: 4f0d214b6c92 - main - japanese/mozc-server: Fix build with protobuf 3.18.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 28 Feb 2022 12:54:09 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4f0d214b6c92e90f499a708503fb6dfb12cbd267

commit 4f0d214b6c92e90f499a708503fb6dfb12cbd267
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-02-28 09:43:08 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-02-28 12:46:45 +0000

    japanese/mozc-server: Fix build with protobuf 3.18.0+
    
    Deprecated 2-parameter SetTotalBytesLimit() has be removed since protobuf 3.18.0.
    
    Reference:      https://github.com/protocolbuffers/protobuf/commit/cda795437d00a15f375d3d5e2659adac715459c6
---
 ...tch-src_dictionary_user__dictionary__storage.cc | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/japanese/mozc-server/files/patch-src_dictionary_user__dictionary__storage.cc b/japanese/mozc-server/files/patch-src_dictionary_user__dictionary__storage.cc
index ffcff76f194a..1350964f72cb 100644
--- a/japanese/mozc-server/files/patch-src_dictionary_user__dictionary__storage.cc
+++ b/japanese/mozc-server/files/patch-src_dictionary_user__dictionary__storage.cc
@@ -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()) {
@@ -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;
    }
  
@@ -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 =
@@ -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) {
@@ -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;
    }
  
@@ -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 {
@@ -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) {
@@ -100,7 +102,7 @@
  }
  
  UserDictionaryStorage::UserDictionaryStorageErrorType
-@@ -352,8 +352,8 @@ bool UserDictionaryStorage::AddToAutoReg
+@@ -352,8 +352,8 @@ bool UserDictionaryStorage::AddToAutoRegisteredDiction
    }
  
    int auto_index = -1;
@@ -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) {
@@ -133,7 +135,7 @@
    }
  
    if (dic == NULL) {
-@@ -410,13 +410,13 @@ bool UserDictionaryStorage::AddToAutoReg
+@@ -410,13 +410,13 @@ bool UserDictionaryStorage::AddToAutoRegisteredDiction
  }
  
  bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
@@ -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) {
@@ -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(
@@ -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);
    }
  
@@ -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(