]> granicus.if.org Git - transmission/commitdiff
(trunk libT) tweak MAX_PATH_LENGTH a little for better portability -- defer to limits...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 6 May 2010 15:07:18 +0000 (15:07 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 6 May 2010 15:07:18 +0000 (15:07 +0000)
libtransmission/bencode.c
libtransmission/fdlimit.c
libtransmission/makemeta.c
libtransmission/platform.c
libtransmission/platform.h

index 78dedcd50356d5e1da4d75a23f99543f2a5e14a2..8aa4825f02cd2243a4730d2b45c2a865731c03d1 100644 (file)
@@ -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 */
index 736f8038242ffe1be0f1e2e4afbd41f4ebe0109d..26dbf90903a8a54145d1b18156f9126b78ad1783 100644 (file)
@@ -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;
 };
index 612d593f0235b8e5efb301e566f69ce839324988..bc2cb7b06b4b06e98f2b0bc2995fe48ddaed9294 100644 (file)
@@ -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;
index 3e4afba3c28aee0c01ada40ad24520e8047a58c3..1e5946c7f69b7ac1fcd924d7aeb070a84e0e21cf 100644 (file)
@@ -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
index 52c78202181952a7c6074e3445b4a2152df271de..900e515bfaa0db55201a7f4dd49faa08c5660d68 100644 (file)
 #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
 
 /**