increase buffer size for tracker error messages. Fix snprintf on windows

This commit is contained in:
Arvid Norberg 2009-05-06 00:52:33 +00:00
parent 126f8db863
commit 41a9b88189
2 changed files with 6 additions and 6 deletions

View File

@ -274,7 +274,7 @@ namespace libtorrent
virtual char const* what() const { return "tracker error"; }
virtual std::string message() const
{
char ret[200];
char ret[400];
snprintf(ret, 200, "%s (%d) %s (%d)"
, torrent_alert::message().c_str(), status_code, msg.c_str(), times_in_row);
return ret;
@ -326,7 +326,7 @@ namespace libtorrent
virtual char const* what() const { return "tracker scrape reply"; }
virtual std::string message() const
{
char ret[200];
char ret[400];
snprintf(ret, 200, "%s scrape reply: %u %u"
, torrent_alert::message().c_str(), incomplete, complete);
return ret;
@ -371,7 +371,7 @@ namespace libtorrent
virtual char const* what() const { return "tracker reply"; }
virtual std::string message() const
{
char ret[200];
char ret[400];
snprintf(ret, 200, "%s received peers: %u"
, torrent_alert::message().c_str(), num_peers);
return ret;
@ -393,7 +393,7 @@ namespace libtorrent
virtual char const* what() const { return "DHT reply"; }
virtual std::string message() const
{
char ret[200];
char ret[400];
snprintf(ret, 200, "%s received DHT peers: %u"
, torrent_alert::message().c_str(), num_peers);
return ret;
@ -436,7 +436,7 @@ namespace libtorrent
virtual int category() const { return static_category; }
virtual std::string message() const
{
char ret[200];
char ret[400];
snprintf(ret, 200, "%s hash for piece %u failed"
, torrent_alert::message().c_str(), piece_index);
return ret;

View File

@ -105,7 +105,7 @@ POSSIBILITY OF SUCH DAMAGE.
// this is the maximum number of characters in a
// path element / filename on windows
#define NAME_MAX 255
#define snprintf _snprintf
#define snprintf sprintf_s
#define strtoll _strtoi64
#endif