diff ui/listutil.c @ 9:2ad9a96518e3

Actually parse all elements in the list
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 12 Feb 2014 18:45:13 +0000
parents 992c0ec57660
children 58d51a91d448
line wrap: on
line diff
--- a/ui/listutil.c	Wed Feb 12 17:17:44 2014 +0000
+++ b/ui/listutil.c	Wed Feb 12 18:45:13 2014 +0000
@@ -59,7 +59,7 @@
 
     *data = (char*) malloc(*size);
 
-    if (data == NULL) {
+    if (*data == NULL) {
         printf("Malloc failed\n");
         retval = UnknownError;
         goto cleanup;
@@ -96,7 +96,7 @@
 list_status_t readAndVerifyList(const char *fileName, char **data, size_t *size)
 {
 //    int validSig = 0;
-    char ** firstChar = NULL;
+    char * signature = NULL;
 
     list_status_t retval = UnknownError;
     *data = NULL;
@@ -111,14 +111,12 @@
 
     if (!data || !*size) {
         // should not have happend if readList works as specified
-        printf ("No data or no size\n");
-        printf ("%ld\n", (long)data);
         return UnknownError;
     }
 
-    firstChar = (char**) data;
+    signature = *data;
 
-    if (**firstChar != 'S') {
+    if (*signature != 'S') {
         printf("Does not start with S\n");
         retval = InvalidFormat;
         goto cleanup;
@@ -127,6 +125,8 @@
 // TODO VERIFIY
 retval = Valid;
 
+// Maybe check if all bytes are < 127 and > 0
+
 cleanup:
     if (retval != Valid && *data) {
         free(*data);

http://wald.intevation.org/projects/trustbridge/