[xiph-commits] r18467 - in icecast/trunk/libshout: include/shout src

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Wed Jul 18 13:26:51 PDT 2012


Author: ph3-der-loewe
Date: 2012-07-18 13:26:51 -0700 (Wed, 18 Jul 2012)
New Revision: 18467

Modified:
   icecast/trunk/libshout/include/shout/shout.h.in
   icecast/trunk/libshout/src/shout.c
Log:
cleanups and hardening. Part of patch libshout-2.3.0-aac-mime-aim-irc-icq.patch, see #1872

Modified: icecast/trunk/libshout/include/shout/shout.h.in
===================================================================
--- icecast/trunk/libshout/include/shout/shout.h.in	2012-07-18 15:10:58 UTC (rev 18466)
+++ icecast/trunk/libshout/include/shout/shout.h.in	2012-07-18 20:26:51 UTC (rev 18467)
@@ -39,9 +39,10 @@
 
 #define SHOUTERR_BUSY		(-10)
 
-#define SHOUT_FORMAT_OGG	(0)
-#define SHOUT_FORMAT_MP3	(1)
-#define SHOUT_FORMAT_WEBM	(2)
+#define SHOUT_FORMAT_OGG		(0) /* application/ogg */
+#define SHOUT_FORMAT_MP3		(1) /* audio/mpeg */
+#define SHOUT_FORMAT_WEBM		(2) /* video/webm */
+
 /* backward-compatibility alias */
 #define SHOUT_FORMAT_VORBIS	SHOUT_FORMAT_OGG
 

Modified: icecast/trunk/libshout/src/shout.c
===================================================================
--- icecast/trunk/libshout/src/shout.c	2012-07-18 15:10:58 UTC (rev 18466)
+++ icecast/trunk/libshout/src/shout.c	2012-07-18 20:26:51 UTC (rev 18467)
@@ -217,7 +217,7 @@
 	if (len && ! self->wqueue.len) {
 		if ((ret = try_write(self, data, len)) < 0)
 			return self->error;
-		if (ret < len) {
+		if (ret < (ssize_t)len) {
 			self->error = queue_data(&self->wqueue, data + ret, len - ret);
 			if (self->error != SHOUTERR_SUCCESS)
 				return self->error;
@@ -994,16 +994,20 @@
 		if ((rc = parse_response(self)) != SHOUTERR_SUCCESS)
                         goto failure;
 
-		if (self->format == SHOUT_FORMAT_OGG) {
+		switch (self->format) {
+		case SHOUT_FORMAT_OGG:
 			if ((rc = self->error = shout_open_ogg(self)) != SHOUTERR_SUCCESS)
                                 goto failure;
-		} else if (self->format == SHOUT_FORMAT_MP3) {
+			break;
+		case SHOUT_FORMAT_MP3:
 			if ((rc = self->error = shout_open_mp3(self)) != SHOUTERR_SUCCESS)
                                 goto failure;
-		} else if (self->format == SHOUT_FORMAT_WEBM) {
+			break;
+		case SHOUT_FORMAT_WEBM:
 			if ((rc = self->error = shout_open_webm(self)) != SHOUTERR_SUCCESS)
 				goto failure;
-		} else {
+			break;
+		default:
                         rc = SHOUTERR_INSANE;
                         goto failure;
 		}
@@ -1206,10 +1210,7 @@
 	char *header = NULL;
 	int hlen = 0;
 	int code;
-	char *retcode;
-#if 0
-	char *realm;
-#endif
+	const char *retcode;
 
 	/* all this copying! */
 	hlen = collect_queue(self->rqueue.head, &header);



More information about the commits mailing list