diff --git albumart.c albumart.c
index 54899c6..6cc6192 100644
--- albumart.c
+++ albumart.c
@@ -156,7 +156,7 @@ update_if_album_art(const char *path)
 	closedir(dh);
 }
 
-char *
+static char *
 check_embedded_art(const char *path, const char *image_data, int image_size)
 {
 	int width = 0, height = 0;
@@ -217,7 +217,7 @@ check_embedded_art(const char *path, const char *image_data, int image_size)
 	}
 	else if( width > 0 && height > 0 )
 	{
-		size_t nwritten;
+		int nwritten;
 		if( art_cache_exists(path, &art_path) )
 			goto end_art;
 		cache_dir = strdup(art_path);
diff --git image_utils.c image_utils.c
index ee4fcf3..09330a3 100644
--- image_utils.c
+++ image_utils.c
@@ -172,7 +172,7 @@ term_source(j_decompress_ptr cinfo)
 	return;
 }
 
-void
+static void
 jpeg_memory_src(j_decompress_ptr cinfo, const unsigned char * buffer, size_t bufsize)
 {
 	struct my_src_mgr *src;
@@ -208,7 +208,7 @@ image_free(image_s *pimage)
 	free(pimage);
 }
 
-pix
+static pix
 get_pix(image_s *pimage, int32_t x, int32_t y)
 {
 	if((x >= 0) && (y >= 0) && (x < pimage->width) && (y < pimage->height))
@@ -222,7 +222,7 @@ get_pix(image_s *pimage, int32_t x, int32_t y)
 	}
 }
 
-void
+static void
 put_pix_alpha_replace(image_s *pimage, int32_t x, int32_t y, pix col)
 {
 	if((x >= 0) && (y >= 0) && (x < pimage->width) && (y < pimage->height))
@@ -398,7 +398,7 @@ image_get_jpeg_date_xmp(const char * path, char ** date)
 	return ret;
 }
 
-image_s *
+static image_s *
 image_new(int32_t width, int32_t height)
 {
 	image_s *vimage;
@@ -563,7 +563,7 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size,
 	return vimage;
 }
 
-void
+static void
 image_upsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
 {
 	int32_t vx, vy;
@@ -626,7 +626,7 @@ image_upsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
 	}
 }
 
-void
+static void
 image_downsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
 {
 	int32_t vx, vy;
diff --git metadata.c metadata.c
index 39a65ef..0ce2ceb 100644
--- metadata.c
+++ metadata.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 
+#include <libgen.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -118,7 +119,7 @@ lav_close(AVFormatContext *ctx)
 }
 
 #if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
-# if LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0)
+# if LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0) && LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 43, 0)
 #define AV_DICT_IGNORE_SUFFIX AV_METADATA_IGNORE_SUFFIX
 #define av_dict_get av_metadata_get
 typedef AVMetadataTag AVDictionaryEntry;
@@ -129,7 +130,7 @@ typedef AVMetadataTag AVDictionaryEntry;
 #define MPEG_TS_SYNC_CODE 0x47
 #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)
 {
 	unsigned char buffer[3*MPEG_TS_PACKET_LENGTH_DLNA];
@@ -222,7 +223,7 @@ no_source_video:
 	free(file);
 }
 
-void
+static void
 parse_nfo(const char * path, metadata_t * m)
 {
 	FILE *nfo;
@@ -273,7 +274,7 @@ parse_nfo(const char * path, metadata_t * m)
 	fclose(nfo);
 }
 
