summaryrefslogtreecommitdiff
path: root/common/ini
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-04-06 15:31:41 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-04-06 15:59:21 -0400
commit2f2e7ac94c86ced957a0232e368985ba8c8f59e7 (patch)
treecbdad3ea5876678669c0f472c4f06b2a95326e7d /common/ini
parent29f9384e70029ebe72ad6199eb8f04c0c92a8981 (diff)
downloadsssd-2f2e7ac94c86ced957a0232e368985ba8c8f59e7.tar.gz
sssd-2f2e7ac94c86ced957a0232e368985ba8c8f59e7.tar.bz2
sssd-2f2e7ac94c86ced957a0232e368985ba8c8f59e7.zip
Clean up a lot of warnings in Collection and INI parser
Diffstat (limited to 'common/ini')
-rw-r--r--common/ini/ini_config.c15
-rw-r--r--common/ini/ini_config.h2
-rw-r--r--common/ini/ini_config_ut.c14
3 files changed, 13 insertions, 18 deletions
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index cf70c9c8..fafc565d 100644
--- a/common/ini/ini_config.c
+++ b/common/ini/ini_config.c
@@ -20,7 +20,7 @@
along with INI Library. If not, see <http://www.gnu.org/licenses/>.
*/
-
+#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -94,6 +94,8 @@ inline const char *parsing_error_str(int parsing_error)
#endif
+int read_line(FILE *file,char **key,char **value, int *length, int *ext_error);
+
/* Add to collection or update - CONSIDER moving to the collection.c */
static int add_or_update(struct collection_item *current_section,
char *key,
@@ -137,7 +139,6 @@ static int ini_to_collection(const char *filename,
char *value = NULL;
struct collection_item *current_section = (struct collection_item *)(NULL);
int length;
- int type;
int ext_err = -1;
struct parse_error pe;
int line = 0;
@@ -349,7 +350,6 @@ int config_for_app(const char *application,
struct collection_item *error_list_specific = (struct collection_item *)(NULL);
struct collection_item **pass_common = (struct collection_item **)(NULL);
struct collection_item **pass_specific = (struct collection_item **)(NULL);
- struct collection_item *error_file_set = (struct collection_item *)(NULL);
int created = 0;
TRACE_FLOW_STRING("config_to_collection", "Entry");
@@ -480,7 +480,7 @@ int config_for_app(const char *application,
}
/* Reads a line from the file */
-int read_line(FILE *file,char **key,void **value, int *length, int *ext_error)
+int read_line(FILE *file,char **key,char **value, int *length, int *ext_error)
{
char *res = NULL;
@@ -488,7 +488,6 @@ int read_line(FILE *file,char **key,void **value, int *length, int *ext_error)
int len = 0;
char *buffer = NULL;
int i = 0;
- int status = RET_INVALID;
char *eq = NULL;
TRACE_FLOW_STRING("read_line","Entry");
@@ -639,9 +638,8 @@ void print_file_parsing_errors(FILE *file,
struct collection_iterator *iterator;
int error;
struct collection_item *item = (struct collection_item *)(NULL);
- struct collection_header *header;
struct parse_error *pe;
- int count;
+ unsigned int count;
TRACE_FLOW_STRING("print_file_parsing_errors", "Entry");
@@ -796,7 +794,7 @@ int get_config_item(const char *section,
return EINVAL;
}
- *item == (struct collection_item *)(NULL);
+ *item = (struct collection_item *)(NULL);
if(section == NULL) to_find = default_section;
else to_find = (char *)section;
@@ -1097,7 +1095,6 @@ char **get_string_config_array(struct collection_item *item, char *sep, int *siz
char defsep[] = ",";
char *copy = NULL;
char *dest = NULL;
- int total = 0;
int lensep;
char *buff;
int count = 0;
diff --git a/common/ini/ini_config.h b/common/ini/ini_config.h
index 8bf7373b..21b912b9 100644
--- a/common/ini/ini_config.h
+++ b/common/ini/ini_config.h
@@ -105,7 +105,7 @@ void print_config_parsing_errors(FILE *file, /* File t
int get_config_item(const char *section, /* Section. If NULL assumed default */
const char *name, /* Name of the property to look up */
struct collection_item *ini_config, /* Collection to search */
- struct collection_item **item); /* Item returned. Will be NULL is not found. /
+ struct collection_item **item); /* Item returned. Will be NULL is not found. */
/* Convertion functions for the configuration item.
* Sets error to EINVAL if the item is bad.
diff --git a/common/ini/ini_config_ut.c b/common/ini/ini_config_ut.c
index 2bb5517d..642f268b 100644
--- a/common/ini/ini_config_ut.c
+++ b/common/ini/ini_config_ut.c
@@ -19,6 +19,7 @@
along with INI Library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#define TRACE_HOME
@@ -84,9 +85,8 @@ int single_file()
int negative_test()
{
int error;
- int count;
+ unsigned int count;
struct collection_item *ini_config = (struct collection_item *)(NULL);
- struct collection_item *error_set = (struct collection_item *)(NULL);
/* App name is null - expect failure */
error = config_for_app(NULL, NULL, NULL, NULL,INI_STOP_ON_NONE,NULL);
@@ -209,9 +209,7 @@ int get_test()
int error;
struct collection_item *ini_config = (struct collection_item *)(NULL);
struct collection_item *error_set = (struct collection_item *)(NULL);
- struct collection_iterator *iterator = (struct collection_iterator *)(NULL);
struct collection_item *item = (struct collection_item *)(NULL);
- int type;
int number;
long number_long;
double number_double;
@@ -449,7 +447,7 @@ int get_test()
return -1;
}
- printf("Expected 3 got %d\n", number_long);
+ printf("Expected 3 got %ld\n", number_long);
printf("Convert item to unsigned.\n");
@@ -489,7 +487,7 @@ int get_test()
return -1;
}
- printf("Expected 3 got %d\n", number_ulong);
+ printf("Expected 3 got %lu\n", number_ulong);
printf("Convert item to double.\n");
@@ -509,7 +507,7 @@ int get_test()
return -1;
}
- printf("Expected 3 got %d\n", number_double);
+ printf("Expected 3 got %e\n", number_double);
printf("Convert item to bool.\n");
@@ -675,7 +673,7 @@ int get_test()
}
/* Can be used with this cycle */
- for(i=0;i<size;i++) printf("%d\n",*(array + i));
+ for(i=0;i<size;i++) printf("%ld\n",*(array + i));
free_long_config_array(array);