summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-09-22 20:08:35 (UTC)
committer Michael Krelin <hacker@klever.net>2008-09-22 20:08:35 (UTC)
commit4522de61114018633f66492e2e9977cdb3108098 (patch) (unidiff)
tree2af460f9269163320098476d484dee867c4e8138
parent767b9926a3b2a2ab000415cc5d36df84dd90f13f (diff)
downloadlibopkele-4522de61114018633f66492e2e9977cdb3108098.zip
libopkele-4522de61114018633f66492e2e9977cdb3108098.tar.gz
libopkele-4522de61114018633f66492e2e9977cdb3108098.tar.bz2
A couple of bugfixes
- added missing 'return' statement to the forward_iterator_proxy operator=() - made temporary non-static for thread safety in url_decode() Thanks to Masato Kataoka of orenosv project Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/iterator.h2
-rw-r--r--lib/util.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/opkele/iterator.h b/include/opkele/iterator.h
index 8f86234..94da7e4 100644
--- a/include/opkele/iterator.h
+++ b/include/opkele/iterator.h
@@ -100,13 +100,13 @@ namespace opkele {
100 : I(new forward_iterator_proxy_impl<IT>(i)) { } 100 : I(new forward_iterator_proxy_impl<IT>(i)) { }
101 forward_iterator_proxy(const forward_iterator_proxy<T,TR,TP>& x) 101 forward_iterator_proxy(const forward_iterator_proxy<T,TR,TP>& x)
102 : I(x.I->dup()) { } 102 : I(x.I->dup()) { }
103 ~forward_iterator_proxy() { delete I; } 103 ~forward_iterator_proxy() { delete I; }
104 104
105 forward_iterator_proxy& operator=(const forward_iterator_proxy<T,TR,TP>& x) { 105 forward_iterator_proxy& operator=(const forward_iterator_proxy<T,TR,TP>& x) {
106 delete I; I = x.I->dup(); } 106 delete I; I = x.I->dup(); return *this; }
107 107
108 bool operator==(const forward_iterator_proxy<T,TR,TP>& x) const { 108 bool operator==(const forward_iterator_proxy<T,TR,TP>& x) const {
109 return (*I)==(*(x.I)); } 109 return (*I)==(*(x.I)); }
110 bool operator!=(const forward_iterator_proxy<T,TR,TP>& x) const { 110 bool operator!=(const forward_iterator_proxy<T,TR,TP>& x) const {
111 return (*I)!=(*(x.I)); } 111 return (*I)!=(*(x.I)); }
112 112
diff --git a/lib/util.cc b/lib/util.cc
index a46ba2a..249eeed 100644
--- a/lib/util.cc
+++ b/lib/util.cc
@@ -207,20 +207,20 @@ namespace opkele {
207 return rv; 207 return rv;
208 } 208 }
209 209
210 string url_decode(const string& str) { 210 string url_decode(const string& str) {
211 string rv; 211 string rv;
212 back_insert_iterator<string> ii(rv); 212 back_insert_iterator<string> ii(rv);
213 char tmp[3]; tmp[2] = 0;
213 for(string::const_iterator i=str.begin(),ie=str.end(); 214 for(string::const_iterator i=str.begin(),ie=str.end();
214 i!=ie;++i) { 215 i!=ie;++i) {
215 switch(*i) { 216 switch(*i) {
216 case '+': 217 case '+':
217 *(ii++) = ' '; break; 218 *(ii++) = ' '; break;
218 case '%': 219 case '%':
219 ++i; 220 ++i;
220 static char tmp[3] = {0,0,0};
221 if(i==ie) 221 if(i==ie)
222 throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string"); 222 throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string");
223 tmp[0] = *(i++); 223 tmp[0] = *(i++);
224 if(i==ie) 224 if(i==ie)
225 throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string"); 225 throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string");
226 tmp[1] = *i; 226 tmp[1] = *i;