[libgda] Fix 2 compiler warnings.



commit b0ae967ed65798a2bd77b7e49c5400c9c4aa266d
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Feb 26 23:42:36 2010 +0100

    Fix 2 compiler warnings.
    
    	* libgda/gda-util.c
    	Remove the charMap() macro define because
    	it is already in keywords_hash.h. Presumably it once was not there. The
    	duplicate definition was causing a compiler warning.
    	(gda_utility_data_model_dump_data_to_xml):
    	Correct a warning due to incorrect use of const. Make a nearby cast from
    	GdaBlob* to GdaBinary* clearer/safer by using the data struct field instead.

 libgda/gda-util.c             |    6 ++----
 libgda/sqlite/keywords_hash.h |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index 1cb2cfb..1286ed9 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -41,7 +41,6 @@
 
 #include <libgda/binreloc/gda-binreloc.h>
 
-#define charMap(X) UpperToLower[(unsigned char)(X)]
 #define KEYWORDS_HASH_NO_STATIC
 #include <libgda/sqlite/keywords_hash.h>
 #include "keywords_hash.c" /* this one is dynamically generated */
@@ -405,10 +404,9 @@ gda_utility_data_model_dump_data_to_xml (GdaDataModel *model, xmlNodePtr parent,
 					}
 					else if (G_VALUE_TYPE (value) == GDA_TYPE_BLOB) {
 						/* force reading the whole blob */
-						GdaBlob *blob;
-						blob = gda_value_get_blob (value);
+						const GdaBlob *blob = gda_value_get_blob (value);
 						if (blob) {
-							GdaBinary *bin = (GdaBinary*) blob;
+							const GdaBinary *bin = &(blob->data);
 							if (blob->op && 
 							    (bin->binary_length != gda_blob_op_get_length (blob->op)))
 								gda_blob_op_read_all (blob->op, blob);
diff --git a/libgda/sqlite/keywords_hash.h b/libgda/sqlite/keywords_hash.h
index 1d0e5e2..dbf4ca7 100644
--- a/libgda/sqlite/keywords_hash.h
+++ b/libgda/sqlite/keywords_hash.h
@@ -30,7 +30,7 @@ const unsigned char UpperToLower[] = {
     234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
     252,253,254,255
 };
-#define charMap(X) UpperToLower[(unsigned char)X]
+#define charMap(X) UpperToLower[(unsigned char)(X)]
 #ifndef KEYWORDS_HASH_NO_STATIC
 static
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]