changeset 963:9549fea94794 trunk

[svn] Warning fixes from SuSe.
author chainsaw
date Tue, 17 Apr 2007 14:45:19 -0700
parents 9f0ac3bb82f4
children 368f8ee0a95f
files ChangeLog src/alarm/alarm.c src/amidi-plug/backend-alsa/b-alsa.c src/amidi-plug/i_configure-alsa.c src/cdaudio/cddb.c src/esd/audio.c src/modplug/archive/arch_bz2.cxx src/modplug/archive/arch_gzip.cxx src/modplug/archive/arch_rar.cxx src/modplug/archive/arch_zip.cxx src/modplug/sndfile.cxx src/paranormal/plugin.c src/paranormal/presets.c src/wma/libffwma/mem.c src/xspf/urlencode.c
diffstat 15 files changed, 134 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 16 01:35:24 2007 -0700
+++ b/ChangeLog	Tue Apr 17 14:45:19 2007 -0700
@@ -1,3 +1,14 @@
+2007-04-16 08:35:24 +0000  Giacomo Lozito <james@develia.org>
+  revision [2064]
+  - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
+  trunk/src/statusicon/si.c           |   14 +++-
+  trunk/src/statusicon/si_audacious.h |    1 
+  trunk/src/statusicon/si_cfg.h       |    3 -
+  trunk/src/statusicon/si_common.h    |    2 
+  trunk/src/statusicon/si_ui.c        |  104 +++++++++++++++++++++++++++---------
+  5 files changed, 92 insertions(+), 32 deletions(-)
+
+
 2007-04-15 19:23:05 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [2062]
   - merge some local changes which makes curl threading more reliable.
--- a/src/alarm/alarm.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/alarm/alarm.c	Tue Apr 17 14:45:19 2007 -0700
@@ -849,7 +849,10 @@
      if(cmd_on == TRUE)
      {
        DEBUG("Executing %s, cmd_on is true\n", cmdstr);
-       system(cmdstr);
+       if(system(cmdstr) == -1)
+       {
+        DEBUG("Executing %s failed\n",cmdstr);
+       }
      }
 
      DEBUG("strcmp playlist, playlist is [%s]\n", playlist);
