mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(trunk libT) tweak MAX_PATH_LENGTH a little for better portability -- defer to limits.h's definition when present
This commit is contained in:
@@ -1621,7 +1621,7 @@ tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename )
|
||||
char * tmp;
|
||||
int fd;
|
||||
int err = 0;
|
||||
char buf[MAX_PATH_LENGTH];
|
||||
char buf[TR_MAX_PATH];
|
||||
|
||||
/* follow symlinks to find the "real" file, to make sure the temporary
|
||||
* we build with mkstemp() is created on the right partition */
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
#include "transmission.h"
|
||||
#include "fdlimit.h"
|
||||
#include "net.h"
|
||||
#include "platform.h" /* MAX_PATH_LENGTH, TR_PATH_DELIMITER */
|
||||
#include "platform.h" /* TR_MAX_PATH, TR_PATH_DELIMITER */
|
||||
#include "session.h"
|
||||
#include "torrent.h" /* tr_isTorrent() */
|
||||
#include "utils.h"
|
||||
@@ -87,7 +87,7 @@ struct tr_openfile
|
||||
tr_bool isWritable;
|
||||
int torrentId;
|
||||
tr_file_index_t fileNum;
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
char filename[TR_MAX_PATH];
|
||||
int fd;
|
||||
uint64_t date;
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "session.h"
|
||||
#include "bencode.h"
|
||||
#include "makemeta.h"
|
||||
#include "platform.h" /* threads, locks */
|
||||
#include "platform.h" /* threads, locks, TR_PATH_MAX */
|
||||
#include "utils.h" /* buildpath */
|
||||
#include "version.h"
|
||||
|
||||
@@ -315,7 +315,7 @@ getFileInfo( const char * topFile,
|
||||
tr_bencInitList( uninitialized_path, n );
|
||||
for( prev = pch = file->filename + topLen; ; ++pch )
|
||||
{
|
||||
char buf[MAX_PATH_LENGTH];
|
||||
char buf[TR_MAX_PATH];
|
||||
|
||||
if( *pch && *pch != TR_PATH_DELIMITER )
|
||||
continue;
|
||||
|
||||
@@ -277,7 +277,7 @@ getOldConfigDir( void )
|
||||
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
|
||||
path = tr_buildPath( appdata, "Transmission", NULL );
|
||||
#elif defined( __HAIKU__ )
|
||||
char buf[MAX_PATH_LENGTH];
|
||||
char buf[TR_PATH_MAX];
|
||||
find_directory( B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof(buf) );
|
||||
path = tr_buildPath( buf, "Transmission", NULL );
|
||||
#else
|
||||
@@ -436,11 +436,11 @@ tr_getDefaultConfigDir( const char * appname )
|
||||
s = tr_buildPath( getHomeDir( ), "Library", "Application Support",
|
||||
appname, NULL );
|
||||
#elif defined( WIN32 )
|
||||
char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
|
||||
char appdata[TR_MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
|
||||
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
|
||||
s = tr_buildPath( appdata, appname, NULL );
|
||||
#elif defined( __HAIKU__ )
|
||||
char buf[MAX_PATH_LENGTH];
|
||||
char buf[TR_MAX_PATH];
|
||||
find_directory( B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof(buf) );
|
||||
s = tr_buildPath( buf, appname, NULL );
|
||||
#else
|
||||
|
||||
@@ -26,10 +26,14 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#define MAX_PATH_LENGTH MAX_PATH
|
||||
#include <windows.h> /* MAX_PATH */
|
||||
#else
|
||||
#define MAX_PATH_LENGTH 4096
|
||||
#include <limits.h> /* MAX_PATH */
|
||||
#endif
|
||||
#ifdef MAX_PATH
|
||||
#define TR_MAX_PATH MAX_PATH
|
||||
#else
|
||||
#define TR_MAX_PATH 4096
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user