--- albumart.c	2012-02-10 18:37:22.000000000 -0500
+++ albumart.c	2012-04-10 11:54:08.000000000 -0400
@@ -26,4 +26,5 @@
 #include <setjmp.h>
 #include <errno.h>
+#include <limits.h>
 
 #include <jpeglib.h>
@@ -157,5 +158,5 @@
 }
 
-char *
+static char *
 check_embedded_art(const char *path, const char *image_data, int image_size)
 {
@@ -218,5 +219,5 @@
 	else if( width > 0 && height > 0 )
 	{
-		size_t nwritten;
+		int nwritten;
 		if( art_cache_exists(path, &art_path) )
 			goto end_art;
--- image_utils.c	2011-08-22 14:24:18.000000000 -0400
+++ image_utils.c	2012-04-11 11:50:16.000000000 -0400
@@ -173,5 +173,5 @@
 }
 
-void
+static void
 jpeg_memory_src(j_decompress_ptr cinfo, const unsigned char * buffer, size_t bufsize)
 {
@@ -192,5 +192,5 @@
 }
 
-jmp_buf setjmp_buffer;
+static jmp_buf setjmp_buffer;
 /* Don't exit on error like libjpeg likes to do */
 static void
@@ -209,5 +209,5 @@
 }
 
-pix
+static pix
 get_pix(image_s *pimage, int32_t x, int32_t y)
 {
@@ -223,5 +223,5 @@
 }
 
-void
+static void
 put_pix_alpha_replace(image_s *pimage, int32_t x, int32_t y, pix col)
 {
@@ -399,5 +399,5 @@
 }
 
