[gnome-pilot-conduits] Fix various warnings, so that we can compile with -Wall and -Werror. email/email_conduit.c: add mis



commit 17435bb62cc2d350a46c2b314ccfd4359bf44f66
Author: Matt Davey <mcdavey mrao cam ac uk>
Date:   Tue Oct 12 23:13:14 2010 +0100

    Fix various warnings, so that we can compile with -Wall and -Werror.
    	email/email_conduit.c: add missing declaration of parsedate, plus
    		signedness warnings.
    	expense/expense_conduit.c: mainly signedness warnings and unused variables
    	memo_file/memo_file_conduit.c: ditto
    	time/time-conduit.c: ditto
    
    Mainly signedness warnings.

 email/email_conduit.c         |   32 +++++++++++++++++---------------
 expense/expense_conduit.c     |   11 ++++++-----
 memo_file/memo_file_conduit.c |    9 +++++----
 time/time-conduit.c           |    3 ---
 4 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/email/email_conduit.c b/email/email_conduit.c
index 661ad77..2e8b7b5 100644
--- a/email/email_conduit.c
+++ b/email/email_conduit.c
@@ -47,6 +47,7 @@ void conduit_destroy_gpilot_conduit( GnomePilotConduit *c );
 static gboolean save_config (GKeyFile    *kfile, const gchar *conf);
 static GKeyFile* get_kfile (const gchar *conf);
 static void migrate_conf (const gchar *old, const gchar *new);
+extern time_t parsedate(char *p);
 
 
 static void 
@@ -182,7 +183,7 @@ destroy_configuration(ConduitCfg **c)
 	*c = NULL;
 }
 
