summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-method.cc2
-rw-r--r--apt-pkg/contrib/macros.h7
-rw-r--r--apt-pkg/contrib/strutl.cc4
-rw-r--r--apt-pkg/contrib/strutl.h3
-rw-r--r--apt-pkg/deb/debmetaindex.cc4
-rw-r--r--debian/libapt-pkg5.90.symbols2
-rw-r--r--methods/basehttp.cc2
-rw-r--r--test/interactive-helper/aptwebserver.cc4
8 files changed, 21 insertions, 7 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc
index ae5ae4a15..f2a61a144 100644
--- a/apt-pkg/acquire-method.cc
+++ b/apt-pkg/acquire-method.cc
@@ -416,7 +416,7 @@ int pkgAcqMethod::Run(bool Single)
Tmp->Uri = LookupTag(Message,"URI");
Tmp->Proxy(LookupTag(Message, "Proxy"));
Tmp->DestFile = LookupTag(Message,"FileName");
- if (RFC1123StrToTime(LookupTag(Message,"Last-Modified").c_str(),Tmp->LastModified) == false)
+ if (RFC1123StrToTime(LookupTag(Message,"Last-Modified"),Tmp->LastModified) == false)
Tmp->LastModified = 0;
Tmp->IndexFile = StringToBool(LookupTag(Message,"Index-File"),false);
Tmp->FailIgnore = StringToBool(LookupTag(Message,"Fail-Ignore"),false);
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index df85b7856..4d9f780c7 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -150,4 +150,11 @@
#define APT_PKG_RELEASE 0
#define APT_PKG_ABI ((APT_PKG_MAJOR * 100) + APT_PKG_MINOR)
+
+#if APT_PKG_ABI > 590
+#define APT_PKG_590(msg) __attribute__((error(msg)))
+#else
+#define APT_PKG_590(msg)
+#endif
+
#endif
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index c00bce5d5..e02067e13 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -995,6 +995,10 @@ static time_t timegm(struct tm *t)
method used to ignore the timezone and assume always UTC. */
bool RFC1123StrToTime(const char* const str,time_t &time)
{
+ return RFC1123StrToTime(std::string(str), time);
+}
+bool RFC1123StrToTime(std::string const &str,time_t &time)
+{
unsigned short day = 0;
signed int year = 0; // yes, Y23K problem – we going to worry then…
std::string weekday, month, datespec, timespec, zone;
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 367b04ef6..fc02357a8 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -81,7 +81,8 @@ std::string TimeRFC1123(time_t Date, bool const NumericTimezone);
* parsing is successful, undefined otherwise.
* @return \b true if parsing was successful, otherwise \b false.
*/
-bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK;
+bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK APT_PKG_590("Replaced by std::string variant");
+bool RFC1123StrToTime(const std::string &str,time_t &time) APT_MUSTCHECK;
bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK;
std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0);
int StringToBool(const std::string &Text,int Default = -1);
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index fef58f543..71e047257 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -528,7 +528,7 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro
AuthPossible = true;
std::string const StrDate = Section.FindS("Date");
- if (RFC1123StrToTime(StrDate.c_str(), Date) == false)
+ if (RFC1123StrToTime(StrDate, Date) == false)
{
_error->Warning( _("Invalid '%s' entry in Release file %s"), "Date", Filename.c_str());
Date = 0;
@@ -567,7 +567,7 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro
// if we have a Valid-Until header in the Release file, use it as default
if (StrValidUntil.empty() == false)
{
- if (RFC1123StrToTime(StrValidUntil.c_str(), ValidUntil) == false)
+ if (RFC1123StrToTime(StrValidUntil, ValidUntil) == false)
{
if (ErrorText != NULL)
strprintf(*ErrorText, _("Invalid '%s' entry in Release file %s"), "Valid-Until", Filename.c_str());
diff --git a/debian/libapt-pkg5.90.symbols b/debian/libapt-pkg5.90.symbols
index 77828464c..44f4df7de 100644
--- a/debian/libapt-pkg5.90.symbols
+++ b/debian/libapt-pkg5.90.symbols
@@ -634,6 +634,8 @@ libapt-pkg.so.5.90 libapt-pkg5.90 #MINVER#
(arch=x32|c++)"FTPMDTMStrToTime(char const*, long long&)@APTPKG_5.90" 0.8.0
(arch=!x32|c++)"RFC1123StrToTime(char const*, long&)@APTPKG_5.90" 0.8.0
(arch=x32|c++)"RFC1123StrToTime(char const*, long long&)@APTPKG_5.90" 0.8.0
+ (arch=!x32|c++)"RFC1123StrToTime(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long&)@APTPKG_5.90" 1.9.0
+ (arch=x32|c++)"RFC1123StrToTime(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long long&)@APTPKG_5.90" 1.9.0
### architecture specific: mode_t
(arch=!kfreebsd-i386 !kfreebsd-amd64|c++)"ChangeOwnerAndPermissionOfFile(char const*, char const*, char const*, char const*, unsigned int)@APTPKG_5.90" 1.1~exp9
(arch=kfreebsd-i386 kfreebsd-amd64|c++)"ChangeOwnerAndPermissionOfFile(char const*, char const*, char const*, char const*, unsigned short)@APTPKG_5.90" 1.1~exp9
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index 04c194ad9..fd5934b40 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -232,7 +232,7 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
if (stringcasecmp(Tag,"Last-Modified:") == 0)
{
- if (RFC1123StrToTime(Val.c_str(), Date) == false)
+ if (RFC1123StrToTime(Val, Date) == false)
return _error->Error(_("Unknown date format"));
return true;
}
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index 2243ccea9..0398a12b6 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -793,7 +793,7 @@ static void * handleClient(int const client, size_t const id) /*{{{*/
if (_config->FindB("aptwebserver::support::modified-since", true) == true && condition.empty() == false)
{
time_t cache;
- if (RFC1123StrToTime(condition.c_str(), cache) == true &&
+ if (RFC1123StrToTime(condition, cache) == true &&
cache >= data.ModificationTime())
{
sendHead(log, client, 304, headers);
@@ -821,7 +821,7 @@ static void * handleClient(int const client, size_t const id) /*{{{*/
if (_config->FindB("aptwebserver::support::if-range", true) == true)
ifrange = LookupTag(*m, "If-Range", "");
bool validrange = (ifrange.empty() == true ||
- (RFC1123StrToTime(ifrange.c_str(), cache) == true &&
+ (RFC1123StrToTime(ifrange, cache) == true &&
cache <= data.ModificationTime()));
// FIXME: support multiple byte-ranges (APT clients do not do this)