summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 20:19:35 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 20:19:35 +0000
commit37c2f16b1138c430f804428c9f0ea038f1f0a186 (patch)
treecf26558e227a7a0fc99983b2be8a77a605a35ad8 /chrome
parent226f045e5149fce5b8296b2f79c2b015628ebf62 (diff)
downloadchromium_src-37c2f16b1138c430f804428c9f0ea038f1f0a186.zip
chromium_src-37c2f16b1138c430f804428c9f0ea038f1f0a186.tar.gz
chromium_src-37c2f16b1138c430f804428c9f0ea038f1f0a186.tar.bz2
Dictionary-related Linux porting.
- build convert_dict tool - compile & pass hunspell tests - misc gcc cleanups Review URL: http://codereview.chromium.org/20462 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/unit/unit_tests.scons6
-rw-r--r--chrome/third_party/hunspell/SConscript4
-rw-r--r--chrome/third_party/hunspell/google/bdict_writer.cc6
-rw-r--r--chrome/tools/convert_dict/aff_reader.cc16
-rw-r--r--chrome/tools/convert_dict/convert_dict.scons7
5 files changed, 18 insertions, 21 deletions
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index 6799abe..ca34bed 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -438,12 +438,6 @@ if not env.Bit('windows'):
'$CHROME_DIR/renderer/render_widget_unittest.cc',
'$CHROME_DIR/test/browser_with_test_window_test.cc',
'$CHROME_DIR/test/test_tab_contents.cc',
- '$CHROME_DIR/third_party/hunspell/google/bdict_reader$OBJSUFFIX',
- '$CHROME_DIR/third_party/hunspell/google/bdict_writer$OBJSUFFIX',
- '$CHROME_DIR/third_party/hunspell/google/hunspell_tests.cc',
- '$CHROME_DIR/tools/convert_dict/aff_reader$OBJSUFFIX',
- '$CHROME_DIR/tools/convert_dict/dic_reader$OBJSUFFIX',
- '$CHROME_DIR/tools/convert_dict/hunspell_reader$OBJSUFFIX',
'$CHROME_DIR/views/focus_manager_unittest.cc',
'$CHROME_DIR/views/grid_layout_unittest.cc',
'$CHROME_DIR/views/label_unittest.cc',
diff --git a/chrome/third_party/hunspell/SConscript b/chrome/third_party/hunspell/SConscript
index 4d4c037..803d17b 100644
--- a/chrome/third_party/hunspell/SConscript
+++ b/chrome/third_party/hunspell/SConscript
@@ -52,7 +52,7 @@ if env.Bit('windows'):
env.Append(
CPPDEFINES = [
'W32',
- ],
+ ],
CCFLAGS = [
'/TP',
@@ -108,6 +108,8 @@ input_files = ChromeFileList([
'google/bdict_affentry.h',
'google/bdict_reader.cc',
'google/bdict_reader.h',
+ 'google/bdict_writer.cc',
+ 'google/bdict_writer.h',
]),
])
diff --git a/chrome/third_party/hunspell/google/bdict_writer.cc b/chrome/third_party/hunspell/google/bdict_writer.cc
index 6ec080b..ee47acb 100644
--- a/chrome/third_party/hunspell/google/bdict_writer.cc
+++ b/chrome/third_party/hunspell/google/bdict_writer.cc
@@ -191,7 +191,7 @@ size_t ComputeTrieStorage(DicNode* node) {
static const int kListHeaderSize = 1;
// Lists can only store up to 16 items.
- static const int kListThreshold = 16;
+ static const size_t kListThreshold = 16;
if (node->children.size() < kListThreshold && child_size <= 0xFF) {
node->storage = DicNode::LIST8;
return kListHeaderSize + node->children.size() * 2 + child_size;
@@ -265,7 +265,7 @@ void SerializeLeaf(const DicNode* node, std::string* output) {
output->push_back(
static_cast<char>((node->affix_indices[i] >> 8) & 0xFF));
}
-
+
// Terminator for affix list. We use 0xFFFF.
output->push_back(static_cast<unsigned char>(0xFF));
output->push_back(static_cast<unsigned char>(0xFF));
@@ -442,7 +442,7 @@ void BDictWriter::SetWords(const WordList& words) {
std::string BDictWriter::GetBDict() const {
std::string ret;
-
+
// Save room for the header. This will be populated at the end.
ret.resize(sizeof(hunspell::BDict::Header));
diff --git a/chrome/tools/convert_dict/aff_reader.cc b/chrome/tools/convert_dict/aff_reader.cc
index ea797fb..2e0d8b3 100644
--- a/chrome/tools/convert_dict/aff_reader.cc
+++ b/chrome/tools/convert_dict/aff_reader.cc
@@ -91,20 +91,24 @@ bool AffReader::Read() {
// Affix. The first one is the number of ones following which we don't
// bother with.
has_indexed_affixes_ = true;
- if (got_first_af)
- AddAffixGroup(&line.substr(3));
- else
+ if (got_first_af) {
+ std::string group(line.substr(3));
+ AddAffixGroup(&group);
+ } else {
got_first_af = true;
+ }
} else if (StringBeginsWith(line, "SFX ") ||
StringBeginsWith(line, "PFX ")) {
AddAffix(&line);
} else if (StringBeginsWith(line, "REP ")) {
// The first rep line is the number of ones following which we don't
// bother with.
- if (got_first_rep)
- AddReplacement(&line.substr(4));
- else
+ if (got_first_rep) {
+ std::string replacement(line.substr(4));
+ AddReplacement(&replacement);
+ } else {
got_first_rep = true;
+ }
} else if (StringBeginsWith(line, "TRY ") ||
StringBeginsWith(line, "MAP ")) {
HandleEncodedCommand(line);
diff --git a/chrome/tools/convert_dict/convert_dict.scons b/chrome/tools/convert_dict/convert_dict.scons
index 07b7027..0026ca7 100644
--- a/chrome/tools/convert_dict/convert_dict.scons
+++ b/chrome/tools/convert_dict/convert_dict.scons
@@ -30,7 +30,7 @@ input_files = ChromeFileList([
'$CHROME_DIR/third_party/hunspell/google/bdict.h',
'$CHROME_DIR/third_party/hunspell/google/bdict_reader$OBJSUFFIX',
'$CHROME_DIR/third_party/hunspell/google/bdict_reader.h',
- '$CHROME_DIR/third_party/hunspell/google/bdict_writer.cc',
+ '$CHROME_DIR/third_party/hunspell/google/bdict_writer$OBJSUFFIX',
'$CHROME_DIR/third_party/hunspell/google/bdict_writer.h',
'convert_dict.cc',
'dic_reader.cc',
@@ -39,10 +39,7 @@ input_files = ChromeFileList([
'hunspell_reader.h',
])
-
-# TODO(port):
-if env.Bit('windows'):
- env.ChromeProgram('convert_dict', input_files)
+env.ChromeProgram('convert_dict', input_files)
p = env.ChromeMSVSProject('convert_dict.vcproj',
dest=('$CHROME_SRC_DIR/chrome/'