[xiph-commits] r12630 - trunk/ezstream/src
moritz at svn.xiph.org
moritz at svn.xiph.org
Sun Mar 4 07:59:08 PST 2007
Author: moritz
Date: 2007-03-04 07:59:06 -0800 (Sun, 04 Mar 2007)
New Revision: 12630
Modified:
trunk/ezstream/src/configfile.c
Log:
Fix logic error and prevent an endless loop on error(s) in the config file.
Modified: trunk/ezstream/src/configfile.c
===================================================================
--- trunk/ezstream/src/configfile.c 2007-03-04 15:50:40 UTC (rev 12629)
+++ trunk/ezstream/src/configfile.c 2007-03-04 15:59:06 UTC (rev 12630)
@@ -168,8 +168,7 @@
shuffle_set = 0;
streamOnce_set = 0;
svrinfopublic_set = 0;
- cur = cur->xmlChildrenNode;
- while (cur != NULL) {
+ for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) {
if (!xmlStrcmp(cur->name, BAD_CAST "url")) {
if (ezConfig.URL != NULL) {
printf("%s[%ld]: Error: Cannot have multiple <url> elements\n",
@@ -452,8 +451,8 @@
int enable_set;
enable_set = 0;
- cur2 = cur->xmlChildrenNode;
- while (cur2 != NULL) {
+ for (cur2 = cur->xmlChildrenNode; cur2 != NULL;
+ cur2 = cur2->next) {
if (!xmlStrcmp(cur2->name, BAD_CAST "enable")) {
if (enable_set) {
printf("%s[%ld]: Error: Cannot have multiple <enable> elements\n",
@@ -483,8 +482,8 @@
pformatEncDec = xcalloc(1, sizeof(FORMAT_ENCDEC));
- cur3 = cur2->xmlChildrenNode;
- while (cur3 != NULL) {
+ for (cur3 = cur2->xmlChildrenNode;
+ cur3 != NULL; cur3 = cur3->next) {
if (!xmlStrcmp(cur3->name, BAD_CAST "format")) {
if (pformatEncDec->format != NULL) {
printf("%s[%ld]: Error: Cannot have multiple <format> elements\n",
@@ -578,15 +577,12 @@
}
}
}
- cur3 = cur3->next;
}
ezConfig.encoderDecoders[ezConfig.numEncoderDecoders] = pformatEncDec;
ezConfig.numEncoderDecoders++;
}
- cur2 = cur2->next;
}
}
- cur = cur->next;
}
xmlFreeDoc(doc);
More information about the commits
mailing list