pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/inputmethod/mozc-server
Module Name: pkgsrc
Committed By: taca
Date: Fri Jun 19 05:45:30 UTC 2020
Modified Files:
pkgsrc/inputmethod/mozc-server: distinfo
pkgsrc/inputmethod/mozc-server/patches:
patch-gui_word__register__dialog_word__register__dialog.cc
patch-prediction_user__history__predictor.cc
Added Files:
pkgsrc/inputmethod/mozc-server/patches:
patch-dictionary_user__dictionary.cc
patch-dictionary_user__dictionary__session.cc
patch-dictionary_user__dictionary__session__test.cc
patch-dictionary_user__dictionary__storage.cc
patch-dictionary_user__dictionary__storage.h
patch-dictionary_user__dictionary__storage__test.cc
patch-dictionary_user__dictionary__test.cc
patch-prediction_user__history__predictor.h
patch-prediction_user__history__predictor__test.cc
patch-rewriter_usage__rewriter__test.cc
Log Message:
inputmethod/mozc-server: fix build problem
Fix build problem applying from https://github.com/google/mozc/issues/460.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 pkgsrc/inputmethod/mozc-server/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session__test.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.h \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage__test.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__test.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.h \
pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor__test.cc \
pkgsrc/inputmethod/mozc-server/patches/patch-rewriter_usage__rewriter__test.cc
cvs rdiff -u -r1.4 -r1.5 \
pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc
cvs rdiff -u -r1.1 -r1.2 \
pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/inputmethod/mozc-server/distinfo
diff -u pkgsrc/inputmethod/mozc-server/distinfo:1.21 pkgsrc/inputmethod/mozc-server/distinfo:1.22
--- pkgsrc/inputmethod/mozc-server/distinfo:1.21 Sat Dec 30 14:51:42 2017
+++ pkgsrc/inputmethod/mozc-server/distinfo Fri Jun 19 05:45:30 2020
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.21 2017/12/30 14:51:42 tsutsui Exp $
+$NetBSD: distinfo,v 1.22 2020/06/19 05:45:30 taca Exp $
SHA1 (mozc-2.20.2673.102.tar.xz) = 9cedf4d392593e04755fa44afd79cd40bb80b9d1
RMD160 (mozc-2.20.2673.102.tar.xz) = 723fef550d88c5a4dc33f2ec9c8d7ee694e60d64
@@ -25,6 +25,13 @@ SHA1 (patch-build__tools_mozc__version.p
SHA1 (patch-build__tools_util.py) = 5ca614adf2453fcc33c18cda74c0d9b2e4f6bc21
SHA1 (patch-client_client.cc) = f1eb1860c41a97c82a338f74acdcf0ed3477b6da
SHA1 (patch-config_stats__config__util__test.cc) = 3514f04a921908795c03d0e8685135297dc9e2af
+SHA1 (patch-dictionary_user__dictionary.cc) = 34147edfd4d0c09637ab285584b4fad4e7ee95ff
+SHA1 (patch-dictionary_user__dictionary__session.cc) = 13270d72fcdd11a3d7fd6992613a8b562f7e51d0
+SHA1 (patch-dictionary_user__dictionary__session__test.cc) = 2c3fb20f3bd8c4f7e870e978f51a6e707d4a366d
+SHA1 (patch-dictionary_user__dictionary__storage.cc) = d2ac32d6606b835d93422e925bb1b82e62b46ab8
+SHA1 (patch-dictionary_user__dictionary__storage.h) = df3da7bf5a31f030d0202051befb70cf7afac519
+SHA1 (patch-dictionary_user__dictionary__storage__test.cc) = 1f11ecc89326af675f252ead82bcd4afb65cec2e
+SHA1 (patch-dictionary_user__dictionary__test.cc) = 5ca305cae59163f1e1779e77e608f3087aae0190
SHA1 (patch-gui_config__dialog_config__dialog.cc) = de2750a6bf99c4e38983cf5322adae8c46ca45d6
SHA1 (patch-gui_config__dialog_keybinding__editor.cc) = 529e902c146907d3a91181bad3822bbbec69b6b7
SHA1 (patch-gui_dictionary__tool_dictionary__tool.cc) = cae617cc8e324b0f93adc1e76632a018530cd2c7
@@ -32,7 +39,7 @@ SHA1 (patch-gui_qt__libraries.gypi) = ce
SHA1 (patch-gui_qt__moc.gypi) = e3d42e61b35012cda10da13aa03cee67786e171c
SHA1 (patch-gui_qt__rcc.gypi) = d38a849fe8e81672eb441a41936f454d8e45ff5c
SHA1 (patch-gui_qt__uic.gypi) = 7dd69ee109e81f0e70f2866b77555412518b4844
-SHA1 (patch-gui_word__register__dialog_word__register__dialog.cc) = 6e247fcab5d570b733365b57c5a5d72a021dd16f
+SHA1 (patch-gui_word__register__dialog_word__register__dialog.cc) = 213b087d4cd5f22ee2b202963a7b7b3325baafb0
SHA1 (patch-gyp_common.gypi) = 13cd5010a6f3ed314a94248144657955f8bbbe72
SHA1 (patch-gyp_directories.gypi) = 6504d8b43f83be3908b39a5e51598c2aba0dffd9
SHA1 (patch-handwriting_zinnia.gyp) = b59e546cb9b8b91dcd627885e1853e8ba8dead46
@@ -42,7 +49,10 @@ SHA1 (patch-ipc_ipc__path__manager__test
SHA1 (patch-ipc_named__event.cc) = 92283261e7580569587e43156f13567b593c9a32
SHA1 (patch-ipc_unix__ipc.cc) = 25107c2e84844ecaa3445efb48cc3f2795579dec
SHA1 (patch-net_net.gyp) = 61353724533f9239f4c58fa37f0a8fb2eb5552c3
-SHA1 (patch-prediction_user__history__predictor.cc) = 14e7a899c1c27108169de6571746d5fe4841630a
+SHA1 (patch-prediction_user__history__predictor.cc) = 66cf79206663d35f64a0cbee63be04c8faa99903
+SHA1 (patch-prediction_user__history__predictor.h) = 50ee05871b01864b71e4682f712c3eb662b0be94
+SHA1 (patch-prediction_user__history__predictor__test.cc) = 7fbcbfcb6bcaa236bc94fd8a9c1cd97051ffa222
+SHA1 (patch-rewriter_usage__rewriter__test.cc) = 0ceba47a833574d4eeac3e38ed2fca5ba5ba0c0c
SHA1 (patch-session_session.cc) = 773017ac54e79239f6734a124f457b0b81bb1ced
SHA1 (patch-session_session__test.cc) = 99165b29555844a40d30cf5554cc5c66773b70ed
SHA1 (patch-third__party_protobuf_post__process__dist.sh) = 8adc79d5d7eed3cbf406ebcfbd5832b7a050ced6
Index: pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc
diff -u pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc:1.4
pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc:1.5
--- pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc:1.4 Sun Dec 17 14:15:43 2017
+++ pkgsrc/inputmethod/mozc-server/patches/patch-gui_word__register__dialog_word__register__dialog.cc Fri Jun 19 05:45:30 2020
@@ -1,8 +1,9 @@
-$NetBSD: patch-gui_word__register__dialog_word__register__dialog.cc,v 1.4 2017/12/17 14:15:43 tsutsui Exp $
+$NetBSD: patch-gui_word__register__dialog_word__register__dialog.cc,v 1.5 2020/06/19 05:45:30 taca Exp $
* NetBSD support
+* Fix from https://github.com/google/mozc/issues/460
---- gui/word_register_dialog/word_register_dialog.cc.orig 2016-05-15 08:11:11.000000000 +0000
+--- gui/word_register_dialog/word_register_dialog.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ gui/word_register_dialog/word_register_dialog.cc
@@ -90,9 +90,9 @@ QString GetEnv(const char *envname) {
}
@@ -16,3 +17,12 @@ $NetBSD: patch-gui_word__register__dialo
// TODO(team): Support other platforms.
return "";
}
+@@ -301,7 +301,7 @@ WordRegisterDialog::ErrorCode WordRegist
+ }
+
+ UserDictionary *dic =
+- session_->mutable_storage()->mutable_dictionaries(index);
++ session_->mutable_storage()->user_dictionary_storage_base.mutable_dictionaries(index);
+ CHECK(dic);
+
+ if (dic->name() != DictionarycomboBox->currentText().toStdString()) {
Index: pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc
diff -u pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc:1.1 pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc:1.2
--- pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc:1.1 Sat Dec 30 14:51:42 2017
+++ pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.cc Fri Jun 19 05:45:30 2020
@@ -1,10 +1,72 @@
-$NetBSD: patch-prediction_user__history__predictor.cc,v 1.1 2017/12/30 14:51:42 tsutsui Exp $
+$NetBSD: patch-prediction_user__history__predictor.cc,v 1.2 2020/06/19 05:45:30 taca Exp $
- Apply a patch from the upstream pull request #424:
https://github.com/google/mozc/pull/424/files
+- Fix from https://github.com/google/mozc/issues/460
--- prediction/user_history_predictor.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ prediction/user_history_predictor.cc
+@@ -298,23 +298,23 @@ bool UserHistoryStorage::Load() {
+ return false;
+ }
+
+- if (!ParseFromString(input)) {
++ if (!user_history_base.ParseFromString(input)) {
+ LOG(ERROR) << "ParseFromString failed. message looks broken";
+ return false;
+ }
+
+- VLOG(1) << "Loaded user histroy, size=" << entries_size();
++ VLOG(1) << "Loaded user histroy, size=" << user_history_base.entries_size();
+ return true;
+ }
+
+ bool UserHistoryStorage::Save() const {
+- if (entries_size() == 0) {
++ if (user_history_base.entries_size() == 0) {
+ LOG(WARNING) << "etries size is 0. Not saved";
+ return false;
+ }
+
+ string output;
+- if (!AppendToString(&output)) {
++ if (!user_history_base.AppendToString(&output)) {
+ LOG(ERROR) << "AppendToString failed";
+ return false;
+ }
+@@ -501,12 +501,12 @@ bool UserHistoryPredictor::Load() {
+ return false;
+ }
+
+- for (size_t i = 0; i < history.entries_size(); ++i) {
+- dic_->Insert(EntryFingerprint(history.entries(i)),
+- history.entries(i));
++ for (size_t i = 0; i < history.user_history_base.entries_size(); ++i) {
++ dic_->Insert(EntryFingerprint(history.user_history_base.entries(i)),
++ history.user_history_base.entries(i));
+ }
+
+- VLOG(1) << "Loaded user histroy, size=" << history.entries_size();
++ VLOG(1) << "Loaded user histroy, size=" << history.user_history_base.entries_size();
+
+ return true;
+ }
+@@ -528,13 +528,13 @@ bool UserHistoryPredictor::Save() {
+
+ UserHistoryStorage history(filename);
+ for (const DicElement *elm = tail; elm != nullptr; elm = elm->prev) {
+- history.add_entries()->CopyFrom(elm->value);
++ history.user_history_base.add_entries()->CopyFrom(elm->value);
+ }
+
+ // Updates usage stats here.
+ UsageStats::SetInteger(
+ "UserHistoryPredictorEntrySize",
+- static_cast<int>(history.entries_size()));
++ static_cast<int>(history.user_history_base.entries_size()));
+
+ if (!history.Save()) {
+ LOG(ERROR) << "UserHistoryStorage::Save() failed";
@@ -841,7 +841,7 @@ bool UserHistoryPredictor::RomanFuzzyPre
// swap.
if (i + 1 < prefix.size()) {
Added files:
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-dictionary_user__dictionary.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary.cc
+@@ -289,7 +289,7 @@ class UserDictionary::UserDictionaryRelo
+ }
+
+ auto_register_mode_ = false;
+- dic_->Load(*(storage.get()));
++ dic_->Load(storage.get()->user_dictionary_storage_base);
+ }
+
+ private:
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,204 @@
+$NetBSD: patch-dictionary_user__dictionary__session.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_session.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_session.cc
+@@ -69,11 +69,11 @@ class UndoCreateDictionaryCommand : publ
+ }
+
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+- if (storage->dictionaries_size() == 0) {
++ if (storage->user_dictionary_storage_base.dictionaries_size() == 0) {
+ return false;
+ }
+
+- storage->mutable_dictionaries()->RemoveLast();
++ storage->user_dictionary_storage_base.mutable_dictionaries()->RemoveLast();
+ return true;
+ }
+
+@@ -94,7 +94,7 @@ class UndoDeleteDictionaryCommand : publ
+ }
+
+ RepeatedPtrField<UserDictionary> *dictionaries =
+- storage->mutable_dictionaries();
++ storage->user_dictionary_storage_base.mutable_dictionaries();
+ dictionaries->AddAllocated(dictionary_.release());
+
+ // Adjust the position of the reverted dictionary.
+@@ -120,10 +120,10 @@ class UndoDeleteDictionaryWithEnsuringNo
+ }
+
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+- if (storage->dictionaries_size() != 1) {
++ if (storage->user_dictionary_storage_base.dictionaries_size() != 1) {
+ return false;
+ }
+- dictionary_->Swap(storage->mutable_dictionaries(0));
++ dictionary_->Swap(storage->user_dictionary_storage_base.mutable_dictionaries(0));
+ return true;
+ }
+
+@@ -144,7 +144,7 @@ class UndoRenameDictionaryCommand : publ
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage, dictionary_id_);
++ &storage->user_dictionary_storage_base, dictionary_id_);
+ if (dictionary == NULL) {
+ return false;
+ }
+@@ -169,7 +169,7 @@ class UndoAddEntryCommand : public UserD
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage, dictionary_id_);
++ &storage->user_dictionary_storage_base, dictionary_id_);
+ if (dictionary == NULL || dictionary->entries_size() == 0) {
+ return false;
+ }
+@@ -195,7 +195,7 @@ class UndoEditEntryCommand : public User
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage, dictionary_id_);
++ &storage->user_dictionary_storage_base, dictionary_id_);
+ if (dictionary == NULL ||
+ index_ < 0 || dictionary->entries_size() <= index_) {
+ return false;
+@@ -240,7 +240,7 @@ class UndoDeleteEntryCommand : public Us
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage, dictionary_id_);
++ &storage->user_dictionary_storage_base, dictionary_id_);
+ if (dictionary == NULL) {
+ return false;
+ }
+@@ -306,7 +306,7 @@ class UndoImportFromStringCommand : publ
+ virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage, dictionary_id_);
++ &storage->user_dictionary_storage_base, dictionary_id_);
+ if (dictionary == NULL) {
+ return false;
+ }
+@@ -345,7 +345,7 @@ UserDictionarySession::~UserDictionarySe
+
+ // TODO(hidehiko) move this to header.
+ const UserDictionaryStorage &UserDictionarySession::storage() const {
+- return *storage_;
++ return storage_->user_dictionary_storage_base;
+ }
+ mozc::UserDictionaryStorage *UserDictionarySession::mutable_storage() {
+ return storage_.get();
+@@ -464,7 +464,7 @@ UserDictionaryCommandStatus::Status User
+ const string &dictionary_name, uint64 *new_dictionary_id) {
+ UserDictionaryCommandStatus::Status status =
+ UserDictionaryUtil::CreateDictionary(
+- storage_.get(), dictionary_name, new_dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_name, new_dictionary_id);
+ if (status == UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
+ AddUndoCommand(new UndoCreateDictionaryCommand);
+ }
+@@ -488,7 +488,7 @@ UserDictionarySession::DeleteDictionaryI
+ int original_index;
+ UserDictionary *deleted_dictionary;
+ if (!UserDictionaryUtil::DeleteDictionary(
+- storage_.get(), dictionary_id,
++ &storage_->user_dictionary_storage_base, dictionary_id,
+ &original_index, &deleted_dictionary)) {
+ // Failed to delete the dictionary.
+ return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
+@@ -510,7 +510,7 @@ UserDictionaryCommandStatus::Status User
+ uint64 dictionary_id, const string &dictionary_name) {
+ string original_name;
+ const UserDictionary *dictionary =
+- UserDictionaryUtil::GetUserDictionaryById(*storage_, dictionary_id);
++ UserDictionaryUtil::GetUserDictionaryById(storage_->user_dictionary_storage_base, dictionary_id);
+ if (dictionary != NULL) {
+ // Note that if dictionary is null, it means the dictionary_id is invalid
+ // so following RenameDictionary will fail, and error handling is done
+@@ -547,7 +547,7 @@ UserDictionaryCommandStatus::Status User
+ uint64 dictionary_id, const UserDictionary::Entry &entry) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage_.get(), dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_id);
+ if (dictionary == NULL) {
+ return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
+ }
+@@ -575,7 +575,7 @@ UserDictionaryCommandStatus::Status User
+ uint64 dictionary_id, int index, const UserDictionary::Entry &entry) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage_.get(), dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_id);
+ if (dictionary == NULL) {
+ return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
+ }
+@@ -604,7 +604,7 @@ UserDictionaryCommandStatus::Status User
+ uint64 dictionary_id, const std::vector<int> &index_list) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage_.get(), dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_id);
+ if (dictionary == NULL) {
+ return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
+ }
+@@ -644,7 +644,7 @@ UserDictionaryCommandStatus::Status User
+ uint64 dictionary_id, const string &data) {
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage_.get(), dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_id);
+ if (dictionary == NULL) {
+ return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
+ }
+@@ -699,7 +699,7 @@ UserDictionarySession::ImportToNewDictio
+ uint64 *new_dictionary_id) {
+ UserDictionaryCommandStatus::Status status =
+ UserDictionaryUtil::CreateDictionary(
+- storage_.get(), dictionary_name, new_dictionary_id);
++ &storage_->user_dictionary_storage_base, dictionary_name, new_dictionary_id);
+ if (status != UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
+ return status;
+ }
+@@ -709,7 +709,7 @@ UserDictionarySession::ImportToNewDictio
+
+ UserDictionary *dictionary =
+ UserDictionaryUtil::GetMutableUserDictionaryById(
+- storage_.get(), *new_dictionary_id);
++ &storage_->user_dictionary_storage_base, *new_dictionary_id);
+ if (dictionary == NULL) {
+ // The dictionary should be always found.
+ return UserDictionaryCommandStatus::UNKNOWN_ERROR;
+@@ -719,7 +719,7 @@ UserDictionarySession::ImportToNewDictio
+ }
+
+ bool UserDictionarySession::EnsureNonEmptyStorage() {
+- if (storage_->dictionaries_size() > 0) {
++ if (storage_->user_dictionary_storage_base.dictionaries_size() > 0) {
+ // The storage already has at least one dictionary. Do nothing.
+ return false;
+ }
+@@ -728,7 +728,7 @@ bool UserDictionarySession::EnsureNonEmp
+ uint64 new_dictionary_id;
+ UserDictionaryCommandStatus::Status status =
+ UserDictionaryUtil::CreateDictionary(
+- storage_.get(), default_dictionary_name_, &new_dictionary_id);
++ &storage_->user_dictionary_storage_base, default_dictionary_name_, &new_dictionary_id);
+ CHECK_EQ(
+ status, UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS);
+ return true;
+@@ -755,7 +755,7 @@ void UserDictionarySession::AddUndoComma
+
+ void UserDictionarySession::ClearDictionariesAndUndoHistory() {
+ ScopedUserDictionaryLocker l(storage_.get());
+- storage_->clear_dictionaries();
++ storage_->user_dictionary_storage_base.clear_dictionaries();
+ ClearUndoHistory();
+ }
+
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session__test.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session__test.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__session__test.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,66 @@
+$NetBSD: patch-dictionary_user__dictionary__session__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_session_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_session_test.cc
+@@ -105,12 +105,12 @@ TEST_F(UserDictionarySessionTest, SaveAn
+
+ ASSERT_EQ(UserDictionaryCommandStatus::FILE_NOT_FOUND, session.Load());
+
+- session.mutable_storage()->set_version(10);
++ session.mutable_storage()->user_dictionary_storage_base.set_version(10);
+ ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
+ session.Save());
+
+ // Clear once, in order to make sure that Load is actually working.
+- session.mutable_storage()->Clear();
++ session.mutable_storage()->user_dictionary_storage_base.Clear();
+ ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
+ session.Load());
+
+@@ -140,7 +140,7 @@ TEST_F(UserDictionarySessionTest, DISABL
+
+ // Create huge dummy data.
+ {
+- UserDictionaryStorage *storage = session.mutable_storage();
++ UserDictionaryStorage *storage = &session.mutable_storage()->user_dictionary_storage_base;
+ for (int i = 0; i < 100; ++i) {
+ UserDictionary *dictionary = storage->add_dictionaries();
+ for (int j = 0; j < 1000; ++j) {
+@@ -157,7 +157,7 @@ TEST_F(UserDictionarySessionTest, DISABL
+ ASSERT_EQ(UserDictionaryCommandStatus::FILE_SIZE_LIMIT_EXCEEDED,
+ session.Save());
+
+- session.mutable_storage()->Clear();
++ session.mutable_storage()->user_dictionary_storage_base.Clear();
+ ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
+ session.Load());
+
+@@ -201,7 +201,7 @@ TEST_F(UserDictionarySessionTest, Create
+
+ while (session.storage().dictionaries_size() <
+ ::mozc::UserDictionaryStorage::max_dictionary_size()) {
+- session.mutable_storage()->add_dictionaries();
++ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
+ }
+ EXPECT_EQ(UserDictionaryCommandStatus::DICTIONARY_SIZE_LIMIT_EXCEEDED,
+ session.CreateDictionary("dictionary 2", &dummy_dictionary_id));
+@@ -214,7 +214,7 @@ TEST_F(UserDictionarySessionTest, Delete
+ const uint64 kDummyId = 10;
+ {
+ UserDictionary *user_dictionary =
+- session.mutable_storage()->add_dictionaries();
++ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
+ user_dictionary->set_id(kDummyId);
+ }
+
+@@ -239,7 +239,7 @@ TEST_F(UserDictionarySessionTest,
+ const uint64 kDummyId = 10;
+ {
+ UserDictionary *user_dictionary =
+- session.mutable_storage()->add_dictionaries();
++ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
+ user_dictionary->set_id(kDummyId);
+ }
+
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,197 @@
+$NetBSD: patch-dictionary_user__dictionary__storage.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_storage.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_storage.cc
+@@ -114,7 +114,7 @@ bool UserDictionaryStorage::LoadInternal
+ mozc::protobuf::io::IstreamInputStream zero_copy_input(&ifs);
+ mozc::protobuf::io::CodedInputStream decoder(&zero_copy_input);
+ decoder.SetTotalBytesLimit(kDefaultTotalBytesLimit, -1);
+- if (!ParseFromCodedStream(&decoder)) {
++ if (!user_dictionary_storage_base.ParseFromCodedStream(&decoder)) {
+ LOG(ERROR) << "Failed to parse";
+ if (!decoder.ConsumedEntireMessage() || !ifs.eof()) {
+ LOG(ERROR) << "ParseFromStream failed: file seems broken";
+@@ -142,11 +142,11 @@ bool UserDictionaryStorage::Load() {
+ }
+
+ // Check dictionary id here. if id is 0, assign random ID.
+- for (int i = 0; i < dictionaries_size(); ++i) {
+- const UserDictionary &dict = dictionaries(i);
++ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
++ const UserDictionary &dict = user_dictionary_storage_base.dictionaries(i);
+ if (dict.id() == 0) {
+- mutable_dictionaries(i)->set_id(
+- UserDictionaryUtil::CreateNewDictionaryId(*this));
++ user_dictionary_storage_base.mutable_dictionaries(i)->set_id(
++ UserDictionaryUtil::CreateNewDictionaryId(this->user_dictionary_storage_base));
+ }
+ }
+
+@@ -176,7 +176,7 @@ bool UserDictionaryStorage::Save() {
+ return false;
+ }
+
+- if (!SerializeToOstream(&ofs)) {
++ if (!user_dictionary_storage_base.SerializeToOstream(&ofs)) {
+ LOG(ERROR) << "SerializeToString failed";
+ last_error_type_ = SYNC_FAILURE;
+ return false;
+@@ -232,7 +232,7 @@ bool UserDictionaryStorage::ExportDictio
+ return false;
+ }
+
+- const UserDictionary &dic = dictionaries(index);
++ const UserDictionary &dic = user_dictionary_storage_base.dictionaries(index);
+ for (size_t i = 0; i < dic.entries_size(); ++i) {
+ const UserDictionaryEntry &entry = dic.entries(i);
+ ofs << entry.key() << "\t" << entry.value() << "\t"
+@@ -246,7 +246,7 @@ bool UserDictionaryStorage::ExportDictio
+ bool UserDictionaryStorage::CreateDictionary(
+ const string &dic_name, uint64 *new_dic_id) {
+ UserDictionaryCommandStatus::Status status =
+- UserDictionaryUtil::CreateDictionary(this, dic_name, new_dic_id);
++ UserDictionaryUtil::CreateDictionary(&this->user_dictionary_storage_base, dic_name, new_dic_id);
+ // Update last_error_type_
+ switch (status) {
+ case UserDictionaryCommandStatus::DICTIONARY_NAME_EMPTY:
+@@ -278,7 +278,7 @@ bool UserDictionaryStorage::CreateDictio
+ }
+
+ bool UserDictionaryStorage::DeleteDictionary(uint64 dic_id) {
+- if (!UserDictionaryUtil::DeleteDictionary(this, dic_id, NULL, NULL)) {
++ if (!UserDictionaryUtil::DeleteDictionary(&this->user_dictionary_storage_base, dic_id, NULL, NULL)) {
+ // Failed to delete dictionary.
+ last_error_type_ = INVALID_DICTIONARY_ID;
+ return false;
+@@ -309,8 +309,8 @@ bool UserDictionaryStorage::RenameDictio
+ return true;
+ }
+
+- for (int i = 0; i < dictionaries_size(); ++i) {
+- if (dic_name == dictionaries(i).name()) {
++ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
++ if (dic_name == user_dictionary_storage_base.dictionaries(i).name()) {
+ last_error_type_ = DUPLICATED_DICTIONARY_NAME;
+ LOG(ERROR) << "duplicated dictionary name";
+ return false;
+@@ -323,14 +323,14 @@ bool UserDictionaryStorage::RenameDictio
+ }
+
+ int UserDictionaryStorage::GetUserDictionaryIndex(uint64 dic_id) const {
+- return UserDictionaryUtil::GetUserDictionaryIndexById(*this, dic_id);
++ return UserDictionaryUtil::GetUserDictionaryIndexById(this->user_dictionary_storage_base, dic_id);
+ }
+
+ bool UserDictionaryStorage::GetUserDictionaryId(const string &dic_name,
+ uint64 *dic_id) {
+- for (size_t i = 0; i < dictionaries_size(); ++i) {
+- if (dic_name == dictionaries(i).name()) {
+- *dic_id = dictionaries(i).id();
++ for (size_t i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
++ if (dic_name == user_dictionary_storage_base.dictionaries(i).name()) {
++ *dic_id = user_dictionary_storage_base.dictionaries(i).id();
+ return true;
+ }
+ }
+@@ -340,7 +340,7 @@ bool UserDictionaryStorage::GetUserDicti
+
+ user_dictionary::UserDictionary *UserDictionaryStorage::GetUserDictionary(
+ uint64 dic_id) {
+- return UserDictionaryUtil::GetMutableUserDictionaryById(this, dic_id);
++ return UserDictionaryUtil::GetMutableUserDictionaryById(&this->user_dictionary_storage_base, dic_id);
+ }
+
+ UserDictionaryStorage::UserDictionaryStorageErrorType
+@@ -357,8 +357,8 @@ bool UserDictionaryStorage::AddToAutoReg
+ }
+
+ int auto_index = -1;
+- for (int i = 0; i < dictionaries_size(); ++i) {
+- if (dictionaries(i).name() == kAutoRegisteredDictionaryName) {
++ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
++ if (user_dictionary_storage_base.dictionaries(i).name() == kAutoRegisteredDictionaryName) {
+ auto_index = i;
+ break;
+ }
+@@ -366,17 +366,17 @@ bool UserDictionaryStorage::AddToAutoReg
+
+ UserDictionary *dic = NULL;
+ if (auto_index == -1) {
+- if (UserDictionaryUtil::IsStorageFull(*this)) {
++ if (UserDictionaryUtil::IsStorageFull(this->user_dictionary_storage_base)) {
+ last_error_type_ = TOO_MANY_DICTIONARIES;
+ LOG(ERROR) << "too many dictionaries";
+ UnLock();
+ return false;
+ }
+- dic = add_dictionaries();
+- dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(*this));
++ dic = user_dictionary_storage_base.add_dictionaries();
++ dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(this->user_dictionary_storage_base));
+ dic->set_name(kAutoRegisteredDictionaryName);
+ } else {
+- dic = mutable_dictionaries(auto_index);
++ dic = user_dictionary_storage_base.mutable_dictionaries(auto_index);
+ }
+
+ if (dic == NULL) {
+@@ -415,13 +415,13 @@ bool UserDictionaryStorage::AddToAutoReg
+ }
+
+ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
+- if (CountSyncableDictionaries(*this) == 0) {
++ if (CountSyncableDictionaries(this->user_dictionary_storage_base) == 0) {
+ return false;
+ }
+
+- for (int dictionary_index = dictionaries_size() - 1;
++ for (int dictionary_index = user_dictionary_storage_base.dictionaries_size() - 1;
+ dictionary_index >= 0; --dictionary_index) {
+- UserDictionary *dic = mutable_dictionaries(dictionary_index);
++ UserDictionary *dic = user_dictionary_storage_base.mutable_dictionaries(dictionary_index);
+ if (!dic->syncable()) {
+ continue;
+ }
+@@ -438,10 +438,10 @@ bool UserDictionaryStorage::ConvertSyncD
+
+ // Delete removed or unused sync dictionaries.
+ if (dic->removed() || dic->entries_size() == 0) {
+- for (int i = dictionary_index + 1; i < dictionaries_size(); ++i) {
+- mutable_dictionaries()->SwapElements(i - 1, i);
++ for (int i = dictionary_index + 1; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
++ user_dictionary_storage_base.mutable_dictionaries()->SwapElements(i - 1, i);
+ }
+- mutable_dictionaries()->RemoveLast();
++ user_dictionary_storage_base.mutable_dictionaries()->RemoveLast();
+ continue;
+ }
+
+@@ -450,7 +450,7 @@ bool UserDictionaryStorage::ConvertSyncD
+ kDictionaryNameConvertedFromSyncableDictionary;
+ int index = 0;
+ while (UserDictionaryUtil::ValidateDictionaryName(
+- *this, new_dictionary_name)
++ this->user_dictionary_storage_base, new_dictionary_name)
+ != UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
+ ++index;
+ new_dictionary_name = Util::StringPrintf(
+@@ -461,7 +461,7 @@ bool UserDictionaryStorage::ConvertSyncD
+ dic->set_syncable(false);
+ }
+
+- DCHECK_EQ(0, CountSyncableDictionaries(*this));
++ DCHECK_EQ(0, CountSyncableDictionaries(this->user_dictionary_storage_base));
+
+ return true;
+ }
+@@ -492,7 +492,7 @@ size_t UserDictionaryStorage::max_dictio
+ bool UserDictionaryStorage::IsValidDictionaryName(const string &name) {
+ UserDictionaryCommandStatus::Status status =
+ UserDictionaryUtil::ValidateDictionaryName(
+- UserDictionaryStorage::default_instance(), name);
++ user_dictionary::UserDictionaryStorage::default_instance(), name);
+
+ // Update last_error_type_.
+ switch (status) {
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.h
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.h:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage.h Fri Jun 19 05:45:30 2020
@@ -0,0 +1,25 @@
+$NetBSD: patch-dictionary_user__dictionary__storage.h,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_storage.h.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_storage.h
+@@ -72,13 +72,15 @@ namespace mozc {
+ class Mutex;
+ class ProcessMutex;
+
+-// Inherit from ProtocolBuffer
+-// TODO(hidehiko): Get rid of this implementation.
+-class UserDictionaryStorage : public user_dictionary::UserDictionaryStorage {
++class UserDictionaryStorage {
+ public:
+ typedef user_dictionary::UserDictionary UserDictionary;
+ typedef user_dictionary::UserDictionary::Entry UserDictionaryEntry;
+
++ // Instance of base class generated by Protocol Buffers compiler.
++ // Regular inheritance strongly discouraged.
++ user_dictionary::UserDictionaryStorage user_dictionary_storage_base;
++
+ enum UserDictionaryStorageErrorType {
+ USER_DICTIONARY_STORAGE_NO_ERROR = 0, // default
+ FILE_NOT_EXISTS,
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage__test.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage__test.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__storage__test.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,176 @@
+$NetBSD: patch-dictionary_user__dictionary__storage__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_storage_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_storage_test.cc
+@@ -135,7 +135,7 @@ TEST_F(UserDictionaryStorageTest, BasicO
+ }
+
+ for (size_t i = 0; i < kDictionariesSize; ++i) {
+- EXPECT_EQ(storage.mutable_dictionaries(i + dict_size),
++ EXPECT_EQ(storage.user_dictionary_storage_base.mutable_dictionaries(i + dict_size),
+ storage.GetUserDictionary(id[i]));
+ EXPECT_EQ(NULL, storage.GetUserDictionary(id[i] + 1));
+ }
+@@ -167,7 +167,7 @@ TEST_F(UserDictionaryStorageTest, BasicO
+ EXPECT_FALSE(storage.DeleteDictionary(0));
+
+ EXPECT_TRUE(storage.DeleteDictionary(id[1]));
+- EXPECT_EQ(kDictionariesSize + dict_size - 1, storage.dictionaries_size());
++ EXPECT_EQ(kDictionariesSize + dict_size - 1, storage.user_dictionary_storage_base.dictionaries_size());
+ }
+
+ TEST_F(UserDictionaryStorageTest, DeleteTest) {
+@@ -176,7 +176,7 @@ TEST_F(UserDictionaryStorageTest, Delete
+
+ // repeat 10 times
+ for (int i = 0; i < 10; ++i) {
+- storage.Clear();
++ storage.user_dictionary_storage_base.Clear();
+ std::vector<uint64> ids(100);
+ for (size_t i = 0; i < ids.size(); ++i) {
+ EXPECT_TRUE(storage.CreateDictionary(
+@@ -193,10 +193,10 @@ TEST_F(UserDictionaryStorageTest, Delete
+ alive.push_back(ids[i]);
+ }
+
+- EXPECT_EQ(alive.size(), storage.dictionaries_size());
++ EXPECT_EQ(alive.size(), storage.user_dictionary_storage_base.dictionaries_size());
+
+ for (size_t i = 0; i < alive.size(); ++i) {
+- EXPECT_EQ(alive[i], storage.dictionaries(i).id());
++ EXPECT_EQ(alive[i], storage.user_dictionary_storage_base.dictionaries(i).id());
+ }
+ }
+ }
+@@ -270,7 +270,7 @@ TEST_F(UserDictionaryStorageTest, Serial
+ const size_t entry_size = Util::Random(100) + 1;
+ for (size_t j = 0; j < entry_size; ++j) {
+ UserDictionaryStorage::UserDictionary *dic =
+- storage1.mutable_dictionaries(i);
++ storage1.user_dictionary_storage_base.mutable_dictionaries(i);
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+ dic->add_entries();
+ entry->set_key(GenRandomString(10));
+@@ -290,7 +290,7 @@ TEST_F(UserDictionaryStorageTest, Serial
+ EXPECT_TRUE(storage2.Load());
+ }
+
+- EXPECT_EQ(storage1.DebugString(), storage2.DebugString());
++ EXPECT_EQ(storage1.user_dictionary_storage_base.DebugString(), storage2.user_dictionary_storage_base.DebugString());
+ }
+ }
+
+@@ -354,7 +354,7 @@ TEST_F(UserDictionaryStorageTest, Conver
+ uint64 dict_id = 0;
+ ASSERT_TRUE(storage.CreateDictionary(data.dictionary_name, &dict_id));
+ UserDictionaryStorage::UserDictionary *dict =
+- storage.mutable_dictionaries(storage.GetUserDictionaryIndex(dict_id));
++ storage.user_dictionary_storage_base.mutable_dictionaries(storage.GetUserDictionaryIndex(dict_id));
+ dict->set_syncable(data.is_sync_dictionary);
+ dict->set_removed(data.is_removed_dictionary);
+ if (data.has_normal_entry) {
+@@ -371,7 +371,7 @@ TEST_F(UserDictionaryStorageTest, Conver
+ entry->set_removed(true);
+ }
+ }
+- EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage));
++ EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
+
+ ASSERT_TRUE(storage.ConvertSyncDictionariesToNormalDictionaries());
+
+@@ -389,12 +389,12 @@ TEST_F(UserDictionaryStorageTest, Conver
+ { true, kDictionaryNameConvertedFromSyncableDictionary },
+ };
+
+- EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage));
+- ASSERT_EQ(arraysize(expected_data), storage.dictionaries_size());
++ EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
++ ASSERT_EQ(arraysize(expected_data), storage.user_dictionary_storage_base.dictionaries_size());
+ for (size_t i = 0; i < arraysize(expected_data); ++i) {
+ SCOPED_TRACE(Util::StringPrintf("verify %d", static_cast<int>(i)));
+ const ExpectedData &expected = expected_data[i];
+- const UserDictionaryStorage::UserDictionary &dict = storage.dictionaries(i);
++ const UserDictionaryStorage::UserDictionary &dict = storage.user_dictionary_storage_base.dictionaries(i);
+
+ EXPECT_EQ(expected.dictionary_name, dict.name());
+ EXPECT_FALSE(dict.syncable());
+@@ -408,42 +408,42 @@ TEST_F(UserDictionaryStorageTest, Conver
+ }
+
+ // Test duplicated dictionary name.
+- storage.Clear();
++ storage.user_dictionary_storage_base.Clear();
+ {
+ uint64 dict_id = 0;
+ storage.CreateDictionary(
+ UserDictionaryStorage::default_sync_dictionary_name(), &dict_id);
+ storage.CreateDictionary(
+ kDictionaryNameConvertedFromSyncableDictionary, &dict_id);
+- ASSERT_EQ(2, storage.dictionaries_size());
++ ASSERT_EQ(2, storage.user_dictionary_storage_base.dictionaries_size());
+ UserDictionaryStorage::UserDictionary *dict;
+- dict = storage.mutable_dictionaries(0);
++ dict = storage.user_dictionary_storage_base.mutable_dictionaries(0);
+ dict->set_syncable(true);
+ dict->add_entries()->set_key("0");
+- dict = storage.mutable_dictionaries(1);
++ dict = storage.user_dictionary_storage_base.mutable_dictionaries(1);
+ dict->set_syncable(false);
+ dict->add_entries()->set_key("1");
+ }
+ ASSERT_TRUE(storage.ConvertSyncDictionariesToNormalDictionaries());
+- EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage));
+- EXPECT_EQ(2, storage.dictionaries_size());
++ EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
++ EXPECT_EQ(2, storage.user_dictionary_storage_base.dictionaries_size());
+ EXPECT_EQ(Util::StringPrintf("%s_1",
+ kDictionaryNameConvertedFromSyncableDictionary),
+- storage.dictionaries(0).name());
++ storage.user_dictionary_storage_base.dictionaries(0).name());
+ EXPECT_EQ(kDictionaryNameConvertedFromSyncableDictionary,
+- storage.dictionaries(1).name());
++ storage.user_dictionary_storage_base.dictionaries(1).name());
+ }
+
+ TEST_F(UserDictionaryStorageTest, AddToAutoRegisteredDictionary) {
+ {
+ UserDictionaryStorage storage(GetUserDictionaryFile());
+- EXPECT_EQ(0, storage.dictionaries_size());
++ EXPECT_EQ(0, storage.user_dictionary_storage_base.dictionaries_size());
+ EXPECT_TRUE(storage.AddToAutoRegisteredDictionary(
+ "key1", "value1", UserDictionary::NOUN));
+- EXPECT_EQ(1, storage.dictionaries_size());
+- EXPECT_EQ(1, storage.dictionaries(0).entries_size());
++ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
++ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
+ const UserDictionaryStorage::UserDictionaryEntry &entry1 =
+- storage.dictionaries(0).entries(0);
++ storage.user_dictionary_storage_base.dictionaries(0).entries(0);
+ EXPECT_EQ("key1", entry1.key());
+ EXPECT_EQ("value1", entry1.value());
+ EXPECT_EQ(UserDictionary::NOUN, entry1.pos());
+@@ -451,10 +451,10 @@ TEST_F(UserDictionaryStorageTest, AddToA
+
+ EXPECT_TRUE(storage.AddToAutoRegisteredDictionary(
+ "key2", "value2", UserDictionary::NOUN));
+- EXPECT_EQ(1, storage.dictionaries_size());
+- EXPECT_EQ(2, storage.dictionaries(0).entries_size());
++ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
++ EXPECT_EQ(2, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
+ const UserDictionaryStorage::UserDictionaryEntry &entry2 =
+- storage.dictionaries(0).entries(1);
++ storage.user_dictionary_storage_base.dictionaries(0).entries(1);
+ EXPECT_EQ("key2", entry2.key());
+ EXPECT_EQ("value2", entry2.value());
+ EXPECT_EQ(UserDictionary::NOUN, entry2.pos());
+@@ -478,7 +478,7 @@ TEST_F(UserDictionaryStorageTest, Export
+ {
+ UserDictionaryStorage storage(GetUserDictionaryFile());
+ {
+- UserDictionary *dictionary = storage.add_dictionaries();
++ UserDictionary *dictionary = storage.user_dictionary_storage_base.add_dictionaries();
+ dictionary->set_id(kDummyDictionaryId);
+ UserDictionary::Entry *entry = dictionary->add_entries();
+ entry->set_key("key");
Index: pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__test.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__test.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-dictionary_user__dictionary__test.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,212 @@
+$NetBSD: patch-dictionary_user__dictionary__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- dictionary/user_dictionary_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ dictionary/user_dictionary_test.cc
+@@ -336,9 +336,9 @@ class UserDictionaryTest : public ::test
+ std::istringstream is(contents);
+ CHECK(is.good());
+
+- storage->Clear();
++ storage->user_dictionary_storage_base.Clear();
+ UserDictionaryStorage::UserDictionary *dic
+- = storage->add_dictionaries();
++ = storage->user_dictionary_storage_base.add_dictionaries();
+ CHECK(dic);
+
+ string line;
+@@ -391,7 +391,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
+ {
+ UserDictionaryStorage storage("");
+ UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // A normal lookup operation.
+@@ -429,7 +429,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
+ {
+ UserDictionaryStorage storage("");
+ LoadFromString(kUserDictionary1, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // A normal lookup again.
+@@ -454,7 +454,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
+ {
+ UserDictionaryStorage storage("");
+ LoadFromString(kUserDictionary0, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // A normal lookup operation.
+@@ -486,7 +486,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
+ {
+ UserDictionaryStorage storage("");
+ LoadFromString(kUserDictionary1, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // A normal lookup.
+@@ -510,7 +510,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
+ {
+ UserDictionaryStorage storage("");
+ LoadFromString(kUserDictionary0, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // A normal lookup operation.
+@@ -547,7 +547,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
+ uint64 id = 0;
+ EXPECT_TRUE(storage.CreateDictionary("test", &id));
+ UserDictionaryStorage::UserDictionary *dic =
+- storage.mutable_dictionaries(0);
++ storage.user_dictionary_storage_base.mutable_dictionaries(0);
+
+ // "名詞"
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+@@ -562,7 +562,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
+ entry->set_value("suggest_only");
+ entry->set_pos(user_dictionary::UserDictionary::SUGGESTION_ONLY);
+
+- user_dic->Load(storage);
++ user_dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // "suggestion_only" should not be looked up.
+@@ -584,7 +584,7 @@ TEST_F(UserDictionaryTest, IncognitoMode
+ {
+ UserDictionaryStorage storage("");
+ UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ TestLookupPrefixHelper(NULL, 0, "start", 4, *dic);
+@@ -619,7 +619,7 @@ TEST_F(UserDictionaryTest, AsyncLoadTest
+ uint64 id = 0;
+ EXPECT_TRUE(storage.CreateDictionary("test", &id));
+ UserDictionaryStorage::UserDictionary *dic =
+- storage.mutable_dictionaries(0);
++ storage.user_dictionary_storage_base.mutable_dictionaries(0);
+ for (size_t j = 0; j < 10000; ++j) {
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+ dic->add_entries();
+@@ -727,12 +727,12 @@ TEST_F(UserDictionaryTest, AddToAutoRegi
+ {
+ UserDictionaryStorage storage(filename);
+ EXPECT_TRUE(storage.Load());
+- EXPECT_EQ(1, storage.dictionaries_size());
+- EXPECT_EQ(1, storage.dictionaries(0).entries_size());
+- EXPECT_EQ("key", storage.dictionaries(0).entries(0).key());
+- EXPECT_EQ("value", storage.dictionaries(0).entries(0).value());
++ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
++ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
++ EXPECT_EQ("key", storage.user_dictionary_storage_base.dictionaries(0).entries(0).key());
++ EXPECT_EQ("value", storage.user_dictionary_storage_base.dictionaries(0).entries(0).value());
+ EXPECT_EQ(user_dictionary::UserDictionary::NOUN,
+- storage.dictionaries(0).entries(0).pos());
++ storage.user_dictionary_storage_base.dictionaries(0).entries(0).pos());
+ }
+ }
+
+@@ -751,7 +751,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
+ uint64 id = 0;
+ EXPECT_TRUE(storage.CreateDictionary("test", &id));
+ UserDictionaryStorage::UserDictionary *dic =
+- storage.mutable_dictionaries(0);
++ storage.user_dictionary_storage_base.mutable_dictionaries(0);
+ for (size_t j = 0; j < 10000; ++j) {
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+ dic->add_entries();
+@@ -775,7 +775,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
+
+ suppression_dictionary_->Lock();
+ EXPECT_TRUE(suppression_dictionary_->IsLocked());
+- user_dic->Load(storage);
++ user_dic->Load(storage.user_dictionary_storage_base);
+ EXPECT_FALSE(suppression_dictionary_->IsLocked());
+
+ for (size_t j = 0; j < 10; ++j) {
+@@ -787,11 +787,11 @@ TEST_F(UserDictionaryTest, TestSuppressi
+
+ // Remove suppression entry
+ {
+- storage.Clear();
++ storage.user_dictionary_storage_base.Clear();
+ uint64 id = 0;
+ EXPECT_TRUE(storage.CreateDictionary("test", &id));
+ UserDictionaryStorage::UserDictionary *dic =
+- storage.mutable_dictionaries(0);
++ storage.user_dictionary_storage_base.mutable_dictionaries(0);
+ for (size_t j = 0; j < 10000; ++j) {
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+ dic->add_entries();
+@@ -803,7 +803,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
+ }
+
+ suppression_dictionary_->Lock();
+- user_dic->Load(storage);
++ user_dic->Load(storage.user_dictionary_storage_base);
+ EXPECT_FALSE(suppression_dictionary_->IsLocked());
+
+ for (size_t j = 0; j < 10; ++j) {
+@@ -830,7 +830,7 @@ TEST_F(UserDictionaryTest, TestSuggestio
+ uint64 id = 0;
+ EXPECT_TRUE(storage.CreateDictionary("test", &id));
+ UserDictionaryStorage::UserDictionary *dic =
+- storage.mutable_dictionaries(0);
++ storage.user_dictionary_storage_base.mutable_dictionaries(0);
+
+ for (size_t j = 0; j < 10; ++j) {
+ UserDictionaryStorage::UserDictionaryEntry *entry =
+@@ -850,7 +850,7 @@ TEST_F(UserDictionaryTest, TestSuggestio
+ entry->set_pos(user_dictionary::UserDictionary::SUGGESTION_ONLY);
+ }
+
+- user_dic->Load(storage);
++ user_dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ {
+@@ -883,7 +883,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
+ UserDictionaryStorage storage("");
+
+ {
+- UserDictionaryStorage::UserDictionary *dic1 = storage.add_dictionaries();
++ UserDictionaryStorage::UserDictionary *dic1 = storage.user_dictionary_storage_base.add_dictionaries();
+ CHECK(dic1);
+ UserDictionaryStorage::UserDictionaryEntry *entry;
+ entry = dic1->add_entries();
+@@ -898,7 +898,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
+ entry->set_pos(user_dictionary::UserDictionary::NOUN);
+ }
+ {
+- UserDictionaryStorage::UserDictionary *dic2 = storage.add_dictionaries();
++ UserDictionaryStorage::UserDictionary *dic2 = storage.user_dictionary_storage_base.add_dictionaries();
+ CHECK(dic2);
+ UserDictionaryStorage::UserDictionaryEntry *entry;
+ entry = dic2->add_entries();
+@@ -917,7 +917,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
+ entry->set_value("value5");
+ entry->set_pos(user_dictionary::UserDictionary::NOUN);
+ }
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+
+ EXPECT_INTEGER_STATS("UserRegisteredWord", 5);
+ }
+@@ -930,7 +930,7 @@ TEST_F(UserDictionaryTest, LookupComment
+ {
+ UserDictionaryStorage storage("");
+ UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
+- dic->Load(storage);
++ dic->Load(storage.user_dictionary_storage_base);
+ }
+
+ // Entry is in user dictionary but has no comment.
Index: pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.h
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.h:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor.h Fri Jun 19 05:45:30 2020
@@ -0,0 +1,23 @@
+$NetBSD: patch-prediction_user__history__predictor.h,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- prediction/user_history_predictor.h.orig 2017-11-02 13:32:47.000000000 +0000
++++ prediction/user_history_predictor.h
+@@ -61,11 +61,15 @@ class Segments;
+ class UserHistoryPredictorSyncer;
+
+ // Added serialization method for UserHistory.
+-class UserHistoryStorage : public mozc::user_history_predictor::UserHistory {
++class UserHistoryStorage {
+ public:
+ explicit UserHistoryStorage(const string &filename);
+ ~UserHistoryStorage();
+
++ // Instance of base class generated by Protocol Buffers compiler.
++ // Regular inheritance strongly discouraged.
++ mozc::user_history_predictor::UserHistory user_history_base;
++
+ // Loads from encrypted file.
+ bool Load();
+
Index: pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor__test.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor__test.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-prediction_user__history__predictor__test.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,24 @@
+$NetBSD: patch-prediction_user__history__predictor__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- prediction/user_history_predictor_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ prediction/user_history_predictor_test.cc
+@@ -2715,7 +2715,7 @@ TEST_F(UserHistoryPredictorTest, UserHis
+
+ UserHistoryStorage storage1(filename);
+
+- UserHistoryPredictor::Entry *entry = storage1.add_entries();
++ UserHistoryPredictor::Entry *entry = storage1.user_history_base.add_entries();
+ CHECK(entry);
+ entry->set_key("key");
+ entry->set_key("value");
+@@ -2723,7 +2723,7 @@ TEST_F(UserHistoryPredictorTest, UserHis
+ UserHistoryStorage storage2(filename);
+ storage2.Load();
+
+- EXPECT_EQ(storage1.DebugString(), storage2.DebugString());
++ EXPECT_EQ(storage1.user_history_base.DebugString(), storage2.user_history_base.DebugString());
+ FileUtil::Unlink(filename);
+ }
+
Index: pkgsrc/inputmethod/mozc-server/patches/patch-rewriter_usage__rewriter__test.cc
diff -u /dev/null pkgsrc/inputmethod/mozc-server/patches/patch-rewriter_usage__rewriter__test.cc:1.1
--- /dev/null Fri Jun 19 05:45:30 2020
+++ pkgsrc/inputmethod/mozc-server/patches/patch-rewriter_usage__rewriter__test.cc Fri Jun 19 05:45:30 2020
@@ -0,0 +1,24 @@
+$NetBSD: patch-rewriter_usage__rewriter__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
+
+Fix from https://github.com/google/mozc/issues/460
+
+--- rewriter/usage_rewriter_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
++++ rewriter/usage_rewriter_test.cc
+@@ -478,7 +478,7 @@ TEST_F(UsageRewriterTest, CommentFromUse
+ // Load mock data
+ {
+ UserDictionaryStorage storage("");
+- UserDictionaryStorage::UserDictionary *dic = storage.add_dictionaries();
++ UserDictionaryStorage::UserDictionary *dic = storage.user_dictionary_storage_base.add_dictionaries();
+
+ UserDictionaryStorage::UserDictionaryEntry *entry = dic->add_entries();
+ // key="うま", value="アルパカ", comment="アルパカコメント"
+@@ -488,7 +488,7 @@ TEST_F(UsageRewriterTest, CommentFromUse
+ entry->set_comment("\xE3\x82\xA2\xE3\x83\xAB\xE3\x83\x91\xE3\x82\xAB\xE3"
+ "\x82\xB3\xE3\x83\xA1\xE3\x83\xB3\xE3\x83\x88");
+
+- user_dictionary_->Load(storage);
++ user_dictionary_->Load(storage.user_dictionary_storage_base);
+ }
+
+ // Emulates the conversion of key="うま".
Home |
Main Index |
Thread Index |
Old Index