-rw-r--r-- | lib/util.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/util.cc b/lib/util.cc index a46ba2a..249eeed 100644 --- a/lib/util.cc +++ b/lib/util.cc | |||
@@ -205,24 +205,24 @@ namespace opkele { | |||
205 | for_each(str.begin(),str.end(), | 205 | for_each(str.begin(),str.end(), |
206 | __url_encoder(rv)); | 206 | __url_encoder(rv)); |
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; |
227 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) | 227 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) |
228 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); | 228 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); |