[xiph-commits] r7089 - icecast/trunk/icecast/src

brendan at dactyl.lonelymoon.com brendan
Sun Jul 11 09:46:04 PDT 2004


Author: brendan
Date: Sun Jul 11 09:46:04 2004
New Revision: 7089

Modified:
icecast/trunk/icecast/src/format_mp3.c
Log:
The inline metadata text was losing the final character when the string length was a
multiple of 16.


Modified: icecast/trunk/icecast/src/format_mp3.c
===================================================================
--- icecast/trunk/icecast/src/format_mp3.c	2004-07-11 15:12:46 UTC (rev 7088)
+++ icecast/trunk/icecast/src/format_mp3.c	2004-07-11 16:46:02 UTC (rev 7089)
@@ -125,28 +125,28 @@

fullmetadata_size = strlen (source_state->metadata) + sizeof (meta_fmt);

-        if (fullmetadata_size > 4080)
+        if (fullmetadata_size > 4079)
{
-            fullmetadata_size = 4080;
+            fullmetadata_size = 4079;
}
fullmetadata = malloc (fullmetadata_size);
if (fullmetadata == NULL)
break;

fullmetadata_size = snprintf (fullmetadata, fullmetadata_size,
-                "StreamTitle='%.*s';", fullmetadata_size-(sizeof (meta_fmt)-1), source_state->metadata);
+                "StreamTitle='%.*s';", fullmetadata_size-(sizeof (meta_fmt)-1), source_state->metadata);

source_age = source_state->metadata_age;

if (fullmetadata_size > 0 && source_age != client_state->metadata_age)
{
-            len_byte = (fullmetadata_size-1)/16 + 1; /* to give 1-255 */
+            len_byte = (fullmetadata_size)/16 + 1; /* to give 1-255 */
client_state->metadata_offset = 0;
}
else
len_byte = 0;
len = 1 + len_byte*16;
-        buf = malloc (len);
+        buf = calloc (1, len);
if (buf == NULL)
break;




More information about the commits mailing list