Replace 'long' with 'int64_t' in public core headers
diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h
index b40c2b2..21fd9de 100644
--- a/include/grpc/impl/codegen/time.h
+++ b/include/grpc/impl/codegen/time.h
@@ -102,14 +102,14 @@
GPR_API gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
GPR_API gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
-/* Return a timespec representing a given number of time units. LONG_MIN is
- interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */
-GPR_API gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type);
-GPR_API gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type);
-GPR_API gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type);
-GPR_API gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type);
-GPR_API gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type);
-GPR_API gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type);
+/* Return a timespec representing a given number of time units. INT64_MIN is
+ interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
+GPR_API gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type);
GPR_API int32_t gpr_time_to_millis(gpr_timespec timespec);
diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h
index 3433124..623da66 100644
--- a/include/grpc/support/avl.h
+++ b/include/grpc/support/avl.h
@@ -43,7 +43,7 @@
void *value;
struct gpr_avl_node *left;
struct gpr_avl_node *right;
- long height;
+ int64_t height;
} gpr_avl_node;
typedef struct gpr_avl_vtable {
@@ -53,7 +53,7 @@
void *(*copy_key)(void *key);
/** compare key1, key2; return <0 if key1 < key2,
>0 if key1 > key2, 0 if key1 == key2 */
- long (*compare_keys)(void *key1, void *key2);
+ int64_t (*compare_keys)(void *key1, void *key2);
/** destroy a value */
void (*destroy_value)(void *value);
/** copy a value */
diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c
index 96b6f81..759340e 100644
--- a/src/core/iomgr/iocp_windows.c
+++ b/src/core/iomgr/iocp_windows.c
@@ -57,7 +57,7 @@
static DWORD deadline_to_millis_timeout(gpr_timespec deadline,
gpr_timespec now) {
gpr_timespec timeout;
- static const int max_spin_polling_us = 10;
+ static const int64_t max_spin_polling_us = 10;
if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) == 0) {
return INFINITE;
}
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index a8e2e22..19ee665 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -393,7 +393,7 @@
int grpc_poll_deadline_to_millis_timeout(gpr_timespec deadline,
gpr_timespec now) {
gpr_timespec timeout;
- static const int max_spin_polling_us = 10;
+ static const int64_t max_spin_polling_us = 10;
if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) == 0) {
return -1;
}
diff --git a/src/core/support/avl.c b/src/core/support/avl.c
index 9734c99..1767fc1 100644
--- a/src/core/support/avl.c
+++ b/src/core/support/avl.c
@@ -67,12 +67,12 @@
}
}
-static long node_height(gpr_avl_node *node) {
+static int64_t node_height(gpr_avl_node *node) {
return node == NULL ? 0 : node->height;
}
#ifndef NDEBUG
-static long calculate_height(gpr_avl_node *node) {
+static int64_t calculate_height(gpr_avl_node *node) {
return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right));
}
@@ -103,7 +103,7 @@
static gpr_avl_node *get(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key) {
- long cmp;
+ int64_t cmp;
if (node == NULL) {
return NULL;
@@ -198,7 +198,7 @@
static gpr_avl_node *add(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key, void *value) {
- long cmp;
+ int64_t cmp;
if (node == NULL) {
return new_node(key, value, NULL, NULL);
}
@@ -240,7 +240,7 @@
static gpr_avl_node *remove(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key) {
- long cmp;
+ int64_t cmp;
if (node == NULL) {
return NULL;
}
diff --git a/src/core/support/time.c b/src/core/support/time.c
index ac8c3bc..2a1e40c 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -83,12 +83,12 @@
/* TODO(ctiller): consider merging _nanos, _micros, _millis into a single
function for maintainability. Similarly for _seconds, _minutes, and _hours */
-gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) {
+gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (ns == LONG_MAX) {
+ if (ns == INT64_MAX) {
result = gpr_inf_future(type);
- } else if (ns == LONG_MIN) {
+ } else if (ns == INT64_MIN) {
result = gpr_inf_past(type);
} else if (ns >= 0) {
result.tv_sec = ns / GPR_NS_PER_SEC;
@@ -101,12 +101,12 @@
return result;
}
-gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) {
+gpr_timespec gpr_time_from_micros(int64_t us, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (us == LONG_MAX) {
+ if (us == INT64_MAX) {
result = gpr_inf_future(type);
- } else if (us == LONG_MIN) {
+ } else if (us == INT64_MIN) {
result = gpr_inf_past(type);
} else if (us >= 0) {
result.tv_sec = us / 1000000;
@@ -119,12 +119,12 @@
return result;
}
-gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) {
+gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (ms == LONG_MAX) {
+ if (ms == INT64_MAX) {
result = gpr_inf_future(type);
- } else if (ms == LONG_MIN) {
+ } else if (ms == INT64_MIN) {
result = gpr_inf_past(type);
} else if (ms >= 0) {
result.tv_sec = ms / 1000;
@@ -137,12 +137,12 @@
return result;
}
-gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) {
+gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (s == LONG_MAX) {
+ if (s == INT64_MAX) {
result = gpr_inf_future(type);
- } else if (s == LONG_MIN) {
+ } else if (s == INT64_MIN) {
result = gpr_inf_past(type);
} else {
result.tv_sec = s;
@@ -151,12 +151,12 @@
return result;
}
-gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) {
+gpr_timespec gpr_time_from_minutes(int64_t m, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (m >= LONG_MAX / 60) {
+ if (m >= INT64_MAX / 60) {
result = gpr_inf_future(type);
- } else if (m <= LONG_MIN / 60) {
+ } else if (m <= INT64_MIN / 60) {
result = gpr_inf_past(type);
} else {
result.tv_sec = m * 60;
@@ -165,12 +165,12 @@
return result;
}
-gpr_timespec gpr_time_from_hours(long h, gpr_clock_type type) {
+gpr_timespec gpr_time_from_hours(int64_t h, gpr_clock_type type) {
gpr_timespec result;
result.clock_type = type;
- if (h >= LONG_MAX / 3600) {
+ if (h >= INT64_MAX / 3600) {
result = gpr_inf_future(type);
- } else if (h <= LONG_MIN / 3600) {
+ } else if (h <= INT64_MIN / 3600) {
result = gpr_inf_past(type);
} else {
result.tv_sec = h * 3600;
diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc
index 64015e8..9284db6 100644
--- a/src/node/ext/timeval.cc
+++ b/src/node/ext/timeval.cc
@@ -32,6 +32,7 @@
*/
#include <limits>
+#include <cstdint>
#include "grpc/grpc.h"
#include "grpc/support/time.h"
@@ -46,7 +47,7 @@
} else if (millis == -std::numeric_limits<double>::infinity()) {
return gpr_inf_past(GPR_CLOCK_REALTIME);
} else {
- return gpr_time_from_micros(static_cast<long>(millis * 1000),
+ return gpr_time_from_micros(static_cast<int64_t>(millis * 1000),
GPR_CLOCK_REALTIME);
}
}
diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c
index b818f34..817303c 100644
--- a/src/python/grpcio/grpc/_cython/imports.generated.c
+++ b/src/python/grpcio/grpc/_cython/imports.generated.c
@@ -41,7 +41,14 @@
census_shutdown_type census_shutdown_import;
census_supported_type census_supported_import;
census_enabled_type census_enabled_import;
-census_context_serialize_type census_context_serialize_import;
+census_context_create_type census_context_create_import;
+census_context_destroy_type census_context_destroy_import;
+census_context_get_status_type census_context_get_status_import;
+census_context_initialize_iterator_type census_context_initialize_iterator_import;
+census_context_next_tag_type census_context_next_tag_import;
+census_context_get_tag_type census_context_get_tag_import;
+census_context_encode_type census_context_encode_import;
+census_context_decode_type census_context_decode_import;
census_trace_mask_type census_trace_mask_import;
census_set_trace_mask_type census_set_trace_mask_import;
census_start_rpc_op_timestamp_type census_start_rpc_op_timestamp_import;
@@ -54,15 +61,6 @@
census_trace_scan_start_type census_trace_scan_start_import;
census_get_trace_record_type census_get_trace_record_import;
census_trace_scan_end_type census_trace_scan_end_import;
-census_tag_set_create_type census_tag_set_create_import;
-census_tag_set_destroy_type census_tag_set_destroy_import;
-census_tag_set_get_create_status_type census_tag_set_get_create_status_import;
-census_tag_set_initialize_iterator_type census_tag_set_initialize_iterator_import;
-census_tag_set_next_tag_type census_tag_set_next_tag_import;
-census_tag_set_get_tag_by_key_type census_tag_set_get_tag_by_key_import;
-census_tag_set_encode_type census_tag_set_encode_import;
-census_tag_set_decode_type census_tag_set_decode_import;
-census_context_tag_set_type census_context_tag_set_import;
census_record_values_type census_record_values_import;
census_view_create_type census_view_create_import;
census_view_delete_type census_view_delete_import;
@@ -303,7 +301,14 @@
census_shutdown_import = (census_shutdown_type) GetProcAddress(library, "census_shutdown");
census_supported_import = (census_supported_type) GetProcAddress(library, "census_supported");
census_enabled_import = (census_enabled_type) GetProcAddress(library, "census_enabled");
- census_context_serialize_import = (census_context_serialize_type) GetProcAddress(library, "census_context_serialize");
+ census_context_create_import = (census_context_create_type) GetProcAddress(library, "census_context_create");
+ census_context_destroy_import = (census_context_destroy_type) GetProcAddress(library, "census_context_destroy");
+ census_context_get_status_import = (census_context_get_status_type) GetProcAddress(library, "census_context_get_status");
+ census_context_initialize_iterator_import = (census_context_initialize_iterator_type) GetProcAddress(library, "census_context_initialize_iterator");
+ census_context_next_tag_import = (census_context_next_tag_type) GetProcAddress(library, "census_context_next_tag");
+ census_context_get_tag_import = (census_context_get_tag_type) GetProcAddress(library, "census_context_get_tag");
+ census_context_encode_import = (census_context_encode_type) GetProcAddress(library, "census_context_encode");
+ census_context_decode_import = (census_context_decode_type) GetProcAddress(library, "census_context_decode");
census_trace_mask_import = (census_trace_mask_type) GetProcAddress(library, "census_trace_mask");
census_set_trace_mask_import = (census_set_trace_mask_type) GetProcAddress(library, "census_set_trace_mask");
census_start_rpc_op_timestamp_import = (census_start_rpc_op_timestamp_type) GetProcAddress(library, "census_start_rpc_op_timestamp");
@@ -316,15 +321,6 @@
census_trace_scan_start_import = (census_trace_scan_start_type) GetProcAddress(library, "census_trace_scan_start");
census_get_trace_record_import = (census_get_trace_record_type) GetProcAddress(library, "census_get_trace_record");
census_trace_scan_end_import = (census_trace_scan_end_type) GetProcAddress(library, "census_trace_scan_end");
- census_tag_set_create_import = (census_tag_set_create_type) GetProcAddress(library, "census_tag_set_create");
- census_tag_set_destroy_import = (census_tag_set_destroy_type) GetProcAddress(library, "census_tag_set_destroy");
- census_tag_set_get_create_status_import = (census_tag_set_get_create_status_type) GetProcAddress(library, "census_tag_set_get_create_status");
- census_tag_set_initialize_iterator_import = (census_tag_set_initialize_iterator_type) GetProcAddress(library, "census_tag_set_initialize_iterator");
- census_tag_set_next_tag_import = (census_tag_set_next_tag_type) GetProcAddress(library, "census_tag_set_next_tag");
- census_tag_set_get_tag_by_key_import = (census_tag_set_get_tag_by_key_type) GetProcAddress(library, "census_tag_set_get_tag_by_key");
- census_tag_set_encode_import = (census_tag_set_encode_type) GetProcAddress(library, "census_tag_set_encode");
- census_tag_set_decode_import = (census_tag_set_decode_type) GetProcAddress(library, "census_tag_set_decode");
- census_context_tag_set_import = (census_context_tag_set_type) GetProcAddress(library, "census_context_tag_set");
census_record_values_import = (census_record_values_type) GetProcAddress(library, "census_record_values");
census_view_create_import = (census_view_create_type) GetProcAddress(library, "census_view_create");
census_view_delete_import = (census_view_delete_type) GetProcAddress(library, "census_view_delete");
diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h
index 2a8a910..6d0a6e0 100644
--- a/src/python/grpcio/grpc/_cython/imports.generated.h
+++ b/src/python/grpcio/grpc/_cython/imports.generated.h
@@ -73,9 +73,30 @@
typedef int(*census_enabled_type)(void);
extern census_enabled_type census_enabled_import;
#define census_enabled census_enabled_import
-typedef size_t(*census_context_serialize_type)(const census_context *context, char *buffer, size_t buf_size);
-extern census_context_serialize_type census_context_serialize_import;
-#define census_context_serialize census_context_serialize_import
+typedef census_context *(*census_context_create_type)(const census_context *base, const census_tag *tags, int ntags, census_context_status const **status);
+extern census_context_create_type census_context_create_import;
+#define census_context_create census_context_create_import
+typedef void(*census_context_destroy_type)(census_context *context);
+extern census_context_destroy_type census_context_destroy_import;
+#define census_context_destroy census_context_destroy_import
+typedef const census_context_status *(*census_context_get_status_type)(const census_context *context);
+extern census_context_get_status_type census_context_get_status_import;
+#define census_context_get_status census_context_get_status_import
+typedef void(*census_context_initialize_iterator_type)(const census_context *context, census_context_iterator *iterator);
+extern census_context_initialize_iterator_type census_context_initialize_iterator_import;
+#define census_context_initialize_iterator census_context_initialize_iterator_import
+typedef int(*census_context_next_tag_type)(census_context_iterator *iterator, census_tag *tag);
+extern census_context_next_tag_type census_context_next_tag_import;
+#define census_context_next_tag census_context_next_tag_import
+typedef int(*census_context_get_tag_type)(const census_context *context, const char *key, census_tag *tag);
+extern census_context_get_tag_type census_context_get_tag_import;
+#define census_context_get_tag census_context_get_tag_import
+typedef char *(*census_context_encode_type)(const census_context *context, char *buffer, size_t buf_size, size_t *print_buf_size, size_t *bin_buf_size);
+extern census_context_encode_type census_context_encode_import;
+#define census_context_encode census_context_encode_import
+typedef census_context *(*census_context_decode_type)(const char *buffer, size_t size, const char *bin_buffer, size_t bin_size);
+extern census_context_decode_type census_context_decode_import;
+#define census_context_decode census_context_decode_import
typedef int(*census_trace_mask_type)(const census_context *context);
extern census_trace_mask_type census_trace_mask_import;
#define census_trace_mask census_trace_mask_import
@@ -112,37 +133,10 @@
typedef void(*census_trace_scan_end_type)();
extern census_trace_scan_end_type census_trace_scan_end_import;
#define census_trace_scan_end census_trace_scan_end_import
-typedef census_tag_set *(*census_tag_set_create_type)(const census_tag_set *base, const census_tag *tags, int ntags, census_tag_set_create_status const **status);
-extern census_tag_set_create_type census_tag_set_create_import;
-#define census_tag_set_create census_tag_set_create_import
-typedef void(*census_tag_set_destroy_type)(census_tag_set *tags);
-extern census_tag_set_destroy_type census_tag_set_destroy_import;
-#define census_tag_set_destroy census_tag_set_destroy_import
-typedef const census_tag_set_create_status *(*census_tag_set_get_create_status_type)(const census_tag_set *tags);
-extern census_tag_set_get_create_status_type census_tag_set_get_create_status_import;
-#define census_tag_set_get_create_status census_tag_set_get_create_status_import
-typedef void(*census_tag_set_initialize_iterator_type)(const census_tag_set *tags, census_tag_set_iterator *iterator);
-extern census_tag_set_initialize_iterator_type census_tag_set_initialize_iterator_import;
-#define census_tag_set_initialize_iterator census_tag_set_initialize_iterator_import
-typedef int(*census_tag_set_next_tag_type)(census_tag_set_iterator *iterator, census_tag *tag);
-extern census_tag_set_next_tag_type census_tag_set_next_tag_import;
-#define census_tag_set_next_tag census_tag_set_next_tag_import
-typedef int(*census_tag_set_get_tag_by_key_type)(const census_tag_set *tags, const char *key, census_tag *tag);
-extern census_tag_set_get_tag_by_key_type census_tag_set_get_tag_by_key_import;
-#define census_tag_set_get_tag_by_key census_tag_set_get_tag_by_key_import
-typedef char *(*census_tag_set_encode_type)(const census_tag_set *tags, char *buffer, size_t buf_size, size_t *print_buf_size, size_t *bin_buf_size);
-extern census_tag_set_encode_type census_tag_set_encode_import;
-#define census_tag_set_encode census_tag_set_encode_import
-typedef census_tag_set *(*census_tag_set_decode_type)(const char *buffer, size_t size, const char *bin_buffer, size_t bin_size);
-extern census_tag_set_decode_type census_tag_set_decode_import;
-#define census_tag_set_decode census_tag_set_decode_import
-typedef census_tag_set *(*census_context_tag_set_type)(census_context *context);
-extern census_context_tag_set_type census_context_tag_set_import;
-#define census_context_tag_set census_context_tag_set_import
typedef void(*census_record_values_type)(census_context *context, census_value *values, size_t nvalues);
extern census_record_values_type census_record_values_import;
#define census_record_values census_record_values_import
-typedef census_view *(*census_view_create_type)(uint32_t metric_id, const census_tag_set *tags, const census_aggregation *aggregations, size_t naggregations);
+typedef census_view *(*census_view_create_type)(uint32_t metric_id, const census_context *tags, const census_aggregation *aggregations, size_t naggregations);
extern census_view_create_type census_view_create_import;
#define census_view_create census_view_create_import
typedef void(*census_view_delete_type)(census_view *view);
@@ -154,7 +148,7 @@
typedef size_t(*census_view_naggregations_type)(const census_view *view);
extern census_view_naggregations_type census_view_naggregations_import;
#define census_view_naggregations census_view_naggregations_import
-typedef const census_tag_set *(*census_view_tags_type)(const census_view *view);
+typedef const census_context *(*census_view_tags_type)(const census_view *view);
extern census_view_tags_type census_view_tags_import;
#define census_view_tags census_view_tags_import
typedef const census_aggregation *(*census_view_aggregrations_type)(const census_view *view);
@@ -661,22 +655,22 @@
typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
extern gpr_time_sub_type gpr_time_sub_import;
#define gpr_time_sub gpr_time_sub_import
-typedef gpr_timespec(*gpr_time_from_micros_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_micros_type gpr_time_from_micros_import;
#define gpr_time_from_micros gpr_time_from_micros_import
-typedef gpr_timespec(*gpr_time_from_nanos_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
#define gpr_time_from_nanos gpr_time_from_nanos_import
-typedef gpr_timespec(*gpr_time_from_millis_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_millis_type gpr_time_from_millis_import;
#define gpr_time_from_millis gpr_time_from_millis_import
-typedef gpr_timespec(*gpr_time_from_seconds_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
#define gpr_time_from_seconds gpr_time_from_seconds_import
-typedef gpr_timespec(*gpr_time_from_minutes_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
#define gpr_time_from_minutes gpr_time_from_minutes_import
-typedef gpr_timespec(*gpr_time_from_hours_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_hours_type gpr_time_from_hours_import;
#define gpr_time_from_hours gpr_time_from_hours_import
typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
index 45e9b47..618ae5e 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
@@ -655,22 +655,22 @@
typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
extern gpr_time_sub_type gpr_time_sub_import;
#define gpr_time_sub gpr_time_sub_import
-typedef gpr_timespec(*gpr_time_from_micros_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_micros_type gpr_time_from_micros_import;
#define gpr_time_from_micros gpr_time_from_micros_import
-typedef gpr_timespec(*gpr_time_from_nanos_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
#define gpr_time_from_nanos gpr_time_from_nanos_import
-typedef gpr_timespec(*gpr_time_from_millis_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_millis_type gpr_time_from_millis_import;
#define gpr_time_from_millis gpr_time_from_millis_import
-typedef gpr_timespec(*gpr_time_from_seconds_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
#define gpr_time_from_seconds gpr_time_from_seconds_import
-typedef gpr_timespec(*gpr_time_from_minutes_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
#define gpr_time_from_minutes gpr_time_from_minutes_import
-typedef gpr_timespec(*gpr_time_from_hours_type)(long x, gpr_clock_type clock_type);
+typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_hours_type gpr_time_from_hours_import;
#define gpr_time_from_hours gpr_time_from_hours_import
typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);
diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c
index aac20fd..858aeb9 100644
--- a/test/core/statistics/census_log_tests.c
+++ b/test/core/statistics/census_log_tests.c
@@ -237,7 +237,7 @@
gpr_timespec interval;
int counter = 0;
printf(" Reader starting\n");
- interval = gpr_time_from_micros(args->read_iteration_interval_in_msec * 1000,
+ interval = gpr_time_from_micros((int64_t)args->read_iteration_interval_in_msec * 1000,
GPR_TIMESPAN);
gpr_mu_lock(args->mu);
while (!args->stop_flag && records_read < args->total_records) {
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c
index d8d8b36..6dae53c 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.c
@@ -48,7 +48,7 @@
return b;
}
-static long int_compare(void *int1, void *int2) {
+static int64_t int_compare(void *int1, void *int2) {
return (*(int *)int1) - (*(int *)int2);
}
static void *int_copy(void *p) { return box(*(int *)p); }
diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c
index 0149bc3..acb5101 100644
--- a/test/core/support/sync_test.c
+++ b/test/core/support/sync_test.c
@@ -251,7 +251,7 @@
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec time_taken;
gpr_timespec deadline = gpr_time_add(
- start, gpr_time_from_micros(timeout_s * 1000000, GPR_TIMESPAN));
+ start, gpr_time_from_micros((int64_t)timeout_s * 1000000, GPR_TIMESPAN));
fprintf(stderr, "%s:", name);
while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) {
iterations <<= 1;
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c
index fc26f94..5285a2c 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.c
@@ -125,15 +125,15 @@
}
/* Test possible overflow in conversion of -ve values. */
- x = gpr_time_from_micros(-(LONG_MAX - 999997), GPR_TIMESPAN);
+ x = gpr_time_from_micros(-(INT64_MAX - 999997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
- x = gpr_time_from_nanos(-(LONG_MAX - 999999997), GPR_TIMESPAN);
+ x = gpr_time_from_nanos(-(INT64_MAX - 999999997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
- x = gpr_time_from_millis(-(LONG_MAX - 997), GPR_TIMESPAN);
+ x = gpr_time_from_millis(-(INT64_MAX - 997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index 15b7174..3872776 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -57,13 +57,13 @@
#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
- gpr_time_from_millis((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
+ gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
GPR_TIMESPAN))
#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
- gpr_time_from_micros((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
+ gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
GPR_TIMESPAN))
#ifndef GRPC_TEST_CUSTOM_PICK_PORT
diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc
index 1e501df..803bd46 100644
--- a/test/cpp/util/time_test.cc
+++ b/test/cpp/util/time_test.cc
@@ -45,7 +45,7 @@
class TimeTest : public ::testing::Test {};
TEST_F(TimeTest, AbsolutePointTest) {
- long us = 10000000L;
+ int64_t us = 10000000L;
gpr_timespec ts = gpr_time_from_micros(us, GPR_TIMESPAN);
ts.clock_type = GPR_CLOCK_REALTIME;
system_clock::time_point tp{microseconds(us)};