Changeset 7652
- Timestamp:
- Jan 10, 2009, 2:22:13 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bencode.c
r7590 r7652 162 162 ( count % LIST_SIZE ? LIST_SIZE - 163 163 ( count % LIST_SIZE ) : 0 ); 164 void * new= realloc( val->val.l.vals, len * sizeof( tr_benc ) );165 if( NULL == new)164 void * tmp = realloc( val->val.l.vals, len * sizeof( tr_benc ) ); 165 if( !tmp ) 166 166 return 1; 167 167 168 168 val->val.l.alloc = len; 169 val->val.l.vals = new;169 val->val.l.vals = tmp; 170 170 } 171 171 -
trunk/libtransmission/list.h
r7469 r7652 64 64 }; 65 65 66 #define __tr_list_entry(ptr, type, member) ({ \ 67 const struct __tr_list *__mptr = (ptr); \ 68 (void *)( (char *)__mptr - offsetof(type,member) ); \ 69 }) 66 /** 67 * Given a __tr_list node that's embedded in a struct, returns a pointer to the struct. 68 * @param ptr pointer to the embedded __tr_list 69 * @param type struct type that has contains the __tr_list 70 * @param field the name of the struct's _tr_list field 71 */ 72 #define __tr_list_entry(ptr,type,field) ((type*) (((char*)ptr) - offsetof(type,field))) 70 73 71 74 typedef int ( *__tr_list_cmp_t ) ( const void * a, const void * b ); -
trunk/libtransmission/net.c
r7585 r7652 33 33 #ifdef WIN32 34 34 #include <winsock2.h> /* inet_addr */ 35 #include <WS2tcpip.h> 35 36 #else 36 37 #include <arpa/inet.h> /* inet_addr */ -
trunk/libtransmission/net.h
r7575 r7652 33 33 #include <inttypes.h> 34 34 #include <winsock2.h> 35 #include <WS2tcpip.h> 35 36 typedef int socklen_t; 36 37 #else -
trunk/libtransmission/peer-io.c
r7641 r7652 12 12 13 13 #include <assert.h> 14 #include <errno.h> 14 15 #include <limits.h> /* INT_MAX */ 15 16 #include <string.h> … … 88 89 while( bytes_transferred ) 89 90 { 90 struct tr_datatype * next = __tr_list_entry( io->outbuf_datatypes.next, 91 struct tr_datatype, head ); 91 struct tr_datatype * next = __tr_list_entry( io->outbuf_datatypes.next, struct tr_datatype, head ); 92 92 const size_t payload = MIN( next->length, bytes_transferred ); 93 93 const size_t overhead = getPacketOverhead( payload ); -
trunk/libtransmission/transmission.h
r7646 r7652 50 50 #endif 51 51 #include <time.h> /* time_t */ 52 53 #if defined(_MSC_VER) && !defined( __cplusplus ) 54 #define inline __inline 55 #endif 52 56 53 57 #define SHA_DIGEST_LENGTH 20
Note: See TracChangeset
for help on using the changeset viewer.