summaryrefslogtreecommitdiffstats
path: root/common/collection/collection_tools.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-03-11 12:23:14 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-03-15 16:13:58 -0400
commit8fec58e70b92df90558ef11c8bebbfd3df06a6de (patch)
treeddf3361bc55151c6e6c0deca0f6b9bf6ad0016a0 /common/collection/collection_tools.c
parent756a9b0dd9dc306e9ef98e67fa1f18c4446f8486 (diff)
downloadsssd-8fec58e70b92df90558ef11c8bebbfd3df06a6de.tar.gz
sssd-8fec58e70b92df90558ef11c8bebbfd3df06a6de.tar.xz
sssd-8fec58e70b92df90558ef11c8bebbfd3df06a6de.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.c24
1 files changed, 14 insertions, 10 deletions
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: