[gthumb] Bug 581081 - Fix compilation warnings



commit 1420191515177a681326c4524b20375c96e14aa4
Author: Marc Pavot <marc pavot gmail com>
Date:   Sat May 2 08:27:11 2009 -0400

    Bug 581081 - Fix compilation warnings
    
    Added -Wall and friends to the Makefiles.
---
 AUTHORS                        |    1 +
 libgthumb/Makefile.am          |    7 ++++++-
 libgthumb/gth-exiv2-utils.cpp  |    6 +-----
 libgthumb/image-viewer-image.c |    4 ++--
 src/Makefile.am                |    5 +++++
 src/catalog-web-exporter.c     |    2 +-
 src/dlg-file-utils.c           |    2 +-
 src/dlg-photo-importer.c       |    2 +-
 src/dlg-scripts.c              |    2 +-
 9 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 010f1e5..c5e168d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,3 +24,4 @@ Contributors:
   David Turner <cillian64 googlemail com>
   Dor Fire <dorfire gmail com>
   Gabriel Falcão <gabriel nacaolivre org>
+  Marc Pavot <marc pavot gmail com>
diff --git a/libgthumb/Makefile.am b/libgthumb/Makefile.am
index 1c74989..fef1100 100644
--- a/libgthumb/Makefile.am
+++ b/libgthumb/Makefile.am
@@ -7,6 +7,10 @@ else
 DISABLE_DEPRECATED =
 endif
 
+WARNINGS = -Wall -Wimplicit -Wunused-label \
+	   -Wpointer-arith -Wcast-align -Wtype-limits \
+	   -Wclobbered -Wempty-body -Wignored-qualifiers
+
 gladedir = $(datadir)/gthumb/glade
 
 INCLUDES =							\
@@ -16,7 +20,8 @@ INCLUDES =							\
 	$(LIBOPENRAW_CFLAGS)                                    \
 	$(EXIV2_CFLAGS)						\
 	$(GSTREAMER_CFLAGS)					\
-	$(DISABLE_DEPRECATED)
+	$(DISABLE_DEPRECATED)					\
+	$(WARNINGS)
 
 libgthumbdir = $(libdir)
 libgthumb_LTLIBRARIES = libgthumb.la
