diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-28 19:06:56 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-28 19:06:56 +0900 |
| commit | 50122f0ab35e16446e652bb62efeed7f4b1da8c1 (patch) | |
| tree | 31876960fe94ef7af861b44ce7ef6b4ff341ea8c /src | |
| parent | ecbc05012ce252c03a5685ee4f0fd2b93b1fda25 (diff) | |
Renamed Exception::errno_ as Exception::errNum_.
Diffstat (limited to 'src')
| -rw-r--r-- | src/AbstractDiskWriter.cc | 2 | ||||
| -rw-r--r-- | src/Exception.cc | 51 | ||||
| -rw-r--r-- | src/Exception.h | 9 |
3 files changed, 45 insertions, 17 deletions
diff --git a/src/AbstractDiskWriter.cc b/src/AbstractDiskWriter.cc index e343857a..39b989f4 100644 --- a/src/AbstractDiskWriter.cc +++ b/src/AbstractDiskWriter.cc @@ -71,7 +71,7 @@ void AbstractDiskWriter::openFile(uint64_t totalLength) try { openExistingFile(totalLength); } catch(RecoverableException& e) { - if(e.getErrno() == ENOENT) { + if(e.getErrNum() == ENOENT) { initAndOpenFile(totalLength); } else { throw; diff --git a/src/Exception.cc b/src/Exception.cc index 5b93242f..6b1565c9 100644 --- a/src/Exception.cc +++ b/src/Exception.cc @@ -38,20 +38,49 @@ namespace aria2 { -Exception::Exception(const char* file, int line, const std::string& msg): - file_(file), line_(line), errno_(0), msg_(msg) {} +Exception::Exception +(const char* file, + int line, + const std::string& msg) + : file_(file), + line_(line), + errNum_(0), + msg_(msg) +{} -Exception::Exception(const char* file, int line, const std::string& msg, - const Exception& cause): - file_(file), line_(line), errno_(0), msg_(msg), cause_(cause.copy()) {} +Exception::Exception +(const char* file, + int line, + const std::string& msg, + const Exception& cause) + : file_(file), + line_(line), + errNum_(0), + msg_(msg), + cause_(cause.copy()) +{} -Exception::Exception(const char* file, int line, const Exception& e): - file_(file), line_(line), errno_(0), msg_(e.msg_), cause_(e.cause_) +Exception::Exception +(const char* file, + int line, + const Exception& e) + : file_(file), + line_(line), + errNum_(0), + msg_(e.msg_), + cause_(e.cause_) {} Exception::Exception -(const char* file, int line, int errnoArg, const std::string& msg): - file_(file), line_(line), errno_(errnoArg), msg_(msg) {} +(const char* file, + int line, + int errNum, + const std::string& msg) + : file_(file), + line_(line), + errNum_(errNum), + msg_(msg) +{} Exception::~Exception() throw() {} @@ -59,8 +88,8 @@ std::string Exception::stackTrace() const { std::stringstream s; s << "Exception: " << "[" << file_ << ":" << line_ << "] "; - if(errno_) { - s << "errno=" << errno_ << " "; + if(errNum_) { + s << "errno=" << errNum_ << " "; } s << what() << "\n"; SharedHandle<Exception> e = cause_; diff --git a/src/Exception.h b/src/Exception.h index 2be24127..a5724c2e 100644 --- a/src/Exception.h +++ b/src/Exception.h @@ -50,12 +50,11 @@ private: int line_; - int errno_; + int errNum_; std::string msg_; SharedHandle<Exception> cause_; - protected: virtual SharedHandle<Exception> copy() const = 0; @@ -67,7 +66,7 @@ public: Exception(const char* file, int line, const Exception& e); - Exception(const char* file, int line, int errnoArg, const std::string& msg); + Exception(const char* file, int line, int errNum, const std::string& msg); virtual ~Exception() throw(); @@ -75,9 +74,9 @@ public: std::string stackTrace() const; - int getErrno() const + int getErrNum() const { - return errno_; + return errNum_; } }; |
