Fixed unused variable warnings in gcc 4.6

ranzbak [2011-11-29 18:05]
Fixed unused variable warnings in gcc 4.6

git-svn-id: https://old.setv.nl/svn/swarmtv@318 88541080-9ad6-de11-9093-5254007c1f44
Filename
trunk/swarmtv/libswarmtv/database.c
trunk/swarmtv/libswarmtv/filter.c
trunk/swarmtv/libswarmtv/logfile.c
trunk/swarmtv/libswarmtv/runloop.c
trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c
trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c
trunk/swarmtv/libswarmtv/torrentdownload.c
trunk/swarmtv/shellfront/daemonize.c
trunk/swarmtv/shellfront/dbus.c
trunk/swarmtv/shellfront/mailmsg.c
trunk/swarmtv/shellfront/runloop.c
trunk/swarmtv/shellfront/simplewizard.c
diff --git a/trunk/swarmtv/libswarmtv/database.c b/trunk/swarmtv/libswarmtv/database.c
index 006ee35..50fd55d 100644
--- a/trunk/swarmtv/libswarmtv/database.c
+++ b/trunk/swarmtv/libswarmtv/database.c
@@ -326,8 +326,10 @@ int rsstexecutequery(sqlite3 *db, const char *query, char *fmt, ...)
   double       	f=0.0;
   int          	count=0;
   int          	changes=0;
-  int           errnum=0;
-  const char   *errstring=NULL;
+#ifndef sqlite_prepare_v2
+  //int           errnum=0;
+  //const char   *errstring=NULL;
+#endif

   /*
    * fmt pointer to NULL is do not substitutes
@@ -417,12 +419,12 @@ int rsstexecutequery(sqlite3 *db, const char *query, char *fmt, ...)
         retval=ROWS_CONSTRAINT;
         break;
       default:
-        errnum = sqlite3_errcode(db);
-        errstring = sqlite3_errmsg(db);
+#ifndef sqlite_prepare_v2
+        //errnum = sqlite3_errcode(db);
+        //errstring = sqlite3_errmsg(db);
         /*
          * Workaround for older sqlite3 libraries, I hope they will upgrade soon to v2 compatible versions of sqlite
          */
-#ifndef sqlite_prepare_v2
         rsstwritelog(LOG_DEBUG, "sqlite3_step, %d %s:%d", step_rc, __FILE__, __LINE__);
         rsstwritelog(LOG_DEBUG, "in statement : \'%s\'", query);
 #else