diff --git a/libgthumb/gth-exiv2-utils.cpp b/libgthumb/gth-exiv2-utils.cpp
index ec2b32b..46e7d4b 100644
--- a/libgthumb/gth-exiv2-utils.cpp
+++ b/libgthumb/gth-exiv2-utils.cpp
@@ -402,11 +402,10 @@ read_exiv2_file (const char *uri, GList *metadata)
 		if (!exifData.empty()) {
 
 			//add exif-metadata to glist
-			GthMetadata *new_entry;
 			Exiv2::ExifData::const_iterator end = exifData.end();
 			for (Exiv2::ExifData::const_iterator md = exifData.begin(); md != end; ++md) {
 				//determine metadata category
-				int pos;
+				int pos = 0;
 				GthMetadataCategory cat = tag_category_exiv2 (*md, pos);
 				
 				//fill entry
@@ -437,7 +436,6 @@ read_exiv2_file (const char *uri, GList *metadata)
 		if (!iptcData.empty()) {
 
 			//add iptc-metadata to glist
-			GthMetadata *new_entry;
 			Exiv2::IptcData::iterator end = iptcData.end();
 			for (Exiv2::IptcData::iterator md = iptcData.begin(); md != end; ++md) {
 
@@ -465,7 +463,6 @@ read_exiv2_file (const char *uri, GList *metadata)
 		if (!xmpData.empty()) {
 
 			//add xmp-metadata to glist
-			GthMetadata *new_entry;
 			Exiv2::XmpData::iterator end = xmpData.end();
 			for (Exiv2::XmpData::iterator md = xmpData.begin(); md != end; ++md) {
 
@@ -518,7 +515,6 @@ read_exiv2_sidecar (const char *uri, GList *metadata)
 		if (!xmpData.empty()) {
 
 			//add xmp-metadata to glist
-			GthMetadata *new_entry;
 			Exiv2::XmpData::iterator end = xmpData.end();
 			for (Exiv2::XmpData::iterator md = xmpData.begin(); md != end; ++md) {
 
diff --git a/libgthumb/image-viewer-image.c b/libgthumb/image-viewer-image.c
index c552dc4..b785251 100644
--- a/libgthumb/image-viewer-image.c
+++ b/libgthumb/image-viewer-image.c
@@ -669,7 +669,7 @@ image_viewer_image_set_fit_mode (ImageViewerImage *image,
 {
 	ImageViewerImagePrivate *priv = IMAGE_VIEWER_IMAGE_GET_PRIVATE (image);
 	GtkWidget               *widget = GTK_WIDGET (priv->viewer);
-	gdouble                  x_level, y_level, new_level;
+	gdouble                  x_level, y_level, new_level = 1.0;
 	gint                     gdk_width, gdk_height;
 	gint                     img_width, img_height;
 	gint                     border;
@@ -1073,7 +1073,7 @@ image_viewer_image_paint (ImageViewerImage *image,
 		cairo_surface_t *checker;
 		int              check_size;
 		GthCheckType     check_type;
-		double           color1, color2;
+		double           color1 = 0, color2 = 0;
 
 		switch (transp_type) {
 		case GTH_TRANSP_TYPE_NONE:
diff --git a/src/Makefile.am b/src/Makefile.am
index 247766e..c90ca62 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,6 +9,10 @@ else
 DISABLE_DEPRECATED =
 endif
 
+WARNINGS = -Wall -Wimplicit -Wunused-label \
+	   -Wpointer-arith -Wcast-align -Wtype-limits \
+	   -Wclobbered -Wempty-body -Wignored-qualifiers
+
 INCLUDES =					\
 	-I$(top_srcdir)/libgthumb		\
 	-I../libgthumb				\
@@ -17,6 +21,7 @@ INCLUDES =					\
 	$(GPHOTO_CFLAGS)			\
 	$(IGE_MAC_INTEGRATION_CFLAGS)		\
 	$(GTKUNIQUE_CFLAGS)			\
+	$(WARNINGS)       			\
 	-DGTHUMB_PREFIX=\"$(prefix)\"		\
 	-DGTHUMB_SYSCONFDIR=\"$(sysconfdir)\"	\
 	-DGTHUMB_DATADIR=\"$(datadir)\"		\
diff --git a/src/catalog-web-exporter.c b/src/catalog-web-exporter.c
index bd2a3f5..2a5393b 100644
--- a/src/catalog-web-exporter.c
+++ b/src/catalog-web-exporter.c
@@ -1492,7 +1492,7 @@ gth_parsed_doc_print (GList               *document,
 	for (scan = document; scan; scan = scan->next) {
 		GthTag     *tag = scan->data;
 		ImageData  *idata;
-		GFile      *file;
+		GFile      *file = NULL;
 		GFile      *dir;
 		char       *line = NULL;
 		char       *image_src = NULL;
diff --git a/src/dlg-file-utils.c b/src/dlg-file-utils.c
index e1401c0..5267358 100644
--- a/src/dlg-file-utils.c
+++ b/src/dlg-file-utils.c
@@ -977,7 +977,7 @@ dlg_file_rename_series (GthWindow *window,
 	GList          *o_scan, *n_scan;
 	GList          *error_list = NULL;
 	int             overwrite_result = OVERWRITE_RESULT_UNSPECIFIED;
-	gboolean        file_exists, show_ow_all_none, result;
+	gboolean        file_exists, show_ow_all_none, result = 0;
 	gboolean        error = FALSE;
 	GList          *files_deleted = NULL;
 	GList          *files_created = NULL;
diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
index 66f6e3e..ff40fb9 100644
--- a/src/dlg-photo-importer.c
+++ b/src/dlg-photo-importer.c
@@ -1269,7 +1269,7 @@ save_image (DialogData *data,
 	char         *camera_folder;
 	const char   *camera_filename;
 	char         *local_path;
-	char         *file_uri;
+	char         *file_uri = NULL;
 	char	     *unescaped_local_folder;
 	time_t        exif_date;
 	GthSubFolder  subfolder_value;
diff --git a/src/dlg-scripts.c b/src/dlg-scripts.c
index 021dfb5..31afe14 100644
--- a/src/dlg-scripts.c
+++ b/src/dlg-scripts.c
@@ -527,6 +527,7 @@ exec_shell_script (GtkWindow  *window,
 	else {
 		full_name = g_strconcat (_("Script Progress"), " - ", name, NULL);
 		gtk_window_set_title (GTK_WINDOW (data->dialog), full_name);
+                g_free (full_name);
 	}
 
 	data->cancel = FALSE;
@@ -705,7 +706,6 @@ exec_shell_script (GtkWindow  *window,
 	g_hash_table_destroy (date_prompts);
 	g_object_unref (data->gui);
 	g_free (data);
-	g_free (full_name);
 }
 
 



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