Chromium Code Reviews| Index: third_party/leveldatabase/env_chromium.cc |
| diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc |
| index cad20412bb343f5abf69b9eb7cc27b6448814e7b..05151b958172388dd4f382e08f09b80ab6dc225f 100644 |
| --- a/third_party/leveldatabase/env_chromium.cc |
| +++ b/third_party/leveldatabase/env_chromium.cc |
| @@ -408,22 +408,23 @@ Status MakeIOError(Slice filename, |
| return Status::IOError(filename, buf); |
| } |
| -ErrorParsingResult ParseMethodAndError(const char* string, |
| +ErrorParsingResult ParseMethodAndError(const leveldb::Status& status, |
| MethodID* method_param, |
| int* error) { |
| + std::string str = status.ToString(); |
|
dgrogan
2014/12/15 21:55:30
Change the variable name so status_string, or some
cmumford
2014/12/15 22:26:11
I renamed it to "status_string". I couldn't make i
dgrogan
2014/12/15 22:31:48
I think you understood it but now I'm confused. Wo
|
| int method; |
| - if (RE2::PartialMatch(string, "ChromeMethodOnly: (\\d+)", &method)) { |
| + if (RE2::PartialMatch(str.c_str(), "ChromeMethodOnly: (\\d+)", &method)) { |
| *method_param = static_cast<MethodID>(method); |
| return METHOD_ONLY; |
| } |
| - if (RE2::PartialMatch( |
| - string, "ChromeMethodPFE: (\\d+)::.*::(\\d+)", &method, error)) { |
| + if (RE2::PartialMatch(str.c_str(), "ChromeMethodPFE: (\\d+)::.*::(\\d+)", |
| + &method, error)) { |
| *error = -*error; |
| *method_param = static_cast<MethodID>(method); |
| return METHOD_AND_PFE; |
| } |
| - if (RE2::PartialMatch( |
| - string, "ChromeMethodErrno: (\\d+)::.*::(\\d+)", &method, error)) { |
| + if (RE2::PartialMatch(str.c_str(), "ChromeMethodErrno: (\\d+)::.*::(\\d+)", |
| + &method, error)) { |
| *method_param = static_cast<MethodID>(method); |
| return METHOD_AND_ERRNO; |
| } |
| @@ -502,8 +503,8 @@ bool IndicatesDiskFull(const leveldb::Status& status) { |
| return false; |
| leveldb_env::MethodID method; |
| int error = -1; |
| - leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError( |
| - status.ToString().c_str(), &method, &error); |
| + leveldb_env::ErrorParsingResult result = |
| + leveldb_env::ParseMethodAndError(status, &method, &error); |
| return (result == leveldb_env::METHOD_AND_PFE && |
| static_cast<base::File::Error>(error) == |
| base::File::FILE_ERROR_NO_SPACE) || |
| @@ -513,8 +514,8 @@ bool IndicatesDiskFull(const leveldb::Status& status) { |
| bool IsIOError(const leveldb::Status& status) { |
| leveldb_env::MethodID method; |
| int error = -1; |
| - leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError( |
| - status.ToString().c_str(), &method, &error); |
| + leveldb_env::ErrorParsingResult result = |
| + leveldb_env::ParseMethodAndError(status, &method, &error); |
| return result != leveldb_env::NONE; |
| } |