diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 22:05:59 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 22:05:59 +0000 |
commit | fbf745a2c70813a8fca9d5de6574fc602b3ebfeb (patch) | |
tree | 818185d9363d9193ee54e0d0a442f937804f84bf | |
parent | 552079df978b40210f549546739b6393fdc3b8b0 (diff) | |
download | chromium_src-fbf745a2c70813a8fca9d5de6574fc602b3ebfeb.zip chromium_src-fbf745a2c70813a8fca9d5de6574fc602b3ebfeb.tar.gz chromium_src-fbf745a2c70813a8fca9d5de6574fc602b3ebfeb.tar.bz2 |
file_util: The member variable |pattern_| has a different type (FilePath) from the constructor parameter (StringType).
So fix this type to match with the constructor.
Original patch by Thiago Farina <thiago.farina@gmail.com> at
http://codereview.chromium.org/465119/show
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/466071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34092 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/file_util.h | 26 | ||||
-rw-r--r-- | base/file_util_posix.cc | 21 | ||||
-rw-r--r-- | base/file_util_win.cc | 4 |
3 files changed, 25 insertions, 26 deletions
diff --git a/base/file_util.h b/base/file_util.h index b91e6b7..e97f498 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -434,19 +434,6 @@ class FileEnumerator { void GetFindInfo(FindInfo* info); private: - FilePath root_path_; - bool recursive_; - FILE_TYPE file_type_; - FilePath pattern_; // Empty when we want to find everything. - - // Set to true when there is a find operation open. This way, we can lazily - // start the operations when the caller calls Next(). - bool is_in_find_op_; - - // A stack that keeps track of which subdirectories we still need to - // enumerate in the breadth-first search. - std::stack<FilePath> pending_paths_; - // Returns true if the given path should be skipped in enumeration. bool ShouldSkip(const FilePath& path); @@ -476,6 +463,19 @@ class FileEnumerator { size_t current_directory_entry_; #endif + FilePath root_path_; + bool recursive_; + FILE_TYPE file_type_; + FilePath::StringType pattern_; // Empty when we want to find everything. + + // Set to true when there is a find operation open. This way, we can lazily + // start the operations when the caller calls Next(). + bool is_in_find_op_; + + // A stack that keeps track of which subdirectories we still need to + // enumerate in the breadth-first search. + std::stack<FilePath> pending_paths_; + DISALLOW_COPY_AND_ASSIGN(FileEnumerator); }; diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index dc9d793..ed5abcc 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -539,11 +539,11 @@ bool SetCurrentDirectory(const FilePath& path) { FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, FileEnumerator::FILE_TYPE file_type) - : root_path_(root_path), + : current_directory_entry_(0), + root_path_(root_path), recursive_(recursive), file_type_(file_type), - is_in_find_op_(false), - current_directory_entry_(0) { + is_in_find_op_(false) { // INCLUDE_DOT_DOT must not be specified if recursive. DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); pending_paths_.push(root_path); @@ -553,19 +553,19 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, FileEnumerator::FILE_TYPE file_type, const FilePath::StringType& pattern) - : root_path_(root_path), + : current_directory_entry_(0), + root_path_(root_path), recursive_(recursive), file_type_(file_type), - pattern_(root_path.Append(pattern)), - is_in_find_op_(false), - current_directory_entry_(0) { + pattern_(root_path.Append(pattern).value()), + is_in_find_op_(false) { // INCLUDE_DOT_DOT must not be specified if recursive. DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); // The Windows version of this code appends the pattern to the root_path, // potentially only matching against items in the top-most directory. // Do the same here. if (pattern.size() == 0) - pattern_ = FilePath(); + pattern_ = FilePath::StringType(); pending_paths_.push(root_path); } @@ -607,9 +607,8 @@ FilePath FileEnumerator::Next() { if (ShouldSkip(full_path)) continue; - if (pattern_.value().size() && - fnmatch(pattern_.value().c_str(), full_path.value().c_str(), - FNM_NOESCAPE)) + if (pattern_.size() && + fnmatch(pattern_.c_str(), full_path.value().c_str(), FNM_NOESCAPE)) continue; if (recursive_ && S_ISDIR(i->stat.st_mode)) diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 9fae6a39..9d29d80 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -739,7 +739,7 @@ FilePath FileEnumerator::Next() { // Start a new find operation. FilePath src = root_path_; - if (pattern_.value().empty()) + if (pattern_.empty()) src = src.Append(L"*"); // No pattern = match everything. else src = src.Append(pattern_); @@ -763,7 +763,7 @@ FilePath FileEnumerator::Next() { // in the root search directory, but for those directories which were // matched, we want to enumerate all files inside them. This will happen // when the handle is empty. - pattern_ = FilePath(); + pattern_ = FilePath::StringType(); return Next(); } |