diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-11 21:57:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-11 21:57:37 +0000 |
commit | 719fb963b47d487112879ff2cb9d10cff88b84f5 (patch) | |
tree | 52f3b24fa1c69251ba451fc28d6dfd3cde250ed3 /src/core | |
parent | ac5f48c0d9c409e3cb7400b9650dc5994cdc59ae (diff) | |
download | gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.tar.gz gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.zip |
use constants instead of casting -1
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 2d06bd440..97ed57360 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -1029,7 +1029,7 @@ handle_client_request_info (void *cls, | |||
1029 | if (old_preference > n->current_preference) | 1029 | if (old_preference > n->current_preference) |
1030 | { | 1030 | { |
1031 | /* overflow; cap at maximum value */ | 1031 | /* overflow; cap at maximum value */ |
1032 | n->current_preference = (unsigned long long) -1; | 1032 | n->current_preference = ULLONG_MAX; |
1033 | } | 1033 | } |
1034 | update_preference_sum (n->current_preference - old_preference); | 1034 | update_preference_sum (n->current_preference - old_preference); |
1035 | #if DEBUG_CORE_QUOTA | 1035 | #if DEBUG_CORE_QUOTA |
@@ -1545,7 +1545,7 @@ select_messages (struct Neighbour *n, | |||
1545 | while (GNUNET_YES == discard_low_prio) | 1545 | while (GNUNET_YES == discard_low_prio) |
1546 | { | 1546 | { |
1547 | min = NULL; | 1547 | min = NULL; |
1548 | min_prio = -1; | 1548 | min_prio = UINT_MAX; |
1549 | discard_low_prio = GNUNET_NO; | 1549 | discard_low_prio = GNUNET_NO; |
1550 | /* calculate number of bytes available for transmission at time "t" */ | 1550 | /* calculate number of bytes available for transmission at time "t" */ |
1551 | avail = GNUNET_BANDWIDTH_tracker_get_available (&n->available_send_window); | 1551 | avail = GNUNET_BANDWIDTH_tracker_get_available (&n->available_send_window); |
@@ -2014,7 +2014,7 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
2014 | (unsigned int) ntohl (n->bw_in.value__), | 2014 | (unsigned int) ntohl (n->bw_in.value__), |
2015 | GNUNET_i2s (&n->peer)); | 2015 | GNUNET_i2s (&n->peer)); |
2016 | #endif | 2016 | #endif |
2017 | ph->iv_seed = htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, -1)); | 2017 | ph->iv_seed = htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX)); |
2018 | ph->sequence_number = htonl (++n->last_sequence_number_sent); | 2018 | ph->sequence_number = htonl (++n->last_sequence_number_sent); |
2019 | ph->inbound_bw_limit = n->bw_in; | 2019 | ph->inbound_bw_limit = n->bw_in; |
2020 | ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 2020 | ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
@@ -2122,10 +2122,10 @@ create_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
2122 | n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; | 2122 | n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; |
2123 | n->bw_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | 2123 | n->bw_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; |
2124 | n->bw_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | 2124 | n->bw_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; |
2125 | n->bw_out_internal_limit = GNUNET_BANDWIDTH_value_init ((uint32_t) - 1); | 2125 | n->bw_out_internal_limit = GNUNET_BANDWIDTH_value_init (UINT32_MAX); |
2126 | n->bw_out_external_limit = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | 2126 | n->bw_out_external_limit = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; |
2127 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2127 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2128 | (uint32_t) - 1); | 2128 | UINT32_MAX); |
2129 | neighbour_quota_update (n, NULL); | 2129 | neighbour_quota_update (n, NULL); |
2130 | consider_free_neighbour (n); | 2130 | consider_free_neighbour (n); |
2131 | return n; | 2131 | return n; |
@@ -2186,7 +2186,7 @@ handle_client_send (void *cls, | |||
2186 | #endif | 2186 | #endif |
2187 | /* bound queue size */ | 2187 | /* bound queue size */ |
2188 | discard_expired_messages (n); | 2188 | discard_expired_messages (n); |
2189 | min_prio = (unsigned int) -1; | 2189 | min_prio = UINT32_MAX; |
2190 | min_prio_entry = NULL; | 2190 | min_prio_entry = NULL; |
2191 | min_prio_prev = NULL; | 2191 | min_prio_prev = NULL; |
2192 | queue_size = 0; | 2192 | queue_size = 0; |
@@ -3641,8 +3641,8 @@ neighbour_quota_update (void *cls, | |||
3641 | if (bandwidth_target_out_bps > need_per_second) | 3641 | if (bandwidth_target_out_bps > need_per_second) |
3642 | distributable = bandwidth_target_out_bps - need_per_second; | 3642 | distributable = bandwidth_target_out_bps - need_per_second; |
3643 | share = distributable * pref_rel; | 3643 | share = distributable * pref_rel; |
3644 | if (share + need_per_peer > ( (uint32_t)-1)) | 3644 | if (share + need_per_peer > UINT32_MAX) |
3645 | q_in = GNUNET_BANDWIDTH_value_init ((uint32_t) -1); | 3645 | q_in = GNUNET_BANDWIDTH_value_init (UINT32_MAX); |
3646 | else | 3646 | else |
3647 | q_in = GNUNET_BANDWIDTH_value_init (need_per_peer + (uint32_t) share); | 3647 | q_in = GNUNET_BANDWIDTH_value_init (need_per_peer + (uint32_t) share); |
3648 | /* check if we want to disconnect for good due to inactivity */ | 3648 | /* check if we want to disconnect for good due to inactivity */ |