-void
+static void
 free_metadata(metadata_t * m, uint32_t flags)
 {
 	if( flags & FLAG_TITLE )
@@ -712,7 +713,8 @@ sqlite_int64
 GetVideoMetadata(const char * path, char * name)
 {
 	struct stat file;
-	int ret, i;
+	int ret;
+	unsigned i;
 	struct tm *modtime;
 	AVFormatContext *ctx = NULL;
 	AVCodecContext *ac = NULL, *vc = NULL;
diff --git minissdp.c minissdp.c
index 81ae23e..ac492db 100644
--- minissdp.c
+++ minissdp.c
@@ -292,7 +292,8 @@ SendSSDPNotifies(int s, const char * host, unsigned short port,
                  unsigned int lifetime)
 {
 	struct sockaddr_in sockname;
-	int l, n, dup, i=0;
+	int n, dup, i=0;
+	size_t l;
 	char bufr[512];
 
 	memset(&sockname, 0, sizeof(struct sockaddr_in));
@@ -355,7 +356,7 @@ SendSSDPNotifies2(int * sockets,
 	}
 }
 
-void
+static void
 ParseUPnPClient(char *location)
 {
 	char buf[8192];
diff --git minissdp.h minissdp.h
index bcc7ff4..be8cb5d 100644
--- minissdp.h
+++ minissdp.h
@@ -32,7 +32,7 @@
 /*#include "minidlnatypes.h"*/
 
 int
-OpenAndConfSSDPReceiveSocket();
+OpenAndConfSSDPReceiveSocket(void);
 /* OpenAndConfSSDPReceiveSocket(int n_lan_addr, struct lan_addr_s * lan_addr);*/
 
 /*int
diff --git minixml.c minixml.c
index 3dfb9a2..0831443 100644
--- minixml.c
+++ minixml.c
@@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
 /* parseatt : used to parse the argument list
  * 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;
 	int attnamelen;
@@ -105,7 +105,7 @@ int parseatt(struct xmlparser * p)
 
 /* 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;
 	const char * elementname;
diff --git options.c options.c
index 435cf9b..1b2d825 100644
--- options.c
+++ options.c
@@ -74,7 +74,7 @@ readoptionsfile(const char * fname)
 	char *value;
 	char *t;
 	int linenum = 0;
-	int i;
+	size_t i;
 	enum upnpconfigoptions id;
 
 	if(!fname || (strlen(fname) == 0))
diff --git playlist.c playlist.c
index 789b48c..8cf1df7 100644
--- playlist.c
+++ playlist.c
@@ -35,6 +35,7 @@
 #include "utils.h"
 #include "sql.h"
 #include "log.h"
+#include "playlist.h"
 
 int
 insert_playlist(const char * path, char * name)
diff --git scanner.c scanner.c
index dc10229..abd0c89 100644
--- scanner.c
+++ scanner.c
@@ -23,6 +23,7 @@
 #include <locale.h>
 #include <libgen.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -76,7 +77,7 @@ get_next_available_id(const char * table, const char * parentID)
 		return objectID;
 }
 
-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)
 {
@@ -169,7 +170,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
 		else
 		{
 			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);
 			//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached date item: %s/%s/%X\n", last_date.name, last_date.parentID, last_date.objectID);
@@ -192,7 +193,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
 		if( !valid_cache || strcmp(camera, last_cam.name) != 0 )
 		{
 			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';
 		}
@@ -204,7 +205,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
 		else
 		{
 			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);
 			//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached camdate item: %s/%s/%s/%X\n", camera, last_camdate.name, last_camdate.parentID, last_camdate.objectID);
@@ -273,12 +274,12 @@ insert_containers(const char * name, const char *path, const char * refID, const
 			if( !valid_cache || strcmp(artist, last_artist.name) != 0 )
 			{
 				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;
 			}
 			else
@@ -294,7 +295,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
 			{
 				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"));
 				//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached artist/album item: %s/%s/%X\n", last_artist.name, last_artist.parentID, last_artist.objectID);
@@ -315,12 +316,12 @@ insert_containers(const char * name, const char *path, const char * refID, const
 			if( !valid_cache || strcmp(genre, last_genre.name) != 0 )
 			{
 				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;
 			}
 			else
@@ -335,7 +336,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
 			{
 				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"));
 				//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached genre/artist item: %s/%s/%X\n", last_genreArtist.name, last_genreArtist.parentID, last_genreArtist.objectID);
@@ -659,7 +660,7 @@ sql_failed:
 	return (ret != SQLITE_OK);
 }
 
-int
+static int
 filter_audio(const struct dirent *d)
 {
 	return ( (*d->d_name != '.') &&
@@ -673,7 +674,7 @@ filter_audio(const struct dirent *d)
 	       ) ));
 }
 
-int
+static int
 filter_video(const struct dirent *d)
 {
 	return ( (*d->d_name != '.') &&
@@ -685,7 +686,7 @@ filter_video(const struct dirent *d)
 	       ) );
 }
 
-int
+static int
 filter_images(const struct dirent *d)
 {
 	return ( (*d->d_name != '.') &&
@@ -697,7 +698,7 @@ filter_images(const struct dirent *d)
 	       ) );
 }
 
-int
+static int
 filter_media(const struct dirent *d)
 {
 	return ( (*d->d_name != '.') &&
@@ -713,7 +714,7 @@ filter_media(const struct dirent *d)
 	       ) ));
 }
 
-void
+static void
 ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
 {
 	struct dirent **namelist;
@@ -804,7 +805,7 @@ ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
 }
 
 void
-start_scanner()
+start_scanner(void)
 {
 	struct media_dir_s * media_path = media_dirs;
 	char name[PATH_MAX];
diff --git scanner.h scanner.h
index a57eedd..7eaa3a0 100644
--- scanner.h
+++ scanner.h
@@ -81,6 +81,6 @@ int
 CreateDatabase(void);
 
 void
-start_scanner();
+start_scanner(void);
 
 #endif
diff --git tagutils/tagutils-aac.c tagutils/tagutils-aac.c
index 4224d5f..609710a 100644
--- tagutils/tagutils-aac.c
+++ tagutils/tagutils-aac.c
@@ -81,7 +81,7 @@ _get_aactags(char *file, struct song_metadata *psong)
 	long atom_offset;
 	unsigned int atom_length;
 
-	long current_offset = 0;
+	unsigned int current_offset = 0;
 	int current_size;
 	char current_atom[4];
 	char *current_data;
@@ -119,7 +119,7 @@ _get_aactags(char *file, struct song_metadata *psong)
 			current_data = (char*)malloc(len); // extra byte
 			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;
 
 			if(!memcmp(current_atom, "\xA9" "nam", 4))
@@ -243,7 +243,7 @@ _aac_lookforatom(FILE *aac_fp, char *atom_path, unsigned int *atom_length)
 	return ftell(aac_fp) - 8;
 }
 
-int
+static int
 _aac_check_extended_descriptor(FILE *infile)
 {
 	short int i;
diff --git tagutils/tagutils-asf.c tagutils/tagutils-asf.c
index 11da1ae..abc5b78 100644
--- tagutils/tagutils-asf.c
+++ tagutils/tagutils-asf.c
@@ -23,7 +23,7 @@
 static int
 _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);
 	if(size < len)
@@ -66,10 +66,10 @@ static int
 _asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size)
 {
 	asf_audio_stream_t s;
-	int len;
+	unsigned long len;
 
 	len = sizeof(s) - sizeof(s.Hdr);
-	if(len > size)
+	if(len > (unsigned long) size)
 		len = size;
 
 	if(len != fread(&s.wfx, 1, len, fp))
@@ -90,7 +90,7 @@ _asf_read_media_stream(FILE *fp, struct song_metadata *psong, __u32 size)
 {
 	asf_media_stream_t s;
 	avi_audio_format_t wfx;
-	int len;
+	unsigned int len;
 
 	len = sizeof(s) - sizeof(s.Hdr);
 	if(len > size)
@@ -121,7 +121,7 @@ static int
 _asf_read_stream_object(FILE *fp, struct song_metadata *psong, __u32 size)
 {
 	asf_stream_object_t s;
-	int len;
+	unsigned int len;
 
 	len = sizeof(s) - sizeof(asf_object_t);
 	if(size < len)
@@ -145,8 +145,8 @@ _asf_read_stream_object(FILE *fp, struct song_metadata *psong, __u32 size)
 static int
 _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;
 	asf_stream_name_t nm;
@@ -201,7 +201,7 @@ static int
 _asf_read_header_extension(FILE *fp, struct song_metadata *psong, __u32 size)
 {
 	off_t pos;
-	long off;
+	size_t off;
 	asf_header_extension_t ext;
 	asf_object_t tmp;
 
@@ -233,7 +233,7 @@ _asf_read_header_extension(FILE *fp, struct song_metadata *psong, __u32 size)
 }
 
 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];
 	__u16 wc;
@@ -302,7 +302,7 @@ _asf_load_string(FILE *fp, int type, int size, char *buf, int len)
 static void *
 _asf_load_picture(FILE *fp, int size, void *bm, int *bm_size)
 {
-	int i;
+	unsigned long i;
 	char buf[256];
 #if 0
 	//
diff --git tagutils/tagutils-flc.c tagutils/tagutils-flc.c
index b8f41d4..839327f 100644
--- tagutils/tagutils-flc.c
+++ tagutils/tagutils-flc.c
@@ -26,7 +26,7 @@ _get_flctags(char *filename, struct song_metadata *psong)
 	FLAC__Metadata_SimpleIterator *iterator = 0;
 	FLAC__StreamMetadata *block;
 	unsigned int sec, ms;
-	int i;
+	unsigned int i;
 	int err = 0;
 
 	if(!(iterator = FLAC__metadata_simple_iterator_new()))
diff --git tagutils/tagutils-mp3.c tagutils/tagutils-mp3.c
index 770f231..698f743 100644
--- tagutils/tagutils-mp3.c
+++ tagutils/tagutils-mp3.c
@@ -31,7 +31,7 @@ _get_mp3tags(char *file, struct song_metadata *psong)
 	struct id3_tag *pid3tag;
 	struct id3_frame *pid3frame;
 	int err;
-	int index;
+	unsigned int index;
 	int used;
 	unsigned char *utf8_text;
 	int genre = WINAMP_GENRE_UNKNOWN;
@@ -405,7 +405,7 @@ static void _mp3_get_average_bitrate(FILE *infile, struct mp3_frameinfo *pfi, co
 	off_t file_size;
 	unsigned char frame_buffer[2900];
 	unsigned char header[4];
-	int index = 0;
+	unsigned int index = 0;
 	int found = 0;
 	off_t pos;
 	struct mp3_frameinfo fi;
@@ -549,11 +549,11 @@ _get_mp3fileinfo(char *file, struct song_metadata *psong)
 	struct id3header *pid3;
 	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;
 	int found;
diff --git tagutils/tagutils-wav.c tagutils/tagutils-wav.c
index e9f6c20..956eef7 100644
--- tagutils/tagutils-wav.c
+++ tagutils/tagutils-wav.c
@@ -79,7 +79,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
 
 	/* now, walk through the chunks */
 	current_offset = 12;
-	while(current_offset + 8 < psong->file_size)
+	while(current_offset + 8 < (unsigned int) psong->file_size)
 	{
 		len = 8;
 		if(!(len = read(fd, hdr, len)) || (len != 8))
@@ -162,7 +162,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
 
 			off = 4;
 			p = tags + off;
-			while(off < len - 8)
+			while(off < (int) len - 8)
 			{
 				taglen = GET_WAV_INT32(p + 4);
 
diff --git tagutils/tagutils.c tagutils/tagutils.c
index 7e147e7..b344552 100644
--- tagutils/tagutils.c
+++ tagutils/tagutils.c
@@ -96,7 +96,7 @@ char *winamp_genre[] = {
 	       "Unknown"
 };
 
-#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)
 
 
 /*
@@ -132,7 +132,7 @@ static taghandler taghandlers[] = {
 	{ "asf", 0,            _get_asffileinfo                                  },
 	{ "wav", _get_wavtags, _get_wavfileinfo                                  },
 	{ "pcm", 0,            _get_pcmfileinfo                                  },
-	{ NULL,  0 }
+	{ NULL, NULL, 0 }
 };
 
 
diff --git upnpdescgen.c upnpdescgen.c
index c3b94e0..2ce8c31 100644
--- upnpdescgen.c
+++ upnpdescgen.c
@@ -325,32 +325,32 @@ static const struct stateVar ConnectionManagerVars[] =
 	{"SourceProtocolInfo", 1<<7, 0, 0, 44}, /* required */
 	{"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}
 };
 
 static const struct argument GetSearchCapabilitiesArgs[] =
 {
 	{"SearchCaps", 2, 10},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
 static const struct argument GetSortCapabilitiesArgs[] =
 {
 	{"SortCaps", 2, 11},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
 static const struct argument GetSystemUpdateIDArgs[] =
 {
 	{"Id", 2, 12},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
 static const struct argument BrowseArgs[] =
@@ -365,7 +365,7 @@ static const struct argument BrowseArgs[] =
 	{"NumberReturned", 2, 8},
 	{"TotalMatches", 2, 8},
 	{"UpdateID", 2, 9},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
 static const struct argument SearchArgs[] =
@@ -380,7 +380,7 @@ static const struct argument SearchArgs[] =
 	{"NumberReturned", 2, 8},
 	{"TotalMatches", 2, 8},
 	{"UpdateID", 2, 9},
-	{0, 0}
+	{NULL, 0, 0}
 };
 
 static const struct action ContentDirectoryActions[] =
@@ -407,16 +407,16 @@ static const struct action ContentDirectoryActions[] =
 static const struct stateVar ContentDirectoryVars[] =
 {
 	{"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},
 	/* Allowed Values : COMPLETED / ERROR / IN_PROGRESS / STOPPED */
@@ -424,11 +424,11 @@ static const struct stateVar ContentDirectoryVars[] =
 	//JM{"A_ARG_TYPE_TransferTotal", 0, 0},
 	//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}
+	{NULL, 0, 0, 0, 0}
 };
 
 static const struct argument GetIsAuthorizedArgs[] =
@@ -464,15 +464,15 @@ static const struct action X_MS_MediaReceiverRegistrarActions[] =
 
 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}
 };
 
 /* WANCfg.xml */
diff --git upnpevents.c upnpevents.c
index 1b5f018..2438bf3 100644
--- upnpevents.c
+++ upnpevents.c
@@ -256,7 +256,7 @@ error:
 static void
 upnp_event_notify_connect(struct upnp_event_notify * obj)
 {
-	int i;
+	unsigned long i;
 	const char * p;
 	unsigned short port;
 	struct sockaddr_in addr;
diff --git upnphttp.c upnphttp.c
index b368cd9..58f3f2c 100644
--- upnphttp.c
+++ upnphttp.c
@@ -1283,7 +1283,7 @@ SendResp_upnphttp(struct upnphttp * h)
 	}
 }
 
-int
+static int
 send_data(struct upnphttp * h, char * header, size_t size, int flags)
 {
 	int n;
@@ -1853,7 +1853,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
 	                char path[PATH_MAX];
 	                char mime[32];
 	                char dlna[96];
-	              } last_file = { 0, 0 };
+	              } last_file = { 0, 0, { '\0' }, { '\0' }, { '\0' } };
 #if USE_FORK
 	pid_t newpid = 0;
 #endif
diff --git upnpsoap.c upnpsoap.c
index 3182ca4..ae4ff95 100644
--- upnpsoap.c
+++ upnpsoap.c
@@ -542,7 +542,7 @@ set_filter_flags(char * filter, struct upnphttp *h)
 	return flags;
 }
 
-char *
+static char *
 parse_sort_criteria(char *sortCriteria, int *error)
 {
 	char *order = NULL;
diff --git utils.c utils.c
index d8cba4d..36ff168 100644
--- utils.c
+++ utils.c
@@ -19,7 +19,11 @@
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
+#if defined(__FreeBSD__)
+#include <limits.h>
+#else
 #include <linux/limits.h>
+#endif
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -30,6 +34,7 @@
 #include "minidlnatypes.h"
 #include "upnpglobalvars.h"
 #include "log.h"
+#include "utils.h"
 
 inline int
 strcatf(struct string_s *str, const char *fmt, ...)
@@ -277,7 +282,7 @@ unsigned int
 DJBHash(const char *str, int len)
 {
 	unsigned int hash = 5381;
-	unsigned int i = 0;
+	int i = 0;
 
 	for(i = 0; i < len; str++, i++)
 	{
diff --git utils.h utils.h
index fbd0a91..b5b433a 100644
--- utils.h
+++ utils.h
@@ -25,7 +25,11 @@
 #define __UTILS_H__
 
 int
-strcatf(struct string_s *str, char *fmt, ...);
+strcatf(struct string_s *str, const char *fmt, ...)
+#ifdef __GNUC__
+       __attribute__((format(printf, 2, 3)))
+#endif
+;
 
 void
 strncpyt(char *dst, const char *src, size_t len);
diff --git uuid.c uuid.c
index bdb4abc..bfa22b7 100644
--- uuid.c
+++ uuid.c
@@ -37,6 +37,7 @@
 
 #include "getifaddr.h"
 #include "log.h"
+#include "uuid.h"
 
 #define ETH_ALEN 6
 #define NSEC_PER_SEC 1000000000L
@@ -106,7 +107,7 @@ read_random_bytes(unsigned char *buf, size_t size)
 	}
 }
 
-void
+static void
 init_clockseq(void)
 {
 	unsigned char buf[4];
@@ -117,7 +118,7 @@ init_clockseq(void)
 	clock_seq_initialized = 1;
 }
 
-int
+static int
 generate_uuid(unsigned char uuid_out[16])
 {
 	static u_int64_t last_time_all;

