diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-26 13:41:02 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-26 16:31:20 +0100 |
commit | 88d3a9fde4ed1d1070ba0326569138f651cc60e8 (patch) | |
tree | da875f9f33e0e5c6c1059f772025799d7025e525 /apt-pkg/contrib | |
parent | e9ac86f11b23310924058a045e0352b499c66d43 (diff) |
strutl: Remove deprecated functions
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 55 | ||||
-rw-r--r-- | apt-pkg/contrib/strutl.h | 2 |
2 files changed, 0 insertions, 57 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 50344d1fe..e854c5bf1 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -806,10 +806,6 @@ int StringToBool(const string &Text,int Default) // --------------------------------------------------------------------- /* This converts a time_t into a string time representation that is year 2000 compliant and timezone neutral */ -string TimeRFC1123(time_t Date) -{ - return TimeRFC1123(Date, false); -} string TimeRFC1123(time_t Date, bool const NumericTimezone) { struct tm Conv; @@ -1099,57 +1095,6 @@ bool FTPMDTMStrToTime(const char* const str,time_t &time) return true; } /*}}}*/ -// StrToTime - Converts a string into a time_t /*{{{*/ -// --------------------------------------------------------------------- -/* This handles all 3 popular time formats including RFC 1123, RFC 1036 - and the C library asctime format. It requires the GNU library function - 'timegm' to convert a struct tm in UTC to a time_t. For some bizzar - reason the C library does not provide any such function :< This also - handles the weird, but unambiguous FTP time format*/ -bool StrToTime(const string &Val,time_t &Result) -{ - struct tm Tm; - char Month[10]; - - // Skip the day of the week - const char *I = strchr(Val.c_str(), ' '); - - // Handle RFC 1123 time - Month[0] = 0; - if (sscanf(I," %2d %3s %4d %2d:%2d:%2d GMT",&Tm.tm_mday,Month,&Tm.tm_year, - &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6) - { - // Handle RFC 1036 time - if (sscanf(I," %2d-%3s-%3d %2d:%2d:%2d GMT",&Tm.tm_mday,Month, - &Tm.tm_year,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) == 6) - Tm.tm_year += 1900; - else - { - // asctime format - if (sscanf(I," %3s %2d %2d:%2d:%2d %4d",Month,&Tm.tm_mday, - &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec,&Tm.tm_year) != 6) - { - // 'ftp' time - if (sscanf(Val.c_str(),"%4d%2d%2d%2d%2d%2d",&Tm.tm_year,&Tm.tm_mon, - &Tm.tm_mday,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6) - return false; - Tm.tm_mon--; - } - } - } - - Tm.tm_isdst = 0; - if (Month[0] != 0) - Tm.tm_mon = MonthConv(Month); - else - Tm.tm_mon = 0; // we don't have a month, so pick something - Tm.tm_year -= 1900; - - // Convert to local time and then to GMT - Result = timegm(&Tm); - return true; -} - /*}}}*/ // StrToNum - Convert a fixed length string to a number /*{{{*/ // --------------------------------------------------------------------- /* This is used in decoding the crazy fixed length string headers in diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 9f74f8c2a..c25ce8054 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -66,7 +66,6 @@ std::string TimeToStr(unsigned long Sec); std::string Base64Encode(const std::string &Str); std::string OutputInDepth(const unsigned long Depth, const char* Separator=" "); std::string URItoFileName(const std::string &URI); -APT_DEPRECATED_MSG("Specify if GMT is required or a numeric timezone can be used") std::string TimeRFC1123(time_t Date); /** returns a datetime string as needed by HTTP/1.1 and Debian files. * * Note: The date will always be represented in a UTC timezone @@ -94,7 +93,6 @@ std::string TimeRFC1123(time_t Date, bool const NumericTimezone); */ bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK; bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK; -APT_DEPRECATED_MSG("Use RFC1123StrToTime or FTPMDTMStrToTime as needed instead") bool StrToTime(const std::string &Val,time_t &Result); std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0); int StringToBool(const std::string &Text,int Default = -1); bool ReadMessages(int Fd, std::vector<std::string> &List); |