]> granicus.if.org Git - transmission/commitdiff
Fix a number of other style inconsistencies met along the way (part 2)
authorMike Gelfand <mikedld@mikedld.com>
Mon, 1 May 2017 15:47:49 +0000 (18:47 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Mon, 1 May 2017 15:47:49 +0000 (18:47 +0300)
29 files changed:
daemon/remote.c
gtk/details.c
gtk/file-list.c
gtk/filter.c
gtk/icons.c
gtk/makemeta-ui.c
gtk/tr-core.c
libtransmission/announcer-udp.c
libtransmission/bandwidth.c
libtransmission/bitfield.c
libtransmission/bitfield.h
libtransmission/crypto-utils-polarssl.c
libtransmission/fdlimit.c
libtransmission/file-win32.c
libtransmission/handshake.c
libtransmission/list.c
libtransmission/metainfo.c
libtransmission/move-test.c
libtransmission/peer-mgr.c
libtransmission/platform.c
libtransmission/torrent-ctor.c
libtransmission/torrent.c
libtransmission/tr-lpd.c
libtransmission/tr-udp.c
libtransmission/watchdir-win32.c
libtransmission/watchdir.c
qt/FilterBarComboBoxDelegate.cc
qt/TorrentDelegate.cc
qt/WatchDir.cc

index 0bec7675434ebb60e064e53520dff8e66ddb17d9..f66e2f0c683bbbdc0e28471fa4b6aca92565f13f 100644 (file)
@@ -2811,7 +2811,7 @@ static int processArgs(char const* rpcurl, int argc, char const* const* argv)
 
             case 'w':
                 {
-                    tr_variant* args = tadd ? tr_variantDictFind(tadd, TR_KEY_arguments) : ensure_sset(&sset);
+                    tr_variant* args = tadd != NULL ? tr_variantDictFind(tadd, TR_KEY_arguments) : ensure_sset(&sset);
                     tr_variantDictAddStr(args, TR_KEY_download_dir, optarg);
                     break;
                 }
index 00889e0719bbcaea01b42fc65ab599946d163d9c..b7a290bf1453549d456243b33b622f493524675c 100644 (file)
@@ -797,11 +797,11 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
     }
     else
     {
-        char const* baseline = infos[0]->comment ? infos[0]->comment : "";
+        char const* baseline = infos[0]->comment != NULL ? infos[0]->comment : "";
 
         for (i = 1; i < n; ++i)
         {
-            if (g_strcmp0(baseline, infos[i]->comment ? infos[i]->comment : "") != 0)
+            if (g_strcmp0(baseline, infos[i]->comment != NULL ? infos[i]->comment : "") != 0)
             {
                 break;
             }
@@ -1015,8 +1015,8 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
             char unver[64];
             char total[64];
             char avail[32];
-            double const d = sizeWhenDone ? (100.0 * available) / sizeWhenDone : 0;
-            double const ratio = 100.0 * (sizeWhenDone ? (haveValid + haveUnchecked) / (double)sizeWhenDone : 1);
+            double const d = sizeWhenDone != 0 ? (100.0 * available) / sizeWhenDone : 0;
+            double const ratio = 100.0 * (sizeWhenDone != 0 ? (haveValid + haveUnchecked) / (double)sizeWhenDone : 1);
 
             tr_strlpercent(avail, d, sizeof(avail));
             tr_strlpercent(buf2, ratio, sizeof(buf2));
index f4d8f742d0f16258ac89c00ab4ea155111c6f275..e05d573cfa5a69cf140b71bb739785dd5f2e4c2d 100644 (file)
@@ -118,10 +118,10 @@ static gboolean refreshFilesForeach(GtkTreeModel* model, GtkTreePath* path UNUSE
     {
         tr_torrent* tor = refresh_data->tor;
         tr_info const* inf = tr_torrentInfo(tor);
-        int const enabled = !inf->files[index].dnd;
+        int const enabled = inf->files[index].dnd ? 0 : 1;
         int const priority = inf->files[index].priority;
         uint64_t const have = refresh_data->refresh_file_stat[index].bytesCompleted;
-        int const prog = size ? (int)((100.0 * have) / size) : 1;
+        int const prog = size != 0 ? (int)(100.0 * have / size) : 1;
 
         if (priority != old_priority || enabled != old_enabled || have != old_have || prog != old_prog)
         {
@@ -480,7 +480,7 @@ static GNode* find_child(GNode* parent, char const* name)
 {
     GNode* child = parent->children;
 
-    while (child)
+    while (child != NULL)
     {
         struct row_struct const* child_data = child->data;
 
index 80d61d1e2094db307ad6130df9c926514dfe3135..e166915755e37b7bf51c5176f73bf5e865d3961a 100644 (file)
@@ -608,7 +608,7 @@ static GtkTreeModel* activity_filter_model_new(GtkTreeModel* tmodel)
 
     for (i = 0, n = G_N_ELEMENTS(types); i < n; ++i)
     {
-        char const* name = types[i].context ? g_dpgettext2(NULL, types[i].context, types[i].name) : _(types[i].name);
+        char const* name = types[i].context != NULL ? g_dpgettext2(NULL, types[i].context, types[i].name) : _(types[i].name);
         gtk_list_store_insert_with_values(store, NULL, -1,
             ACTIVITY_FILTER_COL_NAME, name,
             ACTIVITY_FILTER_COL_TYPE, types[i].type,
@@ -724,7 +724,7 @@ static gboolean testText(tr_torrent const* tor, char const* key)
         /* test the torrent name... */
         {
             char* pch = g_utf8_casefold(tr_torrentName(tor), -1);
-            ret = !key || strstr(pch, key) != NULL;
+            ret = key == NULL || strstr(pch, key) != NULL;
             g_free(pch);
         }
 
@@ -732,7 +732,7 @@ static gboolean testText(tr_torrent const* tor, char const* key)
         for (i = 0; i < inf->fileCount && !ret; ++i)
         {
             char* pch = g_utf8_casefold(inf->files[i].name, -1);
-            ret = !key || strstr(pch, key) != NULL;
+            ret = key == NULL || strstr(pch, key) != NULL;
             g_free(pch);
         }
     }
index 7f6756b7f37cec22cf2a10f51f289f90d149caf9..5ae71a88a6f8fa7609c8e856db4e7ea1e5c55330 100644 (file)
@@ -34,7 +34,8 @@ typedef struct
     GtkIconTheme* icon_theme;
     int icon_size;
     GHashTable* cache;
-} IconCache;
+}
+IconCache;
 
 static IconCache* icon_cache[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
 
@@ -128,7 +129,7 @@ static GdkPixbuf* get_themed_icon_pixbuf(GThemedIcon* icon, int size, GtkIconThe
 
     if (pixbuf == NULL)
     {
-        if (error && error->message)
+        if (error != NULL && error->message != NULL)
         {
             g_warning("could not load icon pixbuf: %s\n", error->message);
         }
index a48269667cf0c85fa277acdf89b8ab5aaa4693e8..0eaaf86815aff008245043aa1523213e0f105855 100644 (file)
@@ -297,7 +297,7 @@ static void onSourceToggled(GtkToggleButton* tb, gpointer user_data)
 static void updatePiecesLabel(MakeMetaUI* ui)
 {
     tr_metainfo_builder const* builder = ui->builder;
-    char const* filename = builder ? builder->top : NULL;
+    char const* filename = builder != NULL ? builder->top : NULL;
     GString* gstr = g_string_new(NULL);
 
     g_string_append(gstr, "<i>");
index 00669c977a1d9b5adca40b7767dbdc24c59d8c6f..e8cb98d9d7663b153ac1146abb55f92d6a6ef690 100644 (file)
@@ -1159,7 +1159,6 @@ static int core_add_ctor(TrCore* core, tr_ctor* ctor, gboolean do_prompt, gboole
         break;
 
     case TR_PARSE_DUPLICATE:
-
         /* don't complain about .torrent files in the watch directory
          * that have already been added... that gets annoying and we
          * don't want to be nagging users to clean up their watch dirs */
@@ -1173,7 +1172,6 @@ static int core_add_ctor(TrCore* core, tr_ctor* ctor, gboolean do_prompt, gboole
         break;
 
     default:
-
         if (do_prompt)
         {
             g_signal_emit(core, signals[ADD_PROMPT_SIGNAL], 0, ctor);
index 60cb5cb5c01630e732618aab306650899d7eaaeb..bc40fceff39c579fd56d11a9417d3fd17cb7e015 100644 (file)
@@ -619,7 +619,7 @@ static void on_tracker_connection_response(struct tau_tracker* tracker, tau_acti
     else
     {
         char* errmsg;
-        size_t const buflen = buf ? evbuffer_get_length(buf) : 0;
+        size_t const buflen = buf != NULL ? evbuffer_get_length(buf) : 0;
 
         if (action == TAU_ACTION_ERROR && buflen > 0)
         {
@@ -644,7 +644,7 @@ static void tau_tracker_timeout_reqs(struct tau_tracker* tracker)
     int n;
     tr_ptrArray* reqs;
     time_t const now = time(NULL);
-    bool const cancel_all = tracker->close_at && (tracker->close_at <= now);
+    bool const cancel_all = tracker->close_at != 0 && (tracker->close_at <= now);
 
     if (tracker->connecting_at != 0 && tracker->connecting_at + TAU_REQUEST_TTL < now)
     {
index b0a4a328ef2cee83634da8560dcea20c374d76d6..06cd1c045e2558016ecfe2d0f07055f917a6a517 100644 (file)
@@ -186,7 +186,7 @@ static void allocateBandwidth(tr_bandwidth* b, tr_priority_t parent_priority, tr
     }
 
     /* traverse & repeat for the subtree */
-    if (1)
+    if (true)
     {
         int i;
         struct tr_bandwidth** children = (struct tr_bandwidth**)tr_ptrArrayBase(&b->children);
index 5e0212711716d1ccb4ed99262cd3382572f948da..70ab427d986b452f0744f5586a84bb7026034faf 100644 (file)
@@ -247,7 +247,6 @@ static void tr_bitfieldEnsureBitsAlloced(tr_bitfield* b, size_t n)
 static bool tr_bitfieldEnsureNthBitAlloced(tr_bitfield* b, size_t nth)
 {
     /* count is zero-based, so we need to allocate nth+1 bits before setting the nth */
-
     if (nth == SIZE_MAX)
     {
         return false;
index b0049df967401fd7b4126fd90240b8e7519a7462..08fdd00cfa0dbd0893a8130452a823fa093661f9 100644 (file)
@@ -82,12 +82,12 @@ size_t tr_bitfieldCountTrueBits(tr_bitfield const* b);
 
 static inline bool tr_bitfieldHasAll(tr_bitfield const* b)
 {
-    return b->bit_count ? (b->true_count == b->bit_count) : b->have_all_hint;
+    return b->bit_count != 0 ? (b->true_count == b->bit_count) : b->have_all_hint;
 }
 
 static inline bool tr_bitfieldHasNone(tr_bitfield const* b)
 {
-    return b->bit_count ? (b->true_count == 0) : b->have_none_hint;
+    return b->bit_count != 0 ? (b->true_count == 0) : b->have_none_hint;
 }
 
 bool tr_bitfieldHas(tr_bitfield const* b, size_t n);
index 489105803067260a021188e2c874067e48d0f005..80c04aca61efe6b27263023a4cab406712dcc774 100644 (file)
@@ -135,7 +135,7 @@ static tr_lock* get_rng_lock(void)
 
 tr_sha1_ctx_t tr_sha1_init(void)
 {
-    API(sha1_context) * handle = tr_new0(API(sha1_context), 1);
+    API(sha1_context)* handle = tr_new0(API(sha1_context), 1);
 
 #if API_VERSION_NUMBER >= 0x01030800
     API(sha1_init)(handle);
@@ -183,7 +183,7 @@ bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash)
 
 tr_rc4_ctx_t tr_rc4_new(void)
 {
-    API(arc4_context) * handle = tr_new0(API(arc4_context), 1);
+    API(arc4_context)* handle = tr_new0(API(arc4_context), 1);
 
 #if API_VERSION_NUMBER >= 0x01030800
     API(arc4_init)(handle);
@@ -231,7 +231,7 @@ void tr_rc4_process(tr_rc4_ctx_t handle, void const* input, void* output, size_t
 tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num,
     size_t generator_num_length)
 {
-    API(dhm_context) * handle = tr_new0(API(dhm_context), 1);
+    API(dhm_context)* handle = tr_new0(API(dhm_context), 1);
 
     assert(prime_num != NULL);
     assert(generator_num != NULL);
@@ -264,7 +264,7 @@ void tr_dh_free(tr_dh_ctx_t handle)
 
 bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* public_key, size_t* public_key_length)
 {
-    API(dhm_context) * handle = raw_handle;
+    API(dhm_context)* handle = raw_handle;
 
     assert(handle != NULL);
     assert(public_key != NULL);
@@ -279,7 +279,7 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t*
 
 tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t raw_handle, uint8_t const* other_public_key, size_t other_public_key_length)
 {
-    API(dhm_context) * handle = raw_handle;
+    API(dhm_context)* handle = raw_handle;
     struct tr_dh_secret* ret;
     size_t secret_key_length;
 
index 2cb43ef64c998ec1f838cd0410f328dac5095c22..0879fd1c60652a37ac08c0a883445e5c5bd31bf1 100644 (file)
@@ -598,8 +598,8 @@ tr_socket_t tr_fdSocketAccept(tr_session* s, tr_socket_t sockfd, tr_address* add
     struct sockaddr_storage sock;
 
     assert(tr_isSession(s));
-    assert(addr);
-    assert(port);
+    assert(addr != NULL);
+    assert(port != NULL);
 
     ensureSessionFdInfoExists(s);
     gFd = s->fdInfo;
index 73b8d1ca8cbee255cc90eff2514267b5fa2881e0..1ab4ff6a05a976fa7090c0f73fc169e8ca38100b 100644 (file)
@@ -808,30 +808,30 @@ tr_sys_file_t tr_sys_file_open(char const* path, int flags, int permissions, tr_
 
     (void)permissions;
 
-    if (flags & TR_SYS_FILE_READ)
+    if ((flags & TR_SYS_FILE_READ) != 0)
     {
         native_access |= GENERIC_READ;
     }
 
-    if (flags & TR_SYS_FILE_WRITE)
+    if ((flags & TR_SYS_FILE_WRITE)) != 0
     {
         native_access |= GENERIC_WRITE;
     }
 
-    if (flags & TR_SYS_FILE_CREATE_NEW)
+    if ((flags & TR_SYS_FILE_CREATE_NEW)) != 0
     {
         native_disposition = CREATE_NEW;
     }
-    else if (flags & TR_SYS_FILE_CREATE)
+    else if ((flags & TR_SYS_FILE_CREATE)) != 0
     {
-        native_disposition = flags & TR_SYS_FILE_TRUNCATE ? CREATE_ALWAYS : OPEN_ALWAYS;
+        native_disposition = (flags & TR_SYS_FILE_TRUNCATE) != 0 ? CREATE_ALWAYS : OPEN_ALWAYS;
     }
-    else if (flags & TR_SYS_FILE_TRUNCATE)
+    else if ((flags & TR_SYS_FILE_TRUNCATE)) != 0
     {
         native_disposition = TRUNCATE_EXISTING;
     }
 
-    if (flags & TR_SYS_FILE_SEQUENTIAL)
+    if ((flags & TR_SYS_FILE_SEQUENTIAL)) != 0
     {
         native_flags |= FILE_FLAG_SEQUENTIAL_SCAN;
     }
@@ -840,7 +840,7 @@ tr_sys_file_t tr_sys_file_open(char const* path, int flags, int permissions, tr_
 
     success = ret != TR_BAD_SYS_FILE;
 
-    if (success && (flags & TR_SYS_FILE_APPEND))
+    if (success && (flags & TR_SYS_FILE_APPEND) != 0)
     {
         success = SetFilePointer(ret, 0, NULL, FILE_END) != INVALID_SET_FILE_POINTER;
     }
index 6bfe66c5d28d75492547e00d4b019ef39413c82f..abfecf104a99fdc61e2294fbfcb35212517ecdc3 100644 (file)
@@ -824,7 +824,7 @@ static ReadState readCryptoProvide(tr_handshake* handshake, struct evbuffer* inb
     uint16_t padc_len = 0;
     uint32_t crypto_provide = 0;
     tr_torrent* tor;
-    size_t const needlen = SHA_DIGEST_LENGTH + /* HASH('req1',s) */
+    size_t const needlen = SHA_DIGEST_LENGTH + /* HASH('req1', s) */
         SHA_DIGEST_LENGTH + /* HASH('req2', SKEY) xor HASH('req3', S) */
         VC_LENGTH + sizeof(crypto_provide) + sizeof(padc_len);
 
index 4453c3e30cc78d99d91cc15fbad6f51fbaeb7f75..d01b048cb46ce67ed5e36e12c6711d441e05c3ec 100644 (file)
@@ -206,7 +206,7 @@ void tr_list_insert_sorted(tr_list** list, void* data, TrListCompareFunc compare
 
     for (l = *list; l != NULL; l = l->next)
     {
-        int const c = (compare)(data, l->data);
+        int const c = (*compare)(data, l->data);
 
         if (c <= 0)
         {
index 1463d9f8d56c0e7bca9a547b2b31f64e14d15f86..27303685093300f601b380b6f8b09ac01197b8f0 100644 (file)
@@ -597,7 +597,7 @@ static char const* tr_metainfoParseImpl(tr_session const* session, tr_info* inf,
             return "pieces";
         }
 
-        if (len % SHA_DIGEST_LENGTH)
+        if (len % SHA_DIGEST_LENGTH != 0)
         {
             return "pieces";
         }
index 0706f72d3c2c118b7bf6ed3993912c0cac8a0265..6f19299ef00d2b8a3e7386e6aed10ad8cad59d83 100644 (file)
@@ -201,7 +201,7 @@ static int test_set_location(void)
     state = -1;
     tr_torrentSetLocation(tor, target_dir, true, NULL, &state);
 
-    while ((state == TR_LOC_MOVING) && (time(NULL) <= deadline))
+    while (state == TR_LOC_MOVING && time(NULL) <= deadline)
     {
         tr_wait_msec(50);
     }
index 085d3463a03c336ea5571d8d89e079bd2c10fad6..4bf9141d9487c0fa33a2f6f3b783f90a46b6249d 100644 (file)
@@ -461,7 +461,7 @@ static void swarmFree(void* vs)
 {
     tr_swarm* s = vs;
 
-    assert(s);
+    assert(s != NULL);
     assert(!s->isRunning);
     assert(swarmIsLocked(s));
     assert(tr_ptrArrayEmpty(&s->outgoingHandshakes));
@@ -1630,9 +1630,9 @@ static void peerSuggestedPiece(tr_swarm* s UNUSED, tr_peer* peer UNUSED, tr_piec
 {
 #if 0
 
-    assert(t);
-    assert(peer);
-    assert(peer->msgs);
+    assert(t != NULL);
+    assert(peer != NULL);
+    assert(peer->msgs != NULL);
 
     /* is this a valid piece? */
     if (pieceIndex >= t->tor->info.pieceCount)
@@ -2487,7 +2487,7 @@ int tr_peerMgrGetPeers(tr_torrent* tor, tr_pex** setme_pex, uint8_t af, uint8_t
 
     qsort(pex, count, sizeof(tr_pex), tr_pexCompare);
 
-    assert((walk - pex) == count);
+    assert(walk - pex == count);
     *setme_pex = pex;
 
     /* cleanup */
index c7d568c77cde28907cefdd2f0cb77494aa12d56c..fa9732a5b83aa44664677ba05b86663551f5a415 100644 (file)
@@ -592,7 +592,7 @@ char const* tr_getWebClientDir(tr_session const* session UNUSED)
                 char const* pkg = PACKAGE_DATA_DIR;
                 char* xdg = tr_env_get_string("XDG_DATA_DIRS", NULL);
                 char const* fallback = "/usr/local/share:/usr/share";
-                char* buf = tr_strdup_printf("%s:%s:%s", (pkg ? pkg : ""), (xdg ? xdg : ""), fallback);
+                char* buf = tr_strdup_printf("%s:%s:%s", pkg != NULL ? pkg : "", xdg != NULL ? xdg : "", fallback);
                 tr_free(xdg);
                 tmp = buf;
 
index 0cb3e8a5bcf3875273e78b5b262a7e79af95844b..18e22cbab66ea30e32900b8cd88b49f8c0445e42 100644 (file)
@@ -310,7 +310,7 @@ void tr_ctorSetSave(tr_ctor* ctor, bool saveInOurTorrentsDir)
 
 bool tr_ctorGetSave(tr_ctor const* ctor)
 {
-    return ctor && ctor->saveInOurTorrentsDir;
+    return ctor != NULL && ctor->saveInOurTorrentsDir;
 }
 
 void tr_ctorSetPaused(tr_ctor* ctor, tr_ctorMode mode, bool isPaused)
index 42bb232adef26b69b0946ac679879216e82e591e..5ac2000c8f960e94520d0183cea4e264b3ff3e40 100644 (file)
@@ -409,7 +409,7 @@ static bool tr_torrentGetSeedRatioBytes(tr_torrent const* tor, uint64_t* setmeLe
     {
         uint64_t const u = tor->uploadedCur + tor->uploadedPrev;
         uint64_t const d = tor->downloadedCur + tor->downloadedPrev;
-        uint64_t const baseline = d ? d : tr_cpSizeWhenDone(&tor->completion);
+        uint64_t const baseline = d != 0 ? d : tr_cpSizeWhenDone(&tor->completion);
         uint64_t const goal = baseline * seedRatio;
 
         if (setmeLeft != NULL)
@@ -431,7 +431,7 @@ static bool tr_torrentGetSeedRatioBytes(tr_torrent const* tor, uint64_t* setmeLe
 static bool tr_torrentIsSeedRatioDone(tr_torrent const* tor)
 {
     uint64_t bytesLeft;
-    return tr_torrentGetSeedRatioBytes(tor, &bytesLeft, NULL) && !bytesLeft;
+    return tr_torrentGetSeedRatioBytes(tor, &bytesLeft, NULL) && bytesLeft == 0;
 }
 
 /***
@@ -1637,7 +1637,7 @@ void tr_torrentAvailability(tr_torrent const* tor, int8_t* tab, int size)
 {
     assert(tr_isTorrent(tor));
 
-    if ((tab != NULL) && (size > 0))
+    if (tab != NULL && size > 0)
     {
         tr_peerMgrTorrentAvailability(tor, tab, size);
     }
@@ -2719,7 +2719,7 @@ bool tr_torrentReqIsValid(tr_torrent const* tor, tr_piece_index_t index, uint32_
             (unsigned long)length, err);
     }
 
-    return !err;
+    return err == 0;
 }
 
 uint64_t tr_pieceOffset(tr_torrent const* tor, tr_piece_index_t index, uint32_t offset, uint32_t length)
index ca67b8b829aba31cf2d9a23094f7d93e0ed3d55a..a2b73a7f520b5252e707582117c0f0a84e232d6d 100644 (file)
@@ -713,7 +713,7 @@ static void event_callback(evutil_socket_t s UNUSED, short type, void* ignore UN
     if ((type & EV_READ) != 0)
     {
         struct sockaddr_in foreignAddr;
-        int addrLen = sizeof foreignAddr;
+        int addrLen = sizeof(foreignAddr);
         char foreignMsg[lpd_maxDatagramLength + 1];
 
         /* process local announcement from foreign peer */
index 2e0d90092b47477adbfb561d1513a8ed0a6d81e4..2366599dde8c1f0c5459bb81a55e98a7b244ad7d 100644 (file)
@@ -346,7 +346,6 @@ void tr_udpInit(tr_session* ss)
     }
 
 ipv6:
-
     if (tr_globalIPv6())
     {
         rebind_ipv6(ss, true);
index cbd2b1fc95ffa614565ddd99d378a6474b6c195e..66450813bad753eb23061e478b7310cbe147af5b 100644 (file)
@@ -76,7 +76,7 @@ static BOOL tr_get_overlapped_result_ex(HANDLE handle, LPOVERLAPPED overlapped,
 
     if (real_impl != NULL)
     {
-        return real_impl(handle, overlapped, bytes_transferred, timeout, alertable);
+        return (*real_impl)(handle, overlapped, bytes_transferred, timeout, alertable);
     }
 
     DWORD const wait_result = WaitForSingleObjectEx(handle, timeout, alertable);
index d88b0d32d571e65488e3f45b82f19ac9dbd4d874..4dce090a076283774e3bf670cc62ffbdfe2039ea 100644 (file)
@@ -103,7 +103,7 @@ static tr_watchdir_status tr_watchdir_process_impl(tr_watchdir_t handle, char co
         return TR_WATCHDIR_IGNORE;
     }
 
-    tr_watchdir_status const ret = handle->callback(handle, name, handle->callback_user_data);
+    tr_watchdir_status const ret = (*handle->callback)(handle, name, handle->callback_user_data);
 
     assert(ret == TR_WATCHDIR_ACCEPT || ret == TR_WATCHDIR_IGNORE || ret == TR_WATCHDIR_RETRY);
 
@@ -347,7 +347,7 @@ void tr_watchdir_scan(tr_watchdir_t handle, tr_ptrArray* dir_entries)
     tr_sys_dir_t dir;
     char const* name;
     tr_ptrArray new_dir_entries = TR_PTR_ARRAY_INIT_STATIC;
-    PtrArrayCompareFunc const name_compare_func = (PtrArrayCompareFunc) & strcmp;
+    PtrArrayCompareFunc const name_compare_func = (PtrArrayCompareFunc)&strcmp;
     tr_error* error = NULL;
 
     if ((dir = tr_sys_dir_open(handle->path, &error)) == TR_BAD_SYS_DIR)
index cd779259f71909051a443553da173cf0b46cb359..fabd111446a5c6e20942021b25979471fd20e47e 100644 (file)
@@ -68,7 +68,7 @@ void FilterBarComboBoxDelegate::paint(QPainter* painter, QStyleOptionViewItem co
     else
     {
         QStyleOptionViewItem disabledOption = option;
-        QPalette::ColorRole const disabledColorRole = (disabledOption.state & QStyle::State_Selected) ?
+        QPalette::ColorRole const disabledColorRole = (disabledOption.state & QStyle::State_Selected) != 0 ?
             QPalette::HighlightedText : QPalette::Text;
         disabledOption.palette.setColor(disabledColorRole, Utils::getFadedColor(disabledOption.palette.color(
             disabledColorRole)));
index 525a5e61edb943517434ad86d7c2372cbc10e88c..75ec618f1c60a94941c18b7f905ebef91f35c1d3 100644 (file)
@@ -430,8 +430,8 @@ void TorrentDelegate::setProgressBarPercentDone(QStyleOptionViewItem const& opti
     {
         bool const isMagnet(!tor.hasMetadata());
         myProgressBarStyle->direction = option.direction;
-        myProgressBarStyle->progress = static_cast<int>(myProgressBarStyle->minimum + (((isMagnet ? tor.metadataPercentDone() :
-            tor.percentDone()) * (myProgressBarStyle->maximum - myProgressBarStyle->minimum))));
+        myProgressBarStyle->progress = static_cast<int>(myProgressBarStyle->minimum + (isMagnet ? tor.metadataPercentDone() :
+            tor.percentDone()) * (myProgressBarStyle->maximum - myProgressBarStyle->minimum));
     }
 }
 
index adef9e08a84cfcfdaade6b11fc7e505e4a76ad63..3fedf63f9a3c118e3dd00b011670fb612755f20c 100644 (file)
@@ -87,7 +87,7 @@ void WatchDir::setPath(QString const& path, bool isEnabled)
     // clear out any remnants of the previous watcher, if any
     myWatchDirFiles.clear();
 
-    if (myWatcher)
+    if (myWatcher != nullptr)
     {
         delete myWatcher;
         myWatcher = nullptr;