-image_s *
+static image_s *
 image_new(int32_t width, int32_t height)
 {
@@ -423,6 +423,15 @@
 image_new_from_jpeg(const char * path, int is_file, const char * buf, int size, int scale, int rotate)
 {
-	image_s *vimage;
-	FILE  *file = NULL;
+	struct {
+		/*
+		 * Using the struct to prevent pointers cached in
+		 * in registers and being clobbered by longjmp().
+		 * http://lists.apple.com/archives/xcode-users/2003/Dec/msg00050.html
+		 */
+		image_s *vimage;
+		FILE  *file;
+	} s = { NULL, NULL };
+#define vimage	s.vimage
+#define file	s.file
 	struct jpeg_decompress_struct cinfo;
 	unsigned char *line[16], *ptr;
@@ -562,7 +571,9 @@
 
 	return vimage;
+#undef vimage
+#undef file
 }
 
-void
+static void
 image_upsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
 {
@@ -627,5 +638,5 @@
 }
 
-void
+static void
 image_downsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
 {
--- log.c	2011-06-20 22:08:21.000000000 -0400
+++ log.c	2012-01-09 17:57:41.000000000 -0500
@@ -71,5 +71,5 @@
 			rhs++;
 			p = strchr(rhs, ',');
-			n = p ? p - rhs : strlen(rhs);
+			n = p ? (size_t)(p - rhs) : strlen(rhs);
 			for (level=0; level_name[level]; level++) {
 				if (!(strncasecmp(level_name[level], rhs, n)))
@@ -84,5 +84,5 @@
 				if (*lhs==',') lhs++;
 				p = strpbrk(lhs, ",=");
-				n = p ? p - lhs : strlen(lhs);
+				n = p ? (size_t)(p - lhs) : strlen(lhs);
 				for (facility=0; facility_name[facility]; facility++) {
 					if (!(strncasecmp(facility_name[facility], lhs, n)))
--- metadata.c	2011-08-22 14:24:19.000000000 -0400
+++ metadata.c	2012-01-09 18:00:06.000000000 -0500
@@ -21,5 +21,5 @@
 #include <stdlib.h>
 #include <sys/stat.h>
-
+#include <libgen.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -95,5 +95,5 @@
 #define MPEG_TS_PACKET_LENGTH 188
 #define MPEG_TS_PACKET_LENGTH_DLNA 192 /* prepends 4 bytes to TS packet */
-int
+static int
 dlna_timestamp_is_present(const char * filename, int * raw_packet_size)
 {
@@ -188,5 +188,5 @@
 }
 
-void
+static void
 parse_nfo(const char * path, metadata_t * m)
 {
@@ -239,5 +239,5 @@
 }
 
-void
+static void
 free_metadata(metadata_t * m, uint32_t flags)
 {
@@ -507,5 +507,6 @@
 	struct jpeg_error_mgr jerr;
 	FILE *infile;
-	int width=0, height=0, thumb=0;
+	int width = 0, height = 0;
+	volatile int thumb = 0;
 	char make[32], model[64] = {'\0'};
 	char b[1024];
@@ -648,5 +649,6 @@
 {
 	struct stat file;
-	int ret, i;
+	int ret;
+	unsigned i;
 	struct tm *modtime;
 	AVFormatContext *ctx = NULL;
--- minissdp.h	2011-07-22 19:03:38.000000000 -0400
+++ minissdp.h	2012-01-09 18:03:04.000000000 -0500
@@ -32,7 +32,5 @@
 /*#include "minidlnatypes.h"*/
 
-int
-OpenAndConfSSDPReceiveSocket();
-/* OpenAndConfSSDPReceiveSocket(int n_lan_addr, struct lan_addr_s * lan_addr);*/
+int OpenAndConfSSDPReceiveSocket(void);
 
 /*int
--- scanner.h	2010-11-11 18:48:13.000000000 -0500
+++ scanner.h	2012-01-09 18:04:19.000000000 -0500
@@ -82,5 +82,5 @@
 
 void
-start_scanner();
+start_scanner(void);
 
 #endif
--- minissdp.c	2011-08-24 21:27:56.000000000 -0400
+++ minissdp.c	2012-01-09 18:15:43.000000000 -0500
@@ -289,5 +289,6 @@
 {
 	struct sockaddr_in sockname;
-	int l, n, dup, i=0;
+	int n, dup, i = 0;
+	size_t l;
 	char bufr[512];
 
@@ -352,5 +353,5 @@
 }
 
-void
+static void
 ParseUPnPClient(char *location)
 {
--- minixml.c	2008-10-23 13:30:45.000000000 -0400
+++ minixml.c	2012-01-09 18:17:20.000000000 -0500
@@ -36,5 +36,6 @@
  * return 0 (false) in case of success and -1 (true) if the end
  * of the xmlbuffer is reached. */
-int parseatt(struct xmlparser * p)
+static int
+parseatt(struct xmlparser * p)
 {
 	const char * attname;
@@ -107,5 +108,6 @@
 /* parseelt parse the xml stream and
  * call the callback functions when needed... */
-void parseelt(struct xmlparser * p)
+static void
+parseelt(struct xmlparser * p)
 {
 	int i;
--- options.c	2011-08-24 21:27:56.000000000 -0400
+++ options.c	2012-01-09 18:18:31.000000000 -0500
@@ -74,5 +74,5 @@
 	char *t;
 	int linenum = 0;
-	int i;
+	unsigned i;
 	enum upnpconfigoptions id;
 
--- playlist.c	2011-08-04 20:31:20.000000000 -0400
+++ playlist.c	2012-01-09 18:20:32.000000000 -0500
@@ -35,4 +35,5 @@
 #include "sql.h"
 #include "log.h"
+#include "playlist.h"
 
 int
--- scanner.c	2011-08-24 20:37:10.000000000 -0400
+++ scanner.c	2012-04-11 11:11:02.000000000 -0400
@@ -24,4 +24,5 @@
 #include <libgen.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -73,5 +74,5 @@
 }
 
-int
+static int
 insert_container(const char * item, const char * rootParent, const char * refID, const char *class,
                  const char *artist, const char *genre, const char *album_art, sqlite3_int64 *objectID, sqlite3_int64 *parentID)
@@ -166,5 +167,6 @@
 		{
 			insert_container(date_taken, IMAGE_DATE_ID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID);
-			sprintf(last_date.parentID, IMAGE_DATE_ID"$%"PRIX64, parentID);
+			sprintf(last_date.parentID, IMAGE_DATE_ID"$%"PRIX64,
+			    (int64_t)parentID);
 			last_date.objectID = objectID;
 			strcpy(last_date.name, date_taken);
@@ -189,5 +191,6 @@
 		{
 			insert_container(camera, IMAGE_CAMERA_ID, NULL, "storageFolder", NULL, NULL, NULL, &objectID, &parentID);
-			sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%"PRIX64, parentID);
+			sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%"PRIX64,
+			    (int64_t)parentID);
 			strncpy(last_cam.name, camera, 255);
 			last_camdate.name[0] = '\0';
@@ -201,5 +204,6 @@
 		{
 			insert_container(date_taken, last_cam.parentID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID);
-			sprintf(last_camdate.parentID, "%s$%"PRIX64, last_cam.parentID, parentID);
+			sprintf(last_camdate.parentID, "%s$%"PRIX64, last_cam.parentID,
+			    (int64_t)parentID);
 			last_camdate.objectID = objectID;
 			strcpy(last_camdate.name, date_taken);
@@ -224,5 +228,5 @@
 	else if( strstr(class, "audioItem") )
 	{
-		snprintf(sql, sizeof(sql), "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %lld", detailID);
+		snprintf(sql, sizeof(sql), "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %jd", (intmax_t)detailID);
 		ret = sql_get_table(db, sql, &result, &row, &cols);
 		if( ret != SQLITE_OK )
@@ -270,10 +274,12 @@
 			{
 				insert_container(artist, MUSIC_ARTIST_ID, NULL, "person.musicArtist", NULL, genre, NULL, &objectID, &parentID);
-				sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%"PRIX64, parentID);
+				sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%"PRIX64,
+				    (int64_t)parentID);
 				strcpy(last_artist.name, artist);
 				last_artistAlbum.name[0] = '\0';
 				/* Add this file to the "- All Albums -" container as well */
 				insert_container(_("- All Albums -"), last_artist.parentID, NULL, "album", artist, genre, NULL, &objectID, &parentID);
-				sprintf(last_artistAlbumAll.parentID, "%s$%"PRIX64, last_artist.parentID, parentID);
+				sprintf(last_artistAlbumAll.parentID, "%s$%"PRIX64, last_artist.parentID,
+				    (int64_t)parentID);
 				last_artistAlbumAll.objectID = objectID;
 			}
@@ -291,5 +297,6 @@
 				insert_container(album?album:_("Unknown Album"), last_artist.parentID, album?last_album.parentID:NULL,
 				                 "album.musicAlbum", artist, genre, album_art, &objectID, &parentID);
-				sprintf(last_artistAlbum.parentID, "%s$%"PRIX64, last_artist.parentID, parentID);
+				sprintf(last_artistAlbum.parentID, "%s$%"PRIX64, last_artist.parentID,
+				    (int64_t)parentID);
 				last_artistAlbum.objectID = objectID;
 				strcpy(last_artistAlbum.name, album?album:_("Unknown Album"));
@@ -312,10 +319,12 @@
 			{
 				insert_container(genre, MUSIC_GENRE_ID, NULL, "genre.musicGenre", NULL, NULL, NULL, &objectID, &parentID);
-				sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%"PRIX64, parentID);
+				sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%"PRIX64,
+				    (int64_t)parentID);
 				strcpy(last_genre.name, genre);
 				last_genreArtist.name[0] = '\0';
 				/* Add this file to the "- All Artists -" container as well */
 				insert_container(_("- All Artists -"), last_genre.parentID, NULL, "person", NULL, genre, NULL, &objectID, &parentID);
-				sprintf(last_genreArtistAll.parentID, "%s$%"PRIX64, last_genre.parentID, parentID);
+				sprintf(last_genreArtistAll.parentID, "%s$%"PRIX64, last_genre.parentID,
+				    (int64_t)parentID);
 				last_genreArtistAll.objectID = objectID;
 			}
@@ -332,5 +341,6 @@
 				insert_container(artist?artist:_("Unknown Artist"), last_genre.parentID, artist?last_artist.parentID:NULL,
 				                 "person.musicArtist", NULL, genre, NULL, &objectID, &parentID);
-				sprintf(last_genreArtist.parentID, "%s$%"PRIX64, last_genre.parentID, parentID);
+				sprintf(last_genreArtist.parentID, "%s$%"PRIX64, last_genre.parentID,
+				    (int64_t)parentID);
 				last_genreArtist.objectID = objectID;
 				strcpy(last_genreArtist.name, artist?artist:_("Unknown Artist"));
@@ -656,5 +666,5 @@
 }
 
-int
+static int
 filter_audio(const struct dirent *d)
 {
@@ -670,5 +680,5 @@
 }
 
-int
+static int
 filter_video(const struct dirent *d)
 {
@@ -682,5 +692,5 @@
 }
 
-int
+static int
 filter_images(const struct dirent *d)
 {
@@ -694,5 +704,5 @@
 }
 
-int
+static int
 filter_media(const struct dirent *d)
 {
@@ -710,5 +720,5 @@
 }
 
-void
+static void
 ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
 {
--- upnpdescgen.c	2011-05-02 19:50:52.000000000 -0400
+++ upnpdescgen.c	2012-01-09 18:30:11.000000000 -0500
@@ -327,12 +327,12 @@
 	{"SinkProtocolInfo", 1<<7, 0, 0, 48}, /* required */
 	{"CurrentConnectionIDs", 1<<7, 0, 0, 46}, /* required */
-	{"A_ARG_TYPE_ConnectionStatus", 0, 0, 27}, /* required */
-	{"A_ARG_TYPE_ConnectionManager", 0, 0}, /* required */
-	{"A_ARG_TYPE_Direction", 0, 0, 33}, /* required */
-	{"A_ARG_TYPE_ProtocolInfo", 0, 0}, /* required */
-	{"A_ARG_TYPE_ConnectionID", 4, 0}, /* required */
-	{"A_ARG_TYPE_AVTransportID", 4, 0}, /* required */
-	{"A_ARG_TYPE_RcsID", 4, 0}, /* required */
-	{0, 0}
+	{"A_ARG_TYPE_ConnectionStatus", 0, 0, 27, 0}, /* required */
+	{"A_ARG_TYPE_ConnectionManager", 0, 0, 0, 0}, /* required */
+	{"A_ARG_TYPE_Direction", 0, 0, 33, 0}, /* required */
+	{"A_ARG_TYPE_ProtocolInfo", 0, 0, 0, 0}, /* required */
+	{"A_ARG_TYPE_ConnectionID", 4, 0, 0, 0}, /* required */
+	{"A_ARG_TYPE_AVTransportID", 4, 0, 0, 0}, /* required */
+	{"A_ARG_TYPE_RcsID", 4, 0, 0, 0}, /* required */
+	{NULL, 0, 0, 0, 0}
 };
 
@@ -340,5 +340,5 @@
 {
 	{"SearchCaps", 2, 10},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
@@ -346,5 +346,5 @@
 {
 	{"SortCaps", 2, 11},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
@@ -352,5 +352,5 @@
 {
 	{"Id", 2, 12},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
@@ -367,5 +367,5 @@
 	{"TotalMatches", 2, 8},
 	{"UpdateID", 2, 9},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
@@ -382,5 +382,5 @@
 	{"TotalMatches", 2, 8},
 	{"UpdateID", 2, 9},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
@@ -409,14 +409,14 @@
 {
 	{"TransferIDs", 1<<7, 0, 0, 48}, /* 0 */
-	{"A_ARG_TYPE_ObjectID", 0, 0},
-	{"A_ARG_TYPE_Result", 0, 0},
-	{"A_ARG_TYPE_SearchCriteria", 0, 0},
-	{"A_ARG_TYPE_BrowseFlag", 0, 0, 36},
+	{"A_ARG_TYPE_ObjectID", 0, 0, 0, 0},
+	{"A_ARG_TYPE_Result", 0, 0, 0, 0},
+	{"A_ARG_TYPE_SearchCriteria", 0, 0, 0, 0},
+	{"A_ARG_TYPE_BrowseFlag", 0, 0, 36, 0},
 	/* Allowed Values : BrowseMetadata / BrowseDirectChildren */
-	{"A_ARG_TYPE_Filter", 0, 0}, /* 5 */
-	{"A_ARG_TYPE_SortCriteria", 0, 0},
-	{"A_ARG_TYPE_Index", 3, 0},
-	{"A_ARG_TYPE_Count", 3, 0},
-	{"A_ARG_TYPE_UpdateID", 3, 0},
+	{"A_ARG_TYPE_Filter", 0, 0, 0, 0}, /* 5 */
+	{"A_ARG_TYPE_SortCriteria", 0, 0, 0, 0},
+	{"A_ARG_TYPE_Index", 3, 0, 0, 0},
+	{"A_ARG_TYPE_Count", 3, 0, 0, 0},
+	{"A_ARG_TYPE_UpdateID", 3, 0, 0, 0},
 	//JM{"A_ARG_TYPE_TransferID", 3, 0}, /* 10 */
 	//JM{"A_ARG_TYPE_TransferStatus", 0, 0, 39},
@@ -426,9 +426,9 @@
 	//JM{"A_ARG_TYPE_TagValueList", 0, 0},
 	//JM{"A_ARG_TYPE_URI", 5, 0}, /* 15 */
-	{"SearchCapabilities", 0, 0},
-	{"SortCapabilities", 0, 0},
+	{"SearchCapabilities", 0, 0, 0, 0},
+	{"SortCapabilities", 0, 0, 0, 0},
 	{"SystemUpdateID", 3|0x80, 0, 0, 255},
-	//{"ContainerUpdateIDs", 0, 0},
-	{0, 0}
+	//{"ContainerUpdateIDs", 0, 0, 0, 0},
+	{NULL, 0, 0, 0, 0}
 };
 
@@ -466,13 +466,12 @@
 static const struct stateVar X_MS_MediaReceiverRegistrarVars[] =
 {
-	{"A_ARG_TYPE_DeviceID", 0, 0},
-	{"A_ARG_TYPE_RegistrationReqMsg", 7, 0},
-	{"A_ARG_TYPE_RegistrationRespMsg", 7, 0},
-	{"A_ARG_TYPE_Result", 6, 0},
-	{"AuthorizationDeniedUpdateID", 3, 0},
-	{"AuthorizationGrantedUpdateID", 3, 0},
-	{"ValidationRevokedUpdateID", 3, 0},
-	{"ValidationSucceededUpdateID", 3, 0},
-	{0, 0}
+	{"A_ARG_TYPE_DeviceID", 0, 0, 0, 0},
+	{"A_ARG_TYPE_RegistrationReqMsg", 7, 0, 0, 0},
+	{"A_ARG_TYPE_RegistrationRespMsg", 7, 0, 0, 0},
+	{"A_ARG_TYPE_Result", 6, 0, 0, 0},
+	{"AuthorizationDeniedUpdateID", 3, 0, 0, 0},
+	{"AuthorizationGrantedUpdateID", 3, 0, 0, 0},
+	{"ValidationRevokedUpdateID", 3, 0, 0, 0},
+	{"ValidationSucceededUpdateID", 3, 0, 0, 0},
+	{NULL, 0, 0, 0, 0}
 };
--- upnphttp.c	2011-08-18 14:34:59.000000000 -0400
+++ upnphttp.c	2012-01-09 18:32:37.000000000 -0500
@@ -1138,5 +1149,5 @@
 }
 
-int
+static int
 send_data(struct upnphttp * h, char * header, size_t size, int flags)
 {
@@ -1710,5 +1743,5 @@
 	                char mime[32];
 	                char dlna[96];
-	              } last_file = { 0, 0 };
+	              } last_file = { 0, 0, { '\0' }, { '\0' }, { '\0' } };
 #if USE_FORK
 	pid_t newpid = 0;
--- upnpsoap.c	2011-08-18 19:24:17.000000000 -0400
+++ upnpsoap.c	2012-01-09 18:38:42.000000000 -0500
@@ -488,5 +488,5 @@
 }
 
-char *
+static char *
 parse_sort_criteria(char * sortCriteria, int * error)
 {
--- utils.h	2011-05-13 18:10:15.000000000 -0400
+++ utils.h	2012-01-09 19:00:08.000000000 -0500
@@ -26,5 +26,9 @@
 
 int
-strcatf(struct string_s *str, char *fmt, ...);
+strcatf(struct string_s *str, const char *fmt, ...)
+#ifdef __GNUC__
+	__attribute__((format(printf, 2, 3)))
+#endif
+;
 
 int
--- utils.c	2011-07-18 14:13:25.000000000 -0400
+++ utils.c	2012-01-09 18:57:14.000000000 -0500
@@ -20,5 +20,5 @@
 #include <string.h>
 #include <stdlib.h>
-#include <linux/limits.h>
+#include <limits.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -31,6 +31,7 @@
 #include "upnpglobalvars.h"
 #include "log.h"
+#include "utils.h"
 
-inline int
+int
 strcatf(struct string_s *str, const char *fmt, ...)
 {
@@ -282,5 +283,5 @@
 {
 	unsigned int hash = 5381;
-	unsigned int i = 0;
+	int i = 0;
 
 	for(i = 0; i < len; str++, i++)
--- uuid.c	2010-11-11 18:48:13.000000000 -0500
+++ uuid.c	2012-01-09 19:43:31.000000000 -0500
@@ -38,4 +39,5 @@
 #include "getifaddr.h"
 #include "log.h"
+#include "uuid.h"
 
 #define ETH_ALEN 6
@@ -108,3 +88,3 @@
 
-void
+static void
 init_clockseq(void)
@@ -118,5 +98,5 @@
 }
 
-int
+static int
 generate_uuid(unsigned char uuid_out[16])
 {
--- tagutils/tagutils.c	2010-11-11 18:48:14.000000000 -0500
+++ tagutils/tagutils.c	2012-01-09 19:08:06.000000000 -0500
@@ -97,5 +98,5 @@
 };
 
-#define WINAMP_GENRE_UNKNOWN ((sizeof(winamp_genre) / sizeof(winamp_genre[0])) - 1)
+#define WINAMP_GENRE_UNKNOWN ((int)(sizeof(winamp_genre) / sizeof(winamp_genre[0])) - 1)
 
 
@@ -133,5 +134,5 @@
 	{ "wav", _get_wavtags, _get_wavfileinfo                                  },
 	{ "pcm", 0,            _get_pcmfileinfo                                  },
-	{ NULL,  0 }
+	{ NULL, NULL, 0 }
 };
 
--- tagutils/tagutils-mp3.c	2010-11-11 18:48:14.000000000 -0500
+++ tagutils/tagutils-mp3.c	2012-01-09 19:14:45.000000000 -0500
@@ -405,5 +406,5 @@
 	unsigned char frame_buffer[2900];
 	unsigned char header[4];
-	int index = 0;
+	unsigned int index = 0;
 	int found = 0;
 	off_t pos;
@@ -549,9 +550,9 @@
 	struct mp3_frameinfo fi;
 	unsigned int size = 0;
-	unsigned int n_read;
+	size_t n_read;
 	off_t fp_size = 0;
 	off_t file_size;
 	unsigned char buffer[1024];
-	int index;
+	unsigned int index;
 
 	int xing_flags;
@@ -618,5 +619,5 @@
 	{
 		fseek(infile, fp_size, SEEK_SET);
-		if((n_read = fread(buffer, 1, sizeof(buffer), infile)) < 4)   // at least mp3 frame header size (i.e. 4 bytes)
+		if((n_read = fread(buffer, 1, sizeof(buffer), infile)) < 50)
 		{
 			fclose(infile);
--- tagutils/tagutils-aac.c	2010-11-11 18:48:14.000000000 -0500
+++ tagutils/tagutils-aac.c	2012-01-09 19:20:35.000000000 -0500
@@ -82,5 +82,5 @@
 	unsigned int atom_length;
 
-	long current_offset = 0;
+	unsigned int current_offset = 0;
 	int current_size;
 	char current_atom[4];
@@ -120,5 +120,6 @@
 			memset(current_data, 0x00, len);
 
-			if(fread(current_data, 1, current_size - 8, fin) != current_size - 8)
+			if ((int)fread(current_data, 1, current_size - 8, fin)
+			    != current_size - 8)
 				break;
 
@@ -244,5 +245,5 @@
 }
 
-int
+static int
 _aac_check_extended_descriptor(FILE *infile)
 {
--- tagutils/tagutils-flc.c	2011-05-02 19:50:52.000000000 -0400
+++ tagutils/tagutils-flc.c	2012-01-09 19:22:35.000000000 -0500
@@ -27,5 +27,5 @@
 	FLAC__StreamMetadata *block;
 	unsigned int sec, ms;
-	int i;
+	unsigned int i;
 	int err = 0;
 
--- tagutils/tagutils-asf.c	2011-05-16 20:25:03.000000000 -0400
+++ tagutils/tagutils-asf.c	2012-01-09 19:28:32.000000000 -0500
@@ -24,5 +24,5 @@
 _asf_read_file_properties(FILE *fp, asf_file_properties_t *p, __u32 size)
 {
-	int len;
+	unsigned int len;
 
 	len = sizeof(*p) - offsetof(asf_file_properties_t, FileID);
@@ -64,8 +64,8 @@
 
 static int
-_asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size)
+_asf_read_audio_stream(FILE *fp, struct song_metadata *psong, __u32 size)
 {
 	asf_audio_stream_t s;
-	int len;
+	unsigned int len;
 
 	len = sizeof(s) - sizeof(s.Hdr);
@@ -91,5 +91,5 @@
 	asf_media_stream_t s;
 	avi_audio_format_t wfx;
-	int len;
+	unsigned int len;
 
 	len = sizeof(s) - sizeof(s.Hdr);
@@ -122,5 +122,5 @@
 {
 	asf_stream_object_t s;
-	int len;
+	unsigned int len;
 
 	len = sizeof(s) - sizeof(asf_object_t);
@@ -146,6 +146,6 @@
 _asf_read_extended_stream_object(FILE *fp, struct song_metadata *psong, __u32 size)
 {
-	int i, len;
-	long off;
+	unsigned int i, len;
+	size_t off;
 	asf_object_t tmp;
 	asf_extended_stream_object_t xs;
@@ -202,5 +202,5 @@
 {
 	off_t pos;
-	long off;
+	size_t off;
 	asf_header_extension_t ext;
 	asf_object_t tmp;
@@ -234,5 +234,5 @@
 
 static int
-_asf_load_string(FILE *fp, int type, int size, char *buf, int len)
+_asf_load_string(FILE *fp, int type, unsigned short size, char *buf, int len)
 {
 	unsigned char data[2048];
@@ -303,5 +303,5 @@
 _asf_load_picture(FILE *fp, int size, void *bm, int *bm_size)
 {
-	int i;
+	unsigned int i;
 	char buf[256];
 #if 0
--- tagutils/tagutils.h	2011-05-16 20:25:03.000000000 -0400
+++ tagutils/tagutils.h	2012-01-09 19:31:58.000000000 -0500
@@ -44,5 +44,5 @@
 
 struct song_metadata {
-	int file_size;
+	off_t file_size;
 	char *dirpath;
 	char *path;
--- tagutils/tagutils-wav.c	2012-01-17 17:49:02.000000000 -0500
+++ tagutils/tagutils-wav.c	2012-04-10 12:01:10.000000000 -0400
@@ -34,5 +34,4 @@
 {
 	int fd;
-	uint32_t len;
 	unsigned char hdr[12];
 	unsigned char fmt[16];
@@ -58,6 +57,5 @@
 	}
 
-	len = 12;
-	if(!(len = read(fd, hdr, len)) || (len != 12))
+	if (read(fd, hdr, sizeof hdr) != sizeof hdr)
 	{
 		DPRINTF(E_WARN, L_SCANNER, "Could not read wav header from %s\n", filename);
@@ -82,6 +80,5 @@
 	while(current_offset < psong->file_size)
 	{
-		len = 8;
-		if(!(len = read(fd, hdr, len)) || (len != 8))
+		if (read(fd, hdr, 8) != 8)
 		{
 			close(fd);
@@ -101,16 +98,8 @@
 		//        block_len);
 
-		if(block_len < 0)
-		{
-			close(fd);
-			DPRINTF(E_WARN, L_SCANNER, "Bad block len: %s\n", filename);
-			return -1;
-		}
-
 		if(strncmp((char*)&hdr, "fmt ", 4) == 0)
 		{
 			//DEBUG DPRINTF(E_DEBUG,L_SCANNER,"Found 'fmt ' header\n");
-			len = 16;
-			if(!read(fd, fmt, len) || (len != 16))
+			if (read(fd, fmt, 16) != 16)
 			{
 				close(fd);
@@ -144,12 +133,17 @@
 			int taglen;
 			char **m;
+			ssize_t len;
 
 			len = GET_WAV_INT32(hdr + 4);
-			if(len > 65536)
+			if(len <=0 || len > 65536)
 				goto next_block;
 
 			tags = malloc(len+1);
-			if(!tags)
+			if(!tags) {
+				DPRINTF(E_WARN, L_SCANNER,
+				    "Failed to malloc %ld bytes",
+				    (long)len);
 				goto next_block;
+			}
 
 			if(read(fd, tags, len) < len ||
--- upnpevents.c	2012-02-13 17:48:56.000000000 -0500
+++ upnpevents.c	2012-04-11 11:31:14.000000000 -0400
@@ -257,5 +257,5 @@
 upnp_event_notify_connect(struct upnp_event_notify * obj)
 {
-	int i;
+	unsigned int i;
 	const char * p;
 	unsigned short port;
