From 78485ab210b815c21ce55cb0cecb834ba5158e18 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 6 Jul 2011 13:41:18 +0200 Subject: * apt-pkg/init.cc: - use CndSet in pkgInitConfig (Closes: #629617) --- apt-pkg/contrib/configuration.cc | 15 ++++++++++++++- apt-pkg/contrib/configuration.h | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index cc7093fe2..0664e3704 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -318,6 +318,19 @@ void Configuration::CndSet(const char *Name,const string &Value) Itm->Value = Value; } /*}}}*/ +// Configuration::Set - Set an integer value /*{{{*/ +// --------------------------------------------------------------------- +/* */ +void Configuration::CndSet(const char *Name,int const Value) +{ + Item *Itm = Lookup(Name,true); + if (Itm == 0 || Itm->Value.empty() == false) + return; + char S[300]; + snprintf(S,sizeof(S),"%i",Value); + Itm->Value = S; +} + /*}}}*/ // Configuration::Set - Set a value /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -332,7 +345,7 @@ void Configuration::Set(const char *Name,const string &Value) // Configuration::Set - Set an integer value /*{{{*/ // --------------------------------------------------------------------- /* */ -void Configuration::Set(const char *Name,int const &Value) +void Configuration::Set(const char *Name,int const Value) { Item *Itm = Lookup(Name,true); if (Itm == 0) diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 71e5a0e47..3568ce815 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -82,8 +82,9 @@ class Configuration inline void Set(const string &Name,const string &Value) {Set(Name.c_str(),Value);}; void CndSet(const char *Name,const string &Value); + void CndSet(const char *Name,const int Value); void Set(const char *Name,const string &Value); - void Set(const char *Name,const int &Value); + void Set(const char *Name,const int Value); inline bool Exists(const string &Name) const {return Exists(Name.c_str());}; bool Exists(const char *Name) const; -- cgit v1.2.3 From 0df8c3dccbda739af6e20999fb208ada0619ad80 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 15 Jul 2011 10:39:58 +0200 Subject: apt-pkg/contrib/configuration.cc: revert Configuration::Set() ABI break --- apt-pkg/contrib/configuration.cc | 2 +- apt-pkg/contrib/configuration.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 0664e3704..942ea9fbc 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -345,7 +345,7 @@ void Configuration::Set(const char *Name,const string &Value) // Configuration::Set - Set an integer value /*{{{*/ // --------------------------------------------------------------------- /* */ -void Configuration::Set(const char *Name,int const Value) +void Configuration::Set(const char *Name,int const &Value) { Item *Itm = Lookup(Name,true); if (Itm == 0) diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 3568ce815..2844ec097 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -84,7 +84,7 @@ class Configuration void CndSet(const char *Name,const string &Value); void CndSet(const char *Name,const int Value); void Set(const char *Name,const string &Value); - void Set(const char *Name,const int Value); + void Set(const char *Name,const int &Value); inline bool Exists(const string &Name) const {return Exists(Name.c_str());}; bool Exists(const char *Name) const; -- cgit v1.2.3 From 1edc38abff0bffd56ad7a128f6243050d4064827 Mon Sep 17 00:00:00 2001 From: David Miller Date: Tue, 26 Jul 2011 09:00:10 +0200 Subject: * apt-pkg/contrib/sha1.cc: - fix illegally casts of on-stack buffer to a type requiring more alignment than it has resulting in segfaults on sparc (Closes: #634696) The problem is how sha1.cc codes the SHA1 transform, it illegally casts the on-stack workspace buffer to a type requiring more alignment than 'workspace' is actually declared to have. This only shows up recently because gcc-4.6 now does a really aggressive optimization where it gets rid of the workspace buffer entirely and just accesses 'buffer' directly, and assumes it has the necessary alignment for 32-bit loads (which it doesn't). --- apt-pkg/contrib/sha1.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index eae52d52f..abc2aaf9f 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -74,10 +74,9 @@ static void SHA1Transform(uint32_t state[5],uint8_t const buffer[64]) uint32_t l[16]; } CHAR64LONG16; - CHAR64LONG16 *block; + CHAR64LONG16 workspace, *block; - uint8_t workspace[64]; - block = (CHAR64LONG16 *)workspace; + block = &workspace; memcpy(block,buffer,sizeof(workspace)); /* Copy context->state[] to working vars */ -- cgit v1.2.3