Ignore:
Timestamp:
May 29, 2009, 7:17:12 PM (13 years ago)
Author:
charles
Message:

(trunk libT) re-start work on making libT doxygen friendly. still a long ways to go on this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.h

    r8424 r8561  
    3232***/
    3333
     34/**
     35 * @addtogroup utils Utilities
     36 * @{
     37 */
     38
    3439#ifndef FALSE
    3540 #define FALSE 0
     
    193198                           const char * pattern );
    194199
    195 /** a portability wrapper for basename(). */
    196 char*          tr_basename( const char * path ) TR_GNUC_MALLOC;
    197 
    198 /** a portability wrapper for dirname(). */
    199 char*          tr_dirname( const char * path ) TR_GNUC_MALLOC;
    200 
    201 /**
     200/** @brief Portability wrapper for basename() that uses the system implementation if available */
     201char* tr_basename( const char * path ) TR_GNUC_MALLOC;
     202
     203/** @brief Portability wrapper for dirname() that uses the system implementation if available */
     204char* tr_dirname( const char * path ) TR_GNUC_MALLOC;
     205
     206/**
     207 * @brief Portability wrapper for mkdir()
     208 *
    202209 * a portability wrapper around mkdir().
    203210 * On WIN32, the `permissions' argument is unused.
     
    215222 * (in which case errno is set appropriately).
    216223 */
    217 int            tr_mkdirp( const char * path,
    218                           int          permissions );
    219 
    220 
    221 /**
    222  * Loads a file and returns its contents.
     224int tr_mkdirp( const char * path, int permissions );
     225
     226
     227/**
     228 * @brief Loads a file and returns its contents.
    223229 * On failure, NULL is returned and errno is set.
    224230 */
    225 uint8_t*       tr_loadFile( const char * filename,
    226                             size_t *     size ) TR_GNUC_MALLOC;
    227 
    228 
    229 /* creates a filename from a series of elements using the
    230    correct separator for filenames. */
    231 char*          tr_buildPath( const char * first_element, ... )
    232                                               TR_GNUC_NULL_TERMINATED
    233                                               TR_GNUC_MALLOC;
     231uint8_t* tr_loadFile( const char * filename, size_t * size ) TR_GNUC_MALLOC;
     232
     233
     234/** @brief build a filename from a series of elements using the
     235           platform's correct directory separator. */
     236char* tr_buildPath( const char * first_element, ... ) TR_GNUC_NULL_TERMINATED
     237                                                      TR_GNUC_MALLOC;
    234238
    235239struct timeval;
    236240
    237 void tr_timevalMsec( uint64_t           milliseconds,
    238                      struct timeval   * setme );
    239 
    240 
    241 /* return the current date in milliseconds */
     241void tr_timevalMsec( uint64_t milliseconds, struct timeval   * setme );
     242
     243
     244/** @brief return the current date in milliseconds */
    242245uint64_t       tr_date( void );
    243246
    244 /* wait the specified number of milliseconds */
     247/** @brief wait the specified number of milliseconds */
    245248void           tr_wait( uint64_t delay_milliseconds );
    246249
    247 char*          tr_utf8clean( const char  * str,
    248                              int           max_len,
    249                              tr_bool     * err );
     250/**
     251 * @brief make a copy of 'str' whose non-utf8 content has been corrected or stripped
     252 * @param str the string to make a clean copy of
     253 * @param len the length of the string to copy.  If -1, the entire string is used.
     254 * @param err if an error occurs and err is non-NULL, it's set to TRUE.
     255 */
     256char* tr_utf8clean( const char * str, int len, tr_bool * err ) TR_GNUC_MALLOC;
    250257
    251258
     
    269276***/
    270277
    271 /* Sometimes the system defines MAX/MIN, sometimes not. In the latter
    272    case, define those here since we will use them */
     278/* Sometimes the system defines MAX/MIN, sometimes not.
     279   In the latter case, define those here since we will use them */
    273280#ifndef MAX
    274281 #define MAX( a, b ) ( ( a ) > ( b ) ? ( a ) : ( b ) )
     
    338345                              int *        outlen ) TR_GNUC_MALLOC;
    339346
    340 size_t      tr_strlcpy( char *       dst,
    341                         const void * src,
    342                         size_t       siz );
    343 
    344 int         tr_snprintf( char *       buf,
    345                          size_t       buflen,
    346                          const char * fmt,
    347                          ... ) TR_GNUC_PRINTF( 3, 4 );
     347/** @brief Portability wrapper for strlcpy() that uses the system implementation if available */
     348size_t tr_strlcpy( char * dst, const void * src, size_t siz );
     349
     350/** @brief Portability wrapper for snprintf() that uses the system implementation if available */
     351int tr_snprintf( char * buf, size_t buflen,
     352                 const char * fmt, ... ) TR_GNUC_PRINTF( 3, 4 );
    348353
    349354const char* tr_strerror( int );
    350355
    351 char*       tr_strstrip( char * str );
    352 
     356/** @brief strips leading and trailing whitspace from a string
     357    @return the stripped string */
     358char* tr_strstrip( char * str );
     359
     360/** @brief Portability wrapper for memmem() that uses the system implementation if available */
    353361const char* tr_memmem( const char * haystack, size_t haystack_len,
    354362                       const char * needle, size_t needle_len );
     
    455463double tr_getRatio( double numerator, double denominator );
    456464
    457 int* tr_parseNumberRange( const char * str, int str_len, int * setmeCount );
     465int* tr_parseNumberRange( const char * str, int str_len, int * setmeCount ) TR_GNUC_MALLOC;
    458466
    459467
     
    470478char* tr_strratio( char * buf, size_t buflen, double ratio, const char * infinity );
    471479
     480/** @brief Portability wrapper for localtime_r() that uses the system implementation if available */
    472481struct tm * tr_localtime_r( const time_t *_clock, struct tm *_result );
    473482
     
    481490#endif
    482491
    483 #endif
     492/** @} */
     493
     494#endif
Note: See TracChangeset for help on using the changeset viewer.