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 | eb5b6e43451d6b517947b7029dd81182aa000fa1 (patch) | |
tree | c2a1c2dea55c3d25c460b2ee5ce93b60cbea8a4f /common/collection/collection_tools.c | |
parent | d4a4fe465517a4ca820e4d1ce1d85b4e5bc3ee8e (diff) | |
download | sssd-eb5b6e43451d6b517947b7029dd81182aa000fa1.tar.gz sssd-eb5b6e43451d6b517947b7029dd81182aa000fa1.tar.bz2 sssd-eb5b6e43451d6b517947b7029dd81182aa000fa1.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 'common/collection/collection_tools.c')
-rw-r--r-- | common/collection/collection_tools.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/common/collection/collection_tools.c b/common/collection/collection_tools.c index 503a1a8c..7352b3aa 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: |