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 | |
parent | ac5f48c0d9c409e3cb7400b9650dc5994cdc59ae (diff) | |
download | gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.tar.gz gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.zip |
use constants instead of casting -1
Diffstat (limited to 'src')
-rw-r--r-- | src/core/gnunet-service-core.c | 16 | ||||
-rw-r--r-- | src/datastore/datastore.h | 2 | ||||
-rw-r--r-- | src/fs/fs_download.c | 3 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 7 | ||||
-rw-r--r-- | src/fs/test_gnunet_service_fs_migration.c | 1 | ||||
-rw-r--r-- | src/fs/test_gnunet_service_fs_migration_data.conf | 3 | ||||
-rw-r--r-- | src/testing/testing_group.c | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 4 | ||||
-rw-r--r-- | src/util/time.c | 20 |
9 files changed, 35 insertions, 31 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 */ |
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index aa2646c0a..f827f8766 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #ifndef DATASTORE_H | 27 | #ifndef DATASTORE_H |
28 | #define DATASTORE_H | 28 | #define DATASTORE_H |
29 | 29 | ||
30 | #define DEBUG_DATASTORE GNUNET_NO | 30 | #define DEBUG_DATASTORE GNUNET_YES |
31 | 31 | ||
32 | #include "gnunet_util_lib.h" | 32 | #include "gnunet_util_lib.h" |
33 | 33 | ||
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index ff3eb09e1..807ade93c 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1647,7 +1647,8 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, | |||
1647 | struct GNUNET_FS_ProgressInfo pi; | 1647 | struct GNUNET_FS_ProgressInfo pi; |
1648 | struct GNUNET_FS_DownloadContext *dc; | 1648 | struct GNUNET_FS_DownloadContext *dc; |
1649 | 1649 | ||
1650 | if (sr->download != NULL) | 1650 | if ( (sr != NULL) && |
1651 | (sr->download != NULL) ) | ||
1651 | { | 1652 | { |
1652 | GNUNET_break (0); | 1653 | GNUNET_break (0); |
1653 | return NULL; | 1654 | return NULL; |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index c5a47973c..d7dc86002 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -2150,7 +2150,7 @@ forward_request_task (void *cls, | |||
2150 | pr->irc = GNUNET_CORE_peer_change_preference (sched, cfg, | 2150 | pr->irc = GNUNET_CORE_peer_change_preference (sched, cfg, |
2151 | &psc.target, | 2151 | &psc.target, |
2152 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 2152 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
2153 | GNUNET_BANDWIDTH_value_init ((uint32_t) -1 /* no limit */), | 2153 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), |
2154 | DBLOCK_SIZE * 2, | 2154 | DBLOCK_SIZE * 2, |
2155 | (uint64_t) cp->inc_preference, | 2155 | (uint64_t) cp->inc_preference, |
2156 | &target_reservation_cb, | 2156 | &target_reservation_cb, |
@@ -2348,7 +2348,8 @@ process_reply (void *cls, | |||
2348 | if (pr->cp != NULL) | 2348 | if (pr->cp != NULL) |
2349 | { | 2349 | { |
2350 | GNUNET_PEER_change_rc (prq->sender->last_p2p_replies | 2350 | GNUNET_PEER_change_rc (prq->sender->last_p2p_replies |
2351 | [prq->sender->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE], -1); | 2351 | [prq->sender->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE], |
2352 | -1); | ||
2352 | GNUNET_PEER_change_rc (pr->cp->pid, 1); | 2353 | GNUNET_PEER_change_rc (pr->cp->pid, 1); |
2353 | prq->sender->last_p2p_replies | 2354 | prq->sender->last_p2p_replies |
2354 | [(prq->sender->last_p2p_replies_woff++) % P2P_SUCCESS_LIST_SIZE] | 2355 | [(prq->sender->last_p2p_replies_woff++) % P2P_SUCCESS_LIST_SIZE] |
@@ -2515,7 +2516,7 @@ process_reply (void *cls, | |||
2515 | reply->cont = &transmit_reply_continuation; | 2516 | reply->cont = &transmit_reply_continuation; |
2516 | reply->cont_cls = pr; | 2517 | reply->cont_cls = pr; |
2517 | reply->msize = msize; | 2518 | reply->msize = msize; |
2518 | reply->priority = (uint32_t) -1; /* send replies first! */ | 2519 | reply->priority = UINT32_MAX; /* send replies first! */ |
2519 | pm = (struct PutMessage*) &reply[1]; | 2520 | pm = (struct PutMessage*) &reply[1]; |
2520 | pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); | 2521 | pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); |
2521 | pm->header.size = htons (msize); | 2522 | pm->header.size = htons (msize); |
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 9cf8c3773..835650ef6 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c | |||
@@ -244,6 +244,7 @@ main (int argc, char *argv[]) | |||
244 | "WARNING", | 244 | "WARNING", |
245 | #endif | 245 | #endif |
246 | NULL); | 246 | NULL); |
247 | system ("netstat -ntpl"); | ||
247 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, | 248 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, |
248 | argvx, "test-gnunet-service-fs-migration", | 249 | argvx, "test-gnunet-service-fs-migration", |
249 | "nohelp", options, &run, NULL); | 250 | "nohelp", options, &run, NULL); |
diff --git a/src/fs/test_gnunet_service_fs_migration_data.conf b/src/fs/test_gnunet_service_fs_migration_data.conf index 82606092c..9a388e0e8 100644 --- a/src/fs/test_gnunet_service_fs_migration_data.conf +++ b/src/fs/test_gnunet_service_fs_migration_data.conf | |||
@@ -12,12 +12,13 @@ HOSTNAME = localhost | |||
12 | [transport] | 12 | [transport] |
13 | PORT = 43465 | 13 | PORT = 43465 |
14 | PLUGINS = tcp | 14 | PLUGINS = tcp |
15 | #DEBUG = YES | 15 | DEBUG = YES |
16 | 16 | ||
17 | [arm] | 17 | [arm] |
18 | PORT = 43466 | 18 | PORT = 43466 |
19 | HOSTNAME = localhost | 19 | HOSTNAME = localhost |
20 | DEFAULTSERVICES = fs | 20 | DEFAULTSERVICES = fs |
21 | OPTIONS = -L DEBUG | ||
21 | 22 | ||
22 | [datastore] | 23 | [datastore] |
23 | #DEBUG = YES | 24 | #DEBUG = YES |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 7afbbd48b..4f369812d 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -726,7 +726,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connectio | |||
726 | { | 726 | { |
727 | probability = pg->peers[i].num_connections / (double)previous_total_connections; | 727 | probability = pg->peers[i].num_connections / (double)previous_total_connections; |
728 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 728 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
729 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 729 | UINT64_MAX)) / ( (double) UINT64_MAX); |
730 | #if VERBOSE_TESTING | 730 | #if VERBOSE_TESTING |
731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
732 | "Considering connecting peer %d to peer %d\n", | 732 | "Considering connecting peer %d to peer %d\n", |
@@ -820,7 +820,7 @@ create_small_world_ring(struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Conn | |||
820 | for (j = 0; j < connsPerPeer / 2; j++) | 820 | for (j = 0; j < connsPerPeer / 2; j++) |
821 | { | 821 | { |
822 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 822 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
823 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 823 | UINT64_MAX) / ( (double) UINT64_MAX)); |
824 | if (random < percentage) | 824 | if (random < percentage) |
825 | { | 825 | { |
826 | /* Connect to uniformly selected random peer */ | 826 | /* Connect to uniformly selected random peer */ |
@@ -1035,7 +1035,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1035 | probability = 1.0 / (distance * distance); | 1035 | probability = 1.0 / (distance * distance); |
1036 | /* Choose a random value between 0 and 1 */ | 1036 | /* Choose a random value between 0 and 1 */ |
1037 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 1037 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
1038 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 1038 | UINT64_MAX)) / ( (double) UINT64_MAX); |
1039 | /* If random < probability, then connect the two nodes */ | 1039 | /* If random < probability, then connect the two nodes */ |
1040 | if (random < probability) | 1040 | if (random < probability) |
1041 | smallWorldConnections += proc (pg, j, k); | 1041 | smallWorldConnections += proc (pg, j, k); |
@@ -1086,7 +1086,7 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1086 | inner_count++) | 1086 | inner_count++) |
1087 | { | 1087 | { |
1088 | temp_rand = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 1088 | temp_rand = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
1089 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 1089 | UINT64_MAX)) / ( (double) UINT64_MAX); |
1090 | #if VERBOSE_TESTING | 1090 | #if VERBOSE_TESTING |
1091 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1091 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1092 | _("rand is %f probability is %f\n"), temp_rand, | 1092 | _("rand is %f probability is %f\n"), temp_rand, |
@@ -2077,7 +2077,7 @@ random_connect_iterator (void *cls, | |||
2077 | uint32_t second_pos; | 2077 | uint32_t second_pos; |
2078 | GNUNET_HashCode first_hash; | 2078 | GNUNET_HashCode first_hash; |
2079 | random_number = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 2079 | random_number = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
2080 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 2080 | UINT64_MAX)) / ( (double) UINT64_MAX); |
2081 | if (random_number < random_ctx->percentage) | 2081 | if (random_number < random_ctx->percentage) |
2082 | { | 2082 | { |
2083 | GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(random_ctx->first->connect_peers_working_set, key, value, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2083 | GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(random_ctx->first->connect_peers_working_set, key, value, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 1dcd988a9..fd47130a1 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -3132,7 +3132,7 @@ send_periodic_ping (void *cls, | |||
3132 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen); | 3132 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen); |
3133 | va->transport_name = GNUNET_strdup (tp->short_name); | 3133 | va->transport_name = GNUNET_strdup (tp->short_name); |
3134 | va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 3134 | va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
3135 | (unsigned int) -1); | 3135 | UINT_MAX); |
3136 | va->send_time = GNUNET_TIME_absolute_get(); | 3136 | va->send_time = GNUNET_TIME_absolute_get(); |
3137 | va->session = peer_address->session; | 3137 | va->session = peer_address->session; |
3138 | if (peer_address->addr != NULL) | 3138 | if (peer_address->addr != NULL) |
@@ -3690,7 +3690,7 @@ run_validation (void *cls, | |||
3690 | chvc->ve_count++; | 3690 | chvc->ve_count++; |
3691 | va->transport_name = GNUNET_strdup (tname); | 3691 | va->transport_name = GNUNET_strdup (tname); |
3692 | va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 3692 | va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
3693 | (unsigned int) -1); | 3693 | UINT_MAX); |
3694 | va->send_time = GNUNET_TIME_absolute_get(); | 3694 | va->send_time = GNUNET_TIME_absolute_get(); |
3695 | va->addr = (const void*) &va[1]; | 3695 | va->addr = (const void*) &va[1]; |
3696 | memcpy (&va[1], addr, addrlen); | 3696 | memcpy (&va[1], addr, addrlen); |
diff --git a/src/util/time.c b/src/util/time.c index 3d53e0af2..6a5a314da 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -84,7 +84,7 @@ GNUNET_TIME_relative_get_unit () | |||
84 | struct GNUNET_TIME_Relative | 84 | struct GNUNET_TIME_Relative |
85 | GNUNET_TIME_relative_get_forever () | 85 | GNUNET_TIME_relative_get_forever () |
86 | { | 86 | { |
87 | static struct GNUNET_TIME_Relative forever = { (uint64_t) - 1LL }; | 87 | static struct GNUNET_TIME_Relative forever = { UINT64_MAX }; |
88 | return forever; | 88 | return forever; |
89 | } | 89 | } |
90 | 90 | ||
@@ -94,7 +94,7 @@ GNUNET_TIME_relative_get_forever () | |||
94 | struct GNUNET_TIME_Absolute | 94 | struct GNUNET_TIME_Absolute |
95 | GNUNET_TIME_absolute_get_forever () | 95 | GNUNET_TIME_absolute_get_forever () |
96 | { | 96 | { |
97 | static struct GNUNET_TIME_Absolute forever = { (uint64_t) - 1LL }; | 97 | static struct GNUNET_TIME_Absolute forever = { UINT64_MAX }; |
98 | return forever; | 98 | return forever; |
99 | } | 99 | } |
100 | 100 | ||
@@ -108,7 +108,7 @@ struct GNUNET_TIME_Absolute | |||
108 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | 108 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) |
109 | { | 109 | { |
110 | struct GNUNET_TIME_Absolute ret; | 110 | struct GNUNET_TIME_Absolute ret; |
111 | if (rel.value == (uint64_t) - 1LL) | 111 | if (rel.value == UINT64_MAX) |
112 | return GNUNET_TIME_absolute_get_forever (); | 112 | return GNUNET_TIME_absolute_get_forever (); |
113 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 113 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
114 | if (rel.value + now.value < rel.value) | 114 | if (rel.value + now.value < rel.value) |
@@ -196,7 +196,7 @@ struct GNUNET_TIME_Relative | |||
196 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | 196 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) |
197 | { | 197 | { |
198 | struct GNUNET_TIME_Relative ret; | 198 | struct GNUNET_TIME_Relative ret; |
199 | if (future.value == (uint64_t) - 1LL) | 199 | if (future.value == UINT64_MAX) |
200 | return GNUNET_TIME_relative_get_forever (); | 200 | return GNUNET_TIME_relative_get_forever (); |
201 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 201 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
202 | if (now.value > future.value) | 202 | if (now.value > future.value) |
@@ -217,7 +217,7 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | |||
217 | struct GNUNET_TIME_Absolute end) | 217 | struct GNUNET_TIME_Absolute end) |
218 | { | 218 | { |
219 | struct GNUNET_TIME_Relative ret; | 219 | struct GNUNET_TIME_Relative ret; |
220 | if (end.value == (uint64_t) - 1LL) | 220 | if (end.value == UINT64_MAX) |
221 | return GNUNET_TIME_relative_get_forever (); | 221 | return GNUNET_TIME_relative_get_forever (); |
222 | if (end.value < start.value) | 222 | if (end.value < start.value) |
223 | return GNUNET_TIME_relative_get_zero (); | 223 | return GNUNET_TIME_relative_get_zero (); |
@@ -238,7 +238,7 @@ GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute hence) | |||
238 | struct GNUNET_TIME_Relative ret; | 238 | struct GNUNET_TIME_Relative ret; |
239 | 239 | ||
240 | now = GNUNET_TIME_absolute_get (); | 240 | now = GNUNET_TIME_absolute_get (); |
241 | GNUNET_assert (hence.value != (uint64_t) - 1LL); | 241 | GNUNET_assert (hence.value != UINT64_MAX); |
242 | if (hence.value > now.value) | 242 | if (hence.value > now.value) |
243 | return GNUNET_TIME_relative_get_zero (); | 243 | return GNUNET_TIME_relative_get_zero (); |
244 | ret.value = now.value - hence.value; | 244 | ret.value = now.value - hence.value; |
@@ -258,8 +258,8 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | |||
258 | { | 258 | { |
259 | struct GNUNET_TIME_Absolute ret; | 259 | struct GNUNET_TIME_Absolute ret; |
260 | 260 | ||
261 | if ((start.value == (uint64_t) - 1LL) || | 261 | if ((start.value == UINT64_MAX) || |
262 | (duration.value == (uint64_t) - 1LL)) | 262 | (duration.value == UINT64_MAX)) |
263 | return GNUNET_TIME_absolute_get_forever (); | 263 | return GNUNET_TIME_absolute_get_forever (); |
264 | if (start.value + duration.value < start.value) | 264 | if (start.value + duration.value < start.value) |
265 | { | 265 | { |
@@ -382,7 +382,7 @@ GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | |||
382 | { | 382 | { |
383 | struct GNUNET_TIME_Relative ret; | 383 | struct GNUNET_TIME_Relative ret; |
384 | 384 | ||
385 | if ((a1.value == (uint64_t) - 1LL) || (a2.value == (uint64_t) - 1LL)) | 385 | if ((a1.value == UINT64_MAX) || (a2.value == UINT64_MAX)) |
386 | return GNUNET_TIME_relative_get_forever (); | 386 | return GNUNET_TIME_relative_get_forever (); |
387 | if (a1.value + a2.value < a1.value) | 387 | if (a1.value + a2.value < a1.value) |
388 | { | 388 | { |
@@ -409,7 +409,7 @@ GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | |||
409 | 409 | ||
410 | if (a2.value >= a1.value) | 410 | if (a2.value >= a1.value) |
411 | return GNUNET_TIME_relative_get_zero (); | 411 | return GNUNET_TIME_relative_get_zero (); |
412 | if (a1.value == (uint64_t) - 1LL) | 412 | if (a1.value == UINT64_MAX) |
413 | return GNUNET_TIME_relative_get_forever (); | 413 | return GNUNET_TIME_relative_get_forever (); |
414 | ret.value = a1.value - a2.value; | 414 | ret.value = a1.value - a2.value; |
415 | return ret; | 415 | return ret; |