Removed A2STR strings other than NIL

pull/28/head
Tatsuhiro Tsujikawa 2012-09-24 23:01:08 +09:00
parent 4423ece43d
commit d95a179876
7 changed files with 15 additions and 59 deletions

View File

@ -36,30 +36,10 @@
namespace aria2 {
const std::string A2STR::NIL("");
namespace A2STR {
const std::string A2STR::SHARP_C("#");
const std::string NIL("");
const std::string A2STR::CR_C("\r");
const std::string A2STR::LF_C("\n");
const std::string A2STR::CRLF("\r\n");
const std::string A2STR::SLASH_C("/");
const std::string A2STR::DOT_C(".");
const std::string A2STR::COLON_C(":");
const std::string A2STR::SEMICOLON_C(";");
const std::string A2STR::EQUAL_C("=");
const std::string A2STR::UNDERSCORE_C("_");
const std::string A2STR::BACK_SLASH_C("\\");
const std::string A2STR::COMMA_C(",");
} // namespace A2STR
} // namespace aria2

View File

@ -39,36 +39,12 @@
namespace aria2 {
class A2STR {
private:
A2STR();
public:
static const std::string NIL;
namespace A2STR {
static const std::string SHARP_C;
extern const std::string NIL;
static const std::string CR_C;
} // namespace A2STR
static const std::string LF_C;
static const std::string CRLF;
static const std::string SLASH_C;
static const std::string DOT_C;
static const std::string COLON_C;
static const std::string SEMICOLON_C;
static const std::string EQUAL_C;
static const std::string UNDERSCORE_C;
static const std::string BACK_SLASH_C;
static const std::string COMMA_C;
};
} // namespace aria2
#endif // D_A2_STR_H

View File

@ -147,7 +147,7 @@ std::string Cookie::toNsCookieFormat() const
{
std::stringstream ss;
if(!hostOnly_) {
ss << A2STR::DOT_C;
ss << ".";
}
ss << domain_ << "\t";
if(hostOnly_) {

View File

@ -216,10 +216,10 @@ std::string File::getDirname() const
if(name_.empty()) {
return A2STR::NIL;
} else {
return A2STR::DOT_C;
return ".";
}
} else if(lastSlashIndex == 0) {
return A2STR::SLASH_C;
return "/";
} else {
return name_.substr(0, lastSlashIndex);
}
@ -281,7 +281,7 @@ std::string File::getCurrentDir()
if(_wgetcwd(buf, buflen)) {
return wCharToUtf8(buf);
} else {
return A2STR::DOT_C;
return ".";
}
#else // !__MINGW32__
const size_t buflen = 2048;
@ -289,7 +289,7 @@ std::string File::getCurrentDir()
if(getcwd(buf, buflen)) {
return std::string(buf);
} else {
return A2STR::DOT_C;
return ".";
}
#endif // !__MINGW32__
}

View File

@ -314,7 +314,7 @@ FtpConnection::findEndOfResponse
if(p == std::string::npos) {
return std::string::npos;
}
p = buf.find(A2STR::CRLF, p+6);
p = buf.find("\r\n", p+6);
if(p == std::string::npos) {
return std::string::npos;
} else {
@ -322,7 +322,7 @@ FtpConnection::findEndOfResponse
}
} else {
// single line response
std::string::size_type p = buf.find(A2STR::CRLF);
std::string::size_type p = buf.find("\r\n");
if(p == std::string::npos) {
return std::string::npos;
} else {

View File

@ -1371,7 +1371,7 @@ std::string applyDir(const std::string& dir, const std::string& relPath)
std::string fixTaintedBasename(const std::string& src)
{
static std::string SLASH_REP = "%2F";
return escapePath(replace(src, A2STR::SLASH_C, SLASH_REP));
return escapePath(replace(src, "/", SLASH_REP));
}
void generateRandomKey(unsigned char* key)

View File

@ -38,7 +38,7 @@ void ExceptionTest::testStackTrace()
("Exception: [ExceptionTest.cc:34] errorCode=2 exception thrown\n"
" -> [ExceptionTest.cc:32] errorCode=2 cause2\n"
" -> [ExceptionTest.cc:31] errorCode=2 cause1\n"),
util::replace(e.stackTrace(), A2_TEST_DIR+A2STR::SLASH_C, ""));
util::replace(e.stackTrace(), std::string(A2_TEST_DIR)+"/", ""));
}
} // namespace aria2