-void markline( char *msg ) 
+void markline( unsigned char *msg ) 
 {
     while( (*msg) != '\n' && (*msg) != 0 ) {
         msg++; 
@@ -271,9 +272,9 @@ static gint match_mail(gconstpointer a, gconstpointer b)
 
 static gboolean
 write_message_to_pilot (GnomePilotConduit *c, GnomePilotDBInfo *dbi, 
-			int dbHandle, char *buffer, int msg_num)
+			int dbHandle, unsigned char *buffer, int msg_num)
 {
-    char *msg;
+    unsigned char *msg;
     int h;
     struct Mail t;
     int len;
@@ -299,7 +300,7 @@ write_message_to_pilot (GnomePilotConduit *c, GnomePilotDBInfo *dbi,
     t.priority = 0;
     t.addressing = 0;
 
-    msg = (char *)buffer;
+    msg = buffer;
     h = 1;
     
     while ( h == 1 ) {
@@ -313,9 +314,9 @@ write_message_to_pilot (GnomePilotConduit *c, GnomePilotDBInfo *dbi,
 	    h = 0;
 	    header( &t, 0 );
 	} else {
-	    header( &t, msg );
+	    header( &t, (char *) msg );
 	}
-	msg += strlen(msg)+1;
+	msg += strlen((char *)msg)+1;
     }
     
     if ( (*msg) == 0 ) {
@@ -328,7 +329,7 @@ write_message_to_pilot (GnomePilotConduit *c, GnomePilotDBInfo *dbi,
 	return FALSE;
     }
     
-    t.body = strdup( msg );
+    t.body = strdup( (char *) msg );
     
     len = pack_Mail( &t, buffer, 0xffff );
 
@@ -442,7 +443,9 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
     for ( i = 0; ; i++ ) {
         struct Mail t;
         int attr;
+#ifndef PILOT_LINK_0_12
         int size=0;
+#endif
         recordid_t recID;
         int length;
         FILE * sendf;
@@ -566,7 +569,10 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
     if ( strcmp( GET_CONFIG(c)->receiveAction, "copy" ) == 0 ||
          strcmp( GET_CONFIG(c)->receiveAction, "mirror" ) == 0 ) {
     	for ( i = 0; ; i++ ) {
-	    int attr, length, size;
+	    int attr, length;
+#ifndef PILOT_LINK_0_12
+	    int size;
+#endif
 	    recordid_t recID;
 	    MailDBRecord *record;
 
@@ -693,9 +699,9 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
 
 	if (f) {
 #ifdef PILOT_LINK_0_12
-	    if (fgets (pi_buf->data, pi_buf->allocated - 1, f) != NULL) {
-		while (!feof (f) && strncmp (pi_buf->data, "From ", 5)) {
-		    if (fgets (pi_buf->data, pi_buf->allocated - 1, f) == NULL)
+	    if (fgets ((char *) pi_buf->data, pi_buf->allocated - 1, f) != NULL) {
+		while (!feof (f) && strncmp ((char *)pi_buf->data, "From ", 5)) {
+		    if (fgets ((char *)pi_buf->data, pi_buf->allocated - 1, f) == NULL)
 			break;
 		}
 	    }
@@ -792,8 +798,6 @@ static GtkWidget
 {
     GtkWidget *vbox, *table;
     GtkWidget *label, *widget;
-    GtkWidget *menu, *menuItem;
-    GtkWidget *box, *button;
 
     vbox = gtk_vbox_new(FALSE, EC_PAD);
 
@@ -866,7 +870,6 @@ static void
 setOptionsCfg(GtkWidget *cfg, ConduitCfg *c)
 {
     GtkWidget *send_action, *from_address, *sendmail, *receive_action, *mbox_file;
-    GtkWidget *menuItem;
     guint id;
 
     /* fetch all the controls from the cfg window */
@@ -898,7 +901,6 @@ static void
 readOptionsCfg(GtkWidget *cfg, ConduitCfg *c)
 {
     GtkWidget *send_action, *from_address, *sendmail, *receive_action, *mbox_file;
-    GtkWidget *menu, *menuItem;
     gchar *str;
     gint id;
     struct stat mboxStat;
diff --git a/expense/expense_conduit.c b/expense/expense_conduit.c
index aded2a5..e7fb972 100644
--- a/expense/expense_conduit.c
+++ b/expense/expense_conduit.c
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <ctype.h>
 #include <utime.h>
 #include <unistd.h>
 #include <pwd.h>
@@ -628,7 +629,7 @@ static void
 readOptionsCfg(GtkWidget *pilotcfg, ConduitCfg *state)
 {
 	GtkWidget *ExpenseDir, *DirMode, *FileMode;
-        GtkWidget *option_menu, *menu, *menu_item;
+        GtkWidget *combo_box;
         
 	ExpenseDir = g_object_get_data(G_OBJECT(pilotcfg), "ExpenseDir");
 	DirMode = g_object_get_data(G_OBJECT(pilotcfg), "DirMode");
@@ -638,13 +639,13 @@ readOptionsCfg(GtkWidget *pilotcfg, ConduitCfg *state)
         state->dirMode = strtol(gtk_entry_get_text(GTK_ENTRY(DirMode)), NULL, 0);
         state->fileMode = strtol(gtk_entry_get_text(GTK_ENTRY(FileMode)), NULL, 0);
 
-        option_menu = g_object_get_data(G_OBJECT(pilotcfg), "DateFormat");
+        combo_box = g_object_get_data(G_OBJECT(pilotcfg), "DateFormat");
         state->dateFormat = g_strdup(date_options[
-                gtk_combo_box_get_active(GTK_COMBO_BOX(option_menu))].format);
+                gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box))].format);
 
-        option_menu = g_object_get_data(G_OBJECT(pilotcfg), "OutputFormat");
+        combo_box = g_object_get_data(G_OBJECT(pilotcfg), "OutputFormat");
         state->outputFormat = writeout_options[
-            gtk_combo_box_get_active(GTK_COMBO_BOX(option_menu))].format;
+            gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box))].format;
         
 }
 
diff --git a/memo_file/memo_file_conduit.c b/memo_file/memo_file_conduit.c
index f45c8bd..62304c6 100644
--- a/memo_file/memo_file_conduit.c
+++ b/memo_file/memo_file_conduit.c
@@ -76,7 +76,8 @@ load_configuration (GnomePilotConduit *conduit, ConduitCfg **c,guint32 pilotId)
 	GKeyFile *kfile;
 	GError *error = NULL;
 
-	char *buf, *key;
+	char *buf;
+
 	g_return_if_fail (c!=NULL);
 	
  	kfile = get_kfile("memo_file-conduit");
@@ -703,7 +704,7 @@ load_record (GnomePilotConduitStandardAbs *abs, MemoLocalRecord *local)
 	fseek (rec, 0L, SEEK_END);
 	local->length = ftell (rec)+1;
 	rewind (rec);
-	local->record = (unsigned char*)g_malloc (local->length);
+	local->record = (char *)g_malloc (local->length);
 	fread (local->record, local->length-1, 1, rec);
 	local->record[local->length-1]='\0';
 	fclose (rec);
@@ -1048,7 +1049,7 @@ store_remote (GnomePilotConduitStandardAbs *abs,
 			local->record = NULL;
 			local->length = 0;
 		} else {
-			local->record = (unsigned char*)g_malloc (local->length);
+			local->record = (char*)g_malloc (local->length);
 			memcpy (local->record, remote->record, local->length);
 		}
 	}
@@ -1167,7 +1168,7 @@ compare (GnomePilotConduitStandardAbs *abs,
 	g_return_val_if_fail (local!=NULL,-1);
 	g_return_val_if_fail (remote!=NULL,-1);
 	if (local->record==NULL || remote->record == NULL) return -1;
-	return strncmp (local->record, remote->record, local->length);
+	return strncmp (local->record, (char *)remote->record, local->length);
 }
 
 static gint
diff --git a/time/time-conduit.c b/time/time-conduit.c
index a4e6599..d5579dd 100644
--- a/time/time-conduit.c
+++ b/time/time-conduit.c
@@ -98,9 +98,6 @@ static GtkWidget
 *createCfgWindow(GnomePilotConduit* conduit, ConduitCfg *cfg)
 {
 	GtkWidget *vbox;
-	GtkWidget *option;
-	GtkMenu *menu;
-	GtkWidget *m1, *m2;
 	GtkWidget *label;
 
 	vbox = gtk_vbox_new (FALSE, TC_PAD);	



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