diff --git a/src/rewriter/rewriter.cc b/src/rewriter/rewriter.cc index f310f4a3a..8d924166a 100644 --- a/src/rewriter/rewriter.cc +++ b/src/rewriter/rewriter.cc @@ -131,7 +131,7 @@ Rewriter::Rewriter(const engine::Modules &modules) { const DataManager &data_manager = modules.GetDataManager(); const dictionary::DictionaryInterface &dictionary = *modules.GetDictionary(); const dictionary::PosMatcher &pos_matcher = *modules.GetPosMatcher(); - const dictionary::PosGroup *pos_group = modules.GetPosGroup(); + const dictionary::PosGroup &pos_group = *modules.GetPosGroup(); #ifdef MOZC_USER_DICTIONARY_REWRITER AddRewriter(std::make_unique()); @@ -158,7 +158,7 @@ Rewriter::Rewriter(const engine::Modules &modules) { if (absl::GetFlag(FLAGS_use_history_rewriter)) { AddRewriter(std::make_unique()); AddRewriter( - std::make_unique(&pos_matcher, pos_group)); + std::make_unique(pos_matcher, pos_group)); } #ifdef MOZC_DATE_REWRITERS diff --git a/src/rewriter/user_segment_history_rewriter.cc b/src/rewriter/user_segment_history_rewriter.cc index 7a18d139d..6e0f7db8d 100644 --- a/src/rewriter/user_segment_history_rewriter.cc +++ b/src/rewriter/user_segment_history_rewriter.cc @@ -492,10 +492,10 @@ bool UserSegmentHistoryRewriter::SortCandidates( } UserSegmentHistoryRewriter::UserSegmentHistoryRewriter( - const PosMatcher *pos_matcher, const PosGroup *pos_group) + const PosMatcher &pos_matcher, const PosGroup &pos_group) : storage_(std::make_unique()), - pos_matcher_(pos_matcher), - pos_group_(pos_group) { + pos_matcher_(&pos_matcher), + pos_group_(&pos_group) { Reload(); CHECK_EQ(sizeof(uint32_t), sizeof(FeatureValue)); diff --git a/src/rewriter/user_segment_history_rewriter.h b/src/rewriter/user_segment_history_rewriter.h index 556764b06..c9e3a0c98 100644 --- a/src/rewriter/user_segment_history_rewriter.h +++ b/src/rewriter/user_segment_history_rewriter.h @@ -49,8 +49,8 @@ namespace mozc { class UserSegmentHistoryRewriter : public RewriterInterface { public: - UserSegmentHistoryRewriter(const dictionary::PosMatcher *pos_matcher, - const dictionary::PosGroup *pos_group); + UserSegmentHistoryRewriter(const dictionary::PosMatcher &pos_matcher, + const dictionary::PosGroup &pos_group); bool Rewrite(const ConversionRequest &request, Segments *segments) const override; diff --git a/src/rewriter/user_segment_history_rewriter_test.cc b/src/rewriter/user_segment_history_rewriter_test.cc index 956f00517..4b331a4db 100644 --- a/src/rewriter/user_segment_history_rewriter_test.cc +++ b/src/rewriter/user_segment_history_rewriter_test.cc @@ -167,7 +167,7 @@ class UserSegmentHistoryRewriterTest : public testing::TestWithTempUserProfile { } UserSegmentHistoryRewriter *CreateUserSegmentHistoryRewriter() const { - return new UserSegmentHistoryRewriter(&pos_matcher_, pos_group_.get()); + return new UserSegmentHistoryRewriter(pos_matcher_, *pos_group_); } void SetNumberForm(Config::CharacterForm form) {