NAME_MAX fix

This commit is contained in:
Arvid Norberg 2009-09-10 17:12:17 +00:00
parent 3d9c8f1b2d
commit e43dacb275
2 changed files with 2 additions and 2 deletions

View File

@ -178,7 +178,7 @@ POSSIBILITY OF SUCH DAMAGE.
#else #else
// this is the maximum number of characters in a // this is the maximum number of characters in a
// path element / filename on windows // path element / filename on windows
#define NAME_MAX 255 #define TORRENT_MAX_PATH 255
#warning unknown platform, assuming the longest path is 255 #warning unknown platform, assuming the longest path is 255
#endif #endif

View File

@ -268,7 +268,7 @@ namespace libtorrent
if (!need_encoding(path.c_str(), path.size())) if (!need_encoding(path.c_str(), path.size()))
return url; return url;
char msg[NAME_MAX*4]; char msg[TORRENT_MAX_PATH*4];
snprintf(msg, sizeof(msg), "%s://%s%s%s:%d%s", protocol.c_str(), auth.c_str() snprintf(msg, sizeof(msg), "%s://%s%s%s:%d%s", protocol.c_str(), auth.c_str()
, auth.empty()?"":"@", host.c_str(), port , auth.empty()?"":"@", host.c_str(), port
, escape_path(path.c_str(), path.size()).c_str()); , escape_path(path.c_str(), path.size()).c_str());