Misc style fixes.
This is just a code cleanup. Hence no behavior change should occur.
BUG=none
TEST=unittest
diff --git a/src/base/clock_mock.h b/src/base/clock_mock.h
index ff1af9f..5639fa6 100644
--- a/src/base/clock_mock.h
+++ b/src/base/clock_mock.h
@@ -32,6 +32,7 @@
#include <ctime>
+#include "base/port.h"
#include "base/util.h"
namespace mozc {
diff --git a/src/base/cpu_stats.h b/src/base/cpu_stats.h
index 575e276..c298e6c 100644
--- a/src/base/cpu_stats.h
+++ b/src/base/cpu_stats.h
@@ -39,12 +39,12 @@
CPUStatsInterface() {}
virtual ~CPUStatsInterface() {}
- // returns the percentage of total CPU load since the last time
+ // Returns the percentage of total CPU load since the last time
// this method was called.
// The return value must be in the range of [0.0 .. 1.0].
virtual float GetSystemCPULoad() = 0;
- // returns the percentage of current process's CPU load
+ // Returns the percentage of current process's CPU load
// since the last time this method was called.
// If the process has multi-threads, the return value
// may be larger than 1.0.
@@ -59,6 +59,9 @@
// default implementation
class CPUStats : public CPUStatsInterface {
public:
+ CPUStats();
+ virtual ~CPUStats();
+
// return 0.0 if CPU load is unknown
float GetSystemCPULoad();
@@ -68,15 +71,13 @@
// return the number of processors
size_t GetNumberOfProcessors() const;
- CPUStats();
- virtual ~CPUStats();
-
private:
uint64 prev_system_total_times_;
uint64 prev_system_cpu_times_;
uint64 prev_current_process_total_times_;
uint64 prev_current_process_cpu_times_;
};
+
} // namespace mozc
#endif // MOZC_BASE_CPU_STATS_H_
diff --git a/src/base/init_test.cc b/src/base/init_test.cc
index 0e9096f..f95c10e 100644
--- a/src/base/init_test.cc
+++ b/src/base/init_test.cc
@@ -29,8 +29,6 @@
#include "base/init.h"
-#include <string.h>
-#include "base/util.h"
#include "testing/base/public/gunit.h"
namespace mozc {
@@ -57,6 +55,5 @@
EXPECT_EQ(4, g_counter);
}
-
} // namespace
} // namespace mozc
diff --git a/src/base/multifile.h b/src/base/multifile.h
index 9b0fede..8dc5a12 100644
--- a/src/base/multifile.h
+++ b/src/base/multifile.h
@@ -33,7 +33,6 @@
#ifndef MOZC_BASE_MULTIFILE_H_
#define MOZC_BASE_MULTIFILE_H_
-#include <fstream>
#include <string>
#include <vector>
diff --git a/src/base/process.cc b/src/base/process.cc
index 898c340..7fb0ce3 100644
--- a/src/base/process.cc
+++ b/src/base/process.cc
@@ -37,7 +37,7 @@
#include <string.h>
#include <sys/stat.h>
#include <cerrno>
-#endif // WINDOWS
+#endif // OS_WIN
#ifdef OS_MACOSX
#include <fcntl.h>
@@ -51,7 +51,7 @@
#include <signal.h>
#include <spawn.h> // for posix_spawn().
#include <sys/types.h>
-#endif
+#endif // OS_LINUX
#include <cstdlib>
#include <vector>
diff --git a/src/base/process.h b/src/base/process.h
index b92374a..61106e3 100644
--- a/src/base/process.h
+++ b/src/base/process.h
@@ -32,14 +32,17 @@
#include <string>
+#include "base/port.h"
+
namespace mozc {
+
class Process {
public:
- // Open the URL with the default browser. If this function is not
+ // Opens the URL with the default browser. If this function is not
// supported on the OS or failed, false is returned.
static bool OpenBrowser(const string &url);
- // Spawn a process specified by path using arg as options.
+ // Spawns a process specified by path using arg as options.
// On Windows Vista the process is spawned as the same level as the parent
// process.
// Return true if process is successfully launched.
@@ -50,18 +53,18 @@
// specifies an directory ending with ".app", an application is
// spawned in the OSX way.
static bool SpawnProcess(
- const string &path, const string& arg, size_t *pid = NULL);
+ const string &path, const string& arg, size_t *pid = nullptr);
// A SpawnProcess wrapper to run an executable which is installed in
// the Mozc server directory.
static bool SpawnMozcProcess(
- const string &filename, const string &arg, size_t *pid = NULL);
+ const string &filename, const string &arg, size_t *pid = nullptr);
- // Wait process |pid| until it terminates.
- // you can set timeout. if timeout is negative, wait forever.
+ // Waits for process |pid| to terminate up to |timeout|.
+ // If |timeout| is negative, waits forever.
static bool WaitProcess(size_t pid, int timeout);
- // return true if a process having |pid| is still alive.
+ // Returns true if a process having |pid| is still alive.
// if the the current thread has no permission to get the status or
// operation failed in system call, it returns |default_result|.
// TODO(all):
@@ -71,7 +74,7 @@
// creation time if this kind of false-positive matters.
static bool IsProcessAlive(size_t pid, bool default_result);
- // return true if a thread having |thread_id| is still alive.
+ // Returns true if a thread having |thread_id| is still alive.
// if the current thread has no permission to get the status or
// operation failed in system call, it returns |default_result|.
// On Posix, it always returns |default_result| as thread_id is not supported.
@@ -82,13 +85,13 @@
// creation time if this kind of false-positive matters.
static bool IsThreadAlive(size_t thread_id, bool default_result);
- // launch error message dialog
+ // Launches an error message dialog.
static bool LaunchErrorMessageDialog(const string &type);
private:
- Process() {}
- virtual ~Process() {}
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Process);
};
+
} // namespace mozc
#endif // MOZC_BASE_PROCESS_H_
diff --git a/src/base/process_mutex_test.cc b/src/base/process_mutex_test.cc
index 50e2a22..2abcb55 100644
--- a/src/base/process_mutex_test.cc
+++ b/src/base/process_mutex_test.cc
@@ -27,6 +27,8 @@
// (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 "base/process_mutex.h"
+
#ifndef OS_WIN
#include <unistd.h>
#include <cstdlib>
@@ -34,7 +36,6 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/process_mutex.h"
#include "base/system_util.h"
#include "base/util.h"
#include "testing/base/public/gunit.h"
diff --git a/src/base/stopwatch.h b/src/base/stopwatch.h
index e527514..a2c77d8 100644
--- a/src/base/stopwatch.h
+++ b/src/base/stopwatch.h
@@ -33,6 +33,7 @@
#include "base/port.h"
namespace mozc {
+
class Stopwatch {
public:
enum StopwatchState {
diff --git a/src/base/stopwatch_test.cc b/src/base/stopwatch_test.cc
index 420d7aa..8259135 100644
--- a/src/base/stopwatch_test.cc
+++ b/src/base/stopwatch_test.cc
@@ -29,12 +29,12 @@
#include <numeric>
-#include "testing/base/public/googletest.h"
-#include "testing/base/public/gunit.h"
#include "base/clock_mock.h"
#include "base/scoped_ptr.h"
#include "base/stopwatch.h"
#include "base/util.h"
+#include "testing/base/public/googletest.h"
+#include "testing/base/public/gunit.h"
namespace mozc {
diff --git a/src/base/text_converter_compiler.cc b/src/base/text_converter_compiler.cc
index 292ac2d..5a72e0a 100644
--- a/src/base/text_converter_compiler.cc
+++ b/src/base/text_converter_compiler.cc
@@ -31,6 +31,7 @@
#include <vector>
#include "base/file_stream.h"
+#include "base/flags.h"
#include "base/logging.h"
#include "base/text_converter.h"
#include "base/util.h"
diff --git a/src/base/unnamed_event_test.cc b/src/base/unnamed_event_test.cc
index 8ac8824..c79fd5c 100644
--- a/src/base/unnamed_event_test.cc
+++ b/src/base/unnamed_event_test.cc
@@ -35,31 +35,31 @@
#include "base/util.h"
#include "testing/base/public/gunit.h"
+namespace mozc {
namespace {
-class UnnamedEventNotifierThread: public mozc::Thread {
+
+class UnnamedEventNotifierThread : public Thread {
public:
- UnnamedEventNotifierThread(mozc::UnnamedEvent *event,
- int timeout)
+ UnnamedEventNotifierThread(UnnamedEvent *event, int timeout)
: event_(event), timeout_(timeout) {}
public:
- void Run() {
- mozc::Util::Sleep(timeout_);
+ virtual void Run() {
+ Util::Sleep(timeout_);
LOG(INFO) << "Notify event";
event_->Notify();
}
private:
- mozc::UnnamedEvent *event_;
+ UnnamedEvent *event_;
int timeout_;
DISALLOW_COPY_AND_ASSIGN(UnnamedEventNotifierThread);
};
-} // namespace
TEST(UnnamedEventTest, UnnamedEventTest) {
{
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
EXPECT_TRUE(event.IsAvailable());
UnnamedEventNotifierThread t(&event, 400);
t.Start();
@@ -70,7 +70,7 @@
}
{
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
EXPECT_TRUE(event.IsAvailable());
UnnamedEventNotifierThread t(&event, 100);
t.Start();
@@ -79,7 +79,7 @@
}
{
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
EXPECT_TRUE(event.IsAvailable());
UnnamedEventNotifierThread t(&event, 3000);
t.Start();
@@ -90,7 +90,7 @@
}
{
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
EXPECT_TRUE(event.IsAvailable());
UnnamedEventNotifierThread t(&event, 2000);
t.Start();
@@ -102,15 +102,18 @@
}
TEST(UnnamedEventTest, NotifyBeforeWait) {
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
ASSERT_TRUE(event.Notify());
EXPECT_TRUE(event.Wait(100));
}
TEST(UnnamedEventTest, DoubleNotifyBeforeWait) {
- mozc::UnnamedEvent event;
+ UnnamedEvent event;
ASSERT_TRUE(event.Notify());
ASSERT_TRUE(event.Notify());
EXPECT_TRUE(event.Wait(100));
EXPECT_FALSE(event.Wait(100));
}
+
+} // namespace
+} // namespace mozc
diff --git a/src/base/url.h b/src/base/url.h
index 008ab8a..6cbaaaa 100644
--- a/src/base/url.h
+++ b/src/base/url.h
@@ -32,20 +32,22 @@
#include <string>
+#include "base/port.h"
+
namespace mozc {
-// util class to get URLs
+
class URL {
public:
- // composes a URL for an uninstallation survey.
- // note that we should set version
- // because in Mac OS, we can not get mozc version from uninstaller binary.
+ // Composes a URL for an uninstallation survey. Note that we should set
+ // version because, in Mac OS, we can not get mozc version from uninstaller
+ // binary.
static bool GetUninstallationSurveyURL(const string &version, string *url);
// should never be allocated.
private:
- URL();
- virtual ~URL();
+ DISALLOW_IMPLICIT_CONSTRUCTORS(URL);
};
+
} // namespace mozc
#endif // MOZC_BASE_URL_H_
diff --git a/src/base/url_test.cc b/src/base/url_test.cc
index 6fc7281..666330d 100644
--- a/src/base/url_test.cc
+++ b/src/base/url_test.cc
@@ -33,11 +33,11 @@
#include <vector>
#include "base/util.h"
-#include "base/version.h"
#include "testing/base/public/gunit.h"
namespace mozc {
namespace {
+
const char kSurveyBaseURL[] =
"http://www.google.com/support/ime/japanese/bin/request.py";
@@ -53,7 +53,6 @@
}
return false;
}
-} // namespace
TEST(URLTest, UninstallationSurveyURL) {
string url;
@@ -85,4 +84,6 @@
EXPECT_TRUE(FindEncodedParam(params, "hl", "jp"));
EXPECT_TRUE(FindEncodedParam(params, "format", "inproduct"));
}
+
+} // namespace
} // namespace mozc
diff --git a/src/dictionary/file/dictionary_file_builder.cc b/src/dictionary/file/dictionary_file_builder.cc
index a8f2681..da3b56e 100644
--- a/src/dictionary/file/dictionary_file_builder.cc
+++ b/src/dictionary/file/dictionary_file_builder.cc
@@ -69,10 +69,8 @@
ifs.read(ptr, len);
sections_.push_back(DictionaryFileSection(ptr, len, ""));
-
sections_.back().name =
DictionaryFileCodecFactory::GetCodec()->GetSectionName(section_name);
-
return true;
}
diff --git a/src/dictionary/system/system_dictionary.cc b/src/dictionary/system/system_dictionary.cc
index 35d7f2e..85de1f0 100644
--- a/src/dictionary/system/system_dictionary.cc
+++ b/src/dictionary/system/system_dictionary.cc
@@ -263,7 +263,8 @@
}
if (token_info_.accent_encoding_type == TokenInfo::EMBEDDED_IN_TOKEN) {
- token_.value += "_" + Util::StringPrintf("%d", token_info_.accent_type);
+ token_.value.append(1, '_')
+ .append(Util::StringPrintf("%d", token_info_.accent_type));
}
if (token_info_.pos_type == TokenInfo::FREQUENT_POS) {
diff --git a/src/gui/character_pad/character_palette.cc b/src/gui/character_pad/character_palette.cc
index 6695f30..c879164 100644
--- a/src/gui/character_pad/character_palette.cc
+++ b/src/gui/character_pad/character_palette.cc
@@ -48,7 +48,6 @@
namespace mozc {
namespace gui {
-
namespace {
const char32 kHexBase = 16;
@@ -114,14 +113,15 @@
{ NULL, 0 }
};
-// add child QTreeWidgetItem with the text "name" to parent.
-// return child item.
+// Adds a child QTreeWidgetItem with the text "name" to parent.
+// Returns the added child item.
QTreeWidgetItem *AddItem(QTreeWidgetItem *parent, const char *name) {
QTreeWidgetItem *item = new QTreeWidgetItem(parent);
item->setText(0, QString::fromUtf8(name));
parent->addChild(item);
return item;
}
+
} // namespace
CharacterPalette::CharacterPalette(QWidget *parent)
@@ -485,5 +485,6 @@
return QWidget::winEvent(message, result);
}
#endif // OS_WIN
+
} // namespace gui
} // namespace mozc
diff --git a/src/gui/character_pad/windows_selection_handler.cc b/src/gui/character_pad/windows_selection_handler.cc
index 126e1fc..c4f4c86 100644
--- a/src/gui/character_pad/windows_selection_handler.cc
+++ b/src/gui/character_pad/windows_selection_handler.cc
@@ -28,13 +28,14 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef OS_WIN
+
#include "gui/character_pad/windows_selection_handler.h"
#include <windows.h>
#include <QtCore/QString>
#include <vector>
+
#include "base/logging.h"
-#include "base/util.h"
namespace mozc {
namespace gui {
@@ -74,6 +75,8 @@
return;
}
}
+
} // namespace gui
} // namespace mozc
+
#endif // OS_WIN
diff --git a/src/gui/character_pad/windows_selection_handler.h b/src/gui/character_pad/windows_selection_handler.h
index 5391899..e946029 100644
--- a/src/gui/character_pad/windows_selection_handler.h
+++ b/src/gui/character_pad/windows_selection_handler.h
@@ -29,11 +29,10 @@
#ifndef MOZC_GUI_CHARACTER_PAD_WINDOWS_SELECTION_HANDLER_H_
#define MOZC_GUI_CHARACTER_PAD_WINDOWS_SELECTION_HANDLER_H_
-
-#include <string>
-
#ifdef OS_WIN
+
#include <QtCore/QString>
+
#include "gui/character_pad/selection_handler.h"
namespace mozc {
@@ -41,11 +40,14 @@
class WindowsSelectionHandler : public SelectionCallbackInterface {
public:
- virtual void Select(const QString &str);
WindowsSelectionHandler();
virtual ~WindowsSelectionHandler();
+
+ virtual void Select(const QString &str);
};
-}
-}
-#endif
+
+} // namespace gui
+} // namespace mozc
+
+#endif // OS_WIN
#endif // MOZC_GUI_CHARACTER_PAD_WINDOWS_SELECTION_HANDLER_H_
diff --git a/src/gui/config_dialog/combobox_delegate.cc b/src/gui/config_dialog/combobox_delegate.cc
index 51a46c8..ca73385 100644
--- a/src/gui/config_dialog/combobox_delegate.cc
+++ b/src/gui/config_dialog/combobox_delegate.cc
@@ -28,6 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gui/config_dialog/combobox_delegate.h"
+
#include <QtGui/QtGui>
#include <QtGui/QComboBox>
@@ -60,8 +61,7 @@
QWidget *editor,
const QModelIndex &index) const {
QString str = index.model()->data(index, Qt::EditRole).toString();
- QComboBox *comboBox =
- static_cast<QComboBox*>(editor);
+ QComboBox *comboBox = static_cast<QComboBox*>(editor);
if (comboBox == NULL) {
return;
}
@@ -71,8 +71,7 @@
void ComboBoxDelegate::setModelData(
QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const {
- QComboBox *comboBox =
- static_cast<QComboBox*>(editor);
+ QComboBox *comboBox = static_cast<QComboBox*>(editor);
if (comboBox == NULL || model == NULL) {
return;
}
@@ -94,5 +93,6 @@
emit commitData(editor);
emit closeEditor(editor);
}
-} // gui
-} // mozc
+
+} // namespace gui
+} // namespace mozc
diff --git a/src/gui/config_dialog/combobox_delegate.h b/src/gui/config_dialog/combobox_delegate.h
index e0bd1f5..39314a7 100644
--- a/src/gui/config_dialog/combobox_delegate.h
+++ b/src/gui/config_dialog/combobox_delegate.h
@@ -69,6 +69,8 @@
private:
QStringList item_list_;
};
-} // gui
-} // mozc
+
+} // namespace gui
+} // namespace mozc
+
#endif // MOZC_GUI_CONFIG_DIALOG_COMBOBOX_DELEGATE_H_
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index 4bcf8bf..24e7bdf 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=17
-BUILD=2090
+BUILD=2091
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.
diff --git a/src/prediction/predictor.cc b/src/prediction/predictor.cc
index 18d2807..1e816d3 100644
--- a/src/prediction/predictor.cc
+++ b/src/prediction/predictor.cc
@@ -47,6 +47,7 @@
namespace mozc {
namespace {
+
const int kPredictionSize = 100;
// On Mobile mode PREDICTION (including PARTIAL_PREDICTION) behaves like as
// conversion so very large limit is preferable.
@@ -263,4 +264,5 @@
return result;
}
+
} // namespace mozc