From b3330bb9043f689faaab5af653e0feba9ed5cf4f Mon Sep 17 00:00:00 2001 From: Noriyuki Takahashi Date: Sat, 24 Oct 2015 20:22:56 -0700 Subject: [PATCH] Deprecate scoped_ptr part 2. With this CL, scoped_ptr is replaced with std::unique_ptr mainly in the following directories. - src/dictionary/file/ - src/gui/ - src/server/ - src/storage/ BUG=#219 TEST=unittest REF_BUG=9164610 REF_CL=84944931,84944947,84945576,85032863,85033860 --- src/dictionary/file/codec_test.cc | 9 ++++----- src/dictionary/file/dictionary_file.h | 4 ++-- src/dictionary/text_dictionary_loader.cc | 5 +++-- src/gui/about_dialog/about_dialog.h | 7 ++++--- src/gui/base/setup_util.h | 6 ++++-- src/gui/base/singleton_window_helper.h | 5 +++-- src/gui/character_pad/character_pad_libmain.cc | 6 +++++- src/gui/character_pad/character_palette.h | 6 ++++-- src/gui/character_pad/hand_writing.h | 9 +++++---- src/gui/config_dialog/character_form_editor.cc | 8 ++++++-- src/gui/config_dialog/character_form_editor.h | 11 +++++++---- src/gui/config_dialog/config_dialog.cc | 5 ++++- src/gui/config_dialog/config_dialog.h | 6 ++++-- src/gui/config_dialog/keybinding_editor.h | 10 +++++++--- .../config_dialog/keybinding_editor_delegate.cc | 4 +++- src/gui/config_dialog/keymap_editor.cc | 5 ++++- src/gui/config_dialog/keymap_editor.h | 16 ++++++++++------ src/gui/config_dialog/roman_table_editor.cc | 7 +++++-- src/gui/config_dialog/roman_table_editor.h | 11 ++++++++--- src/gui/dictionary_tool/dictionary_tool.cc | 17 +++++++++-------- src/gui/dictionary_tool/dictionary_tool.h | 12 +++++++----- .../post_install_dialog/post_install_dialog.h | 8 ++++++-- .../set_default_dialog/set_default_dialog.cc | 6 ++++-- src/gui/tool/mozc_tool_libmain.cc | 10 ++++++---- src/gui/tool/prelauncher_libmain.cc | 7 ++++--- .../word_register_dialog/word_register_dialog.h | 14 +++++++++----- src/mozc_version_template.txt | 2 +- src/prediction/gen_suggestion_filter_main.cc | 3 ++- src/rewriter/gen_existence_data.cc | 3 ++- src/server/mozc_rpc_server_main.cc | 12 ++++++------ src/server/mozc_server.cc | 5 +++-- src/storage/encrypted_string_storage_test.cc | 7 +++---- src/storage/existence_filter.h | 5 +++-- src/storage/existence_filter_test.cc | 8 ++++---- src/storage/lru_storage.cc | 6 +++--- src/storage/lru_storage.h | 7 ++++--- src/storage/memory_storage_test.cc | 4 ++-- src/storage/registry.cc | 4 ++-- src/storage/tiny_storage.cc | 4 ++-- src/storage/tiny_storage_test.cc | 6 +++--- 40 files changed, 177 insertions(+), 113 deletions(-) diff --git a/src/dictionary/file/codec_test.cc b/src/dictionary/file/codec_test.cc index 996af6a08..e6bdcf43d 100644 --- a/src/dictionary/file/codec_test.cc +++ b/src/dictionary/file/codec_test.cc @@ -29,18 +29,17 @@ #include "dictionary/file/codec.h" +#include + #include "base/file_stream.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_ptr.h" #include "base/util.h" #include "dictionary/file/codec_interface.h" #include "dictionary/file/section.h" #include "testing/base/public/googletest.h" #include "testing/base/public/gunit.h" -DECLARE_string(test_tmpdir); - namespace mozc { namespace dictionary { namespace { @@ -117,7 +116,7 @@ class CodecMock : public DictionaryFileCodecInterface { }; TEST_F(CodecTest, FactoryTest) { - scoped_ptr codec_mock(new CodecMock); + std::unique_ptr codec_mock(new CodecMock); DictionaryFileCodecFactory::SetCodec(codec_mock.get()); const DictionaryFileCodecInterface *codec = DictionaryFileCodecFactory::GetCodec(); @@ -185,7 +184,7 @@ TEST_F(CodecTest, DefaultTest) { } TEST_F(CodecTest, CodecTest) { - scoped_ptr default_codec( + std::unique_ptr default_codec( new DictionaryFileCodec); DictionaryFileCodecFactory::SetCodec(default_codec.get()); const DictionaryFileCodecInterface *codec = diff --git a/src/dictionary/file/dictionary_file.h b/src/dictionary/file/dictionary_file.h index 4e5c7e7de..726e512f6 100644 --- a/src/dictionary/file/dictionary_file.h +++ b/src/dictionary/file/dictionary_file.h @@ -33,12 +33,12 @@ #ifndef MOZC_DICTIONARY_FILE_DICTIONARY_FILE_H_ #define MOZC_DICTIONARY_FILE_DICTIONARY_FILE_H_ +#include #include #include #include "base/mmap.h" #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { namespace dictionary { @@ -63,7 +63,7 @@ class DictionaryFile { private: // This will be nullptr if the mapping source is given as a pointer. - scoped_ptr mapping_; + std::unique_ptr mapping_; vector sections_; DISALLOW_COPY_AND_ASSIGN(DictionaryFile); diff --git a/src/dictionary/text_dictionary_loader.cc b/src/dictionary/text_dictionary_loader.cc index 9aaa3ed2b..8e18e0f04 100644 --- a/src/dictionary/text_dictionary_loader.cc +++ b/src/dictionary/text_dictionary_loader.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -273,7 +274,7 @@ void TextDictionaryLoader::LoadReadingCorrectionTokens( // We here assume that the wrong reading appear with 1/100 probability // of the original (correct) reading. const int kCostPenalty = 2302; // -log(1/100) * 500; - scoped_ptr token(new Token); + std::unique_ptr token(new Token); value_key.second.CopyToString(&token->key); token->value = max_cost_token->value; token->lid = max_cost_token->lid; @@ -314,7 +315,7 @@ Token *TextDictionaryLoader::ParseTSV( const vector &columns) const { CHECK_LE(5, columns.size()) << "Lack of columns: " << columns.size(); - scoped_ptr token(new Token); + std::unique_ptr token(new Token); // Parse key, lid, rid, cost, value. Util::NormalizeVoicedSoundMark(columns[0], &token->key); diff --git a/src/gui/about_dialog/about_dialog.h b/src/gui/about_dialog/about_dialog.h index 7bad63da0..ce971913e 100644 --- a/src/gui/about_dialog/about_dialog.h +++ b/src/gui/about_dialog/about_dialog.h @@ -34,8 +34,9 @@ #include +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/about_dialog/ui_about_dialog.h" class QImage; @@ -53,7 +54,7 @@ class AboutDialog : public QDialog, private Ui::AboutDialog { Q_OBJECT; public: - explicit AboutDialog(QWidget *parent = NULL); + explicit AboutDialog(QWidget *parent = nullptr); void SetLinkCallback(LinkCallbackInterface *callback); void paintEvent(QPaintEvent *event); @@ -63,7 +64,7 @@ class AboutDialog : public QDialog, private: LinkCallbackInterface *callback_; - scoped_ptr product_image_; + std::unique_ptr product_image_; }; } // namespace mozc::gui diff --git a/src/gui/base/setup_util.h b/src/gui/base/setup_util.h index d7f79fcb1..fdce99f9d 100644 --- a/src/gui/base/setup_util.h +++ b/src/gui/base/setup_util.h @@ -30,8 +30,9 @@ #ifndef MOZC_GUI_BASE_SETUP_UTIL_H_ #define MOZC_GUI_BASE_SETUP_UTIL_H_ +#include + #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { @@ -72,12 +73,13 @@ class SetupUtil { // Imports MS-IME's user dictionary to Mozc' dictionary bool MigrateDictionaryFromMSIME(); - scoped_ptr storage_; + std::unique_ptr storage_; bool is_userdictionary_locked_; DISALLOW_COPY_AND_ASSIGN(SetupUtil); }; + } // namespace gui } // namespace mozc diff --git a/src/gui/base/singleton_window_helper.h b/src/gui/base/singleton_window_helper.h index 4dbe8136e..d0bb16054 100644 --- a/src/gui/base/singleton_window_helper.h +++ b/src/gui/base/singleton_window_helper.h @@ -44,10 +44,10 @@ #ifndef MOZC_GUI_BASE_SINGLETON_WINDOW_HELPER_H_ #define MOZC_GUI_BASE_SINGLETON_WINDOW_HELPER_H_ +#include #include #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { class ProcessMutex; @@ -66,10 +66,11 @@ class SingletonWindowHelper { bool ActivatePreviousWindow(); private: - scoped_ptr mutex_; + std::unique_ptr mutex_; DISALLOW_COPY_AND_ASSIGN(SingletonWindowHelper); }; + } // namespace gui } // namespace mozc diff --git a/src/gui/character_pad/character_pad_libmain.cc b/src/gui/character_pad/character_pad_libmain.cc index cf27dcd97..186a070c8 100644 --- a/src/gui/character_pad/character_pad_libmain.cc +++ b/src/gui/character_pad/character_pad_libmain.cc @@ -33,6 +33,9 @@ #include #include + +#include + #include "base/logging.h" #include "base/system_util.h" #include "base/util.h" @@ -59,6 +62,7 @@ enum { CHARACTER_PALETTE, HAND_WRITING }; + } // namespace int RunCharacterPad(int argc, char *argv[], @@ -70,7 +74,7 @@ int RunCharacterPad(int argc, char *argv[], mozc::gui::LocaleUtil::InstallTranslationMessageAndFont("character_pad"); - scoped_ptr window; + std::unique_ptr window; if (mode == HAND_WRITING) { window.reset(new mozc::gui::HandWriting); diff --git a/src/gui/character_pad/character_palette.h b/src/gui/character_pad/character_palette.h index 8f7bf6e8b..4abca5d2e 100644 --- a/src/gui/character_pad/character_palette.h +++ b/src/gui/character_pad/character_palette.h @@ -32,8 +32,10 @@ #include #include + +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/character_pad/ui_character_palette.h" class QTextCodec; @@ -86,7 +88,7 @@ class CharacterPalette : public QMainWindow, bool winEvent(MSG *message, long *result); #endif // OS_WIN - scoped_ptr client_; + std::unique_ptr client_; bool usage_stats_enabled_; private: diff --git a/src/gui/character_pad/hand_writing.h b/src/gui/character_pad/hand_writing.h index 86848b401..f2de833bf 100644 --- a/src/gui/character_pad/hand_writing.h +++ b/src/gui/character_pad/hand_writing.h @@ -32,7 +32,8 @@ #include -#include "base/scoped_ptr.h" +#include + #include "gui/character_pad/ui_hand_writing.h" namespace mozc { @@ -71,7 +72,7 @@ class HandWriting : public QMainWindow, void updateHandwritingSource(int index); - scoped_ptr client_; + std::unique_ptr client_; bool usage_stats_enabled_; // Do not depend on CloudHandwriting class to keep dependencies // minimum. @@ -84,9 +85,9 @@ class HandWriting : public QMainWindow, // necessary and updates the current config as // |config.set_allow_cloud_handwriting(true)| when it is allowed. bool TryToEnableCloudHandwriting(); - scoped_ptr cloud_handwriting_; + std::unique_ptr cloud_handwriting_; #endif // ENABLE_CLOUD_HANDWRITING - scoped_ptr zinnia_handwriting_; + std::unique_ptr zinnia_handwriting_; }; } // namespace gui } // namespace mozc diff --git a/src/gui/config_dialog/character_form_editor.cc b/src/gui/config_dialog/character_form_editor.cc index 18ea9d892..419dc326d 100644 --- a/src/gui/config_dialog/character_form_editor.cc +++ b/src/gui/config_dialog/character_form_editor.cc @@ -27,9 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "gui/config_dialog/character_form_editor.h" + #include + +#include + #include "config/config_handler.h" -#include "gui/config_dialog/character_form_editor.h" #include "gui/config_dialog/combobox_delegate.h" namespace mozc { @@ -117,7 +121,7 @@ void CharacterFormEditor::Load(const config::Config &config) { header << tr("Group") << tr("Composition") << tr("Conversion"); setHorizontalHeaderLabels(header); - scoped_ptr default_config; + std::unique_ptr default_config; const config::Config *target_config = &config; // make sure that table isn't empty. diff --git a/src/gui/config_dialog/character_form_editor.h b/src/gui/config_dialog/character_form_editor.h index 88a3918b5..6cbedd5bc 100644 --- a/src/gui/config_dialog/character_form_editor.h +++ b/src/gui/config_dialog/character_form_editor.h @@ -31,8 +31,10 @@ #define MOZC_GUI_CONFIG_DIALOG_CHARACTER_FORM_EDITOR_H_ #include + +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "protocol/config.pb.h" namespace mozc { @@ -54,10 +56,11 @@ class CharacterFormEditor : public QTableWidget { void Save(config::Config *config); private: - scoped_ptr delegate_; + std::unique_ptr delegate_; }; -} // gui -} // mozc + +} // namespace gui +} // namespace mozc #if defined UI_CONFIG_DIALOG_H using mozc::gui::CharacterFormEditor; diff --git a/src/gui/config_dialog/config_dialog.cc b/src/gui/config_dialog/config_dialog.cc index 3a063ba38..83d68f917 100644 --- a/src/gui/config_dialog/config_dialog.cc +++ b/src/gui/config_dialog/config_dialog.cc @@ -36,9 +36,12 @@ #endif #include + #include #include +#include #include + #include "base/config_file_stream.h" #include "base/const.h" #include "base/logging.h" @@ -815,7 +818,7 @@ void ConfigDialog::EditKeymap() { // Load from predefined mapping file. const char *keymap_file = keymap::KeyMapManager::GetKeyMapFileName(itr->second); - scoped_ptr ifs( + std::unique_ptr ifs( ConfigFileStream::LegacyOpen(keymap_file)); CHECK(ifs.get() != NULL); // should never happen stringstream buffer; diff --git a/src/gui/config_dialog/config_dialog.h b/src/gui/config_dialog/config_dialog.h index e9d01179f..98e9dde9e 100644 --- a/src/gui/config_dialog/config_dialog.h +++ b/src/gui/config_dialog/config_dialog.h @@ -34,10 +34,12 @@ #include #include + #include +#include #include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/config_dialog/ui_config_dialog.h" #include "protocol/config.pb.h" @@ -100,7 +102,7 @@ class ConfigDialog : public QDialog, bool Update(); void Reload(); - scoped_ptr client_; + std::unique_ptr client_; string custom_keymap_table_; string custom_roman_table_; config::Config::InformationListConfig information_list_config_; diff --git a/src/gui/config_dialog/keybinding_editor.h b/src/gui/config_dialog/keybinding_editor.h index 38dcc7f2f..955ac6338 100644 --- a/src/gui/config_dialog/keybinding_editor.h +++ b/src/gui/config_dialog/keybinding_editor.h @@ -32,9 +32,11 @@ #include #include + +#include #include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/config_dialog/ui_keybinding_editor.h" namespace mozc { @@ -75,8 +77,10 @@ class KeyBindingEditor : public QDialog, private: QWidget *trigger_parent_; - scoped_ptr filter_; + std::unique_ptr filter_; }; -} // namespace mozc::gui + +} // namespace gui } // namespace mozc + #endif // MOZC_GUI_CONFIG_DIALOG_KEYBINDING_EDITOR_H_ diff --git a/src/gui/config_dialog/keybinding_editor_delegate.cc b/src/gui/config_dialog/keybinding_editor_delegate.cc index 528f21f3e..f984e0d9c 100644 --- a/src/gui/config_dialog/keybinding_editor_delegate.cc +++ b/src/gui/config_dialog/keybinding_editor_delegate.cc @@ -32,6 +32,8 @@ #include #include +#include + #include "base/logging.h" #include "gui/config_dialog/keybinding_editor.h" @@ -55,7 +57,7 @@ class KeyBindingEditorTriggerButton : public QPushButton { } private: - scoped_ptr editor_; + std::unique_ptr editor_; }; KeyBindingEditorDelegate::KeyBindingEditorDelegate(QObject *parent) diff --git a/src/gui/config_dialog/keymap_editor.cc b/src/gui/config_dialog/keymap_editor.cc index 679ff8a35..89d7d367e 100644 --- a/src/gui/config_dialog/keymap_editor.cc +++ b/src/gui/config_dialog/keymap_editor.cc @@ -32,12 +32,15 @@ #include #include #include + #include // for unique #include +#include #include #include #include #include + #include "base/config_file_stream.h" #include "base/logging.h" #include "base/singleton.h" @@ -503,7 +506,7 @@ void KeyMapEditorDialog::OnEditMenuAction(QAction *action) { import_index < arraysize(kKeyMaps)) { const char *keymap_file = keymap::KeyMapManager::GetKeyMapFileName(kKeyMaps[import_index]); - scoped_ptr ifs( + std::unique_ptr ifs( ConfigFileStream::LegacyOpen(keymap_file)); CHECK(ifs.get() != NULL); // should never happen CHECK(LoadFromStream(ifs.get())); diff --git a/src/gui/config_dialog/keymap_editor.h b/src/gui/config_dialog/keymap_editor.h index 3ab288e3b..fc4b8f708 100644 --- a/src/gui/config_dialog/keymap_editor.h +++ b/src/gui/config_dialog/keymap_editor.h @@ -31,10 +31,12 @@ #define MOZC_GUI_CONFIG_DIALOG_KEYMAP_EDITOR_H_ #include + +#include #include #include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/config_dialog/generic_table_editor.h" class QAbstractButton; @@ -73,15 +75,17 @@ class KeyMapEditorDialog : public GenericTableEditorDialog { // This is used for deciding whether the user has changed the settings that // are valid only for new applications. set direct_mode_commands_; - scoped_ptr actions_; - scoped_ptr import_actions_; - scoped_ptr status_delegate_; - scoped_ptr commands_delegate_; - scoped_ptr keybinding_delegate_; + std::unique_ptr actions_; + std::unique_ptr import_actions_; + std::unique_ptr status_delegate_; + std::unique_ptr commands_delegate_; + std::unique_ptr keybinding_delegate_; map normalized_command_map_; map normalized_status_map_; }; + } // namespace gui } // namespace mozc + #endif // MOZC_GUI_CONFIG_DIALOG_KEYMAP_EDITOR_H_ diff --git a/src/gui/config_dialog/roman_table_editor.cc b/src/gui/config_dialog/roman_table_editor.cc index 517f8c76d..547679268 100644 --- a/src/gui/config_dialog/roman_table_editor.cc +++ b/src/gui/config_dialog/roman_table_editor.cc @@ -30,10 +30,13 @@ #include "gui/config_dialog/roman_table_editor.h" #include + #include +#include #include #include #include + #include "base/config_file_stream.h" #include "base/logging.h" #include "base/util.h" @@ -84,7 +87,7 @@ RomanTableEditorDialog::RomanTableEditorDialog(QWidget *parent) RomanTableEditorDialog::~RomanTableEditorDialog() {} string RomanTableEditorDialog::GetDefaultRomanTable() { - scoped_ptr ifs(ConfigFileStream::LegacyOpen(kRomanTableFile)); + std::unique_ptr ifs(ConfigFileStream::LegacyOpen(kRomanTableFile)); CHECK(ifs.get() != NULL); // should never happen string line, result; vector fields; @@ -164,7 +167,7 @@ bool RomanTableEditorDialog::LoadFromStream(istream *is) { } bool RomanTableEditorDialog::LoadDefaultRomanTable() { - scoped_ptr ifs(ConfigFileStream::LegacyOpen(kRomanTableFile)); + std::unique_ptr ifs(ConfigFileStream::LegacyOpen(kRomanTableFile)); CHECK(ifs.get() != NULL); // should never happen CHECK(LoadFromStream(ifs.get())); return true; diff --git a/src/gui/config_dialog/roman_table_editor.h b/src/gui/config_dialog/roman_table_editor.h index 172233693..fcfc8f0b9 100644 --- a/src/gui/config_dialog/roman_table_editor.h +++ b/src/gui/config_dialog/roman_table_editor.h @@ -31,9 +31,11 @@ #define MOZC_GUI_CONFIG_DIALOG_ROMAN_TABLE_EDITOR_H_ #include + +#include #include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/config_dialog/generic_table_editor.h" class QAbstractButton; @@ -42,7 +44,8 @@ namespace mozc { namespace gui { class RomanTableEditorDialog : public GenericTableEditorDialog { - Q_OBJECT; + Q_OBJECT; + public: explicit RomanTableEditorDialog(QWidget *parent); virtual ~RomanTableEditorDialog(); @@ -68,8 +71,10 @@ class RomanTableEditorDialog : public GenericTableEditorDialog { static string GetDefaultRomanTable(); private: - scoped_ptr actions_; + std::unique_ptr actions_; }; + } // namespace gui } // namespace mozc + #endif // MOZC_GUI_CONFIG_DIALOG_ROMAN_TABLE_EDITOR_H_ diff --git a/src/gui/dictionary_tool/dictionary_tool.cc b/src/gui/dictionary_tool/dictionary_tool.cc index cac9960e0..176c0cffe 100644 --- a/src/gui/dictionary_tool/dictionary_tool.cc +++ b/src/gui/dictionary_tool/dictionary_tool.cc @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -172,8 +173,8 @@ class UTF16TextLineIterator private: QFile file_; - scoped_ptr stream_; - scoped_ptr progress_; + std::unique_ptr stream_; + std::unique_ptr progress_; }; class MultiByteTextLineIterator @@ -253,8 +254,8 @@ class MultiByteTextLineIterator private: UserDictionaryImporter::EncodingType encoding_type_; - scoped_ptr ifs_; - scoped_ptr progress_; + std::unique_ptr ifs_; + std::unique_ptr progress_; bool first_line_; }; @@ -644,7 +645,7 @@ void DictionaryTool::SetupDicContentEditor( dic_content_->setRowCount(dic->entries_size()); { - scoped_ptr progress(CreateProgressDialog( + std::unique_ptr progress(CreateProgressDialog( tr("Updating the current view data..."), this, dic->entries_size())); @@ -887,7 +888,7 @@ void DictionaryTool::ImportHelper( SyncToStorage(); // Open dictionary - scoped_ptr iter( + std::unique_ptr iter( CreateTextLineIterator(encoding_type, file_name, this)); if (iter.get() == NULL) { LOG(ERROR) << "CreateTextLineIterator returns NULL"; @@ -1085,7 +1086,7 @@ void DictionaryTool::DeleteWord() { setUpdatesEnabled(false); { - scoped_ptr progress( + std::unique_ptr progress( CreateProgressDialog( tr("Deleting the selected words..."), this, @@ -1169,7 +1170,7 @@ void DictionaryTool::MoveTo(int dictionary_row) { { // add |rows.size()| items and remove |rows.size()| items const int progress_max = rows.size() * 2; - scoped_ptr progress( + std::unique_ptr progress( CreateProgressDialog( tr("Moving the selected words..."), this, diff --git a/src/gui/dictionary_tool/dictionary_tool.h b/src/gui/dictionary_tool/dictionary_tool.h index 413270d06..9cca29bee 100644 --- a/src/gui/dictionary_tool/dictionary_tool.h +++ b/src/gui/dictionary_tool/dictionary_tool.h @@ -30,14 +30,15 @@ #ifndef MOZC_GUI_DICTIONARY_TOOL_DICTIONARY_TOOL_H_ #define MOZC_GUI_DICTIONARY_TOOL_DICTIONARY_TOOL_H_ -#include #include #include #include #include +#include +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/dictionary_tool/ui_dictionary_tool.h" #include "dictionary/user_dictionary_importer.h" @@ -191,7 +192,7 @@ class DictionaryTool : public QMainWindow, ImportDialog *import_dialog_; FindDialog *find_dialog_; - scoped_ptr session_; + std::unique_ptr session_; // ID of current selected dictionary. This needs to be maintained // separate from selection on the list widget because data is saved @@ -247,15 +248,16 @@ class DictionaryTool : public QMainWindow, // status message QString statusbar_message_; - scoped_ptr client_; + std::unique_ptr client_; bool is_available_; // The maximum number of entries for a dictionary currently selected. int max_entry_size_; - scoped_ptr user_pos_; + std::unique_ptr user_pos_; }; + } // namespace gui } // namespace mozc diff --git a/src/gui/post_install_dialog/post_install_dialog.h b/src/gui/post_install_dialog/post_install_dialog.h index 242eac809..855d53a2d 100644 --- a/src/gui/post_install_dialog/post_install_dialog.h +++ b/src/gui/post_install_dialog/post_install_dialog.h @@ -30,12 +30,14 @@ #ifndef MOZC_GUI_POST_INSTALL_DIALOG_H_ #define MOZC_GUI_POST_INSTALL_DIALOG_H_ +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/post_install_dialog/ui_post_install_dialog.h" namespace mozc { namespace gui { + class SetupUtil; // Shows additional information to the user after installation. @@ -77,8 +79,10 @@ class PostInstallDialog : public QDialog, // Returns true if showing the help page is required. static bool IsShowHelpPageRequired(); - scoped_ptr setuputil_; + std::unique_ptr setuputil_; }; + } // namespace gui } // namespace mozc + #endif // MOZC_GUI_POST_INSTALL_DIALOG_H_ diff --git a/src/gui/set_default_dialog/set_default_dialog.cc b/src/gui/set_default_dialog/set_default_dialog.cc index 51d534b6b..5db3935c1 100644 --- a/src/gui/set_default_dialog/set_default_dialog.cc +++ b/src/gui/set_default_dialog/set_default_dialog.cc @@ -34,6 +34,9 @@ #endif #include + +#include + #include "base/logging.h" #include "base/util.h" #include "client/client.h" @@ -44,7 +47,6 @@ #include "win32/base/migration_util.h" #endif - namespace mozc { namespace gui { @@ -89,7 +91,7 @@ void SetDefaultDialog::reject() { } bool SetDefaultDialog::SetCheckDefault(bool check_default) { - scoped_ptr client( + std::unique_ptr client( mozc::client::ClientFactory::NewClient()); if (!client->PingServer() && !client->EnsureConnection()) { LOG(ERROR) << "Cannot connect to server"; diff --git a/src/gui/tool/mozc_tool_libmain.cc b/src/gui/tool/mozc_tool_libmain.cc index 97cb8bff4..bac75aabd 100644 --- a/src/gui/tool/mozc_tool_libmain.cc +++ b/src/gui/tool/mozc_tool_libmain.cc @@ -34,14 +34,16 @@ #endif #include + +#ifdef OS_MACOSX +#include +#endif + #include "base/const.h" #include "base/crash_report_handler.h" #include "base/file_util.h" #include "base/flags.h" #include "base/logging.h" -#ifdef OS_MACOSX -#include "base/scoped_ptr.h" -#endif #include "base/password_manager.h" #include "base/run_level.h" #include "base/util.h" @@ -92,7 +94,7 @@ int RunMozcTool(int argc, char *argv[]) { #ifdef OS_MACOSX // OSX's app won't accept command line flags. // Here we read the flags by using --fromenv option - scoped_ptr tmp(new char * [2]); + std::unique_ptr tmp(new char * [2]); tmp[0] = strdup_with_new(argv[0]); tmp[1] = strdup_with_new( "--fromenv=mode,error_type,confirmation_type,register_prelauncher"); diff --git a/src/gui/tool/prelauncher_libmain.cc b/src/gui/tool/prelauncher_libmain.cc index 4d5b6aea5..8b479afc8 100644 --- a/src/gui/tool/prelauncher_libmain.cc +++ b/src/gui/tool/prelauncher_libmain.cc @@ -27,11 +27,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include + #include "base/flags.h" #ifdef OS_MACOSX #include "base/mac_util.h" #endif // OS_MACOSX -#include "base/scoped_ptr.h" #include "client/client_interface.h" #include "renderer/renderer_client.h" @@ -48,14 +49,14 @@ int RunPrelaunchProcesses(int argc, char *argv[]) { #endif // OS_MACOSX { - scoped_ptr converter_client( + std::unique_ptr converter_client( mozc::client::ClientFactory::NewClient()); converter_client->set_suppress_error_dialog(true); converter_client->EnsureConnection(); } { - scoped_ptr renderer_client( + std::unique_ptr renderer_client( new mozc::renderer::RendererClient); renderer_client->set_suppress_error_dialog(true); renderer_client->Activate(); diff --git a/src/gui/word_register_dialog/word_register_dialog.h b/src/gui/word_register_dialog/word_register_dialog.h index c7c5c1bf0..a98fce2fe 100644 --- a/src/gui/word_register_dialog/word_register_dialog.h +++ b/src/gui/word_register_dialog/word_register_dialog.h @@ -33,8 +33,10 @@ #include #include #include + +#include + #include "base/port.h" -#include "base/scoped_ptr.h" #include "gui/word_register_dialog/ui_word_register_dialog.h" namespace mozc { @@ -111,11 +113,13 @@ class WordRegisterDialog : public QDialog, void EnableIME(); bool is_available_; - scoped_ptr session_; - scoped_ptr client_; + std::unique_ptr session_; + std::unique_ptr client_; QString window_title_; - scoped_ptr user_pos_; + std::unique_ptr user_pos_; }; -} // namespace mozc::gui + +} // namespace gui } // namespace mozc + #endif // MOZC_GUI_WORD_REGISTER_DIALOG_H_ diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt index c5de4e3b6..9769626b2 100644 --- a/src/mozc_version_template.txt +++ b/src/mozc_version_template.txt @@ -1,6 +1,6 @@ MAJOR=2 MINOR=17 -BUILD=2147 +BUILD=2148 REVISION=102 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be # downloaded by NaCl Mozc. diff --git a/src/prediction/gen_suggestion_filter_main.cc b/src/prediction/gen_suggestion_filter_main.cc index bf9f9b95e..63c8bb9f0 100644 --- a/src/prediction/gen_suggestion_filter_main.cc +++ b/src/prediction/gen_suggestion_filter_main.cc @@ -28,6 +28,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#include #include #include "base/codegen_bytearray_stream.h" @@ -89,7 +90,7 @@ int main(int argc, char **argv) { LOG(INFO) << "num_bytes: " << num_bytes; - scoped_ptr filter( + std::unique_ptr filter( ExistenceFilter::CreateOptimal(num_bytes, words.size())); for (size_t i = 0; i < words.size(); ++i) { filter->Insert(words[i]); diff --git a/src/rewriter/gen_existence_data.cc b/src/rewriter/gen_existence_data.cc index 4d91e7616..bd1f71b67 100644 --- a/src/rewriter/gen_existence_data.cc +++ b/src/rewriter/gen_existence_data.cc @@ -34,6 +34,7 @@ #include #include +#include #include #include "base/codegen_bytearray_stream.h" @@ -55,7 +56,7 @@ void GenExistenceData(const vector &entries, error_rate, n); LOG(INFO) << "entry: " << n << " err: " << error_rate << " bytes: " << m; - scoped_ptr filter(ExistenceFilter::CreateOptimal(m, n)); + std::unique_ptr filter(ExistenceFilter::CreateOptimal(m, n)); DCHECK(filter.get()); for (size_t i = 0; i < entries.size(); ++i) { diff --git a/src/server/mozc_rpc_server_main.cc b/src/server/mozc_rpc_server_main.cc index 48fe8d1be..d23aa039b 100644 --- a/src/server/mozc_rpc_server_main.cc +++ b/src/server/mozc_rpc_server_main.cc @@ -45,12 +45,12 @@ #include #include -#include +#include #include +#include #include "base/flags.h" #include "base/number_util.h" -#include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/system_util.h" #include "engine/engine_factory.h" @@ -196,7 +196,7 @@ class RPCServer { CHECK_LT(request_size, kMaxRequestSize); // Receive the body of serialized protobuf. - scoped_ptr request_str(new char[request_size]); + std::unique_ptr request_str(new char[request_size]); if (!Recv(client_socket, request_str.get(), request_size, FLAGS_rpc_timeout)) { LOG(ERROR) << "cannot receive body of request."; @@ -236,8 +236,8 @@ class RPCServer { private: int server_socket_; - scoped_ptr engine_; - scoped_ptr handler_; + std::unique_ptr engine_; + std::unique_ptr handler_; }; // Standalone RPCClient. @@ -322,7 +322,7 @@ class RPCClient { CHECK_GT(output_size, 0); CHECK_LT(output_size, kMaxOutputSize); - scoped_ptr output_str(new char[output_size]); + std::unique_ptr output_str(new char[output_size]); CHECK(Recv(client_socket, output_str.get(), output_size, FLAGS_rpc_timeout)); diff --git a/src/server/mozc_server.cc b/src/server/mozc_server.cc index 976014e46..760332e78 100644 --- a/src/server/mozc_server.cc +++ b/src/server/mozc_server.cc @@ -34,6 +34,7 @@ #endif #include +#include #include #include "base/crash_report_handler.h" @@ -124,8 +125,8 @@ int MozcServer::Run() { } { - scoped_ptr session_server - (new mozc::SessionServer); + std::unique_ptr session_server( + new mozc::SessionServer); g_session_server = session_server.get(); CHECK(g_session_server); if (!g_session_server->Connected()) { diff --git a/src/storage/encrypted_string_storage_test.cc b/src/storage/encrypted_string_storage_test.cc index 7c8c239a9..d8ab6f26c 100644 --- a/src/storage/encrypted_string_storage_test.cc +++ b/src/storage/encrypted_string_storage_test.cc @@ -30,16 +30,15 @@ #include "storage/encrypted_string_storage.h" #include +#include #include "base/file_stream.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_ptr.h" #include "base/system_util.h" +#include "testing/base/public/googletest.h" #include "testing/base/public/gunit.h" -DECLARE_string(test_tmpdir); - namespace mozc { namespace storage { @@ -89,7 +88,7 @@ class EncryptedStringStorageTest : public testing::Test { } string filename_; - scoped_ptr storage_; + std::unique_ptr storage_; }; TEST_F(EncryptedStringStorageTest, SaveAndLoad) { diff --git a/src/storage/existence_filter.h b/src/storage/existence_filter.h index 7201fa21a..dd62e143d 100644 --- a/src/storage/existence_filter.h +++ b/src/storage/existence_filter.h @@ -30,8 +30,9 @@ #ifndef MOZC_STORAGE_EXISTENCE_FILTER_H_ #define MOZC_STORAGE_EXISTENCE_FILTER_H_ +#include + #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { namespace storage { @@ -92,7 +93,7 @@ class ExistenceFilter { uint32 n, int k); - scoped_ptr rep_; // points to bitmap + std::unique_ptr rep_; // points to bitmap const uint32 vec_size_; // size of bitmap (in bits) const uint32 expected_nelts_; // expected number of inserts const int32 num_hashes_; // number of hashes per lookup diff --git a/src/storage/existence_filter_test.cc b/src/storage/existence_filter_test.cc index b42f42a49..4d79b7148 100644 --- a/src/storage/existence_filter_test.cc +++ b/src/storage/existence_filter_test.cc @@ -29,13 +29,13 @@ #include "storage/existence_filter.h" +#include #include #include #include "base/hash.h" #include "base/logging.h" #include "base/port.h" -#include "base/scoped_ptr.h" #include "testing/base/public/googletest.h" #include "testing/base/public/gunit.h" @@ -115,7 +115,7 @@ TEST(ExistenceFilterTest, ReadWriteTest) { ExistenceFilter::MinFilterSizeInBytesForErrorRate(kErrorRate, words.size()); - scoped_ptr filter( + std::unique_ptr filter( ExistenceFilter::CreateOptimal(num_bytes, words.size())); for (int i = 0; i < words.size(); ++i) { @@ -125,7 +125,7 @@ TEST(ExistenceFilterTest, ReadWriteTest) { char *buf = NULL; size_t size = 0; filter->Write(&buf, &size); - scoped_ptr filter_read( + std::unique_ptr filter_read( ExistenceFilter::Read(buf, size)); for (int i = 0; i < words.size(); ++i) { @@ -152,7 +152,7 @@ TEST(ExistenceFilterTest, InsertAndExistsTest) { ExistenceFilter::MinFilterSizeInBytesForErrorRate(kErrorRate, words.size()); - scoped_ptr filter( + std::unique_ptr filter( ExistenceFilter::CreateOptimal(num_bytes, words.size())); for (int i = 0; i < words.size(); ++i) { diff --git a/src/storage/lru_storage.cc b/src/storage/lru_storage.cc index 5aaf9bd66..bf2b8c963 100644 --- a/src/storage/lru_storage.cc +++ b/src/storage/lru_storage.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,6 @@ #include "base/logging.h" #include "base/mmap.h" #include "base/port.h" -#include "base/scoped_ptr.h" #include "base/util.h" namespace mozc { @@ -186,7 +186,7 @@ class LRUStorage::LRUList { }; LRUStorage *LRUStorage::Create(const char *filename) { - scoped_ptr n(new LRUStorage); + std::unique_ptr n(new LRUStorage); if (!n->Open(filename)) { LOG(ERROR) << "could not open LRUStorage"; return NULL; @@ -198,7 +198,7 @@ LRUStorage *LRUStorage::Create(const char *filename, size_t value_size, size_t size, uint32 seed) { - scoped_ptr n(new LRUStorage); + std::unique_ptr n(new LRUStorage); if (!n->OpenOrCreate(filename, value_size, size, seed)) { LOG(ERROR) << "could not open LRUStorage"; return NULL; diff --git a/src/storage/lru_storage.h b/src/storage/lru_storage.h index c20940b65..1293bcfc1 100644 --- a/src/storage/lru_storage.h +++ b/src/storage/lru_storage.h @@ -31,10 +31,11 @@ #define MOZC_STORAGE_LRU_STORAGE_H_ #include +#include #include #include + #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { @@ -138,8 +139,8 @@ class LRUStorage { char *end_; string filename_; map map_; - scoped_ptr lru_list_; - scoped_ptr mmap_; + std::unique_ptr lru_list_; + std::unique_ptr mmap_; DISALLOW_COPY_AND_ASSIGN(LRUStorage); }; diff --git a/src/storage/memory_storage_test.cc b/src/storage/memory_storage_test.cc index 06c4efc7c..c83256d99 100644 --- a/src/storage/memory_storage_test.cc +++ b/src/storage/memory_storage_test.cc @@ -30,10 +30,10 @@ #include "storage/memory_storage.h" #include +#include #include #include "base/port.h" -#include "base/scoped_ptr.h" #include "testing/base/public/googletest.h" #include "testing/base/public/gunit.h" @@ -58,7 +58,7 @@ TEST(MemoryStorageTest, SimpleTest) { static const int kSize[] = {10, 100, 1000}; for (int i = 0; i < arraysize(kSize); ++i) { - scoped_ptr storage(MemoryStorage::New()); + std::unique_ptr storage(MemoryStorage::New()); // Insert map target; diff --git a/src/storage/registry.cc b/src/storage/registry.cc index 4bcdc2489..fb966cff4 100644 --- a/src/storage/registry.cc +++ b/src/storage/registry.cc @@ -29,12 +29,12 @@ #include "storage/registry.h" +#include #include #include "base/file_util.h" #include "base/logging.h" #include "base/mutex.h" -#include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/system_util.h" #include "storage/storage_interface.h" @@ -74,7 +74,7 @@ class StorageInitializer { } private: - scoped_ptr default_storage_; + std::unique_ptr default_storage_; StorageInterface *current_storage_; }; } // namespace diff --git a/src/storage/tiny_storage.cc b/src/storage/tiny_storage.cc index 1d45d7f70..581466c48 100644 --- a/src/storage/tiny_storage.cc +++ b/src/storage/tiny_storage.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include "base/file_stream.h" @@ -42,7 +43,6 @@ #include "base/logging.h" #include "base/mmap.h" #include "base/port.h" -#include "base/scoped_ptr.h" namespace mozc { namespace storage { @@ -334,7 +334,7 @@ bool TinyStorageImpl::Clear() { } // namespace StorageInterface *TinyStorage::Create(const char *filename) { - scoped_ptr storage(new TinyStorageImpl); + std::unique_ptr storage(new TinyStorageImpl); if (!storage->Open(filename)) { LOG(ERROR) << "cannot open " << filename; return NULL; diff --git a/src/storage/tiny_storage_test.cc b/src/storage/tiny_storage_test.cc index b1228e968..440e28769 100644 --- a/src/storage/tiny_storage_test.cc +++ b/src/storage/tiny_storage_test.cc @@ -30,6 +30,7 @@ #include "storage/tiny_storage.h" #include +#include #include #include #include @@ -37,7 +38,6 @@ #include "base/file_util.h" #include "base/port.h" -#include "base/scoped_ptr.h" #include "storage/storage_interface.h" #include "testing/base/public/googletest.h" #include "testing/base/public/gunit.h" @@ -99,7 +99,7 @@ TEST_F(TinyStorageTest, TinyStorageTest) { for (int i = 0; i < arraysize(kSize); ++i) { FileUtil::Unlink(filename); - scoped_ptr storage(CreateStorage()); + std::unique_ptr storage(CreateStorage()); // Insert map target; @@ -129,7 +129,7 @@ TEST_F(TinyStorageTest, TinyStorageTest) { storage->Sync(); - scoped_ptr storage2(CreateStorage()); + std::unique_ptr storage2(CreateStorage()); EXPECT_TRUE(storage2->Open(filename)); EXPECT_EQ(storage->Size(), storage2->Size());