Changeset 9891
- Timestamp:
- Jan 6, 2010, 12:18:33 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/crypto.h
r9868 r9891 89 89 90 90 91 /** Returns a random number in the range of [0...n) */91 /** @brief Returns a random number in the range of [0...n) */ 92 92 int tr_cryptoRandInt( int n ); 93 93 94 /** Returns a vaguely random number in the range of [0...n). 95 This is faster -- BUT WEAKER -- than tr_cryptoRandInt() 96 and should only be used when tr_cryptoRandInt() is too 97 slow, and NEVER in sensitive cases */ 94 /** 95 * @brief Returns a vaguely random number in the range of [0...n). 96 * 97 * This is faster, BUT WEAKER, than tr_cryptoRandInt() and never 98 * be used in sensitive cases. 99 * @see tr_cryptoRandInt() 100 */ 98 101 int tr_cryptoWeakRandInt( int n ); 99 102 100 /** Fills a buffer with random bytes */103 /** @brief Fills a buffer with random bytes */ 101 104 void tr_cryptoRandBuf( void * buf, size_t len ); 102 105 -
trunk/libtransmission/ggets.h
r8561 r9891 40 40 #endif 41 41 42 /** @ingroup utils */ 42 /** 43 * @brief read a line from a file and place it in a newly-allocated string 44 * @ingroup utils 45 */ 43 46 int fggets( char* *ln, FILE * f ); 44 47 -
trunk/libtransmission/list.c
r9868 r9891 178 178 } 179 179 180 void180 static void 181 181 __tr_list_splice( struct __tr_list * prev, 182 182 struct __tr_list * next) -
trunk/libtransmission/list.h
r9868 r9891 18 18 #define TR_LIST_H 19 19 20 /** 21 * @addtogroup utils Utilities 22 * @{ 23 */ 24 20 25 #include "transmission.h" /* inline */ 21 26 27 /** @brief simple list structure similar to glib's GList */ 22 28 typedef struct tr_list 23 29 { … … 31 37 typedef void ( *TrListForeachFunc )( void * ); 32 38 39 /** 40 * @brief return the number of items in the list 41 * @return the number of items in the list 42 */ 33 43 int tr_list_size( const tr_list * list ); 34 44 35 void tr_list_free( tr_list ** list, 36 TrListForeachFunc data_free_func ); 45 /** 46 * @brief free the specified list and set its pointer to NULL 47 * @param list pointer to the list to be freed 48 * @param func optional function to invoke on each item in the list 49 */ 50 void tr_list_free( tr_list ** list, TrListForeachFunc data_free_func ); 37 51 38 void tr_list_append( tr_list ** list, 39 void * data ); 52 /** 53 * @brief append an item to the specified list 54 * @param list pointer to the list 55 * @param item the item to append 56 */ 57 void tr_list_append( tr_list ** list, void * data ); 40 58 41 void tr_list_prepend( tr_list ** list, 42 void * data ); 59 /** 60 * @brief prepend an item to the specified list 61 * @param list pointer to the list 62 * @param item the item to prepend 63 */ 64 void tr_list_prepend( tr_list ** list, void * data ); 43 65 44 void* tr_list_pop_front( tr_list ** list ); 66 /** 67 * @brief remove the next item in the list 68 * @return the next item in the list, or NULL if the list is empty 69 * @param list pointer to the list 70 */ 71 void* tr_list_pop_front( tr_list ** list ); 45 72 46 void* tr_list_remove_data( tr_list ** list, 47 const void * data ); 73 /** 74 * @brief remove the list's node that contains the specified data pointer 75 * @param list pointer to the list 76 * @param data data to remove 77 * @return the removed data pointer, or NULL if no match was found 78 */ 79 void* tr_list_remove_data( tr_list ** list, const void * data ); 48 80 81 /** 82 * @brief remove the list's node that compares equal to "b" when compared with "compare_func" 83 * @param list pointer to the list 84 * @param b the comparison key 85 * @param compare_func the comparison function. The arguments passed to it will be the list's pointers and the comparison key "b" 86 * @return the removed data pointer, or NULL if no match was found 87 */ 49 88 void* tr_list_remove( tr_list ** list, 50 89 const void * b, 51 90 TrListCompareFunc compare_func ); 52 91 92 /** 93 * @brief find the list node whose data that compares equal to "b" when compared with "compare_func" 94 * @param list pointer to the list 95 * @param b the comparison key 96 * @param compare_func the comparison function. The arguments passed to it will be the list's pointers and the comparison key "b" 97 * @return the matching list node, or NULL if not match was found 98 */ 53 99 tr_list* tr_list_find( tr_list * list, 54 100 const void * b, … … 56 102 57 103 58 /* 59 * Double-linked list with easy memory management and fast 60 * insert/remove operations 61 */ 62 104 /** @brief Double-linked list with easy memory management and fast insert/remove operations */ 63 105 struct __tr_list 64 106 { … … 67 109 68 110 /** 69 * Given a __tr_list node that's embedded in a struct, returns a pointer to the struct.111 * @brief Given a __tr_list node that's embedded in a struct, returns a pointer to the struct. 70 112 * @param ptr pointer to the embedded __tr_list 71 113 * @param type struct type that has contains the __tr_list … … 78 120 79 121 80 /** 81 * __tr_list_init() 82 * 83 * Init @head as an empty list. 84 */ 122 /** @brief Init @head as an empty list. */ 85 123 static inline void 86 124 __tr_list_init( struct __tr_list * head ) … … 90 128 91 129 92 /** 93 * __tr_list_insert() 94 * 95 * Insert @list between @prev and @next. 96 */ 130 /** @brief Insert @list between @prev and @next. */ 97 131 void 98 132 __tr_list_insert( struct __tr_list * list, … … 100 134 struct __tr_list * next); 101 135 102 /** 103 * __tr_list_splice() 104 * 105 * Connect @prev with @next, removing any nodes that were 106 * in between. 107 */ 108 void 109 __tr_list_splice( struct __tr_list * prev, 110 struct __tr_list * next); 111 112 /** 113 * __tr_list_append() 114 * 115 * Append @list to the end of @head. 116 */ 136 /** @brief Append @list to the end of @head. */ 117 137 static inline void 118 __tr_list_append( struct __tr_list * head, 119 struct __tr_list * list) 138 __tr_list_append( struct __tr_list * head, struct __tr_list * list) 120 139 { 121 140 __tr_list_insert( list, head->prev, head ); 122 141 } 123 142 143 /** @brief Remove @head from the list it is in. */ 144 void __tr_list_remove( struct __tr_list * head ); 124 145 125 /** 126 * __tr_list_remove() 127 * 128 * Remove @head from the list it is in. 129 */ 130 void 131 __tr_list_remove( struct __tr_list * head ); 146 /** @brief Destroy the list and free all nodes */ 147 void __tr_list_destroy( struct __tr_list * head, __tr_list_free_t func ); 132 148 133 /** 134 * __tr_list_destroy() 135 * 136 * Destroy the list and free all nodes 137 */ 138 void 139 __tr_list_destroy( struct __tr_list * head, 140 __tr_list_free_t func); 141 149 /* @} */ 142 150 #endif /* TR_LIST_H */ 143 151 -
trunk/libtransmission/ptrarray.h
r9868 r9891 26 26 27 27 /** 28 * Asimple pointer array that resizes itself dynamically.28 * @brief simple pointer array that resizes itself dynamically. 29 29 */ 30 30 typedef struct tr_ptrArray -
trunk/libtransmission/session.h
r9868 r9891 42 42 struct tr_fdInfo; 43 43 44 /** @brief handle to an active libtransmission session */ 44 45 struct tr_session 45 46 { -
trunk/libtransmission/transmission.h
r9890 r9891 1636 1636 1637 1637 /** 1638 * The current status of a torrent.1638 * @brief Describes a torrent's status 1639 1639 * @see tr_torrentStat() 1640 1640 */ -
trunk/libtransmission/utils.h
r9890 r9891 189 189 FILE* tr_getLog( void ); 190 190 191 tr_bool tr_deepLoggingIsActive( void ); 191 /** @brief return true if deep logging has been enabled by the user; false otherwise */ 192 tr_bool tr_deepLoggingIsActive( void ); 192 193 193 194 void tr_deepLog( const char * file, … … 197 198 ... ) TR_GNUC_PRINTF( 4, 5 ) TR_GNUC_NONNULL(1,4); 198 199 199 char* tr_getLogTimeStr( char * buf, 200 intbuflen ) TR_GNUC_NONNULL(1);200 /** @brief set the buffer with the current time formatted for deep logging. */ 201 char* tr_getLogTimeStr( char * buf, int buflen ) TR_GNUC_NONNULL(1); 201 202 202 203 … … 467 468 468 469 469 /* truncate a double value at a given number of decimal places. 470 this can be used to prevent a printf() call from rounding up: 471 call with the decimal_places argument equal to the number of 472 decimal places in the printf()'s precision: 473 474 - printf("%.2f%%", 99.999 ) ==> "100.00%" 475 476 - printf("%.2f%%", tr_truncd(99.999, 2)) ==> "99.99%" 477 ^ ^ 478 | These should match | 479 +------------------------+ 480 */ 470 /** 471 * @brief truncate a double value at a given number of decimal places. 472 * 473 * this can be used to prevent a printf() call from rounding up: 474 * call with the decimal_places argument equal to the number of 475 * decimal places in the printf()'s precision: 476 * 477 * - printf("%.2f%%", 99.999 ) ==> "100.00%" 478 * 479 * - printf("%.2f%%", tr_truncd(99.999, 2)) ==> "99.99%" 480 * ^ ^ 481 * | These should match | 482 * +------------------------+ 483 */ 481 484 double tr_truncd( double x, int decimal_places ); 482 485 … … 493 496 494 497 495 /** on success, return 0. on failure, return -1 and set errno */ 498 /** 499 * @brief move a file 500 * @return 0 on success; otherwise, return -1 and set errno 501 */ 496 502 int tr_moveFile( const char * oldpath, const char * newpath, 497 503 tr_bool * renamed ) TR_GNUC_NONNULL(1,2); 498 504 505 /** @brief convenience function to remove an item from an array */ 499 506 static inline void tr_removeElementFromArray( void * array, 500 501 502 507 int index_to_remove, 508 size_t sizeof_element, 509 size_t nmemb ) 503 510 { 504 511 char * a = (char*) array;
Note: See TracChangeset
for help on using the changeset viewer.