From ae972b50c443122bbfe6fc1c0758ccb5e1374a38 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Tue, 25 Oct 2011 15:57:10 +0000 Subject: [PATCH] utils.h's public function tr_realpath() function relies on the private constant TR_MAX_PATH. Make TR_MAX_PATH public. --- libtransmission/platform.h | 12 ------------ libtransmission/utils.h | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libtransmission/platform.h b/libtransmission/platform.h index fff1a58d1..7e1571778 100644 --- a/libtransmission/platform.h +++ b/libtransmission/platform.h @@ -20,18 +20,6 @@ #define TR_PATH_DELIMITER '/' #define TR_PATH_DELIMITER_STR "/" -#ifdef WIN32 - #include /* MAX_PATH */ - #define TR_PATH_MAX (MAX_PATH + 1) -#else - #include /* PATH_MAX */ - #ifdef PATH_MAX - #define TR_PATH_MAX PATH_MAX - #else - #define TR_PATH_MAX 4096 - #endif -#endif - /** * @addtogroup tr_session Session * @{ diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 7ca922ca1..c11b28860 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -513,7 +513,20 @@ static inline time_t tr_time( void ) { return __tr_current_time; } /** @brief Private libtransmission function to update tr_time()'s counter */ static inline void tr_timeUpdate( time_t now ) { __tr_current_time = now; } -/** @brief Portability wrapper for realpath() that uses the system implementation if available */ +#ifdef WIN32 + #include /* MAX_PATH */ + #define TR_PATH_MAX (MAX_PATH + 1) +#else + #include /* PATH_MAX */ + #ifdef PATH_MAX + #define TR_PATH_MAX PATH_MAX + #else + #define TR_PATH_MAX 4096 + #endif +#endif + +/** @brief Portability wrapper for realpath() that uses the system implementation if available. + @param resolved_path should be TR_PATH_MAX or larger */ char* tr_realpath( const char *path, char * resolved_path ); /** @brief Portability wrapper for htonll() that uses the system implementation if available */ -- 2.40.0