diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-26 05:58:49 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-26 05:58:49 +0000 |
| commit | 90d5b5c0a268e145cd121a0bcf2bdc0b624f0ca3 (patch) | |
| tree | 913532d3875403d87d38037dcca0e15c3fed539c /src/Request.cc | |
| parent | 0f92203ffebb18f754cffecc06dcb2bea2189594 (diff) | |
2008-04-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added StringFormat class, which internally calls vasprintf.
operator<< is defined for this class, so it can be used with iostream
classes nicely. SimpleLogger and following functions are rewritten
using StringFormat class.
Besides, now Logger class's methods are non-const, many classes
that has a const Logger* as a member variable are modified to remove
const qualifier from the variable declaration.
* src/HelpItemFactory.cc
* src/Request.cc
* src/SimpleLogger.cc
* src/StringFormat.cc
* src/StringFormat.h
* src/Util.cc
* src/option_processing.cc
* src/version_usage.cc
* test/StringFormatTest.cc
* src/*.h: The classes that has const Logger* as a member variable.
Diffstat (limited to 'src/Request.cc')
| -rw-r--r-- | src/Request.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Request.cc b/src/Request.cc index 545dc600..e06f1981 100644 --- a/src/Request.cc +++ b/src/Request.cc @@ -38,6 +38,7 @@ #include "CookieBoxFactory.h" #include "CookieBox.h" #include "RecoverableException.h" +#include "StringFormat.h" #include <utility> namespace aria2 { @@ -180,10 +181,7 @@ std::string Request::urlencode(const std::string& src) const result.replace(index, 1, "%25"); } } else { - char temp[4]; - sprintf(temp, "%%%02x", c); - temp[3] = '\0'; - result.replace(index, 1, temp); + result.replace(index, 1, StringFormat("%%%02x", c).toString()); } } } |
