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

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

Issue 2929002: Convert some tools to use FilePaths for file names. (Closed)
Patch Set: ok Created 10 years, 5 months 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
« no previous file with comments | « chrome/tools/convert_dict/dic_reader.h ('k') | tools/imagediff/image_diff.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } else { 121 } else {
122 found->second.insert(affix_index); 122 found->second.insert(affix_index);
123 } 123 }
124 } 124 }
125 125
126 return true; 126 return true;
127 } 127 }
128 128
129 } // namespace 129 } // namespace
130 130
131 DicReader::DicReader(const std::string& filename) { 131 DicReader::DicReader(const FilePath& path) {
132 FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename));
133 file_ = file_util::OpenFile(path, "r"); 132 file_ = file_util::OpenFile(path, "r");
134 133
135 FilePath additional_path = 134 FilePath additional_path =
136 path.InsertBeforeExtension(FILE_PATH_LITERAL("_delta")); 135 path.InsertBeforeExtension(FILE_PATH_LITERAL("_delta"));
137 additional_words_file_ = file_util::OpenFile(additional_path, "r"); 136 additional_words_file_ = file_util::OpenFile(additional_path, "r");
138 } 137 }
139 138
140 DicReader::~DicReader() { 139 DicReader::~DicReader() {
141 if (file_) 140 if (file_)
142 file_util::CloseFile(file_); 141 file_util::CloseFile(file_);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 std::sort(affixes.begin(), affixes.end()); 176 std::sort(affixes.begin(), affixes.end());
178 words_.push_back(std::make_pair(word->first, affixes)); 177 words_.push_back(std::make_pair(word->first, affixes));
179 } 178 }
180 179
181 // Double-check that the words are sorted. 180 // Double-check that the words are sorted.
182 std::sort(words_.begin(), words_.end()); 181 std::sort(words_.begin(), words_.end());
183 return true; 182 return true;
184 } 183 }
185 184
186 } // namespace convert_dict 185 } // namespace convert_dict
OLDNEW
« no previous file with comments | « chrome/tools/convert_dict/dic_reader.h ('k') | tools/imagediff/image_diff.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698