diff --git a/cli/cli.c b/cli/cli.c index 64ee36824..978bb5cdc 100644 --- a/cli/cli.c +++ b/cli/cli.c @@ -226,8 +226,8 @@ main( int argc, char ** argv ) const char * configDir; uint8_t * fileContents; size_t fileLength; - const char * str; - char buf[TR_PATH_MAX]; + const char * str; + char buf[TR_PATH_MAX]; tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR ); tr_formatter_size_init( DISK_K,DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR ); diff --git a/configure.ac b/configure.ac index 9ad16d8fb..3fec5a598 100644 --- a/configure.ac +++ b/configure.ac @@ -137,35 +137,35 @@ dnl ---------------------------------------------------------------------------- dnl dnl file monitoring for the daemon -AC_CHECK_HEADER([sys/inotify.h], - [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])], - [have_inotify="no"]) -AC_ARG_WITH([inotify], - [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])], - [want_inotify=${withval}], - [want_inotify=${have_inotify}]) -if test "x$want_inotify" = "xyes" ; then - if test "x$have_inotify" = "xyes"; then - AC_DEFINE([WITH_INOTIFY],[1]) - else - AC_MSG_ERROR("inotify not found!") - fi -fi - -AC_CHECK_HEADER([sys/event.h], - [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])], - [have_kqueue="no"]) -AC_ARG_WITH([kqueue], - [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])], - [want_kqueue=${withval}], - [want_kqueue=${have_kqueue}]) -if test "x$want_kqueue" = "xyes" ; then - if test "x$have_kqueue" = "xyes"; then - AC_DEFINE([WITH_KQUEUE],[1]) - else - AC_MSG_ERROR("kqueue not found!") - fi -fi +AC_CHECK_HEADER([sys/inotify.h], + [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])], + [have_inotify="no"]) +AC_ARG_WITH([inotify], + [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])], + [want_inotify=${withval}], + [want_inotify=${have_inotify}]) +if test "x$want_inotify" = "xyes" ; then + if test "x$have_inotify" = "xyes"; then + AC_DEFINE([WITH_INOTIFY],[1]) + else + AC_MSG_ERROR("inotify not found!") + fi +fi + +AC_CHECK_HEADER([sys/event.h], + [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])], + [have_kqueue="no"]) +AC_ARG_WITH([kqueue], + [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])], + [want_kqueue=${withval}], + [want_kqueue=${have_kqueue}]) +if test "x$want_kqueue" = "xyes" ; then + if test "x$have_kqueue" = "xyes"; then + AC_DEFINE([WITH_KQUEUE],[1]) + else + AC_MSG_ERROR("kqueue not found!") + fi +fi AC_CHECK_HEADERS([sys/statvfs.h \ xfs/xfs.h]) @@ -219,7 +219,7 @@ AC_ARG_ENABLE([utp], [want_utp=${enableval}], [want_utp=${have_utp}]) if test "x$want_utp" = "xyes" ; then - if test "x$have_utp" = "xyes"; then + if test "x$have_utp" = "xyes"; then LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/" LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a" if test "x$libutp_extra_libs" != "x" ; then @@ -227,10 +227,10 @@ if test "x$want_utp" = "xyes" ; then fi AC_DEFINE([WITH_UTP],[1]) build_utp="yes" - else - AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found") - fi -fi + else + AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found") + fi +fi AC_SUBST(LIBUTP_CFLAGS) AC_SUBST(LIBUTP_LIBS) AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"]) @@ -243,70 +243,70 @@ dnl AC_MSG_CHECKING([supported miniupnp library]) upnp_version="none" -ac_save_LIBS="$LIBS" -LIBS="-lminiupnpc" +ac_save_LIBS="$LIBS" +LIBS="-lminiupnpc" # See if the OS has its miniupnp 1.5 installed -AC_TRY_LINK([ - #include - #include - #include -],[ - struct UPNPDev * devlist; - struct UPNPUrls urls; - struct IGDdatas data; - char lanaddr[16]; - char portStr[8]; - char intPort[8]; - char intClient[16]; - upnpDiscover( 2000, NULL, NULL, 0 ); - UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); - UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype, - portStr, "TCP", intClient, intPort ); -],[ -AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5]) +AC_TRY_LINK([ + #include + #include + #include +],[ + struct UPNPDev * devlist; + struct UPNPUrls urls; + struct IGDdatas data; + char lanaddr[16]; + char portStr[8]; + char intPort[8]; + char intClient[16]; + upnpDiscover( 2000, NULL, NULL, 0 ); + UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); + UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype, + portStr, "TCP", intClient, intPort ); +],[ +AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5]) upnp_version="1.5"]) - + # See if the OS has its miniupnp 1.6 installed -AC_TRY_LINK([ - #include - #include - #include - #include -],[ - struct UPNPDev * devlist; - struct UPNPUrls urls; - struct IGDdatas data; - char lanaddr[16]; - char portStr[8]; - char intPort[8]; - char intClient[16]; - upnpDiscover( 2000, NULL, NULL, 0, 0, &errno ); - UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); - UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype, - portStr, "TCP", intClient, intPort, NULL, NULL, NULL ); -],[ -AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6]) +AC_TRY_LINK([ + #include + #include + #include + #include +],[ + struct UPNPDev * devlist; + struct UPNPUrls urls; + struct IGDdatas data; + char lanaddr[16]; + char portStr[8]; + char intPort[8]; + char intClient[16]; + upnpDiscover( 2000, NULL, NULL, 0, 0, &errno ); + UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); + UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype, + portStr, "TCP", intClient, intPort, NULL, NULL, NULL ); +],[ +AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6]) upnp_version="1.6"]) # ... and the results of our tests -LIBS="$ac_save_LIBS" +LIBS="$ac_save_LIBS" AC_MSG_RESULT([$upnp_version]) -AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"]) +AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"]) if test "x$upnp_version" = "xnone" ; then - LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/" - LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a" - LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a" + LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/" + LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a" + LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a" dnl because this is the version that we bundle... - AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6]) + AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6]) else - AC_DEFINE([SYSTEM_MINIUPNP]) - LIBUPNP_CFLAGS="" - LIBUPNP_LIBS="-lminiupnpc" - LIBUPNP_LIBS_QT="-lminiupnpc" + AC_DEFINE([SYSTEM_MINIUPNP]) + LIBUPNP_CFLAGS="" + LIBUPNP_LIBS="-lminiupnpc" + LIBUPNP_LIBS_QT="-lminiupnpc" fi -AC_SUBST(LIBUPNP_CFLAGS) -AC_SUBST(LIBUPNP_LIBS) -AC_SUBST(LIBUPNP_LIBS_QT) +AC_SUBST(LIBUPNP_CFLAGS) +AC_SUBST(LIBUPNP_LIBS) +AC_SUBST(LIBUPNP_LIBS_QT) dnl ---------------------------------------------------------------------------- @@ -327,7 +327,7 @@ fi if test "x$with_gtk" = "x3" ; then PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK3_MINIMUM],[gtk_version="3" with_gtk="yes"],[gtk_version="none" with_gtk="no"]) fi -AC_ARG_ENABLE([nls], +AC_ARG_ENABLE([nls], [AS_HELP_STRING([--enable-nls],[enable native language support])],, [enable_nls=yes]) AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"]) @@ -370,7 +370,7 @@ if test "x$with_gtk" = "xyes" ; then if test "x$have_libappindicator" = "xyes"; then use_libappindicator=yes - AC_DEFINE([HAVE_LIBAPPINDICATOR], 1) + AC_DEFINE([HAVE_LIBAPPINDICATOR], 1) else LIBAPPINDICATOR_CFLAGS= LIBAPPINDICATOR_LIBS= @@ -436,9 +436,9 @@ AC_ARG_ENABLE([lightweight], AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]), [enable_lightweight=${enableval}], [enable_lightweight="no"]) -if test "x$enable_lightweight" = "xyes" ; then +if test "x$enable_lightweight" = "xyes" ; then AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems]) -fi +fi AC_ARG_ENABLE([cli], [AS_HELP_STRING([--enable-cli],[build command-line client])], diff --git a/libtransmission/announcer-http.c b/libtransmission/announcer-http.c index 1a687b843..4504783e0 100644 --- a/libtransmission/announcer-http.c +++ b/libtransmission/announcer-http.c @@ -363,7 +363,7 @@ on_scrape_done( tr_session * session, tr_benc * flags; const char * str; const int benc_loaded = !tr_bencLoad( msg, msglen, &top, NULL ); - + if( getenv( "TR_CURL_VERBOSE" ) != NULL ) { if( !benc_loaded ) @@ -378,7 +378,7 @@ on_scrape_done( tr_session * session, tr_free( str ); } } - + if( benc_loaded ) { if( tr_bencDictFindStr( &top, "failure reason", &str ) ) diff --git a/libtransmission/session.c b/libtransmission/session.c index ccee73e22..9c3dad6b1 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -2675,7 +2675,6 @@ tr_sessionSetQueueStalledMinutes( tr_session * session, int minutes ) assert( minutes > 0 ); session->queueStalledMinutes = minutes; - } void @@ -2686,7 +2685,7 @@ tr_sessionSetQueueStalledEnabled( tr_session * session, bool is_enabled ) session->stalledEnabled = is_enabled; } - + bool tr_sessionGetQueueStalledEnabled( const tr_session * session ) { diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 4ccfcc177..5ddee3195 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -759,7 +759,7 @@ void tr_torrentSetPriority( tr_torrent *, tr_priority_t ); **** Torrents can be moved in the queue using the simple functions **** tr_torrentQueueMove{Top,Up,Down,Bottom}. They can be moved to **** arbitrary points in the queue with tr_torrentSetQueuePosition(). -**** +**** ***/ diff --git a/libtransmission/utils.c b/libtransmission/utils.c index 8e2b7dba4..de0d4de44 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -1634,12 +1634,12 @@ tr_htonll( uint64_t x ) #ifdef HAVE_HTONLL return htonll( x ); #else - /* fallback code by bdonlan at - * http://stackoverflow.com/questions/809902/64-bit-ntohl-in-c/875505#875505 */ - union { uint32_t lx[2]; uint64_t llx; } u; - u.lx[0] = htonl(x >> 32); - u.lx[1] = htonl(x & 0xFFFFFFFFULL); - return u.llx; + /* fallback code by bdonlan at + * http://stackoverflow.com/questions/809902/64-bit-ntohl-in-c/875505#875505 */ + union { uint32_t lx[2]; uint64_t llx; } u; + u.lx[0] = htonl(x >> 32); + u.lx[1] = htonl(x & 0xFFFFFFFFULL); + return u.llx; #endif } @@ -1649,11 +1649,11 @@ tr_ntohll( uint64_t x ) #ifdef HAVE_NTOHLL return ntohll( x ); #else - /* fallback code by bdonlan at - * http://stackoverflow.com/questions/809902/64-bit-ntohl-in-c/875505#875505 */ - union { uint32_t lx[2]; uint64_t llx; } u; - u.llx = x; - return ((uint64_t)ntohl(u.lx[0]) << 32) | (uint64_t)ntohl(u.lx[1]); + /* fallback code by bdonlan at + * http://stackoverflow.com/questions/809902/64-bit-ntohl-in-c/875505#875505 */ + union { uint32_t lx[2]; uint64_t llx; } u; + u.llx = x; + return ((uint64_t)ntohl(u.lx[0]) << 32) | (uint64_t)ntohl(u.lx[1]); #endif } diff --git a/utils/edit.c b/utils/edit.c index a0b533eea..5fddb4e2d 100644 --- a/utils/edit.c +++ b/utils/edit.c @@ -242,7 +242,7 @@ addURL( tr_benc * metainfo, const char * url ) if( !had_announce_list ) { announce_list = tr_bencDictAddList( metainfo, "announce-list", 2 ); - + if( had_announce ) { /* we're moving from an 'announce' to an 'announce-list',