Changeset 5112
- Timestamp:
- Feb 25, 2008, 8:21:22 PM (14 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/metainfo.c
r5065 r5112 193 193 } 194 194 195 for( i = 0; i < SHA_DIGEST_LENGTH; i++ ) 196 { 197 snprintf( inf->hashString + i * 2, sizeof( inf->hashString ) - i * 2, 198 "%02x", inf->hash[i] ); 199 } 195 tr_sha1_to_hex( inf->hashString, inf->hash ); 200 196 savedname( inf->torrent, sizeof( inf->torrent ), inf->hashString, tag ); 201 197 -
trunk/libtransmission/utils.c
r5065 r5112 884 884 return ratio; 885 885 } 886 887 void 888 tr_sha1_to_hex( char * out, const uint8_t * sha1 ) 889 { 890 static const char hex[] = "0123456789abcdef"; 891 int i; 892 for (i = 0; i < 20; i++) { 893 unsigned int val = *sha1++; 894 *out++ = hex[val >> 4]; 895 *out++ = hex[val & 0xf]; 896 } 897 *out = '\0'; 898 } -
trunk/libtransmission/utils.h
r5065 r5112 139 139 int tr_compareUint32( uint32_t a, uint32_t b ); 140 140 141 void tr_sha1_to_hex( char * out, const uint8_t * sha1 ); 142 141 143 /*** 142 144 ****
Note: See TracChangeset
for help on using the changeset viewer.