--- a/src/amidi-plug/backend-alsa/b-alsa.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/amidi-plug/backend-alsa/b-alsa.c	Tue Apr 17 14:45:19 2007 -0700
@@ -795,8 +795,7 @@
     gchar buffer[100];
     while ( !feof( fp ) )
     {
-      fgets( buffer , 100 , fp );
-      if (( strlen( buffer ) > 11 ) && ( !strncasecmp( buffer , "addresses: " , 11 ) ))
+      if (fgets( buffer , 100 , fp ) && ( strlen( buffer ) > 11 ) && ( !strncasecmp( buffer , "addresses: " , 11 ) ))
       {
         /* change spaces between ports (65:0 65:1 65:2 ...)
            into commas (65:0,65:1,65:2,...) */
--- a/src/amidi-plug/i_configure-alsa.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/amidi-plug/i_configure-alsa.c	Tue Apr 17 14:45:19 2007 -0700
@@ -480,7 +480,8 @@
     gchar buffer[100];
     while ( !feof( fp ) )
     {
-      fgets( buffer , 100 , fp );
+      if(!fgets( buffer , 100 , fp ))
+        break;
       if (( strlen( buffer ) > 11 ) && ( !strncasecmp( buffer , "addresses: " , 11 ) ))
       {
         /* change spaces between ports (65:0 65:1 65:2 ...)
--- a/src/cdaudio/cddb.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/cdaudio/cddb.c	Tue Apr 17 14:45:19 2007 -0700
@@ -184,6 +184,7 @@
     gchar buffer[256];
     gchar **response;
     gint i;
+    gint ret;
 
     if ((sock = cddb_http_open_connection(server, 80)) == 0)
         return FALSE;
@@ -203,7 +204,14 @@
 	cddb_log(getstr);
 
     g_free(offsets);
-    write(sock, getstr, strlen(getstr));
+    ret = write(sock, getstr, strlen(getstr));
+
+    if(ret != strlen(getstr)){
+        g_free(getstr);
+        http_close_connection(sock);
+        return FALSE;
+    }
+
     g_free(getstr);
 
     if (http_read_first_line(sock, buffer, 256) < 0) {
@@ -258,7 +266,7 @@
 static gint
 cddb_check_protocol_level(const gchar * server)
 {
-    gint level = 0, sock, n;
+    gint level = 0, sock, n, ret;
     gchar *str, buffer[256];
 
     if ((sock = cddb_http_open_connection(server, 80)) == 0)
@@ -269,7 +277,14 @@
         ("GET /~cddb/cddb.cgi?cmd=stat%s&proto=1 HTTP/1.0\r\n\r\n",
          cddb_generate_hello_string());
 
-    write(sock, str, strlen(str));
+    ret = write(sock, str, strlen(str));
+    if(ret != strlen(str)){
+        g_free(str);
+        http_close_connection(sock);
+        return 0;
+    }
+
+
     g_free(str);
 
     if ((n = http_read_first_line(sock, buffer, 256)) < 0 ||
@@ -308,6 +323,7 @@
     gchar *realstr, *temp;
     gint len, command;
     gint num, oldnum;
+    gint ret;
 
     if ((sock = cddb_http_open_connection(server, 80)) == 0)
         return FALSE;
@@ -322,7 +338,13 @@
          cddb_generate_hello_string(), cdda_cfg.cddb_protocol_level);
 	cddb_log(readstr);
 
-    write(sock, readstr, strlen(readstr));
+    ret = write(sock, readstr, strlen(readstr));
+    if(ret != strlen(readstr)){
+        g_free(readstr);
+        http_close_connection(sock);
+        return FALSE;
+    }
+
     g_free(readstr);
 
     if (http_read_first_line(sock, buffer, 256) < 0) {
@@ -443,6 +465,7 @@
     gchar buffer[256];
     gchar **message;
     GList *list = NULL;
+    gint ret;
 
     if ((sock = cddb_http_open_connection(server, 80)) == 0)
         return NULL;
@@ -455,7 +478,12 @@
          cddb_generate_hello_string(), protocol_level);
 	cddb_log(getstr);
 
-    write(sock, getstr, strlen(getstr));
+    ret = write(sock, getstr, strlen(getstr));
+    if(ret != strlen(getstr)){
+        g_free(getstr);
+        http_close_connection(sock);
+        return NULL;
+    }
     g_free(getstr);
 
     if (http_read_first_line(sock, buffer, 256) < 0) {
--- a/src/esd/audio.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/esd/audio.c	Tue Apr 17 14:45:19 2007 -0700
@@ -25,6 +25,7 @@
 #include <esd.h>
 
 #include <unistd.h>
+#include <audacious/util.h>
 
 #include "esdout.h"
 
--- a/src/modplug/archive/arch_bz2.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/archive/arch_bz2.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -40,7 +40,11 @@
 		return;
 	}
 	
-	fscanf(f, "%u", &mSize); // this is the size.
+	if(fscanf(f, "%u", &mSize) != 1); // this is the size.
+	{
+		mSize = 0;
+		return;
+	}
 	
 	pclose(f);
 	
@@ -52,7 +56,7 @@
 	}
 	
 	lCommand = "bzcat \'" + aFileName + '\'';  //decompress to stdout
-	popen(lCommand.c_str(), "r");
+	f = popen(lCommand.c_str(), "r");
 
 	if (f <= 0)
 	{
@@ -60,7 +64,11 @@
 		return;
 	}
 
-	fread((char *)mMap, sizeof(char), mSize, f);
+	if(fread((char *)mMap, sizeof(char), mSize, f) != mSize)
+	{
+		mSize = 0;
+		return;
+	}
 
 	pclose(f);
 }
--- a/src/modplug/archive/arch_gzip.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/archive/arch_gzip.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -37,9 +37,22 @@
 	}
 	
 	char line[81];
-	fgets(line, 80, f);   // ignore a line.
-	fscanf(f, "%u", &mSize); // ignore first number.
-	fscanf(f, "%u", &mSize); // keep second number.
+	if(!fgets(line, 80, f)){   // ignore a line.
+		mSize = 0;
+		pclose(f);
+		return;
+	}
+	if(fscanf(f, "%u", &mSize) != 1){  // ignore first number.
+		mSize = 0;
+		pclose(f);
+		return;
+	}
+
+	if (fscanf(f, "%u", &mSize) != 1){; // keep second number.
+		mSize = 0;
+		pclose(f);
+		return;
+	}
 	
 	pclose(f);
 	
@@ -59,7 +72,8 @@
 		return;
 	}
 
-	fread((char *)mMap, sizeof(char), mSize, f);
+	if(fread((char *)mMap, sizeof(char), mSize, f) != mSize)
+		mSize = 0;
 
 	pclose(f);
 	
@@ -93,11 +107,26 @@
 	}
 	
 	char line[300];
-	fgets(line, 80, f);   // ignore a line.
-	fscanf(f, "%i", &num); // ignore first number
-	fscanf(f, "%i", &num); // ignore second number
-	fscanf(f, "%f%%", &fnum); // ignore ratio
-	fgets(line, 300, f);   // read in correct line safely.
+	if(!fgets(line, 80, f)){   // ignore a line.
+		pclose(f);
+		return false;
+	}	
+	if(fscanf(f, "%i", &num) != 1){ // ignore first number
+		pclose(f);
+		return false;
+	}
+	if(fscanf(f, "%i", &num) != 1){ // ignore second number
+		pclose(f);
+		return false;
+	}
+	if(fscanf(f, "%f%%", &fnum) != 1){ // ignore ratio
+		pclose(f);
+		return false;
+	}
+	if(!fgets(line, 300, f)){   // read in correct line safely.
+		pclose(f);
+		return false;
+	}
 	if (strlen(line) > 1)
 		line[strlen(line)-1] = 0;
 	lName = line;
--- a/src/modplug/archive/arch_rar.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/archive/arch_rar.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -45,7 +45,13 @@
 
 	int num = 7;
 	while (num--) // ignore 7 lines.
-		fgets(lBuffer, 90, f);
+	{
+		if(!fgets(lBuffer, 90, f))
+		{
+			mSize = 0;
+			return;
+		}
+        }
 	
 	bool eof = false;
 	while(!eof)
@@ -112,7 +118,8 @@
 		return;
 	}
 
-	fread((char *)mMap, sizeof(char), mSize, f);
+	if(fread((char *)mMap, sizeof(char), mSize, f) != mSize)
+		mSize = 0;
 	
 	pclose(f);
 }
@@ -145,7 +152,15 @@
 
 	int num = 7;
 	while (num--)
-		fgets(lBuffer, 90, f); //ignore a line.
+	{
+		
+		if(!fgets(lBuffer, 90, f)) //ignore a line.
+		{
+			pclose(f);
+			return false;
+		}
+
+	}
 
 	bool eof = false;
 	while(!eof)
--- a/src/modplug/archive/arch_zip.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/archive/arch_zip.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -81,7 +81,8 @@
 		return;
 	}
 
-	fread((char *)mMap, sizeof(char), mSize, f);
+	if(fread((char *)mMap, sizeof(char), mSize, f) != mSize)
+		mSize = 0;
 	
 	pclose(f);
 	
--- a/src/modplug/sndfile.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/sndfile.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -1176,7 +1176,8 @@
 			short int *pSample = (short int *)pIns->pSample;
 			for (UINT j=0; j<len; j+=2)
 			{
-			        *pSample++ = bswapLE16(*pSample);
+			        *pSample = bswapLE16(*pSample);
+				++pSample;
 			}
 		}
 		break;
@@ -1367,7 +1368,8 @@
 			WORD *pSampleW = (WORD *)pIns->pSample;
 			for (UINT j=0; j<len; j+=2)   // swaparoni!
 			{
-			        *pSampleW++ = bswapLE16(*pSampleW);
+			        *pSampleW = bswapLE16(*pSampleW);
+				++pSampleW;
 			}
 		}
 		break;
--- a/src/paranormal/plugin.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/paranormal/plugin.c	Tue Apr 17 14:45:19 2007 -0700
@@ -21,6 +21,7 @@
 
 #include <gtk/gtk.h>
 #include <audacious/plugin.h>
+#include <audacious/util.h>
 #include <SDL/SDL.h>
 #include <SDL/SDL_thread.h>
 
--- a/src/paranormal/presets.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/paranormal/presets.c	Tue Apr 17 14:45:19 2007 -0700
@@ -23,7 +23,7 @@
 parse_actuator (xmlNodePtr cur, struct pn_actuator *a)
 {
   int i;
-  xmlChar *content;
+  char *content;
   struct pn_actuator *child;
 
   for (cur = cur->xmlChildrenNode; cur; cur = cur->next)
@@ -40,7 +40,7 @@
       if (a->options && a->options[i].desc)
 	{
 	  /* it is an option, so let's set it! */
-	  content = xmlNodeGetContent (cur);
+	  content = (char*)xmlNodeGetContent (cur);
 
 	  /* FIXME: warning? */
 	  if (! content)
@@ -114,11 +114,11 @@
 	    }
 
 	  /* gotta free content */
-	  xmlFree (content);
+	  xmlFree ((xmlChar*)content);
 	}
       /* See if we have a child actuator */
       else if (a->desc->flags & ACTUATOR_FLAG_CONTAINER
-	       && (child = create_actuator (cur->name)))
+	       && (child = create_actuator ((char*)cur->name)))
 	{
 	  container_add_actuator (a, child);
 	  parse_actuator (cur, child);
@@ -157,7 +157,7 @@
 
       /* if (...) { ... } else if (is_documentation [see top of file]) ... else */
       {
-	a = create_actuator (cur->name);
+	a = create_actuator ((char*)cur->name);
 
 	/* FIXME: warn? */
 	if (! a)
--- a/src/wma/libffwma/mem.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/wma/libffwma/mem.c	Tue Apr 17 14:45:19 2007 -0700
@@ -46,7 +46,8 @@
     void *ptr;
 
 #ifdef __GLIBC__
-    posix_memalign(&ptr, 16, size);
+    if(posix_memalign(&ptr, 16, size))
+        return NULL;
 #else
     ptr = malloc(size);
 #endif
--- a/src/xspf/urlencode.c	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/xspf/urlencode.c	Tue Apr 17 14:45:19 2007 -0700
@@ -143,7 +143,7 @@
       else
 	*p2++ = *p1++;
     }
-  g_return_if_fail (p2 - newstr == newlen);
+  g_return_val_if_fail (p2 - newstr == newlen, NULL);
   *p2 = '\0';
 
   return newstr;