Update of /cvsroot/pure-data/externals/pdogg/oggcast~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14481/oggcast~
Modified Files: oggcast~.c Log Message: Mon, 5 Apr 2004 12:12:00 +0200 + added dynamic allocattion of comment strings (TITLE,LOCATION,etc.) via 'pdogg_strdup(s)' macro.
Index: oggcast~.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdogg/oggcast~/oggcast~.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** oggcast~.c 4 Jan 2004 12:16:07 -0000 1.6 --- oggcast~.c 5 Apr 2004 10:00:51 -0000 1.7 *************** *** 61,67 **** --- 61,69 ---- #ifdef UNIX #define sys_closesocket close + #define pdogg_strdup(s) strdup(s) #endif #ifdef NT #define sys_closesocket closesocket + #define pdogg_strdup(s) _strdup(s) #endif
*************** *** 809,813 **** /* get the time for the DATE comment */ now=time(NULL); ! x->x_bcdate = ctime(&now); x->x_pages = 0; clock_delay(x->x_clock_pages, 0); --- 811,815 ---- /* get the time for the DATE comment */ now=time(NULL); ! x->x_bcdate = pdogg_strdup(ctime(&now)); /*--moo*/ x->x_pages = 0; clock_delay(x->x_clock_pages, 0); *************** *** 1055,1068 **** x->x_br_min = 96; x->x_pages = x->x_lastpages = 0; ! x->x_bcname = "ogg/vorbis stream"; ! x->x_bcurl = "http://www.akustische-kunst.org/puredata/"; ! x->x_bcgenre = "experimental"; ! x->x_bcdescription = "ogg/vorbis stream emitted from pure-data with oggcast~"; ! x->x_bcartist = "Pd and oggcast~ v0.2"; ! x->x_bclocation = x->x_bcurl; ! x->x_bccopyright = ""; ! x->x_bcperformer = ""; ! x->x_bccontact = ""; ! x->x_bcdate = ""; x->x_bcpublic = 1; x->x_mountpoint = "puredata.ogg"; --- 1057,1070 ---- x->x_br_min = 96; x->x_pages = x->x_lastpages = 0; ! x->x_bcname = pdogg_strdup("ogg/vorbis stream"); /*--moo: added strdup() */ ! x->x_bcurl = pdogg_strdup("http://www.akustische-kunst.org/puredata/"); ! x->x_bcgenre = pdogg_strdup("experimental"); ! x->x_bcdescription = pdogg_strdup("ogg/vorbis stream emitted from pure-data with oggcast~"); ! x->x_bcartist = pdogg_strdup("Pd and oggcast~ v0.2"); ! x->x_bclocation = pdogg_strdup(x->x_bcurl); ! x->x_bccopyright = pdogg_strdup(""); ! x->x_bcperformer = pdogg_strdup(""); ! x->x_bccontact = pdogg_strdup(""); ! x->x_bcdate = pdogg_strdup(""); x->x_bcpublic = 1; x->x_mountpoint = "puredata.ogg"; *************** *** 1256,1300 **** if(strstr(s->s_name, "ARTIST")) { ! strcpy(x->x_bcartist, comment); post("oggcast~: ARTIST = %s", x->x_bcartist); } else if(strstr(s->s_name, "GENRE")) { ! strcpy(x->x_bcgenre, comment); post("oggcast~: GENRE = %s", x->x_bcgenre); } else if(strstr(s->s_name, "TITLE")) { ! strcpy(x->x_bcname, comment); post("oggcast~: TITLE = %s", x->x_bcname); } else if(strstr(s->s_name, "PERFORMER")) { ! strcpy(x->x_bcperformer, comment); ! post("oggcast~: PERFORMER = %s", x->x_bcperformer); } else if(strstr(s->s_name, "LOCATION")) { ! strcpy(x->x_bclocation, comment); ! post("oggcast~: LOCATION = %s", x->x_bclocation); } else if(strstr(s->s_name, "COPYRIGHT")) { ! strcpy(x->x_bccopyright, comment); post("oggcast~: COPYRIGHT = %s", x->x_bccopyright); } else if(strstr(s->s_name, "CONTACT")) { ! strcpy(x->x_bccontact, comment); post("oggcast~: CONTACT = %s", x->x_bccontact); } else if(strstr(s->s_name, "DESCRIPTION")) { ! strcpy(x->x_bcdescription, comment); post("oggcast~: DESCRIPTION = %s", x->x_bcdescription); } else if(strstr(s->s_name, "DATE")) { ! strcpy(x->x_bcdate, comment); post("oggcast~: DATE = %s", x->x_bcdate); } --- 1258,1311 ---- if(strstr(s->s_name, "ARTIST")) { ! if (x->x_bcartist) free(x->x_bcartist); ! x->x_bcartist = pdogg_strdup(comment); /*-- moo: added strdup() */ post("oggcast~: ARTIST = %s", x->x_bcartist); } else if(strstr(s->s_name, "GENRE")) { ! free(x->x_bcgenre); ! x->x_bcgenre = pdogg_strdup(comment); post("oggcast~: GENRE = %s", x->x_bcgenre); } else if(strstr(s->s_name, "TITLE")) { ! free(x->x_bcname); ! x->x_bcname = pdogg_strdup(comment); post("oggcast~: TITLE = %s", x->x_bcname); } else if(strstr(s->s_name, "PERFORMER")) { ! free(x->x_bcperformer); ! x->x_bcperformer = pdogg_strdup(comment); ! post("oggcast~: PERFORMER = %s",x->x_bcperformer); } else if(strstr(s->s_name, "LOCATION")) { ! free(x->x_bclocation); ! x->x_bclocation = pdogg_strdup(comment); ! post("oggcast~: LOCATION = %s",x->x_bclocation); } else if(strstr(s->s_name, "COPYRIGHT")) { ! free(x->x_bccopyright); ! x->x_bccopyright = pdogg_strdup(comment); post("oggcast~: COPYRIGHT = %s", x->x_bccopyright); } else if(strstr(s->s_name, "CONTACT")) { ! free(x->x_bccontact); ! x->x_bccontact = pdogg_strdup(comment); post("oggcast~: CONTACT = %s", x->x_bccontact); } else if(strstr(s->s_name, "DESCRIPTION")) { ! free(x->x_bcdescription); ! x->x_bcdescription = pdogg_strdup(comment); post("oggcast~: DESCRIPTION = %s", x->x_bcdescription); } else if(strstr(s->s_name, "DATE")) { ! free(x->x_bcdate); ! x->x_bcdate = pdogg_strdup(comment); post("oggcast~: DATE = %s", x->x_bcdate); } *************** *** 1424,1427 **** --- 1435,1450 ---- clock_free(x->x_clock_connect); clock_free(x->x_clock_pages); + + /*-- moo: free dynamically allocated comment strings --*/ + free(x->x_bcname); + free(x->x_bcurl); + free(x->x_bcgenre); + free(x->x_bcdescription); + free(x->x_bcartist); + free(x->x_bclocation); + free(x->x_bccopyright); + free(x->x_bcperformer); + free(x->x_bccontact); + free(x->x_bcdate); }
*************** *** 1442,1444 **** class_addanything(oggcast_class, oggcast_comment); class_sethelpsymbol(oggcast_class, gensym("help-oggcast~.pd")); ! } \ No newline at end of file --- 1465,1467 ---- class_addanything(oggcast_class, oggcast_comment); class_sethelpsymbol(oggcast_class, gensym("help-oggcast~.pd")); ! }