diff --git a/trunk/swarmtv/libswarmtv/filter.c b/trunk/swarmtv/libswarmtv/filter.c
index 0ff4369..c8c4b9f 100644
--- a/trunk/swarmtv/libswarmtv/filter.c
+++ b/trunk/swarmtv/libswarmtv/filter.c
@@ -144,7 +144,7 @@ static int checkfilter(sqlite3 *db, const char *name)
 int rsstaddfilter(rsstor_handle *handle, const char *name, const char *filter, const char *doublefilter)
 {
 	int         rc=0;
-	const char *locdouble=NULL; // holds pointer to double filter or empty
+	//const char *locdouble=NULL; // holds pointer to double filter or empty
 	char        query[MAXLENGHT+1];
 	sqlite3 	 *db=NULL;

@@ -189,6 +189,7 @@ int rsstaddfilter(rsstor_handle *handle, const char *name, const char *filter, c
   rsstwritelog(LOG_NORMAL, "filter : %s", filter);
   rsstwritelog(LOG_NORMAL, "nodouble filter : %s", doublefilter);

+#if 0
   /*
    * if no 'no double' filter is provided insert an empty string
    */
@@ -197,6 +198,7 @@ int rsstaddfilter(rsstor_handle *handle, const char *name, const char *filter, c
   } else {
     locdouble = doublefilter;
   }
+#endif

   /*
    * Execute query to add filter
diff --git a/trunk/swarmtv/libswarmtv/logfile.c b/trunk/swarmtv/libswarmtv/logfile.c
index c8077a9..cb54dc1 100644
--- a/trunk/swarmtv/libswarmtv/logfile.c
+++ b/trunk/swarmtv/libswarmtv/logfile.c
@@ -133,17 +133,17 @@ int rsstinitlog(char *logpath)
 int rsstwritelog(int level, char *str,...)
 {
   char            s[30];
-  size_t          i=0;
-  struct tm       tim;
-  time_t          now=0;
+  //size_t          i=0;
+  //struct tm       tim;
+  //time_t          now=0;

   if(level > LOG_LEVEL) {
     /*
      * What time is now ?
      */
-    now = time(NULL);
-    tim = *(localtime(&now));
-    i = strftime(s,30,"%H:%M:%S",&tim);
+    //now = time(NULL);
+    //tim = *(localtime(&now));
+    //i = strftime(s,30,"%H:%M:%S",&tim);

     /*
      * Build string
diff --git a/trunk/swarmtv/libswarmtv/runloop.c b/trunk/swarmtv/libswarmtv/runloop.c
index 3116dc1..7b2d7f4 100644
--- a/trunk/swarmtv/libswarmtv/runloop.c
+++ b/trunk/swarmtv/libswarmtv/runloop.c
@@ -64,20 +64,22 @@ const char *query="select name, url, parser, metatype, id from sources";
  */
 static int parserdownload(rsstor_handle *handle, struct_download *downed, MemoryStruct *rssfile)
 {
-  int rc;
+  //int rc;

   /*
    * compare the filter string and pass the downloaded file to the correct filtering routine.
    */
   if(strcmp(downed->parser, "defaultrss") == 0) {
     //printf("Found a file for filter %s\n", filter);
-    rc = defaultrss(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);
+    //rc = defaultrss(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);
+    defaultrss(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);
     return 0;
   }

   if(strcmp(downed->parser, "twitter") == 0) {
     //printf("Found a file for filter %s\n", filter);
-    rc = twitter(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);
+    //rc = twitter(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);
+    twitter(handle, downed->name, downed->url, downed->parser, downed->metatype, rssfile);

     return 0;
   }
diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c
index c9e4a9f..631e5ce 100644
--- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c
+++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c
@@ -250,7 +250,7 @@ static int disectenclosure(xmlNode *encnode, rssparse_callback *call)
 int rssparse(rssparse_callback *call, char *url, MemoryStruct *buffer)
 {
   xmlDocPtr           doc=NULL; /* the resulting document tree */
-  xmlNode             *root_element=NULL;
+  //xmlNode             *root_element=NULL;
   xmlNode             *encnode;
   xmlXPathContextPtr  xpathCtx=NULL;
   xmlXPathObjectPtr   xpathObj=NULL;
@@ -269,7 +269,7 @@ int rssparse(rssparse_callback *call, char *url, MemoryStruct *buffer)
     rsstwritelog(LOG_ERROR, "Failed to parse RSS document: '%s' %s:%d", url, __FILE__, __LINE__);
     return -1;
   }
-  root_element = xmlDocGetRootElement(doc);
+  //root_element = xmlDocGetRootElement(doc);

   /* Create xpath evaluation context */
   xpathCtx = xmlXPathNewContext(doc);
diff --git a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c
index 45706db..7735d61 100644
--- a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c
+++ b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c
@@ -111,7 +111,7 @@ static int getxpathstring(const xmlChar * str, xmlXPathContextPtr ctxt, unsigned
 int twitparse(twitparse_callback *call, char *url, MemoryStruct *buffer)
 {
   xmlDocPtr           doc = NULL; /* the resulting document tree */
-  xmlNode             *root_element = NULL;
+  //xmlNode             *root_element = NULL;
   //xmlNode *cur_node = NULL;
   xmlXPathContextPtr  xpathCtx;
   xmlXPathObjectPtr   xpathObj;
@@ -130,7 +130,7 @@ int twitparse(twitparse_callback *call, char *url, MemoryStruct *buffer)
     fprintf(stderr, "Failed to parse document %s:%d\n", __FILE__, __LINE__);
     return -1;
   }
-  root_element = xmlDocGetRootElement(doc);
+  //root_element = xmlDocGetRootElement(doc);

   /* Create xpath evaluation context */
   xpathCtx = xmlXPathNewContext(doc);
diff --git a/trunk/swarmtv/libswarmtv/torrentdownload.c b/trunk/swarmtv/libswarmtv/torrentdownload.c
index c44642a..e916ee5 100644
--- a/trunk/swarmtv/libswarmtv/torrentdownload.c
+++ b/trunk/swarmtv/libswarmtv/torrentdownload.c
@@ -297,12 +297,12 @@ int rsstupdatelastdowned(rsstor_handle *handle, downloaded_struct *downed, FILTE
 static void rssthandlenewresults(rsstor_handle *handle, FILTER_TYPE type, downloaded_struct *downed, SIM simulate)
 {
 	int downsuccess=0;
-	char errorstr[MAXMSGLEN+1];
+	//char errorstr[MAXMSGLEN+1];

 	/*
 	 * Make sure the string is terminated
 	 */
-	errorstr[MAXMSGLEN] = '\0';
+	//errorstr[MAXMSGLEN] = '\0';

 	/*
 	 * call apply filter
@@ -849,12 +849,12 @@ int rssttestmetafiledir(rsstor_handle *handle)
 	char *torpath = NULL;
 	char *nzbpath = NULL;
 	char *fullpath = NULL;
-	sqlite3 *db=NULL;
+	//sqlite3 *db=NULL;

 	/*
 	 * Get database pointer
 	 */
-	db = handle->db;
+	//db = handle->db;

 	/*
 	 *  Get all the information into the variables
diff --git a/trunk/swarmtv/shellfront/daemonize.c b/trunk/swarmtv/shellfront/daemonize.c
index fe7ec86..52d5d85 100644
--- a/trunk/swarmtv/shellfront/daemonize.c
+++ b/trunk/swarmtv/shellfront/daemonize.c
@@ -126,13 +126,13 @@ static void rssflockfile(rsstor_handle *handle, const char *lockpath)
  */
 void rssflock(rsstor_handle *handle)
 {
-	sqlite3 *db=NULL;
+	//sqlite3 *db=NULL;
 	char    *lockpath=NULL;

 	/*
 	 * Get db pointer
 	 */
-	db = handle->db;
+	//db = handle->db;

 	/*
 	 * Get the path the lock file is in
diff --git a/trunk/swarmtv/shellfront/dbus.c b/trunk/swarmtv/shellfront/dbus.c
index 5fde518..25aba12 100644
--- a/trunk/swarmtv/shellfront/dbus.c
+++ b/trunk/swarmtv/shellfront/dbus.c
@@ -92,7 +92,7 @@ static int rssfsenddbusmsg(DBusConnection *bus, char *name, char *msg)
 /*
  * @@Debug
  */
-static int rssfcallbackstartfnct(void *data, void *calldata)
+static int rssfcallbackstartfnct(void *data, void __attribute__ ((unused)) *calldata )
 {
   rsstor_handle   *handle=NULL;
   DBusConnection  *bus=NULL;
@@ -126,7 +126,7 @@ static int rssfcallbackstartfnct(void *data, void *calldata)
 /*
  * @@Debug
  */
-static int rssfcallbackendfnct(void *data, void *calldata)
+static int rssfcallbackendfnct(void *data, void __attribute__ ((unused)) *calldata)
 {
   rsstor_handle   *handle=NULL;
   DBusConnection  *bus=NULL;
diff --git a/trunk/swarmtv/shellfront/mailmsg.c b/trunk/swarmtv/shellfront/mailmsg.c
index a7168e5..6d9f842 100644
--- a/trunk/swarmtv/shellfront/mailmsg.c
+++ b/trunk/swarmtv/shellfront/mailmsg.c
@@ -156,7 +156,7 @@ static int rsstsendmail(const char *host, const char *from, const char *to, cons
 #ifndef __MINGW32__
   smtp_session_t session;
   smtp_message_t message;
-  smtp_recipient_t recipient;
+  //smtp_recipient_t recipient;
   const smtp_status_t *status;

   /* This program sends only one message at a time.  Create an SMTP
@@ -220,7 +220,8 @@ static int rsstsendmail(const char *host, const char *from, const char *to, cons
   /*
    * Add recipient to email
    */
-  recipient = smtp_add_recipient (message, to);
+  //recipient = smtp_add_recipient (message, to);
+  smtp_add_recipient (message, to);
   //smtp_dsn_set_notify (recipient, notify);

   /*
diff --git a/trunk/swarmtv/shellfront/runloop.c b/trunk/swarmtv/shellfront/runloop.c
index 98ccd43..f3facaf 100644
--- a/trunk/swarmtv/shellfront/runloop.c
+++ b/trunk/swarmtv/shellfront/runloop.c
@@ -142,7 +142,7 @@ int rssfrunloop(rsstor_handle *handle, LOOPMODE onetime)
  */
 static gboolean rssfglibcycle(rsstor_handle *handle)
 {
-  int            rc=0;
+  //int            rc=0;
   int            onetime=0;
   GMainLoop     *loop=NULL;
   time_t         after=0;
@@ -169,7 +169,8 @@ static gboolean rssfglibcycle(rsstor_handle *handle)
   /*
    * Call the routine to do the work
    */
-  rc = runcycle(handle);
+  //rc = runcycle(handle);
+  runcycle(handle);

   /*
    * Calculate sleep time left.
diff --git a/trunk/swarmtv/shellfront/simplewizard.c b/trunk/swarmtv/shellfront/simplewizard.c
index 4c6fb3c..05483db 100644
--- a/trunk/swarmtv/shellfront/simplewizard.c
+++ b/trunk/swarmtv/shellfront/simplewizard.c
@@ -179,7 +179,7 @@ static int rssfasknumeric(int *answer, char *question)
  */
 static int rssfaskbool(int *answer, char *question, char *suggestion)
 {
-	int   rc=0;
+	//int   rc=0;
 	int   retval=0;
 	int   match=0;
 	char *ansbuf=NULL;
@@ -194,7 +194,8 @@ static int rssfaskbool(int *answer, char *question, char *suggestion)
 	/*
 	 * Get user input
 	 */
-	rc = rssfaskuser(&ansbuf, question, suggestion);
+	//rc = rssfaskuser(&ansbuf, question, suggestion);
+	rssfaskuser(&ansbuf, question, suggestion);
 	rssflowercase(ansbuf);

 	/*
@@ -538,7 +539,7 @@ static int rssfasksize(char *question, double *size)
  */
 static int rssfacceptsimple(simplefilter_struct *simple, int *answer, char *execname)
 {
-	int rc=0;
+	//int rc=0;

 	/*
 	 * Print current simple-filter
@@ -548,7 +549,8 @@ static int rssfacceptsimple(simplefilter_struct *simple, int *answer, char *exec
 	/*
 	 * Ask for conformation
 	 */
-	rc = rssfaskbool(answer, "Is this filter correct ?", "No");
+	//rc = rssfaskbool(answer, "Is this filter correct ?", "No");
+	rssfaskbool(answer, "Is this filter correct ?", "No");

 	/*
 	 * Done
@@ -569,7 +571,7 @@ static int rsstaskseasonepisode(simplefilter_struct *simple)
 	int   foundseason=0;
 	int   foundepisode=0;
 	int   loop=0;
-	int 	rc=0;
+	//int 	rc=0;

 	/*
 	 * Ask if auto season/episode should be applied
@@ -581,7 +583,8 @@ static int rsstaskseasonepisode(simplefilter_struct *simple)
 			/*
 			 * Fill season/episode automatically
 			 */
-			rc = rsstgetnewestepisode(simple, &foundseason, &foundepisode);
+			//rc = rsstgetnewestepisode(simple, &foundseason, &foundepisode);
+			rsstgetnewestepisode(simple, &foundseason, &foundepisode);
 			simple->fromseason = foundseason;
 			simple->fromepisode = foundepisode;
 			printf("found Last season %d Last episode %d\n", foundseason, foundepisode);
@@ -589,8 +592,10 @@ static int rsstaskseasonepisode(simplefilter_struct *simple)
 			/*
 			 * Ask for last season/episode numbers.
 			 */
-			rc = rssfasknumeric(&(simple->fromseason), "Enter season number: ");
-			rc = rssfasknumeric(&(simple->fromepisode), "Enter episode number: ");
+			//rc = rssfasknumeric(&(simple->fromseason), "Enter season number: ");
+			//rc = rssfasknumeric(&(simple->fromepisode), "Enter episode number: ");
+			rssfasknumeric(&(simple->fromseason), "Enter season number: ");
+			rssfasknumeric(&(simple->fromepisode), "Enter episode number: ");
 		}
 		//printf("answer: '%d' '%d' '%s'\n", loop, ansval, ansval ? "yes" : "no");
 	}