OLD | NEW |
---|---|
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/aff_reader.h" | 5 #include "chrome/tools/convert_dict/aff_reader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 } else { | 41 } else { |
42 prev_space = false; | 42 prev_space = false; |
43 } | 43 } |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 AffReader::AffReader(const std::string& filename) | 49 AffReader::AffReader(const std::string& filename) |
50 : has_indexed_affixes_(false) { | 50 : has_indexed_affixes_(false) { |
51 file_ = file_util::OpenFile(filename, "r"); | 51 FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename)); |
Evan Martin
2010/07/08 16:51:11
I am going to improve this in a follow-up change.
| |
52 file_ = file_util::OpenFile(path, "r"); | |
52 | 53 |
53 // Default to Latin1 in case the file doesn't specify it. | 54 // Default to Latin1 in case the file doesn't specify it. |
54 encoding_ = "ISO8859-1"; | 55 encoding_ = "ISO8859-1"; |
55 } | 56 } |
56 | 57 |
57 AffReader::~AffReader() { | 58 AffReader::~AffReader() { |
58 if (file_) | 59 if (file_) |
59 file_util::CloseFile(file_); | 60 file_util::CloseFile(file_); |
60 } | 61 } |
61 | 62 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 other_commands_.push_back(line); | 305 other_commands_.push_back(line); |
305 } | 306 } |
306 | 307 |
307 void AffReader::HandleEncodedCommand(const std::string& line) { | 308 void AffReader::HandleEncodedCommand(const std::string& line) { |
308 std::string utf8; | 309 std::string utf8; |
309 if (EncodingToUTF8(line, &utf8)) | 310 if (EncodingToUTF8(line, &utf8)) |
310 other_commands_.push_back(utf8); | 311 other_commands_.push_back(utf8); |
311 } | 312 } |
312 | 313 |
313 } // namespace convert_dict | 314 } // namespace convert_dict |
OLD | NEW |