summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-07-03 12:19:12 -0400
committerSimo Sorce <ssorce@redhat.com>2009-07-03 12:36:25 -0400
commit550f27dbdbd00024e483b989ebc033b2cbe0d239 (patch)
tree3cc1875f04808a021eb85ceb3ae6201e4c0b32f6 /common
parent19727007c9948ee92a9505efae6692ea38c96a3e (diff)
downloadsssd-550f27dbdbd00024e483b989ebc033b2cbe0d239.tar.gz
sssd-550f27dbdbd00024e483b989ebc033b2cbe0d239.tar.xz
sssd-550f27dbdbd00024e483b989ebc033b2cbe0d239.zip
Clean up warnings in common/
Fix consts and function declarations
Diffstat (limited to 'common')
-rw-r--r--common/collection/collection.c58
-rw-r--r--common/collection/collection.h12
-rw-r--r--common/collection/collection_cnv.c75
-rw-r--r--common/collection/collection_queue.c2
-rw-r--r--common/collection/collection_queue.h2
-rw-r--r--common/collection/collection_queue_ut.c4
-rw-r--r--common/collection/collection_stack.c2
-rw-r--r--common/collection/collection_stack.h2
-rw-r--r--common/collection/collection_stack_ut.c4
-rw-r--r--common/collection/collection_tools.c21
-rw-r--r--common/collection/collection_tools.h2
-rw-r--r--common/collection/collection_ut.c16
-rw-r--r--common/dhash/dhash.h2
-rw-r--r--common/ini/ini_config.c4
-rw-r--r--common/ini/ini_config.h2
-rw-r--r--common/ini/ini_config_ut.c10
16 files changed, 110 insertions, 108 deletions
diff --git a/common/collection/collection.c b/common/collection/collection.c
index b0bee08fb..d3bc365d9 100644
--- a/common/collection/collection.c
+++ b/common/collection/collection.c
@@ -69,7 +69,7 @@ struct update_property {
};
/* Dummy structure */
-struct collection_item dummy = { NULL, "", 0, COL_TYPE_END, 0, NULL };
+struct collection_item dummy_item = { NULL, "", 0, COL_TYPE_END, 0, NULL };
/******************** FUNCTION DECLARATIONS ****************************/
@@ -184,7 +184,7 @@ void col_delete_item(struct collection_item *item)
/* A generic function to allocate a property item */
static int col_allocate_item(struct collection_item **ci, const char *property,
- void *item_data,int length, int type)
+ const void *item_data, int length, int type)
{
struct collection_item *item = NULL;
int error = 0;
@@ -278,7 +278,7 @@ struct property_search {
/* Find the parent of the item with given name */
static int col_find_property(struct collection_item *collection,
const char *refprop,
- int index,
+ int idx,
int use_type,
int type,
struct collection_item **parent)
@@ -293,7 +293,7 @@ static int col_find_property(struct collection_item *collection,
ps.property = refprop;
ps.hash = FNV1a_base;
ps.parent = NULL;
- ps.index = index;
+ ps.index = idx;
ps.count = 0;
ps.found = 0;
ps.use_type = use_type;
@@ -329,7 +329,7 @@ int col_insert_item_into_current(struct collection_item *collection,
struct collection_item *item,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags)
{
struct collection_header *header = NULL;
@@ -508,7 +508,7 @@ int col_insert_item_into_current(struct collection_item *collection,
}
break;
- case COL_DSP_INDEX: if(index == 0) {
+ case COL_DSP_INDEX: if(idx == 0) {
/* Same is first */
if (header->count == 1) {
header->last->next = item;
@@ -519,7 +519,7 @@ int col_insert_item_into_current(struct collection_item *collection,
collection->next = item;
}
}
- else if(index >= header->count - 1) {
+ else if(idx >= header->count - 1) {
/* In this case add to the end */
if (header->last != NULL) header->last->next = item;
/* Make sure we save a new last element */
@@ -529,8 +529,8 @@ int col_insert_item_into_current(struct collection_item *collection,
/* In the middle */
parent = collection;
/* Move to the right position counting */
- while (index > 0) {
- index--;
+ while (idx > 0) {
+ idx--;
parent = parent->next;
}
item->next = parent->next;
@@ -545,7 +545,7 @@ int col_insert_item_into_current(struct collection_item *collection,
if (disposition == COL_DSP_FIRSTDUP) refindex = 0;
else if (disposition == COL_DSP_LASTDUP) refindex = -1;
- else refindex = index;
+ else refindex = idx;
/* We need to find property based on index */
if (col_find_property(collection, item->property, refindex, 0, 0, &parent)) {
@@ -580,7 +580,7 @@ int col_insert_item_into_current(struct collection_item *collection,
int col_extract_item_from_current(struct collection_item *collection,
int disposition,
const char *refprop,
- int index,
+ int idx,
int type,
struct collection_item **ret_ref)
{
@@ -689,7 +689,7 @@ int col_extract_item_from_current(struct collection_item *collection,
}
break;
- case COL_DSP_INDEX: if (index == 0) {
+ case COL_DSP_INDEX: if (idx == 0) {
*ret_ref = collection->next;
collection->next = (*ret_ref)->next;
/* Special case - one data element */
@@ -698,7 +698,7 @@ int col_extract_item_from_current(struct collection_item *collection,
/* Index 0 stands for the first data element.
* Count includes header element.
*/
- else if (index >= (header->count - 1)) {
+ else if (idx >= (header->count - 1)) {
TRACE_ERROR_STRING("Index is out of boundaries", refprop);
return ENOENT;
}
@@ -707,7 +707,7 @@ int col_extract_item_from_current(struct collection_item *collection,
refindex = 0;
parent = collection;
current = collection->next;
- while (refindex < index) {
+ while (refindex < idx) {
parent = current;
current = current->next;
refindex++;
@@ -725,7 +725,7 @@ int col_extract_item_from_current(struct collection_item *collection,
if (disposition == COL_DSP_FIRSTDUP) refindex = 0;
else if (disposition == COL_DSP_LASTDUP) refindex = -2;
- else refindex = index;
+ else refindex = idx;
/* We need to find property based on index */
if (col_find_property(collection, refprop, refindex, use_type, type, &parent)) {
@@ -764,7 +764,7 @@ int col_extract_item(struct collection_item *collection,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
int type,
struct collection_item **ret_ref)
{
@@ -806,7 +806,7 @@ int col_extract_item(struct collection_item *collection,
error = col_extract_item_from_current(col,
disposition,
refprop,
- index,
+ idx,
type,
ret_ref);
if (error) {
@@ -825,7 +825,7 @@ int col_insert_item(struct collection_item *collection,
struct collection_item *item,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags)
{
int error;
@@ -873,7 +873,7 @@ int col_insert_item(struct collection_item *collection,
item,
disposition,
refprop,
- index,
+ idx,
flags);
if (error) {
@@ -894,11 +894,11 @@ static int col_insert_property_with_ref_int(struct collection_item *collection,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
int type,
- void *data,
+ const void *data,
int length,
struct collection_item **ret_ref)
{
@@ -920,7 +920,7 @@ static int col_insert_property_with_ref_int(struct collection_item *collection,
item,
disposition,
refprop,
- index,
+ idx,
flags);
if (error) {
TRACE_ERROR_NUMBER("Failed to insert item", error);
@@ -941,11 +941,11 @@ int col_insert_property_with_ref(struct collection_item *collection,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
int type,
- void *data,
+ const void *data,
int length,
struct collection_item **ret_ref)
{
@@ -963,7 +963,7 @@ int col_insert_property_with_ref(struct collection_item *collection,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
type,
@@ -1458,7 +1458,7 @@ static int col_simple_traverse_handler(struct collection_item *head,
TRACE_FLOW_STRING("col_simple_traverse_handler", "Entry.");
- if (current == NULL) current = &dummy;
+ if (current == NULL) current = &dummy_item;
error = user_item_handler(current->property,
current->property_len,
@@ -2315,7 +2315,7 @@ int col_update_property(struct collection_item *ci,
int col_modify_item(struct collection_item *item,
const char *property,
int type,
- void *data,
+ const void *data,
int length)
{
TRACE_FLOW_STRING("col_modify_item", "Entry");
@@ -2616,7 +2616,7 @@ int col_iterate_collection(struct collection_iterator *iterator,
if ((iterator->flags & COL_TRAVERSE_END) != 0) {
/* Return dummy entry to indicate the end of the collection */
TRACE_INFO_STRING("Finished level", "told to return END");
- *item = &dummy;
+ *item = &dummy_item;
break;
}
else {
@@ -2725,7 +2725,7 @@ int col_get_item_length(struct collection_item *ci)
}
/* Get data */
-const void *col_get_item_data(struct collection_item *ci)
+void *col_get_item_data(struct collection_item *ci)
{
return ci->data;
}
diff --git a/common/collection/collection.h b/common/collection/collection.h
index 8bce3c787..da785b1b0 100644
--- a/common/collection/collection.h
+++ b/common/collection/collection.h
@@ -213,7 +213,7 @@ void col_destroy_collection(struct collection_item *ci);
int col_add_str_property(struct collection_item *ci,
const char *subcollection,
const char *property,
- char *string,
+ const char *string,
int length);
/* Add a binary property to collection. */
int col_add_binary_property(struct collection_item *ci,
@@ -445,7 +445,7 @@ int col_get_item(struct collection_item *ci, /* Collection to find things
const char *col_get_item_property(struct collection_item *ci,int *property_len);
int col_get_item_type(struct collection_item *ci);
int col_get_item_length(struct collection_item *ci);
-const void *col_get_item_data(struct collection_item *ci);
+void *col_get_item_data(struct collection_item *ci);
/* If you want to modify the item that you got as a result of iterating through collection
* or by calling col_get_item(). If you want to rename item provide a new name in the property
@@ -456,7 +456,7 @@ const void *col_get_item_data(struct collection_item *ci);
int col_modify_item(struct collection_item *item,
const char *property,
int type,
- void *data,
+ const void *data,
int length);
/* Rename the item */
@@ -469,7 +469,7 @@ int col_modify_item_property(struct collection_item *item,
*/
int col_modify_str_item(struct collection_item *item,
const char *property,
- char *string,
+ const char *string,
int length);
int col_modify_binary_item(struct collection_item *item,
const char *property,
@@ -732,7 +732,7 @@ int col_insert_property_with_ref(struct collection_item *ci, /* A collect
unsigned flags, /* Flags that control naming issues */
const char *property, /* Name */
int type, /* Data type */
- void *data, /* Pointer to the data */
+ const void *data, /* Pointer to the data */
int length, /* Length of the data. For
* strings it includes the
* trailing 0
@@ -747,7 +747,7 @@ int col_insert_str_property(struct collection_item *ci, /* A collection o
int index, /* Index of the property to add */
unsigned flags, /* Flags that control naming issues */
const char *property, /* Name */
- char *string, /* String */
+ const char *string, /* String */
int length); /* Length */
int col_insert_binary_property(struct collection_item *ci, /* A collection of items */
diff --git a/common/collection/collection_cnv.c b/common/collection/collection_cnv.c
index 1a70600e9..e60935aeb 100644
--- a/common/collection/collection_cnv.c
+++ b/common/collection/collection_cnv.c
@@ -39,10 +39,10 @@ int col_insert_str_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
- char *string,
+ const char *string,
int length)
{
int error = EOK;
@@ -55,11 +55,11 @@ int col_insert_str_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_STRING,
- (void *)string,
+ (const void *)string,
length,
NULL);
@@ -72,7 +72,7 @@ int col_insert_binary_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
void *binary_data,
@@ -86,7 +86,7 @@ int col_insert_binary_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_BINARY,
@@ -104,7 +104,7 @@ int col_insert_int_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
int number)
@@ -117,7 +117,7 @@ int col_insert_int_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_INTEGER,
@@ -135,7 +135,7 @@ int col_insert_unsigned_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned number)
@@ -148,7 +148,7 @@ int col_insert_unsigned_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_UNSIGNED,
@@ -166,7 +166,7 @@ int col_insert_long_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
long number)
@@ -179,7 +179,7 @@ int col_insert_long_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_LONG,
@@ -196,7 +196,7 @@ int col_insert_ulong_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned long number)
@@ -209,7 +209,7 @@ int col_insert_ulong_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_ULONG,
@@ -226,7 +226,7 @@ int col_insert_double_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
double number)
@@ -239,7 +239,7 @@ int col_insert_double_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_DOUBLE,
@@ -256,7 +256,7 @@ int col_insert_bool_property(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned char logical)
@@ -269,7 +269,7 @@ int col_insert_bool_property(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_BOOL,
@@ -287,7 +287,7 @@ int col_insert_str_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
char *string,
@@ -304,7 +304,7 @@ int col_insert_str_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_STRING,
@@ -321,7 +321,7 @@ int col_insert_binary_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
void *binary_data,
@@ -336,7 +336,7 @@ int col_insert_binary_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_BINARY,
@@ -353,7 +353,7 @@ int col_insert_int_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
int number,
@@ -367,7 +367,7 @@ int col_insert_int_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_INTEGER,
@@ -385,7 +385,7 @@ int col_insert_unsigned_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned number,
@@ -399,7 +399,7 @@ int col_insert_unsigned_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_UNSIGNED,
@@ -416,7 +416,7 @@ int col_insert_long_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
long number,
@@ -430,7 +430,7 @@ int col_insert_long_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_LONG,
@@ -447,7 +447,7 @@ int col_insert_ulong_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned long number,
@@ -461,7 +461,7 @@ int col_insert_ulong_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_ULONG,
@@ -478,7 +478,7 @@ int col_insert_double_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
double number,
@@ -492,7 +492,7 @@ int col_insert_double_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_DOUBLE,
@@ -509,7 +509,7 @@ int col_insert_bool_property_with_ref(struct collection_item *ci,
const char *subcollection,
int disposition,
const char *refprop,
- int index,
+ int idx,
unsigned flags,
const char *property,
unsigned char logical,
@@ -523,7 +523,7 @@ int col_insert_bool_property_with_ref(struct collection_item *ci,
subcollection,
disposition,
refprop,
- index,
+ idx,
flags,
property,
COL_TYPE_BOOL,
@@ -540,7 +540,7 @@ int col_insert_bool_property_with_ref(struct collection_item *ci,
int col_add_str_property(struct collection_item *ci,
const char *subcollection,
const char *property,
- char *string,
+ const char *string,
int length)
{
int error = EOK;
@@ -1141,7 +1141,7 @@ int col_modify_item_property(struct collection_item *item,
/* Modify item data to be str */
int col_modify_str_item(struct collection_item *item,
const char *property,
- char *string,
+ const char *string,
int length)
{
int len;
@@ -1152,7 +1152,8 @@ int col_modify_str_item(struct collection_item *item,
if (length != 0) len = length;
else len = strlen(string) + 1;
- error = col_modify_item(item, property, COL_TYPE_STRING, (void *)string, len);
+ error = col_modify_item(item, property,
+ COL_TYPE_STRING, (const void *)string, len);
TRACE_FLOW_STRING("col_modify_str_item", "Exit");
return error;
diff --git a/common/collection/collection_queue.c b/common/collection/collection_queue.c
index 73e532e19..35c59bc49 100644
--- a/common/collection/collection_queue.c
+++ b/common/collection/collection_queue.c
@@ -51,7 +51,7 @@ void col_destroy_queue(struct collection_item *queue)
/* Put a string property into a queue. */
int col_enqueue_str_property(struct collection_item *queue,
const char *property,
- char *string,
+ const char *string,
int length)
{
int error = EOK;
diff --git a/common/collection/collection_queue.h b/common/collection/collection_queue.h
index 24bdd65eb..ff150ef66 100644
--- a/common/collection/collection_queue.h
+++ b/common/collection/collection_queue.h
@@ -38,7 +38,7 @@ void col_destroy_queue(struct collection_item *queue);
/* Put a string property to queue. */
int col_enqueue_str_property(struct collection_item *queue,
const char *property,
- char *string,
+ const char *string,
int length);
/* Put a binary property to queue. */
int col_enqueue_binary_property(struct collection_item *queue,
diff --git a/common/collection/collection_queue_ut.c b/common/collection/collection_queue_ut.c
index 203936abd..81fb6335a 100644
--- a/common/collection/collection_queue_ut.c
+++ b/common/collection/collection_queue_ut.c
@@ -29,7 +29,7 @@
#include "collection_tools.h"
-int queue_test()
+int queue_test(void)
{
struct collection_item *queue = NULL;
char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -89,7 +89,7 @@ int queue_test()
/* Main function of the unit test */
-int main()
+int main(int argc, char *argv[])
{
int error = EOK;
diff --git a/common/collection/collection_stack.c b/common/collection/collection_stack.c
index 9290b4e4f..674c6c16d 100644
--- a/common/collection/collection_stack.c
+++ b/common/collection/collection_stack.c
@@ -50,7 +50,7 @@ void col_destroy_stack(struct collection_item *stack)
int col_push_str_property(struct collection_item *stack,
- const char *property, char *string, int length)
+ const char *property, const char *string, int length)
{
int error = EOK;
diff --git a/common/collection/collection_stack.h b/common/collection/collection_stack.h
index ef52767f4..256094c26 100644
--- a/common/collection/collection_stack.h
+++ b/common/collection/collection_stack.h
@@ -38,7 +38,7 @@ void col_destroy_stack(struct collection_item *stack);
/* Push a string property to stack. */
int col_push_str_property(struct collection_item *stack,
const char *property,
- char *string,
+ const char *string,
int length);
/* Push a binary property to stack. */
int col_push_binary_property(struct collection_item *stack,
diff --git a/common/collection/collection_stack_ut.c b/common/collection/collection_stack_ut.c
index b3337c778..ebf62fc6b 100644
--- a/common/collection/collection_stack_ut.c
+++ b/common/collection/collection_stack_ut.c
@@ -29,7 +29,7 @@
#include "collection_tools.h"
-int stack_test()
+int stack_test(void)
{
struct collection_item *stack = NULL;
char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -96,7 +96,7 @@ int stack_test()
/* Main function of the unit test */
-int main()
+int main(int argc, char *argv[])
{
int error = EOK;
diff --git a/common/collection/collection_tools.c b/common/collection/collection_tools.c
index 88ba4f090..43466d7f5 100644
--- a/common/collection/collection_tools.c
+++ b/common/collection/collection_tools.c
@@ -263,7 +263,7 @@ int col_get_data_len(int type, int length)
}
/* Copy data escaping characters */
-static int col_copy_esc(char *dest, char *source, char esc)
+static int col_copy_esc(char *dest, const char *source, char esc)
{
int i = 0;
int j = 0;
@@ -450,14 +450,15 @@ int col_serialize(const char *property_in,
switch (type) {
case COL_TYPE_STRING:
/* Escape double quotes */
- len = col_copy_esc(&buf_data->buffer[buf_data->length], (char *)(data), '"');
+ len = col_copy_esc(&buf_data->buffer[buf_data->length],
+ (const char *)(data), '"');
break;
case COL_TYPE_BINARY:
buf_data->buffer[buf_data->length] = '\'';
for (i = 0; i < length; i++)
sprintf(&buf_data->buffer[buf_data->length + i *2] + 1,
- "%02X", (unsigned int)(((unsigned char *)(data))[i]));
+ "%02X", (unsigned int)(((const unsigned char *)(data))[i]));
len = length * 2 + 1;
buf_data->buffer[buf_data->length + len] = '\'';
len++;
@@ -465,32 +466,32 @@ int col_serialize(const char *property_in,
case COL_TYPE_INTEGER:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%d", *((int *)(data)));
+ "%d", *((const int *)(data)));
break;
case COL_TYPE_UNSIGNED:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%u", *((unsigned int *)(data)));
+ "%u", *((const unsigned int *)(data)));
break;
case COL_TYPE_LONG:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%ld", *((long *)(data)));
+ "%ld", *((const long *)(data)));
break;
case COL_TYPE_ULONG:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%lu", *((unsigned long *)(data)));
+ "%lu", *((const unsigned long *)(data)));
break;
case COL_TYPE_DOUBLE:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%.4f", *((double *)(data)));
+ "%.4f", *((const double *)(data)));
break;
case COL_TYPE_BOOL:
len = sprintf(&buf_data->buffer[buf_data->length],
- "%s", (*((unsigned char *)(data))) ? "true" : "false");
+ "%s", (*((const unsigned char *)(data))) ? "true" : "false");
break;
default:
@@ -607,7 +608,7 @@ int col_print_collection2(struct collection_item *handle)
}
/* Find and print one item using default serialization */
-int col_print_item(struct collection_item *handle, char *name)
+int col_print_item(struct collection_item *handle, const char *name)
{
struct col_serial_data buf_data;
int error = EOK;
diff --git a/common/collection/collection_tools.h b/common/collection/collection_tools.h
index 744532973..5bcf08590 100644
--- a/common/collection/collection_tools.h
+++ b/common/collection/collection_tools.h
@@ -96,7 +96,7 @@ int col_print_collection2(struct collection_item *handle);
/* Find and print one item using default serialization */
-int col_print_item(struct collection_item *handle, char *name);
+int col_print_item(struct collection_item *handle, const char *name);
/* Convert collection to list of properties */
char **col_collection_to_list(struct collection_item *handle, int *size, int *error);
diff --git a/common/collection/collection_ut.c b/common/collection/collection_ut.c
index f24d46a57..53fc4d70d 100644
--- a/common/collection/collection_ut.c
+++ b/common/collection/collection_ut.c
@@ -29,7 +29,7 @@
#include "collection_tools.h"
-int ref_collection_test()
+int ref_collection_test(void)
{
struct collection_item *peer = NULL;
struct collection_item *socket = NULL;
@@ -108,7 +108,7 @@ int ref_collection_test()
}
-int single_collection_test()
+int single_collection_test(void)
{
struct collection_item *handle = NULL;
int error = EOK;
@@ -164,7 +164,7 @@ int single_collection_test()
return error;
}
-int add_collection_test()
+int add_collection_test(void)
{
struct collection_item *peer = NULL;
struct collection_item *socket = NULL;
@@ -222,7 +222,7 @@ int add_collection_test()
return error;
}
-int mixed_collection_test()
+int mixed_collection_test(void)
{
struct collection_item *peer;
struct collection_item *socket1;
@@ -550,7 +550,7 @@ int mixed_collection_test()
}
-int iterator_test()
+int iterator_test(void)
{
struct collection_item *peer;
struct collection_item *socket1;
@@ -696,7 +696,7 @@ int iterator_test()
}
-int insert_extract_test()
+int insert_extract_test(void)
{
struct collection_item *col;
struct collection_item *col2;
@@ -874,7 +874,7 @@ int insert_extract_test()
return EOK;
}
-int delete_test()
+int delete_test(void)
{
struct collection_item *col;
@@ -910,7 +910,7 @@ int delete_test()
/* Main function of the unit test */
-int main()
+int main(int argc, char *argv[])
{
int error = 0;
diff --git a/common/dhash/dhash.h b/common/dhash/dhash.h
index 4f97f69eb..2bc5e6e39 100644
--- a/common/dhash/dhash.h
+++ b/common/dhash/dhash.h
@@ -100,7 +100,7 @@ typedef enum
typedef struct hash_key_t {
hash_key_enum type;
union {
- const char *str;
+ char *str;
unsigned long ul;
};
} hash_key_t;
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index 9b23c94cd..4f4ac2f24 100644
--- a/common/ini/ini_config.c
+++ b/common/ini/ini_config.c
@@ -1408,9 +1408,9 @@ void free_bin_config_value(char *value)
/* Arrays of stings and integers */
char **get_string_config_array(struct collection_item *item,
- char *sep, int *size, int *error)
+ const char *sep, int *size, int *error)
{
- char defsep[] = ",";
+ const char *defsep = ",";
char *copy = NULL;
char *dest = NULL;
int lensep;
diff --git a/common/ini/ini_config.h b/common/ini/ini_config.h
index 46e83d1c5..05ab27dff 100644
--- a/common/ini/ini_config.h
+++ b/common/ini/ini_config.h
@@ -216,7 +216,7 @@ void free_bin_config_value(char *);
/* Array of stings */
/* Separator sting includes up to three different separators. If NULL comma is assumed. */
/* The spaces are trimmed automatically around separators in the string. */
-char **get_string_config_array(struct collection_item *item, char *sep, int *size, int *error);
+char **get_string_config_array(struct collection_item *item, const char *sep, int *size, int *error);
/* Array of long values - separators are detected automatically. */
/* The length of the allocated array is returned in "size" */
long *get_long_config_array(struct collection_item *item, int *size, int *error);
diff --git a/common/ini/ini_config_ut.c b/common/ini/ini_config_ut.c
index 249127380..58a5d7629 100644
--- a/common/ini/ini_config_ut.c
+++ b/common/ini/ini_config_ut.c
@@ -28,7 +28,7 @@
#include "collection_tools.h"
-int basic_test()
+int basic_test(void)
{
int error;
struct collection_item *ini_config = NULL;
@@ -56,7 +56,7 @@ int basic_test()
return 0;
}
-int single_file()
+int single_file(void)
{
int error;
struct collection_item *ini_config = NULL;
@@ -118,7 +118,7 @@ int single_file()
return 0;
}
-int negative_test()
+int negative_test(void)
{
int error;
unsigned int count;
@@ -241,7 +241,7 @@ int real_test(const char *file)
return 0;
}
-int get_test()
+int get_test(void)
{
int error;
@@ -797,7 +797,7 @@ int get_test()
return EOK;
}
-int main()
+int main(int argc, char *argv[])
{
int error;