diff --git a/app-i18n/mozc/mozc-2.23.2785.102.9.recipe b/app-i18n/mozc/mozc-2.26.4451.1.recipe similarity index 69% rename from app-i18n/mozc/mozc-2.23.2785.102.9.recipe rename to app-i18n/mozc/mozc-2.26.4451.1.recipe index 0728c3eb0..e78e19e29 100644 --- a/app-i18n/mozc/mozc-2.23.2785.102.9.recipe +++ b/app-i18n/mozc/mozc-2.26.4451.1.recipe @@ -1,21 +1,18 @@ SUMMARY="Japanese input method editor" DESCRIPTION="A Japanese Input Method Editor (IME) designed for multi-platform. \ -This is open source version." +This is open source version. \ +Mozcdic-ut dictionary is contained which adds over 1,000,000 entries \ +to mozc dictionary." HOMEPAGE="https://github.com/google/mozc" -COPYRIGHT="2010-2018 Google Inc." -LICENSE="BSD (3-clause)" -REVISION="4" +COPYRIGHT="2010-2021 Google Inc. + 2021 Utumi Hirosi" +LICENSE="BSD (3-clause) + Apache v2" +REVISION="1" SOURCE_URI="https://github.com/hanya/mozc/releases/download/v$portVersion/mozc-v$portVersion.tar.bz2" -CHECKSUM_SHA256="15785beb91e8ab78728bc85c1e5d8a8a6e17aa64a3c5399339d200679bbcad6a" +CHECKSUM_SHA256="745a8d91bbdfb6eab44e22f89b58add79b012e994ffdb233e2468d7accc73ec3" SOURCE_DIR="mozc" PATCHES="mozc-$portVersion.patchset" -if [ "$effectiveTargetArchitecture" = x86 ]; then - PATCHES+=" - mozc-$portVersion-x86.patch" -fi -zinniaTomoeVersion="0.6.0-20080911" -SOURCE_URI_2="https://downloads.sourceforge.net/zinnia/zinnia-tomoe-$zinniaTomoeVersion.tar.bz2" -CHECKSUM_SHA256_2="fd1a264b8aeea0ebec59e8c8765864a9543a75fb2dba349745bb3a3587790927" ARCHITECTURES="!x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86" @@ -39,9 +36,10 @@ BUILD_PREREQUIRES=" cmd:ninja cmd:pkg_config$secondaryArchSuffix cmd:protoc$secondaryArchSuffix - cmd:python2 + cmd:python3 cmd:which cmd:xres + six_python3 " if [ "$targetArchitecture" = x86_gcc2 ]; then BUILD_PREREQUIRES+=" @@ -53,22 +51,22 @@ BUILD() { cd src + cat third_party/mozcdic-ut/mozcdic-ut-20210725.txt >> \ + $sourceDir/src/data/dictionary_oss/dictionary00.txt + GYP_DEFINES="document_dir=$dataDir/mozc \ - zinnia_model_file=$dataDir/mozc/zinnia/handwriting-ja.model \ - zinnia_tomoe_dir=$sourceDir2/zinnia-tomoe-$zinniaTomoeVersion \ enable_gtk_renderer=0 \ target_x86_gcc2=$targetArchitecture" \ - $portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py gyp \ + $portPackageLinksDir/cmd~python3/bin/python3 build_mozc.py gyp \ --target_platform=Linux --variant=Haiku --noqt \ --server_dir=$dataDir/mozc - $portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py build \ + $portPackageLinksDir/cmd~python3/bin/python3 build_mozc.py build \ -c Release \ server/server.gyp:mozc_server \ emacs/emacs.gyp:mozc_emacs_helper \ input_method/input_method.gyp:mozc \ - haiku_gui/haiku_gui.gyp:mozc_tool_haiku \ - zinnia_model/zinnia_model.gyp:zinnia_model + haiku_gui/haiku_gui.gyp:mozc_tool_haiku } INSTALL() @@ -81,7 +79,6 @@ else InputMethodDir=$addOnsDir/input_server/methods fi mkdir -p $MozcDataDir - mkdir -p $MozcDataDir/zinnia mkdir -p $MozcDataDir/images mkdir -p $dataDir/locale/catalogs/x-vnd.Mozc-InputMethod mkdir -p $dataDir/locale/catalogs/x-vnd.Mozc-MozcTool @@ -93,8 +90,6 @@ if [ "$targetArchitecture" = x86_gcc2 ]; then fi cp $MozcOutDir/mozc_server $MozcDataDir/mozc_server cp $MozcOutDir/mozc_tool_haiku $MozcDataDir/mozc_tool - cp $MozcOutDir/handwriting-ja.model \ - $MozcDataDir/zinnia/handwriting-ja.model cp $MozcOutDir/mozc_emacs_helper $MozcDataDir/mozc_emacs_helper cp src/data/installer/credits_en.html $MozcDataDir/credits_en.html cp src/data/images/product_icon_32bpp-128.png \ @@ -110,5 +105,5 @@ TEST() { cd src # Some tests fails with job > 1 - python2 build_mozc.py runtests -c Release --test_jobs 1 + python3 build_mozc.py runtests -c Release --test_jobs 1 } diff --git a/app-i18n/mozc/patches/mozc-2.23.2785.102.9-x86.patch b/app-i18n/mozc/patches/mozc-2.23.2785.102.9-x86.patch deleted file mode 100644 index ee2cbb4d3..000000000 --- a/app-i18n/mozc/patches/mozc-2.23.2785.102.9-x86.patch +++ /dev/null @@ -1,167 +0,0 @@ -diff --git a/src/base/port.h b/src/base/port.h -index ec4139b5..d90e7485 100644 ---- a/src/base/port.h -+++ b/src/base/port.h -@@ -96,6 +96,9 @@ using uint16 = uint16_t; - using uint32 = uint32_t; - using uint64 = uint64_t; - #else // OS_HAIKU -+#if __HAIKU_ARCH == x86 -+#include -+#else - using int8 = int8_t; - using int16 = int16_t; - using int32 = int32_t; -@@ -108,6 +111,7 @@ using uint32 = uint32_t; - #ifndef uint64 - using uint64 = __haiku_uint64; - #endif -+#endif // __HAIKU_ARCH_ABI - #endif // OS_HAIKU - #endif // OS_WIN - using char32 = uint32; -diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc -index 5c5a8e7b..f659fd6c 100644 ---- a/src/converter/candidate_filter.cc -+++ b/src/converter/candidate_filter.cc -@@ -418,9 +418,9 @@ CandidateFilter::ResultType CandidateFilter::FilterCandidateInternal( - } - } - -- const int64 top_cost = std::max(kMinCost, top_candidate_->cost); -+ const int64 top_cost = std::max(kMinCost, (int)top_candidate_->cost); - const int64 top_structure_cost = -- std::max(kMinCost, top_candidate_->structure_cost); -+ std::max(kMinCost, (int)top_candidate_->structure_cost); - - // If candidate size < 3, don't filter candidate aggressively - // TOOD(taku): This is a tentative workaround for the case where -diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc -index 23e941df..1b96a0f8 100644 ---- a/src/converter/immutable_converter.cc -+++ b/src/converter/immutable_converter.cc -@@ -480,7 +480,7 @@ bool ImmutableConverterImpl::ResegmentArabicNumberAndSuffix( - - // do -1 so that resegmented nodes are boosted - // over compound node. -- const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0); -+ const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0); - - Node *number_node = lattice->NewNode(); - CHECK(number_node); -@@ -557,7 +557,7 @@ bool ImmutableConverterImpl::ResegmentPrefixAndArabicNumber( - - // do -1 so that resegmented nodes are boosted - // over compound node. -- const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0); -+ const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0); - - Node *prefix_node = lattice->NewNode(); - CHECK(prefix_node); -@@ -1690,10 +1690,10 @@ void ImmutableConverterImpl::InsertFirstSegmentToCandidates( - // cost penalty based on the cost diff. - const Segment &first_segment = segments->conversion_segment(0); - const int base_cost_diff = std::max( -- 0, (first_segment.candidate(0).cost - -+ (long int)0, (first_segment.candidate(0).cost - - first_segment.candidate(only_first_segment_candidate_pos).cost)); - const int base_wcost_diff = std::max( -- 0, (first_segment.candidate(0).wcost - -+ (long int)0, (first_segment.candidate(0).wcost - - first_segment.candidate(only_first_segment_candidate_pos).wcost)); - for (size_t i = only_first_segment_candidate_pos; - i < first_segment.candidates_size();) { -diff --git a/src/gui/character_pad/character_palette.cc b/src/gui/character_pad/character_palette.cc -index ee2a4f3a..a40e50cb 100644 ---- a/src/gui/character_pad/character_palette.cc -+++ b/src/gui/character_pad/character_palette.cc -@@ -333,7 +333,7 @@ void CharacterPalette::showUnicodeTableByRange(const UnicodeRange &range) { - for (char32 ucs4 = range.first; ucs4 <= range.last; ++ucs4) { - const char32 ucs4s[] = { ucs4 }; - QTableWidgetItem *item = -- new QTableWidgetItem(QString::fromUcs4(ucs4s, arraysize(ucs4s))); -+ new QTableWidgetItem(QString::fromUcs4((const char32_t*)ucs4s, arraysize(ucs4s))); - item->setTextAlignment(Qt::AlignCenter); - tableWidget->setItem(ucs4 / kHexBase - offset, ucs4 % kHexBase, item); - tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); -diff --git a/src/session/session_handler.cc b/src/session/session_handler.cc -index e32f9c43..fc69e5be 100644 ---- a/src/session/session_handler.cc -+++ b/src/session/session_handler.cc -@@ -196,7 +196,7 @@ void SessionHandler::Init( - config::ConfigHandler::GetConfig(config_.get()); - - // allow [2..128] sessions -- max_session_size_ = std::max(2, std::min(FLAGS_max_session_size, 128)); -+ max_session_size_ = std::max((int32)2, std::min(FLAGS_max_session_size, (int32)128)); - session_map_.reset(new SessionMap(max_session_size_)); - - if (!engine_) { -@@ -626,7 +626,7 @@ bool SessionHandler::CreateSession(commands::Command *command) { - // prevent DOS attack - // don't allow CreateSession in very short period. - const int create_session_minimum_interval = -- std::max(0, std::min(FLAGS_create_session_min_interval, 10)); -+ std::max((int32)0, std::min(FLAGS_create_session_min_interval, (int32)10)); - - uint64 current_time = Clock::GetTime(); - if (last_create_session_time_ != 0 && -@@ -754,11 +754,11 @@ bool SessionHandler::Cleanup(commands::Command *command) { - // allow [1..600] sec. default: 300 - const uint64 create_session_timeout = - suspend_time + -- std::max(1, std::min(FLAGS_last_create_session_timeout, 600)); -+ std::max((int32)1, std::min(FLAGS_last_create_session_timeout, (int32)600)); - - // allow [10..7200] sec. default 3600 - const uint64 last_command_timeout = -- suspend_time + std::max(10, std::min(FLAGS_last_command_timeout, 7200)); -+ suspend_time + std::max((int32)10, std::min(FLAGS_last_command_timeout, (int32)7200)); - - std::vector remove_ids; - for (SessionElement *element = -diff --git a/src/session/session_watch_dog.cc b/src/session/session_watch_dog.cc -index ad6571b3..7cfe7c02 100644 ---- a/src/session/session_watch_dog.cc -+++ b/src/session/session_watch_dog.cc -@@ -67,7 +67,7 @@ SessionWatchDog::SessionWatchDog(int32 interval_sec) - : interval_sec_(interval_sec), - client_(NULL), cpu_stats_(NULL), event_(new UnnamedEvent) { - // allow [1..600]. -- interval_sec_ = std::max(1, std::min(interval_sec_, 600)); -+ interval_sec_ = std::max((int32)1, std::min(interval_sec_, (int32)600)); - DCHECK(event_->IsAvailable()) - << "Unnamed event is not available"; - } -@@ -128,13 +128,13 @@ void SessionWatchDog::Run() { - DCHECK_GE(number_of_processors, 1); - - // the first (interval_sec_ - 60) sec: -> Do nothing -- const int32 idle_interval_msec = std::max(0, (interval_sec_ - 60)) * 1000; -+ const int32 idle_interval_msec = std::max((int32)0, (interval_sec_ - (int32)60)) * 1000; - - // last 60 sec: -> check CPU usage -- const int32 cpu_check_interval_msec = std::min(60, interval_sec_) * 1000; -+ const int32 cpu_check_interval_msec = std::min((int32)60, interval_sec_) * 1000; - - // for every 5 second, get CPU load percentage -- const int32 cpu_check_duration_msec = std::min(5, interval_sec_) * 1000; -+ const int32 cpu_check_duration_msec = std::min((int32)5, interval_sec_) * 1000; - - std::fill(cpu_loads, cpu_loads + arraysize(cpu_loads), 0.0); - -diff --git a/src/usage_stats/usage_stats.cc b/src/usage_stats/usage_stats.cc -index 0880bd5e..65fb65a4 100644 ---- a/src/usage_stats/usage_stats.cc -+++ b/src/usage_stats/usage_stats.cc -@@ -174,8 +174,8 @@ void UsageStats::UpdateTiming(const string &name, uint32 val) { - stats.set_num_timings(stats.num_timings() + 1); - stats.set_total_time(stats.total_time() + val); - stats.set_avg_time(stats.total_time() / stats.num_timings()); -- stats.set_min_time(std::min(stats.min_time(), val)); -- stats.set_max_time(std::max(stats.max_time(), val)); -+ stats.set_min_time(std::min(stats.min_time(), (google::protobuf::uint32)val)); -+ stats.set_max_time(std::max(stats.max_time(), (google::protobuf::uint32)val)); - } else { - stats.set_name(name); - stats.set_type(Stats::TIMING); diff --git a/app-i18n/mozc/patches/mozc-2.23.2785.102.9.patchset b/app-i18n/mozc/patches/mozc-2.23.2785.102.9.patchset deleted file mode 100644 index 698c3f7b2..000000000 --- a/app-i18n/mozc/patches/mozc-2.23.2785.102.9.patchset +++ /dev/null @@ -1,1137 +0,0 @@ -From f6bfd36134d29385f9637526dd34ec4dcceeb789 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Wed, 20 Nov 2019 18:32:30 +0100 -Subject: gentoo patch - - -diff --git a/src/dictionary/user_dictionary.cc b/src/dictionary/user_dictionary.cc -index 475f7a4..0bd7624 100644 ---- a/src/dictionary/user_dictionary.cc -+++ b/src/dictionary/user_dictionary.cc -@@ -289,7 +289,7 @@ class UserDictionary::UserDictionaryReloader : public Thread { - } - - auto_register_mode_ = false; -- dic_->Load(*(storage.get())); -+ dic_->Load(storage.get()->user_dictionary_storage_base); - } - - private: -diff --git a/src/dictionary/user_dictionary_session.cc b/src/dictionary/user_dictionary_session.cc -index f2ed5eb..ce944fc 100644 ---- a/src/dictionary/user_dictionary_session.cc -+++ b/src/dictionary/user_dictionary_session.cc -@@ -69,11 +69,11 @@ class UndoCreateDictionaryCommand : public UserDictionarySession::UndoCommand { - } - - 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 : public UserDictionarySession::UndoCommand { - } - - RepeatedPtrField *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 UndoDeleteDictionaryWithEnsuringNonEmptyStorageCommand - } - - 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 : public UserDictionarySession::UndoCommand { - 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 UserDictionarySession::UndoCommand { - 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 UserDictionarySession::UndoCommand { - 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 UserDictionarySession::UndoCommand { - 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 : public UserDictionarySession::UndoCommand { - 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::~UserDictionarySession() { - - // 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 UserDictionarySession::CreateDictionary( - 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::DeleteDictionaryInternal( - 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 UserDictionarySession::RenameDictionary( - 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 UserDictionarySession::AddEntry( - 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 UserDictionarySession::EditEntry( - 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 UserDictionarySession::DeleteEntry( - uint64 dictionary_id, const std::vector &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 UserDictionarySession::ImportFromString( - 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::ImportToNewDictionaryFromString( - 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::ImportToNewDictionaryFromString( - - 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::ImportToNewDictionaryFromString( - } - - 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::EnsureNonEmptyStorage() { - 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::AddUndoCommand(UndoCommand *undo_command) { - - void UserDictionarySession::ClearDictionariesAndUndoHistory() { - ScopedUserDictionaryLocker l(storage_.get()); -- storage_->clear_dictionaries(); -+ storage_->user_dictionary_storage_base.clear_dictionaries(); - ClearUndoHistory(); - } - -diff --git a/src/dictionary/user_dictionary_session_test.cc b/src/dictionary/user_dictionary_session_test.cc -index a99fa1f..28bce34 100644 ---- a/src/dictionary/user_dictionary_session_test.cc -+++ b/src/dictionary/user_dictionary_session_test.cc -@@ -95,12 +95,12 @@ TEST_F(UserDictionarySessionTest, SaveAndLoad) { - - 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()); - -@@ -130,7 +130,7 @@ TEST_F(UserDictionarySessionTest, DISABLED_HugeFileSave) { - - // 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) { -@@ -147,7 +147,7 @@ TEST_F(UserDictionarySessionTest, DISABLED_HugeFileSave) { - 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()); - -@@ -191,7 +191,7 @@ TEST_F(UserDictionarySessionTest, CreateDictionary) { - - 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)); -@@ -204,7 +204,7 @@ TEST_F(UserDictionarySessionTest, DeleteDictionary) { - 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); - } - -@@ -229,7 +229,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); - } - -diff --git a/src/dictionary/user_dictionary_storage.cc b/src/dictionary/user_dictionary_storage.cc -index 3c09f4d..b6efd91 100644 ---- a/src/dictionary/user_dictionary_storage.cc -+++ b/src/dictionary/user_dictionary_storage.cc -@@ -109,7 +109,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"; -@@ -137,11 +137,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)); - } - } - -@@ -171,7 +171,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; -@@ -227,7 +227,7 @@ bool UserDictionaryStorage::ExportDictionary( - 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" -@@ -241,7 +241,7 @@ bool UserDictionaryStorage::ExportDictionary( - 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: -@@ -273,7 +273,7 @@ bool UserDictionaryStorage::CreateDictionary( - } - - 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; -@@ -304,8 +304,8 @@ bool UserDictionaryStorage::RenameDictionary(uint64 dic_id, - 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; -@@ -318,14 +318,14 @@ bool UserDictionaryStorage::RenameDictionary(uint64 dic_id, - } - - 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; - } - } -@@ -335,7 +335,7 @@ bool UserDictionaryStorage::GetUserDictionaryId(const string &dic_name, - - 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 -@@ -352,8 +352,8 @@ bool UserDictionaryStorage::AddToAutoRegisteredDictionary( - } - - 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; - } -@@ -361,17 +361,17 @@ bool UserDictionaryStorage::AddToAutoRegisteredDictionary( - - 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) { -@@ -410,13 +410,13 @@ bool UserDictionaryStorage::AddToAutoRegisteredDictionary( - } - - 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; - } -@@ -433,10 +433,10 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() { - - // 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; - } - -@@ -445,7 +445,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() { - 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( -@@ -456,7 +456,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() { - dic->set_syncable(false); - } - -- DCHECK_EQ(0, CountSyncableDictionaries(*this)); -+ DCHECK_EQ(0, CountSyncableDictionaries(this->user_dictionary_storage_base)); - - return true; - } -@@ -487,7 +487,7 @@ size_t UserDictionaryStorage::max_dictionary_size() { - 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) { -diff --git a/src/dictionary/user_dictionary_storage.h b/src/dictionary/user_dictionary_storage.h -index e4a0922..e3c7d3a 100644 ---- a/src/dictionary/user_dictionary_storage.h -+++ b/src/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, -diff --git a/src/dictionary/user_dictionary_storage_test.cc b/src/dictionary/user_dictionary_storage_test.cc -index 080f6bf..f95366c 100644 ---- a/src/dictionary/user_dictionary_storage_test.cc -+++ b/src/dictionary/user_dictionary_storage_test.cc -@@ -118,13 +118,13 @@ TEST_F(UserDictionaryStorageTest, BasicOperationsTest) { - const size_t kDictionariesSize = 3; - uint64 id[kDictionariesSize]; - -- const size_t dict_size = storage.dictionaries_size(); -+ const size_t dict_size = storage.user_dictionary_storage_base.dictionaries_size(); - - for (size_t i = 0; i < kDictionariesSize; ++i) { - EXPECT_TRUE(storage.CreateDictionary( - "test" + std::to_string(static_cast(i)), - &id[i])); -- EXPECT_EQ(i + 1 + dict_size, storage.dictionaries_size()); -+ EXPECT_EQ(i + 1 + dict_size, storage.user_dictionary_storage_base.dictionaries_size()); - } - - for (size_t i = 0; i < kDictionariesSize; ++i) { -@@ -133,7 +133,7 @@ TEST_F(UserDictionaryStorageTest, BasicOperationsTest) { - } - - 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)); - } -@@ -165,7 +165,7 @@ TEST_F(UserDictionaryStorageTest, BasicOperationsTest) { - 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) { -@@ -174,7 +174,7 @@ TEST_F(UserDictionaryStorageTest, DeleteTest) { - - // repeat 10 times - for (int i = 0; i < 10; ++i) { -- storage.Clear(); -+ storage.user_dictionary_storage_base.Clear(); - std::vector ids(100); - for (size_t i = 0; i < ids.size(); ++i) { - EXPECT_TRUE(storage.CreateDictionary( -@@ -191,10 +191,10 @@ TEST_F(UserDictionaryStorageTest, DeleteTest) { - 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()); - } - } - } -@@ -268,7 +268,7 @@ TEST_F(UserDictionaryStorageTest, SerializeTest) { - 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)); -@@ -288,7 +288,7 @@ TEST_F(UserDictionaryStorageTest, SerializeTest) { - EXPECT_TRUE(storage2.Load()); - } - -- EXPECT_EQ(storage1.DebugString(), storage2.DebugString()); -+ EXPECT_EQ(storage1.user_dictionary_storage_base.DebugString(), storage2.user_dictionary_storage_base.DebugString()); - } - } - -@@ -352,7 +352,7 @@ TEST_F(UserDictionaryStorageTest, ConvertSyncDictionariesToNormalDictionaries) { - 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) { -@@ -369,7 +369,7 @@ TEST_F(UserDictionaryStorageTest, ConvertSyncDictionariesToNormalDictionaries) { - entry->set_removed(true); - } - } -- EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage)); -+ EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base)); - - ASSERT_TRUE(storage.ConvertSyncDictionariesToNormalDictionaries()); - -@@ -385,12 +385,12 @@ TEST_F(UserDictionaryStorageTest, ConvertSyncDictionariesToNormalDictionaries) { - { 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(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()); -@@ -404,42 +404,42 @@ TEST_F(UserDictionaryStorageTest, ConvertSyncDictionariesToNormalDictionaries) { - } - - // 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()); -@@ -447,10 +447,10 @@ TEST_F(UserDictionaryStorageTest, AddToAutoRegisteredDictionary) { - - 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()); -@@ -474,7 +474,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"); -diff --git a/src/dictionary/user_dictionary_test.cc b/src/dictionary/user_dictionary_test.cc -index d2559e3..4a3ca36 100644 ---- a/src/dictionary/user_dictionary_test.cc -+++ b/src/dictionary/user_dictionary_test.cc -@@ -333,9 +333,9 @@ class UserDictionaryTest : public ::testing::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; -@@ -388,7 +388,7 @@ TEST_F(UserDictionaryTest, TestLookupPredictive) { - { - UserDictionaryStorage storage(""); - UserDictionaryTest::LoadFromString(kUserDictionary0, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - // A normal lookup operation. -@@ -424,7 +424,7 @@ TEST_F(UserDictionaryTest, TestLookupPredictive) { - { - UserDictionaryStorage storage(""); - LoadFromString(kUserDictionary1, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - // A normal lookup again. -@@ -449,7 +449,7 @@ TEST_F(UserDictionaryTest, TestLookupPrefix) { - { - UserDictionaryStorage storage(""); - LoadFromString(kUserDictionary0, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - // A normal lookup operation. -@@ -479,7 +479,7 @@ TEST_F(UserDictionaryTest, TestLookupPrefix) { - { - UserDictionaryStorage storage(""); - LoadFromString(kUserDictionary1, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - // A normal lookup. -@@ -503,7 +503,7 @@ TEST_F(UserDictionaryTest, TestLookupExact) { - { - UserDictionaryStorage storage(""); - LoadFromString(kUserDictionary0, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - // A normal lookup operation. -@@ -539,7 +539,7 @@ TEST_F(UserDictionaryTest, TestLookupExactWithSuggestionOnlyWords) { - 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 = -@@ -554,7 +554,7 @@ TEST_F(UserDictionaryTest, TestLookupExactWithSuggestionOnlyWords) { - 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. -@@ -576,7 +576,7 @@ TEST_F(UserDictionaryTest, IncognitoModeTest) { - { - UserDictionaryStorage storage(""); - UserDictionaryTest::LoadFromString(kUserDictionary0, &storage); -- dic->Load(storage); -+ dic->Load(storage.user_dictionary_storage_base); - } - - TestLookupPrefixHelper(nullptr, 0, "start", 4, *dic); -@@ -611,7 +611,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(); -@@ -678,15 +678,15 @@ TEST_F(UserDictionaryTest, AddToAutoRegisteredDictionary) { - UserDictionaryStorage storage(filename); - EXPECT_TRUE(storage.Load()); - int index = 0; -- EXPECT_EQ(1, storage.dictionaries_size()); -- EXPECT_EQ(100, storage.dictionaries(index).entries_size()); -+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size()); -+ EXPECT_EQ(100, storage.user_dictionary_storage_base.dictionaries(index).entries_size()); - for (int i = 0; i < 100; ++i) { - EXPECT_EQ("key" + std::to_string(i), -- storage.dictionaries(index).entries(i).key()); -+ storage.user_dictionary_storage_base.dictionaries(index).entries(i).key()); - EXPECT_EQ("value" + std::to_string(i), -- storage.dictionaries(index).entries(i).value()); -+ storage.user_dictionary_storage_base.dictionaries(index).entries(i).value()); - EXPECT_EQ(user_dictionary::UserDictionary::NOUN, -- storage.dictionaries(index).entries(i).pos()); -+ storage.user_dictionary_storage_base.dictionaries(index).entries(i).pos()); - } - } - -@@ -719,12 +719,12 @@ TEST_F(UserDictionaryTest, AddToAutoRegisteredDictionary) { - { - 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()); - } - } - -@@ -743,7 +743,7 @@ TEST_F(UserDictionaryTest, TestSuppressionDictionary) { - 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(); -@@ -767,7 +767,7 @@ TEST_F(UserDictionaryTest, TestSuppressionDictionary) { - - 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) { -@@ -779,11 +779,11 @@ TEST_F(UserDictionaryTest, TestSuppressionDictionary) { - - // 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(); -@@ -795,7 +795,7 @@ TEST_F(UserDictionaryTest, TestSuppressionDictionary) { - } - - 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) { -@@ -822,7 +822,7 @@ TEST_F(UserDictionaryTest, TestSuggestionOnlyWord) { - 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 = -@@ -842,7 +842,7 @@ TEST_F(UserDictionaryTest, TestSuggestionOnlyWord) { - entry->set_pos(user_dictionary::UserDictionary::SUGGESTION_ONLY); - } - -- user_dic->Load(storage); -+ user_dic->Load(storage.user_dictionary_storage_base); - } - - { -@@ -875,7 +875,7 @@ TEST_F(UserDictionaryTest, TestUsageStats) { - 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(); -@@ -890,7 +890,7 @@ TEST_F(UserDictionaryTest, TestUsageStats) { - 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(); -@@ -909,7 +909,7 @@ TEST_F(UserDictionaryTest, TestUsageStats) { - 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); - } -@@ -922,7 +922,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. -diff --git a/src/gui/word_register_dialog/word_register_dialog.cc b/src/gui/word_register_dialog/word_register_dialog.cc -index 7f91504..c73f361 100644 ---- a/src/gui/word_register_dialog/word_register_dialog.cc -+++ b/src/gui/word_register_dialog/word_register_dialog.cc -@@ -301,7 +301,7 @@ WordRegisterDialog::ErrorCode WordRegisterDialog::SaveEntry() { - } - - 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()) { -diff --git a/src/prediction/user_history_predictor.cc b/src/prediction/user_history_predictor.cc -index 84741e8..8c34a50 100644 ---- a/src/prediction/user_history_predictor.cc -+++ b/src/prediction/user_history_predictor.cc -@@ -291,23 +291,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; - } -@@ -494,12 +494,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; - } -@@ -521,13 +521,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(history.entries_size())); -+ static_cast(history.user_history_base.entries_size())); - - if (!history.Save()) { - LOG(ERROR) << "UserHistoryStorage::Save() failed"; -diff --git a/src/prediction/user_history_predictor.h b/src/prediction/user_history_predictor.h -index f8061af..039f1bf 100644 ---- a/src/prediction/user_history_predictor.h -+++ b/src/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(); - -diff --git a/src/prediction/user_history_predictor_test.cc b/src/prediction/user_history_predictor_test.cc -index af7c4a7..c9bb746 100644 ---- a/src/prediction/user_history_predictor_test.cc -+++ b/src/prediction/user_history_predictor_test.cc -@@ -2231,7 +2231,7 @@ TEST_F(UserHistoryPredictorTest, UserHistoryStorage) { - - 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"); -@@ -2239,7 +2239,7 @@ TEST_F(UserHistoryPredictorTest, UserHistoryStorage) { - 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); - } - -diff --git a/src/rewriter/usage_rewriter_test.cc b/src/rewriter/usage_rewriter_test.cc -index 246f552..82ec4f7 100644 ---- a/src/rewriter/usage_rewriter_test.cc -+++ b/src/rewriter/usage_rewriter_test.cc -@@ -312,7 +312,7 @@ TEST_F(UsageRewriterTest, CommentFromUserDictionary) { - // 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(); - entry->set_key("うま"); -@@ -320,7 +320,7 @@ TEST_F(UsageRewriterTest, CommentFromUserDictionary) { - entry->set_pos(user_dictionary::UserDictionary::NOUN); - entry->set_comment("アルパカコメント"); - -- user_dictionary_->Load(storage); -+ user_dictionary_->Load(storage.user_dictionary_storage_base); - } - - // Emulates the conversion of key="うま". --- -2.24.0 - - -From 2427d54c93bb8bd90ae33149515a6c8d502b820f Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Wed, 20 Nov 2019 18:57:54 +0100 -Subject: gcc8 patch from Gentoo - - -diff --git a/src/prediction/zero_query_dict.h b/src/prediction/zero_query_dict.h -index c11aa24..6e24b0b 100644 ---- a/src/prediction/zero_query_dict.h -+++ b/src/prediction/zero_query_dict.h -@@ -147,6 +147,17 @@ class ZeroQueryDict { - return iter; - } - -+ iterator &operator--() { -+ ptr_ -= kTokenByteSize; -+ return *this; -+ } -+ -+ iterator operator--(int) { -+ const iterator tmp(ptr_, string_array_); -+ ptr_ -= kTokenByteSize; -+ return tmp; -+ } -+ - iterator &operator-=(ptrdiff_t n) { - ptr_ -= n * kTokenByteSize; - return *this; --- -2.24.0 - - -From fbfa7779b4d038fc15379a1a3466714ab9a72eab Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Wed, 20 Nov 2019 19:07:02 +0100 -Subject: haiku gcc8 patch - - -diff --git a/src/haiku/haiku_gui/base/grid_view.h b/src/haiku/haiku_gui/base/grid_view.h -index 4f53cc6..f88f880 100644 ---- a/src/haiku/haiku_gui/base/grid_view.h -+++ b/src/haiku/haiku_gui/base/grid_view.h -@@ -43,6 +43,7 @@ - #include - #include - #include -+#include - - #include - #include -diff --git a/src/haiku/haiku_gui/word_register_dialog/word_register_dialog.cc b/src/haiku/haiku_gui/word_register_dialog/word_register_dialog.cc -index 78fcb08..8b7b559 100644 ---- a/src/haiku/haiku_gui/word_register_dialog/word_register_dialog.cc -+++ b/src/haiku/haiku_gui/word_register_dialog/word_register_dialog.cc -@@ -391,7 +391,7 @@ WordRegisterDialog::ErrorCode WordRegisterDialog::SaveEntry() { - } - - 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()) { --- -2.24.0 - diff --git a/app-i18n/mozc/patches/mozc-2.26.4451.1.patchset b/app-i18n/mozc/patches/mozc-2.26.4451.1.patchset new file mode 100644 index 000000000..202bf20f2 --- /dev/null +++ b/app-i18n/mozc/patches/mozc-2.26.4451.1.patchset @@ -0,0 +1,25 @@ +From 7dade1410b1475b82beeea746c1eaff0723671f3 Mon Sep 17 00:00:00 2001 +From: hanya +Date: Tue, 10 Aug 2021 18:06:18 +0900 +Subject: [PATCH] Support mmap on Haiku + +--- + src/third_party/abseil-cpp/absl/base/config.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/third_party/abseil-cpp/absl/base/config.h b/src/third_party/abseil-cpp/absl/base/config.h +index 9544996..f878679 100644 +--- a/src/third_party/abseil-cpp/absl/base/config.h ++++ b/src/third_party/abseil-cpp/absl/base/config.h +@@ -372,7 +372,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \ + defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \ +- defined(__ASYLO__) || defined(__myriad2__) ++ defined(__ASYLO__) || defined(__myriad2__) || defined(__HAIKU__) + #define ABSL_HAVE_MMAP 1 + #endif + +-- +2.30.2 +