diff --git a/uppsrc/Core/TimeDate.cpp b/uppsrc/Core/TimeDate.cpp index a2570c7b8..19f3e569b 100644 --- a/uppsrc/Core/TimeDate.cpp +++ b/uppsrc/Core/TimeDate.cpp @@ -238,19 +238,34 @@ int CharFilterDate(int c) return 0; } -int Date::Get() const { - return year * 365 + s_month_off[month - 1] + (day - 1) + - (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400 + 1 + - (month > 2) * IsLeapYear(year); +int Date::Get() const +{ + if(IsNull(*this)) + return Null; + int y400 = (year / 400 ) - 2; + int ym = year - y400 * 400; + return y400 * (400 * 365 + 100 - 3) + + ym * 365 + s_month_off[month - 1] + (day - 1) + + (ym - 1) / 4 - (ym - 1) / 100 + (ym - 1) / 400 + 1 + + (month > 2) * IsLeapYear(ym); } -void Date::Set(int d) { +void Date::Set(int d) +{ + if(IsNull(d)) { + *this = Null; + return; + } int q, leap; year = 0; q = d / (400 * 365 + 100 - 3); year += 400 * q; d -= q * (400 * 365 + 100 - 3); - leap = 1; + if(d < 0) { + year -= 400; + d += 400 * 365 + 100 - 3; + } + leap = 1; if(d >= 100 * 365 + 24 + 1) { d--; q = d / (100 * 365 + 24); diff --git a/uppsrc/plugin/ftp/ftp.cpp b/uppsrc/plugin/ftp/ftp.cpp index 84563f147..c154048f2 100644 --- a/uppsrc/plugin/ftp/ftp.cpp +++ b/uppsrc/plugin/ftp/ftp.cpp @@ -99,7 +99,6 @@ String FtpClient::Load(const char *path) return String::GetVoid(); } load_data = Null; - int p = 0; while(!WhenProgress(load_data.GetLength(), 0)) { byte buffer[1024]; int ndata = FtpRead(buffer, sizeof(buffer), ftpdata); @@ -232,7 +231,6 @@ String FtpClient::List(const char *path) error = FtpError(ftpconn); return String::GetVoid(); } - int p = 0; while(!WhenProgress(load_data.GetLength(),0)) { byte buffer[1024]; int ndata = FtpRead(buffer, sizeof(buffer), ftpdata); diff --git a/uppsrc/plugin/ftp/lib/ftplib.cpp b/uppsrc/plugin/ftp/lib/ftplib.cpp index 36474d40c..38bb5f9c3 100644 --- a/uppsrc/plugin/ftp/lib/ftplib.cpp +++ b/uppsrc/plugin/ftp/lib/ftplib.cpp @@ -80,7 +80,7 @@ struct NetBuf { char perror[256]; }; -static char *version = +static const char version[] = "ftplib Release 3.1-1 9/16/00, copyright 1996-2000 Thomas Pfau"; GLOBALDEF int ftplib_debug = 0; @@ -388,14 +388,6 @@ static int FtpBlock(int sockno, int block, char perror[]) return 1; } -static int FtpCheckRead(int sockno, struct timeval *tv) -{ - fd_set mask; - FD_ZERO(&mask); - FD_SET(sockno, &mask); - return select(sockno + 1, &mask, NULL, &mask, tv) > 0 ? 1 : 0; -} - static int FtpCheckWrite(int sockno, struct timeval *tv) { fd_set mask; @@ -749,7 +741,6 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData, int mode, int dir) //* if (connect(sData, &sin.sa, sizeof(sin.sa)) == -1) { - int t0 = UPP::msecs(), tlim = 0; if(nControl->idlecb && FtpLastError() == ERRPENDING) { while(!FtpCheckWrite(sData, &nControl->idletime)) { if(!nControl->idlecb(nControl, -2, nControl->idlearg)) {