]> granicus.if.org Git - transmission/commitdiff
(libT) add some extra gcc safeguards. fix a couple of compiler warnings in makemeta
authorCharles Kerr <charles@transmissionbt.com>
Wed, 22 Oct 2008 17:14:50 +0000 (17:14 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Wed, 22 Oct 2008 17:14:50 +0000 (17:14 +0000)
libtransmission/crypto.h
libtransmission/makemeta.c
libtransmission/utils.h

index d8dd941b269efb52f6123b4f3395c2db0a95f387..c36d678973b26b7ebfc4d19cce77c18db61654d2 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <inttypes.h>
 
+#include <libtransmission/utils.h> /* TR_GNUC_NULL_TERMINATED */
+
 /**
 ***
 **/
@@ -73,7 +75,7 @@ void           tr_cryptoEncrypt( tr_crypto *  crypto,
 void           tr_sha1( uint8_t *    setme,
                         const void * content1,
                         int          content1_len,
-                        ... );
+                        ... ) TR_GNUC_NULL_TERMINATED;
 
 
 /** Returns a random number in the range of [0...n) */
index 1b9efc82393db2e8b89a819b0119136a179ddc13..ea5889e5d14362526dce1c92f70d5159fdd27797 100644 (file)
@@ -215,8 +215,9 @@ getHashInfo( tr_metainfo_builder * b )
     if( !fp )
     {
         b->my_errno = errno;
-        tr_snprintf( b->errfile, sizeof( b->errfile ),
-                     b->files[fileIndex].filename );
+        tr_strlcpy( b->errfile,
+                    b->files[fileIndex].filename,
+                    sizeof( b->errfile ) );
         b->result = TR_MAKEMETA_IO_READ;
         tr_free( buf );
         tr_free( ret );
@@ -250,8 +251,9 @@ getHashInfo( tr_metainfo_builder * b )
                     if( !fp )
                     {
                         b->my_errno = errno;
-                        tr_snprintf( b->errfile, sizeof( b->errfile ),
-                                     b->files[fileIndex].filename );
+                        tr_strlcpy( b->errfile,
+                                    b->files[fileIndex].filename,
+                                    sizeof( b->errfile ) );
                         b->result = TR_MAKEMETA_IO_READ;
                         tr_free( buf );
                         tr_free( ret );
index 73007de554fc8e7316bd099d08810b1dae190496..7bd27d80767c7b6cc63ad10342e67ba0fdc757a3 100644 (file)
@@ -258,7 +258,7 @@ size_t      tr_strlcpy( char *       dst,
 int         tr_snprintf( char *       buf,
                          size_t       buflen,
                          const char * fmt,
-                         ... );
+                         ... ) TR_GNUC_PRINTF( 3, 4 );
 
 const char* tr_strerror( int );