diff options
author | Dmitri Pal <dpal@redhat.com> | 2010-03-11 12:23:14 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-03-15 16:12:52 -0400 |
commit | 885d8e5c7cd6e27643a70c35a52de0ece0901e1f (patch) | |
tree | 7f3e4fa8094b1bcaf3d68876d2003949799314e3 /collection/collection_tools.c | |
parent | 02a89e253225b46c37ae03a5045e3e18f3fcb296 (diff) | |
download | ding-libs2-885d8e5c7cd6e27643a70c35a52de0ece0901e1f.tar.gz ding-libs2-885d8e5c7cd6e27643a70c35a52de0ece0901e1f.tar.xz ding-libs2-885d8e5c7cd6e27643a70c35a52de0ece0901e1f.zip |
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.
Diffstat (limited to 'collection/collection_tools.c')
-rw-r--r-- | collection/collection_tools.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/collection/collection_tools.c b/collection/collection_tools.c index 503a1a8..7352b3a 100644 --- a/collection/collection_tools.c +++ b/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: |