Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/tools/convert_dict/dic_reader.cc

Issue 109043002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/tools/convert_dict/dic_reader.h" 5 #include "chrome/tools/convert_dict/dic_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 else 122 else
123 found->second.insert(affix_index); 123 found->second.insert(affix_index);
124 } 124 }
125 125
126 return true; 126 return true;
127 } 127 }
128 128
129 } // namespace 129 } // namespace
130 130
131 DicReader::DicReader(const base::FilePath& path) { 131 DicReader::DicReader(const base::FilePath& path) {
132 file_ = file_util::OpenFile(path, "r"); 132 file_ = base::OpenFile(path, "r");
133 133
134 base::FilePath additional_path = 134 base::FilePath additional_path =
135 path.ReplaceExtension(FILE_PATH_LITERAL("dic_delta")); 135 path.ReplaceExtension(FILE_PATH_LITERAL("dic_delta"));
136 additional_words_file_ = file_util::OpenFile(additional_path, "r"); 136 additional_words_file_ = base::OpenFile(additional_path, "r");
137 137
138 if (additional_words_file_) 138 if (additional_words_file_)
139 printf("Reading %" PRFilePath " ...\n", additional_path.value().c_str()); 139 printf("Reading %" PRFilePath " ...\n", additional_path.value().c_str());
140 else 140 else
141 printf("%" PRFilePath " not found.\n", additional_path.value().c_str()); 141 printf("%" PRFilePath " not found.\n", additional_path.value().c_str());
142 } 142 }
143 143
144 DicReader::~DicReader() { 144 DicReader::~DicReader() {
145 if (file_) 145 if (file_)
146 file_util::CloseFile(file_); 146 base::CloseFile(file_);
147 if (additional_words_file_) 147 if (additional_words_file_)
148 file_util::CloseFile(additional_words_file_); 148 base::CloseFile(additional_words_file_);
149 } 149 }
150 150
151 bool DicReader::Read(AffReader* aff_reader) { 151 bool DicReader::Read(AffReader* aff_reader) {
152 if (!file_) 152 if (!file_)
153 return false; 153 return false;
154 154
155 WordSet word_set; 155 WordSet word_set;
156 156
157 // Add words from the dic file to the word set. 157 // Add words from the dic file to the word set.
158 // Note that the first line is the word count in the file. 158 // Note that the first line is the word count in the file.
(...skipping 22 matching lines...) Expand all
181 std::reverse(affixes.begin(), affixes.end()); 181 std::reverse(affixes.begin(), affixes.end());
182 words_.push_back(std::make_pair(word->first, affixes)); 182 words_.push_back(std::make_pair(word->first, affixes));
183 } 183 }
184 184
185 // Double-check that the words are sorted. 185 // Double-check that the words are sorted.
186 std::sort(words_.begin(), words_.end()); 186 std::sort(words_.begin(), words_.end());
187 return true; 187 return true;
188 } 188 }
189 189
190 } // namespace convert_dict 190 } // namespace convert_dict
OLDNEW
« no previous file with comments | « chrome/tools/convert_dict/convert_dict.cc ('k') | cloud_print/virtual_driver/win/port_monitor/port_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698