From 8fec58e70b92df90558ef11c8bebbfd3df06a6de Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Thu, 11 Mar 2010 12:23:14 -0500 Subject: Convert collection to use sized values. This patch replaces int with int32_t, unsigned with uint32_t, long with int64_t, unsigned long with uint64_t as values that collection can store and hold. --- common/collection/collection_tools.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'common/collection/collection_tools.c') diff --git a/common/collection/collection_tools.c b/common/collection/collection_tools.c index 503a1a8c4..7352b3aac 100644 --- a/common/collection/collection_tools.c +++ b/common/collection/collection_tools.c @@ -77,7 +77,7 @@ int col_debug_handle(const char *property, (nest_level -1) * 4, "", property, length, - *((int *)(data)), + *((int32_t *)(data)), nest_level); break; case COL_TYPE_UNSIGNED: @@ -85,23 +85,23 @@ int col_debug_handle(const char *property, (nest_level -1) * 4, "", property, length, - *((unsigned int *)(data)), + *((uint32_t *)(data)), nest_level); break; case COL_TYPE_LONG: - printf(">%*s%s[%d] long: %ld (%d)\n", + printf(">%*s%s[%d] long: %lld (%d)\n", (nest_level -1) * 4, "", property, length, - *((long *)(data)), + (long long int)(*((int64_t *)(data))), nest_level); break; case COL_TYPE_ULONG: - printf(">%*s%s[%d] ulong: %lu (%d)\n", + printf(">%*s%s[%d] ulong: %llu (%d)\n", (nest_level -1) * 4, "", property, length, - *((unsigned long *)(data)), + (long long unsigned)(*((uint64_t *)(data))), nest_level); break; case COL_TYPE_DOUBLE: @@ -242,6 +242,8 @@ int col_get_data_len(int type, int length) switch (type) { case COL_TYPE_INTEGER: case COL_TYPE_UNSIGNED: + len = 11; + break; case COL_TYPE_LONG: case COL_TYPE_ULONG: len = 20; @@ -472,22 +474,24 @@ int col_serialize(const char *property_in, case COL_TYPE_INTEGER: len = sprintf(&buf_data->buffer[buf_data->length], - "%d", *((const int *)(data))); + "%d", *((const int32_t *)(data))); break; case COL_TYPE_UNSIGNED: len = sprintf(&buf_data->buffer[buf_data->length], - "%u", *((const unsigned int *)(data))); + "%u", *((const uint32_t *)(data))); break; case COL_TYPE_LONG: len = sprintf(&buf_data->buffer[buf_data->length], - "%ld", *((const long *)(data))); + "%lld", + (long long int)(*((const int64_t *)(data)))); break; case COL_TYPE_ULONG: len = sprintf(&buf_data->buffer[buf_data->length], - "%lu", *((const unsigned long *)(data))); + "%llu", + (long long unsigned)(*((const uint64_t *)(data)))); break; case COL_TYPE_DOUBLE: -- cgit