mirror of https://github.com/aria2/aria2
2009-02-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Don't use Time::parse(buf, "%Y%m%d%H%M%S") because Mac OS X and included strptime doesn't parse data for this format. * src/FtpConnection.cc * test/FtpConnectionTest.ccpull/1/head
parent
a57e0b1273
commit
fe267b43d5
|
@ -1,3 +1,10 @@
|
|||
2009-02-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Don't use Time::parse(buf, "%Y%m%d%H%M%S") because Mac OS X and
|
||||
included strptime doesn't parse data for this format.
|
||||
* src/FtpConnection.cc
|
||||
* test/FtpConnectionTest.cc
|
||||
|
||||
2009-02-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed tests giving -1 for unsigned argument.
|
||||
|
|
|
@ -367,9 +367,8 @@ unsigned int FtpConnection::receiveMdtmResponse(Time& time)
|
|||
char buf[15]; // YYYYMMDDhhmmss+\0, milli second part is dropped.
|
||||
sscanf(response.second.c_str(), "%*u %14s", buf);
|
||||
if(strlen(buf) == 14) {
|
||||
#ifdef HAVE_STRPTIME
|
||||
time = Time::parse(buf, "%Y%m%d%H%M%S");
|
||||
#else // !HAVE_STRPTIME
|
||||
// We don't use Time::parse(buf,"%Y%m%d%H%M%S") here because Mac OS X
|
||||
// and included strptime doesn't parse data for this format.
|
||||
struct tm tm;
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
tm.tm_sec = Util::parseInt(&buf[12]);
|
||||
|
@ -384,7 +383,6 @@ unsigned int FtpConnection::receiveMdtmResponse(Time& time)
|
|||
buf[4] = '\0';
|
||||
tm.tm_year = Util::parseInt(&buf[0])-1900;
|
||||
time = Time(timegm(&tm));
|
||||
#endif // !HAVE_STRPTIME
|
||||
} else {
|
||||
time = Time::null();
|
||||
}
|
||||
|
|
|
@ -172,14 +172,13 @@ void FtpConnectionTest::testReceiveMdtmResponse()
|
|||
CPPUNIT_ASSERT(t.bad());
|
||||
}
|
||||
{
|
||||
#ifdef HAVE_STRPTIME
|
||||
// invalid month: 19
|
||||
// invalid month: 19, we don't care about invalid month..
|
||||
Time t;
|
||||
_serverSocket->writeData("213 20081908124312\r\n");
|
||||
waitRead(_clientSocket);
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)213, _ftp->receiveMdtmResponse(t));
|
||||
CPPUNIT_ASSERT(t.bad());
|
||||
#endif
|
||||
// Wed Jul 8 12:43:12 2009
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)1247056992, t.getTime());
|
||||
}
|
||||
{
|
||||
Time t;
|
||||
|
|
Loading…
Reference in New Issue