Changeset 14532
- Timestamp:
- May 31, 2015, 10:13:31 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/daemon.c
r14503 r14532 202 202 { 203 203 bool trash = false; 204 inttest = tr_ctorGetDeleteSource (ctor, &trash);204 const bool test = tr_ctorGetDeleteSource (ctor, &trash); 205 205 206 206 tr_logAddInfo ("Parsing .torrent file successful \"%s\"", file); 207 207 208 if ( !test && trash)208 if (test && trash) 209 209 { 210 210 tr_error * error = NULL; -
trunk/gtk/open-dialog.c
r14320 r14532 290 290 -1); 291 291 292 if ( tr_ctorGetDownloadDir (ctor, TR_FORCE, &str))292 if (!tr_ctorGetDownloadDir (ctor, TR_FORCE, &str)) 293 293 g_assert_not_reached (); 294 294 g_assert (str); … … 376 376 row++; 377 377 w = data->run_check; 378 if ( tr_ctorGetPaused (ctor, TR_FORCE, &flag))378 if (!tr_ctorGetPaused (ctor, TR_FORCE, &flag)) 379 379 g_assert_not_reached (); 380 380 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), !flag); … … 384 384 row++; 385 385 w = data->trash_check; 386 if ( tr_ctorGetDeleteSource (ctor, &flag))386 if (!tr_ctorGetDeleteSource (ctor, &flag)) 387 387 g_assert_not_reached (); 388 388 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), flag); -
trunk/gtk/tr-core.c
r14526 r14532 1172 1172 core_apply_defaults (tr_ctor * ctor) 1173 1173 { 1174 if ( tr_ctorGetPaused (ctor, TR_FORCE, NULL))1174 if (!tr_ctorGetPaused (ctor, TR_FORCE, NULL)) 1175 1175 tr_ctorSetPaused (ctor, TR_FORCE, !gtr_pref_flag_get (TR_KEY_start_added_torrents)); 1176 1176 1177 if ( tr_ctorGetDeleteSource (ctor, NULL))1177 if (!tr_ctorGetDeleteSource (ctor, NULL)) 1178 1178 tr_ctorSetDeleteSource (ctor, gtr_pref_flag_get (TR_KEY_trash_original_torrent_files)); 1179 1179 1180 if ( tr_ctorGetPeerLimit (ctor, TR_FORCE, NULL))1180 if (!tr_ctorGetPeerLimit (ctor, TR_FORCE, NULL)) 1181 1181 tr_ctorSetPeerLimit (ctor, TR_FORCE, gtr_pref_int_get (TR_KEY_peer_limit_per_torrent)); 1182 1182 1183 if ( tr_ctorGetDownloadDir (ctor, TR_FORCE, NULL))1183 if (!tr_ctorGetDownloadDir (ctor, TR_FORCE, NULL)) 1184 1184 tr_ctorSetDownloadDir (ctor, TR_FORCE, gtr_pref_string_get (TR_KEY_download_dir)); 1185 1185 } -
trunk/libtransmission/bandwidth.c
r14354 r14532 347 347 return byteCount; 348 348 } 349 349 350 unsigned int 350 351 tr_bandwidthClamp (const tr_bandwidth * b, -
trunk/libtransmission/bitfield.c
r14526 r14532 147 147 ***/ 148 148 149 #ifndef NDEBUG 150 149 151 static bool 150 tr_bitfieldIsValid (const tr_bitfield * b UNUSED)152 tr_bitfieldIsValid (const tr_bitfield * b) 151 153 { 152 154 assert (b != NULL); … … 156 158 return true; 157 159 } 160 161 #endif 158 162 159 163 size_t -
trunk/libtransmission/cache.c
r14476 r14532 454 454 } 455 455 456 456 return err; 457 457 } 458 458 -
trunk/libtransmission/natpmp.c
r14479 r14532 99 99 } 100 100 101 static int101 static bool 102 102 canSendCommand (const struct tr_natpmp * nat) 103 103 { -
trunk/libtransmission/platform.c
r14491 r14532 193 193 } 194 194 195 int 195 bool 196 196 tr_lockHave (const tr_lock * l) 197 197 { -
trunk/libtransmission/platform.h
r14327 r14532 76 76 77 77 /** @brief return nonzero if the specified lock is locked */ 78 inttr_lockHave (const tr_lock *);78 bool tr_lockHave (const tr_lock *); 79 79 80 80 /* @} */ -
trunk/libtransmission/resume.c
r14491 r14532 78 78 } 79 79 80 80 return numAdded; 81 81 } 82 82 … … 873 873 bool isPaused; 874 874 875 if ( !tr_ctorGetPaused (ctor, mode, &isPaused))875 if (tr_ctorGetPaused (ctor, mode, &isPaused)) 876 876 { 877 877 tor->isRunning = !isPaused; … … 881 881 882 882 if (fields & TR_FR_MAX_PEERS) 883 if ( !tr_ctorGetPeerLimit (ctor, mode, &tor->maxConnectedPeers))883 if (tr_ctorGetPeerLimit (ctor, mode, &tor->maxConnectedPeers)) 884 884 ret |= TR_FR_MAX_PEERS; 885 885 … … 888 888 const char * path; 889 889 890 if ( !tr_ctorGetDownloadDir (ctor, mode, &path) && path && *path)890 if (tr_ctorGetDownloadDir (ctor, mode, &path) && path && *path) 891 891 { 892 892 ret |= TR_FR_DOWNLOAD_DIR; -
trunk/libtransmission/torrent-ctor.c
r14491 r14532 259 259 } 260 260 261 int 261 bool 262 262 tr_ctorGetDeleteSource (const tr_ctor * ctor, bool * setme) 263 263 { 264 int err = 0;264 bool ret = true; 265 265 266 266 if (!ctor->isSet_delete) 267 err = 1;267 ret = false; 268 268 else if (setme) 269 *setme = ctor->doDelete ? 1 : 0;270 271 return err;269 *setme = ctor->doDelete; 270 271 return ret; 272 272 } 273 273 … … 284 284 } 285 285 286 int 286 bool 287 287 tr_ctorGetSave (const tr_ctor * ctor) 288 288 { … … 350 350 } 351 351 352 int 352 bool 353 353 tr_ctorGetPeerLimit (const tr_ctor * ctor, 354 354 tr_ctorMode mode, 355 355 uint16_t * setmeCount) 356 356 { 357 int err = 0;357 bool ret = true; 358 358 const struct optional_args * args = &ctor->optionalArgs[mode]; 359 359 360 360 if (!args->isSet_connected) 361 err = 1;361 ret = false; 362 362 else if (setmeCount) 363 363 *setmeCount = args->peerLimit; 364 364 365 return err;366 } 367 368 int 365 return ret; 366 } 367 368 bool 369 369 tr_ctorGetPaused (const tr_ctor * ctor, tr_ctorMode mode, bool * setmeIsPaused) 370 370 { 371 int err = 0;371 bool ret = true; 372 372 const struct optional_args * args = &ctor->optionalArgs[mode]; 373 373 374 374 if (!args->isSet_paused) 375 err = 1;375 ret = false; 376 376 else if (setmeIsPaused) 377 377 *setmeIsPaused = args->isPaused; 378 378 379 return err;380 } 381 382 int 379 return ret; 380 } 381 382 bool 383 383 tr_ctorGetDownloadDir (const tr_ctor * ctor, 384 384 tr_ctorMode mode, 385 385 const char ** setmeDownloadDir) 386 386 { 387 int err = 0;387 bool ret = true; 388 388 const struct optional_args * args = &ctor->optionalArgs[mode]; 389 389 390 390 if (!args->isSet_downloadDir) 391 err = 1;391 ret = false; 392 392 else if (setmeDownloadDir) 393 393 *setmeDownloadDir = args->downloadDir; 394 394 395 return err;396 } 397 398 int 395 return ret; 396 } 397 398 bool 399 399 tr_ctorGetIncompleteDir (const tr_ctor * ctor, 400 400 const char ** setmeIncompleteDir) 401 401 { 402 int err = 0;402 bool ret = true; 403 403 404 404 if (ctor->incompleteDir == NULL) 405 err = 1;405 ret = false; 406 406 else 407 407 *setmeIncompleteDir = ctor->incompleteDir; 408 408 409 return err;410 } 411 412 int 409 return ret; 410 } 411 412 bool 413 413 tr_ctorGetMetainfo (const tr_ctor * ctor, 414 414 const tr_variant ** setme) 415 415 { 416 int err = 0;416 bool ret = true; 417 417 418 418 if (!ctor->isSet_metainfo) 419 err = 1;419 ret = false; 420 420 else if (setme) 421 421 *setme = &ctor->metainfo; 422 422 423 return err;423 return ret; 424 424 } 425 425 -
trunk/libtransmission/torrent-magnet.c
r14525 r14532 193 193 } 194 194 195 196 197 195 assert (ret == NULL || *len > 0); 196 197 return ret; 198 198 } 199 199 -
trunk/libtransmission/torrent.c
r14530 r14532 633 633 } 634 634 635 static int635 static bool 636 636 pieceHasFile (tr_piece_index_t piece, 637 637 const tr_file * file) … … 873 873 NULL); 874 874 875 if ( !tr_ctorGetDownloadDir (ctor, TR_FORCE, &dir) ||876 !tr_ctorGetDownloadDir (ctor, TR_FALLBACK, &dir))877 878 879 if ( tr_ctorGetIncompleteDir (ctor, &dir))875 if (tr_ctorGetDownloadDir (ctor, TR_FORCE, &dir) || 876 tr_ctorGetDownloadDir (ctor, TR_FALLBACK, &dir)) 877 tor->downloadDir = tr_strdup (dir); 878 879 if (!tr_ctorGetIncompleteDir (ctor, &dir)) 880 880 dir = tr_sessionGetIncompleteDir (session); 881 881 if (tr_sessionIsIncompleteDirEnabled (session)) … … 953 953 { 954 954 const tr_variant * val; 955 if ( !tr_ctorGetMetainfo (ctor, &val))955 if (tr_ctorGetMetainfo (ctor, &val)) 956 956 { 957 957 const char * path = tor->info.torrent; … … 997 997 memset (setmeInfo, 0, sizeof (tr_info)); 998 998 999 if ( tr_ctorGetMetainfo (ctor, &metainfo))999 if (!tr_ctorGetMetainfo (ctor, &metainfo)) 1000 1000 return TR_PARSE_ERR; 1001 1001 -
trunk/libtransmission/torrent.h
r14428 r14532 32 32 bool saveMetadataInOurTorrentsDir); 33 33 34 inttr_ctorGetSave (const tr_ctor * ctor);34 bool tr_ctorGetSave (const tr_ctor * ctor); 35 35 36 36 void tr_ctorInitTorrentPriorities (const tr_ctor * ctor, tr_torrent * tor); -
trunk/libtransmission/tr-dht.c
r14491 r14532 78 78 }; 79 79 80 static int80 static bool 81 81 bootstrap_done (tr_session *session, int af) 82 82 { … … 461 461 } 462 462 463 int 463 bool 464 464 tr_dhtAddNode (tr_session * ss, 465 465 const tr_address * address, … … 470 470 471 471 if (!tr_dhtEnabled (ss)) 472 return 0;472 return false; 473 473 474 474 /* Since we don't want to abuse our bootstrap nodes, … … 477 477 if (bootstrap) { 478 478 if (tr_dhtStatus (ss, af, NULL) >= TR_DHT_FIREWALLED) 479 return 0;479 return false; 480 480 } 481 481 … … 487 487 sin.sin_port = htons (port); 488 488 dht_ping_node ((struct sockaddr*)&sin, sizeof (sin)); 489 return 1;489 return true; 490 490 } else if (address->type == TR_AF_INET6) { 491 491 struct sockaddr_in6 sin6; … … 495 495 sin6.sin6_port = htons (port); 496 496 dht_ping_node ((struct sockaddr*)&sin6, sizeof (sin6)); 497 return 1;498 } 499 500 return 0;497 return true; 498 } 499 500 return false; 501 501 } 502 502 -
trunk/libtransmission/tr-dht.h
r13625 r14532 43 43 int tr_dhtStatus (tr_session *, int af, int * setme_nodeCount); 44 44 const char *tr_dhtPrintableStatus (int status); 45 inttr_dhtAddNode (tr_session *, const tr_address *, tr_port, bool bootstrap);45 bool tr_dhtAddNode (tr_session *, const tr_address *, tr_port, bool bootstrap); 46 46 void tr_dhtUpkeep (tr_session *); 47 47 void tr_dhtCallback (unsigned char *buf, int buflen, -
trunk/libtransmission/tr-lpd.c
r14526 r14532 212 212 * - copy back value from end to next "\r\n" 213 213 */ 214 static intlpd_extractParam (const char* const str, const char* const name, int n, char* const val)214 static bool lpd_extractParam (const char* const str, const char* const name, int n, char* const val) 215 215 { 216 216 /* configure maximum length of search string here */ … … 223 223 224 224 if (strlen (name) > maxLength - strlen (CRLF ": ")) 225 return 0;225 return false; 226 226 227 227 /* compose the string token to search for */ … … 230 230 pos = strstr (str, sstr); 231 231 if (pos == NULL) 232 return 0; /* search was not successful */232 return false; /* search was not successful */ 233 233 234 234 { … … 249 249 250 250 /* we successfully returned the value string */ 251 return 1;251 return true; 252 252 } 253 253 … … 513 513 /* save the effort to check Host, which seems to be optional anyway */ 514 514 515 if ( lpd_extractParam (params, "Port", maxValueLen, value) == 0)515 if (!lpd_extractParam (params, "Port", maxValueLen, value)) 516 516 return 0; 517 517 … … 523 523 res = -1; /* signal caller side-effect to peer->port via return != 0 */ 524 524 525 if ( lpd_extractParam (params, "Infohash", maxHashLen, hashString) == 0)525 if (!lpd_extractParam (params, "Infohash", maxHashLen, hashString)) 526 526 return res; 527 527 -
trunk/libtransmission/transmission.h
r14384 r14532 1012 1012 1013 1013 /** @brief Get this peer constructor's peer limit */ 1014 inttr_ctorGetPeerLimit (const tr_ctor * ctor,1014 bool tr_ctorGetPeerLimit (const tr_ctor * ctor, 1015 1015 tr_ctorMode mode, 1016 1016 uint16_t * setmeCount); 1017 1017 1018 1018 /** @brief Get the "isPaused" flag from this peer constructor */ 1019 inttr_ctorGetPaused (const tr_ctor * ctor,1019 bool tr_ctorGetPaused (const tr_ctor * ctor, 1020 1020 tr_ctorMode mode, 1021 1021 bool * setmeIsPaused); 1022 1022 1023 1023 /** @brief Get the download path from this peer constructor */ 1024 inttr_ctorGetDownloadDir (const tr_ctor * ctor,1024 bool tr_ctorGetDownloadDir (const tr_ctor * ctor, 1025 1025 tr_ctorMode mode, 1026 1026 const char ** setmeDownloadDir); 1027 1027 1028 1028 /** @brief Get the incomplete directory from this peer constructor */ 1029 inttr_ctorGetIncompleteDir (const tr_ctor * ctor,1029 bool tr_ctorGetIncompleteDir (const tr_ctor * ctor, 1030 1030 const char ** setmeIncompleteDir); 1031 1031 1032 1032 /** @brief Get the metainfo from this peer constructor */ 1033 inttr_ctorGetMetainfo (const tr_ctor * ctor,1033 bool tr_ctorGetMetainfo (const tr_ctor * ctor, 1034 1034 const struct tr_variant ** setme); 1035 1035 1036 1036 /** @brief Get the "delete .torrent file" flag from this peer constructor */ 1037 inttr_ctorGetDeleteSource (const tr_ctor * ctor,1037 bool tr_ctorGetDeleteSource (const tr_ctor * ctor, 1038 1038 bool * setmeDoDelete); 1039 1039 -
trunk/libtransmission/web.c
r14480 r14532 639 639 } 640 640 641 static int641 static bool 642 642 is_rfc2396_alnum (uint8_t ch) 643 643 {
Note: See TracChangeset
for help on using the changeset viewer.