1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

no functional/structural change but cleans up the annoying signed/unsigned pointer warnings

here with xmlChar, based on work originally done by gtgbr@gmx.net.
closes #783, #784, #785, #787

svn path=/icecast/trunk/icecast/; revision=13933
This commit is contained in:
Karl Heyes 2007-10-04 16:48:38 +00:00
parent da893d8b3b
commit e065acb7f1
10 changed files with 242 additions and 239 deletions

View File

@ -204,12 +204,12 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
char buf[22];
time_t now = time(NULL);
doc = xmlNewDoc("1.0");
xmlnode = xmlNewDocNode(doc, NULL, "icestats", NULL);
doc = xmlNewDoc (XMLSTR("1.0"));
xmlnode = xmlNewDocNode (doc, NULL, XMLSTR("icestats"), NULL);
xmlDocSetRootElement(doc, xmlnode);
if (mount) {
xmlNewChild(xmlnode, NULL, "current_source", mount);
xmlNewChild (xmlnode, NULL, XMLSTR("current_source"), XMLSTR(mount));
}
node = avl_get_first(global.source_tree);
@ -226,21 +226,21 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
ice_config_t *config;
mount_proxy *mountinfo;
srcnode = xmlNewChild(xmlnode, NULL, "source", NULL);
xmlSetProp(srcnode, "mount", source->mount);
srcnode = xmlNewChild(xmlnode, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
xmlNewChild(srcnode, NULL, "fallback",
xmlNewChild(srcnode, NULL, XMLSTR("fallback"),
(source->fallback_mount != NULL)?
source->fallback_mount:"");
XMLSTR(source->fallback_mount):XMLSTR(""));
snprintf (buf, sizeof(buf), "%lu", source->listeners);
xmlNewChild(srcnode, NULL, "listeners", buf);
xmlNewChild(srcnode, NULL, XMLSTR("listeners"), XMLSTR(buf));
config = config_get_config();
mountinfo = config_find_mount (config, source->mount);
if (mountinfo && mountinfo->auth)
{
xmlNewChild(srcnode, NULL, "authenticator",
mountinfo->auth->type);
xmlNewChild(srcnode, NULL, XMLSTR("authenticator"),
XMLSTR(mountinfo->auth->type));
}
config_release_config();
@ -250,10 +250,10 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
{
snprintf (buf, sizeof(buf), "%lu",
(unsigned long)(now - source->con->con_time));
xmlNewChild (srcnode, NULL, "Connected", buf);
xmlNewChild (srcnode, NULL, XMLSTR("Connected"), XMLSTR(buf));
}
xmlNewChild (srcnode, NULL, "content-type",
source->format->contenttype);
xmlNewChild (srcnode, NULL, XMLSTR("content-type"),
XMLSTR(source->format->contenttype));
}
}
node = avl_get_next(node);
@ -342,7 +342,7 @@ void admin_handle_request(client_t *client, const char *uri)
return;
}
config = config_get_config ();
httpp_set_query_param (client->parser, "mount", config->shoutcast_mount);
httpp_set_query_param (client->parser, "mount", (char *)config->shoutcast_mount);
httpp_setvar (client->parser, HTTPP_VAR_PROTOCOL, "ICY");
httpp_setvar (client->parser, HTTPP_VAR_ICYPASSWORD, pass);
config_release_config ();
@ -602,8 +602,8 @@ static void command_move_clients(client_t *client, source_t *source,
INFO2 ("source is \"%s\", destination is \"%s\"", source->mount, dest->mount);
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
xmlDocSetRootElement(doc, node);
source_move_clients (source, dest);
@ -611,8 +611,8 @@ static void command_move_clients(client_t *client, source_t *source,
memset(buf, '\000', sizeof(buf));
snprintf (buf, sizeof(buf), "Clients moved from %s to %s",
source->mount, dest_source);
xmlNewChild(node, NULL, "message", buf);
xmlNewChild(node, NULL, "return", "1");
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
@ -630,38 +630,38 @@ static void command_show_listeners(client_t *client, source_t *source,
const char *userAgent = NULL;
time_t now = time(NULL);
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "icestats", NULL);
srcnode = xmlNewChild(node, NULL, "source", NULL);
xmlSetProp(srcnode, "mount", source->mount);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
xmlDocSetRootElement(doc, node);
memset(buf, '\000', sizeof(buf));
snprintf (buf, sizeof(buf), "%lu", source->listeners);
xmlNewChild(srcnode, NULL, "Listeners", buf);
xmlNewChild(srcnode, NULL, XMLSTR("Listeners"), XMLSTR(buf));
avl_tree_rlock(source->client_tree);
client_node = avl_get_first(source->client_tree);
while(client_node) {
current = (client_t *)client_node->key;
listenernode = xmlNewChild(srcnode, NULL, "listener", NULL);
xmlNewChild(listenernode, NULL, "IP", current->con->ip);
listenernode = xmlNewChild(srcnode, NULL, XMLSTR("listener"), NULL);
xmlNewChild(listenernode, NULL, XMLSTR("IP"), XMLSTR(current->con->ip));
userAgent = httpp_getvar(current->parser, "user-agent");
if (userAgent) {
xmlNewChild(listenernode, NULL, "UserAgent", userAgent);
xmlNewChild(listenernode, NULL, XMLSTR("UserAgent"), XMLSTR(userAgent));
}
else {
xmlNewChild(listenernode, NULL, "UserAgent", "Unknown");
xmlNewChild(listenernode, NULL, XMLSTR("UserAgent"), XMLSTR("Unknown"));
}
memset(buf, '\000', sizeof(buf));
snprintf(buf, sizeof(buf), "%lu", (unsigned long)(now - current->con->con_time));
xmlNewChild(listenernode, NULL, "Connected", buf);
xmlNewChild(listenernode, NULL, XMLSTR("Connected"), XMLSTR(buf));
memset(buf, '\000', sizeof(buf));
snprintf(buf, sizeof(buf)-1, "%lu", current->con->id);
xmlNewChild(listenernode, NULL, "ID", buf);
xmlNewChild(listenernode, NULL, XMLSTR("ID"), XMLSTR(buf));
if (current->username) {
xmlNewChild(listenernode, NULL, "username", current->username);
xmlNewChild(listenernode, NULL, XMLSTR("username"), XMLSTR(current->username));
}
client_node = avl_get_next(client_node);
}
@ -763,14 +763,14 @@ static void command_manageauth(client_t *client, source_t *source,
}
}
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "icestats", NULL);
srcnode = xmlNewChild(node, NULL, "source", NULL);
xmlSetProp(srcnode, "mount", source->mount);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
if (message) {
msgnode = xmlNewChild(node, NULL, "iceresponse", NULL);
xmlNewChild(msgnode, NULL, "message", message);
msgnode = xmlNewChild(node, NULL, XMLSTR("iceresponse"), NULL);
xmlNewChild(msgnode, NULL, XMLSTR("message"), XMLSTR(message));
}
xmlDocSetRootElement(doc, node);
@ -797,10 +797,10 @@ static void command_kill_source(client_t *client, source_t *source,
xmlDocPtr doc;
xmlNodePtr node;
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
xmlNewChild(node, NULL, "message", "Source Removed");
xmlNewChild(node, NULL, "return", "1");
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("Source Removed"));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
xmlDocSetRootElement(doc, node);
source->running = 0;
@ -826,8 +826,8 @@ static void command_kill_client(client_t *client, source_t *source,
listener = source_find_client(source, id);
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
xmlDocSetRootElement(doc, node);
DEBUG1("Response is %d", response);
@ -840,14 +840,14 @@ static void command_kill_client(client_t *client, source_t *source,
listener->con->error = 1;
memset(buf, '\000', sizeof(buf));
snprintf(buf, sizeof(buf)-1, "Client %d removed", id);
xmlNewChild(node, NULL, "message", buf);
xmlNewChild(node, NULL, "return", "1");
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
}
else {
memset(buf, '\000', sizeof(buf));
snprintf(buf, sizeof(buf)-1, "Client %d not found", id);
xmlNewChild(node, NULL, "message", buf);
xmlNewChild(node, NULL, "return", "0");
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("0"));
}
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
@ -880,8 +880,8 @@ static void command_metadata(client_t *client, source_t *source,
xmlDocPtr doc;
xmlNodePtr node;
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode (doc, NULL, XMLSTR("iceresponse"), NULL);
xmlDocSetRootElement(doc, node);
DEBUG0("Got metadata update request");
@ -894,8 +894,8 @@ static void command_metadata(client_t *client, source_t *source,
if (strcmp (action, "updinfo") != 0)
{
xmlNewChild(node, NULL, "message", "No such action");
xmlNewChild(node, NULL, "return", "0");
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("No such action"));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("0"));
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
xmlFreeDoc(doc);
@ -924,17 +924,17 @@ static void command_metadata(client_t *client, source_t *source,
}
else
{
xmlNewChild(node, NULL, "message",
"Mountpoint will not accept URL updates");
xmlNewChild(node, NULL, "return", "1");
xmlNewChild(node, NULL, XMLSTR("message"),
XMLSTR("Mountpoint will not accept URL updates"));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
xmlFreeDoc(doc);
return;
}
xmlNewChild(node, NULL, "message", "Metadata update successful");
xmlNewChild(node, NULL, "return", "1");
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("Metadata update successful"));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
xmlFreeDoc(doc);
@ -1019,10 +1019,10 @@ static void command_updatemetadata(client_t *client, source_t *source,
xmlDocPtr doc;
xmlNodePtr node, srcnode;
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "icestats", NULL);
srcnode = xmlNewChild(node, NULL, "source", NULL);
xmlSetProp(srcnode, "mount", source->mount);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode (doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild (node, NULL, XMLSTR("source"), NULL);
xmlSetProp (srcnode, XMLSTR("mount"), XMLSTR(source->mount));
xmlDocSetRootElement(doc, node);
admin_send_response(doc, client, response,

View File

@ -561,8 +561,8 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
while (options)
{
if (strcmp(options->name, "allow_duplicate_users") == 0)
auth->allow_duplicate_users = atoi (options->value);
if (strcmp (options->name, "allow_duplicate_users") == 0)
auth->allow_duplicate_users = atoi ((char*)options->value);
options = options->next;
}
return 0;
@ -583,16 +583,16 @@ auth_t *auth_get_authenticator (xmlNodePtr node)
{
xmlNodePtr current = option;
option = option->next;
if (strcmp (current->name, "option") == 0)
if (xmlStrcmp (current->name, XMLSTR("option")) == 0)
{
config_options_t *opt = calloc (1, sizeof (config_options_t));
opt->name = xmlGetProp (current, "name");
opt->name = (char *)xmlGetProp (current, XMLSTR("name"));
if (opt->name == NULL)
{
free(opt);
continue;
}
opt->value = xmlGetProp (current, "value");
opt->value = (char *)xmlGetProp (current, XMLSTR("value"));
if (opt->value == NULL)
{
xmlFree (opt->name);
@ -603,10 +603,10 @@ auth_t *auth_get_authenticator (xmlNodePtr node)
next_option = &opt->next;
}
else
if (strcmp (current->name, "text") != 0)
if (xmlStrcmp (current->name, XMLSTR("text")) != 0)
WARN1 ("unknown auth setting (%s)", current->name);
}
auth->type = xmlGetProp (node, "type");
auth->type = (char*)xmlGetProp (node, XMLSTR("type"));
if (get_authenticator (auth, options) < 0)
{
xmlFree (auth->type);

View File

@ -88,7 +88,7 @@ static char *get_hash(const char *data, int len)
MD5Init(&context);
MD5Update(&context, data, len);
MD5Update(&context, (const unsigned char *)data, len);
MD5Final(digest, &context);
@ -406,9 +406,9 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
while (node)
{
htpasswd_user *user = (htpasswd_user *)node->key;
newnode = xmlNewChild (srcnode, NULL, "User", NULL);
xmlNewChild(newnode, NULL, "username", user->name);
xmlNewChild(newnode, NULL, "password", user->pass);
newnode = xmlNewChild (srcnode, NULL, XMLSTR("User"), NULL);
xmlNewChild(newnode, NULL, XMLSTR("username"), XMLSTR(user->name));
xmlNewChild(newnode, NULL, XMLSTR("password"), XMLSTR(user->pass));
node = avl_get_next (node);
}
thread_rwlock_unlock (&state->file_rwlock);

View File

@ -169,6 +169,7 @@ static auth_result url_remove_listener (auth_client *auth_user)
auth_url *url = auth->state;
time_t duration = time(NULL) - client->con->con_time;
char *username, *password, *mount, *server;
const char *mountreq;
ice_config_t *config;
int port;
char *userpwd = NULL, post [4096];
@ -191,10 +192,10 @@ static auth_result url_remove_listener (auth_client *auth_user)
password = strdup ("");
/* get the full uri (with query params if available) */
mount = httpp_getvar (client->parser, HTTPP_VAR_RAWURI);
if (mount == NULL)
mount = httpp_getvar (client->parser, HTTPP_VAR_URI);
mount = util_url_escape (mount);
mountreq = httpp_getvar (client->parser, HTTPP_VAR_RAWURI);
if (mountreq == NULL)
mountreq = httpp_getvar (client->parser, HTTPP_VAR_URI);
mount = util_url_escape (mountreq);
snprintf (post, sizeof (post),
"action=listener_remove&server=%s&port=%d&client=%lu&mount=%s"
@ -248,7 +249,9 @@ static auth_result url_add_listener (auth_client *auth_user)
auth_t *auth = client->auth;
auth_url *url = auth->state;
int res = 0, port;
char *agent, *user_agent, *username, *password;
const char *agent;
char *user_agent, *username, *password;
const char *mountreq;
char *mount, *ipaddr, *server;
ice_config_t *config;
char *userpwd = NULL, post [4096];
@ -274,10 +277,10 @@ static auth_result url_add_listener (auth_client *auth_user)
password = strdup ("");
/* get the full uri (with query params if available) */
mount = httpp_getvar (client->parser, HTTPP_VAR_RAWURI);
if (mount == NULL)
mount = httpp_getvar (client->parser, HTTPP_VAR_URI);
mount = util_url_escape (mount);
mountreq = httpp_getvar (client->parser, HTTPP_VAR_RAWURI);
if (mountreq == NULL)
mountreq = httpp_getvar (client->parser, HTTPP_VAR_URI);
mount = util_url_escape (mountreq);
ipaddr = util_url_escape (client->con->ip);
snprintf (post, sizeof (post),

View File

@ -159,8 +159,7 @@ void config_clear(ice_config_t *c)
aliases *alias, *nextalias;
int i;
if (c->config_filename)
free(c->config_filename);
free(c->config_filename);
if (c->location) xmlFree(c->location);
if (c->admin) xmlFree(c->admin);
@ -268,7 +267,7 @@ int config_parse_file(const char *filename, ice_config_t *configuration)
return CONFIG_ENOROOT;
}
if (strcmp(node->name, "icecast") != 0) {
if (xmlStrcmp (node->name, XMLSTR("icecast")) != 0) {
xmlFreeDoc(doc);
xmlCleanupParser();
return CONFIG_EBADROOT;
@ -276,7 +275,7 @@ int config_parse_file(const char *filename, ice_config_t *configuration)
config_init_configuration(configuration);
configuration->config_filename = (char *)strdup(filename);
configuration->config_filename = strdup (filename);
_parse_root(doc, node->xmlChildrenNode, configuration);
@ -324,9 +323,9 @@ ice_config_t *config_get_config_unlocked(void)
static void _set_defaults(ice_config_t *configuration)
{
configuration->location = xmlCharStrdup (CONFIG_DEFAULT_LOCATION);
configuration->location = (char *)xmlCharStrdup (CONFIG_DEFAULT_LOCATION);
configuration->server_id = (char *)xmlCharStrdup (ICECAST_VERSION_STRING);
configuration->admin = xmlCharStrdup (CONFIG_DEFAULT_ADMIN);
configuration->admin = (char *)xmlCharStrdup (CONFIG_DEFAULT_ADMIN);
configuration->client_limit = CONFIG_DEFAULT_CLIENT_LIMIT;
configuration->source_limit = CONFIG_DEFAULT_SOURCE_LIMIT;
configuration->queue_size_limit = CONFIG_DEFAULT_QUEUE_SIZE_LIMIT;
@ -334,15 +333,15 @@ static void _set_defaults(ice_config_t *configuration)
configuration->client_timeout = CONFIG_DEFAULT_CLIENT_TIMEOUT;
configuration->header_timeout = CONFIG_DEFAULT_HEADER_TIMEOUT;
configuration->source_timeout = CONFIG_DEFAULT_SOURCE_TIMEOUT;
configuration->source_password = xmlCharStrdup (CONFIG_DEFAULT_SOURCE_PASSWORD);
configuration->shoutcast_mount = xmlCharStrdup (CONFIG_DEFAULT_SHOUTCAST_MOUNT);
configuration->source_password = (char *)xmlCharStrdup (CONFIG_DEFAULT_SOURCE_PASSWORD);
configuration->shoutcast_mount = (char *)xmlCharStrdup (CONFIG_DEFAULT_SHOUTCAST_MOUNT);
configuration->ice_login = CONFIG_DEFAULT_ICE_LOGIN;
configuration->fileserve = CONFIG_DEFAULT_FILESERVE;
configuration->touch_interval = CONFIG_DEFAULT_TOUCH_FREQ;
configuration->on_demand = 0;
configuration->dir_list = NULL;
configuration->hostname = xmlCharStrdup (CONFIG_DEFAULT_HOSTNAME);
configuration->mimetypes_fn = xmlCharStrdup (MIMETYPESFILE);
configuration->hostname = (char *)xmlCharStrdup (CONFIG_DEFAULT_HOSTNAME);
configuration->mimetypes_fn = (char *)xmlCharStrdup (MIMETYPESFILE);
configuration->port = 0;
configuration->listeners[0].port = 0;
configuration->listeners[0].bind_address = NULL;
@ -350,22 +349,22 @@ static void _set_defaults(ice_config_t *configuration)
configuration->master_server = NULL;
configuration->master_server_port = 0;
configuration->master_update_interval = CONFIG_MASTER_UPDATE_INTERVAL;
configuration->master_username = xmlStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
configuration->master_username = (char *)xmlCharStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
configuration->master_password = NULL;
configuration->base_dir = xmlCharStrdup (CONFIG_DEFAULT_BASE_DIR);
configuration->log_dir = xmlCharStrdup (CONFIG_DEFAULT_LOG_DIR);
configuration->webroot_dir = xmlCharStrdup (CONFIG_DEFAULT_WEBROOT_DIR);
configuration->adminroot_dir = xmlCharStrdup (CONFIG_DEFAULT_ADMINROOT_DIR);
configuration->playlist_log = xmlCharStrdup (CONFIG_DEFAULT_PLAYLIST_LOG);
configuration->access_log = xmlCharStrdup (CONFIG_DEFAULT_ACCESS_LOG);
configuration->error_log = xmlCharStrdup (CONFIG_DEFAULT_ERROR_LOG);
configuration->base_dir = (char *)xmlCharStrdup (CONFIG_DEFAULT_BASE_DIR);
configuration->log_dir = (char *)xmlCharStrdup (CONFIG_DEFAULT_LOG_DIR);
configuration->webroot_dir = (char *)xmlCharStrdup (CONFIG_DEFAULT_WEBROOT_DIR);
configuration->adminroot_dir = (char *)xmlCharStrdup (CONFIG_DEFAULT_ADMINROOT_DIR);
configuration->playlist_log = (char *)xmlCharStrdup (CONFIG_DEFAULT_PLAYLIST_LOG);
configuration->access_log = (char *)xmlCharStrdup (CONFIG_DEFAULT_ACCESS_LOG);
configuration->error_log = (char *)xmlCharStrdup (CONFIG_DEFAULT_ERROR_LOG);
configuration->loglevel = CONFIG_DEFAULT_LOG_LEVEL;
configuration->chroot = CONFIG_DEFAULT_CHROOT;
configuration->chuid = CONFIG_DEFAULT_CHUID;
configuration->user = CONFIG_DEFAULT_USER;
configuration->group = CONFIG_DEFAULT_GROUP;
configuration->user = NULL;
configuration->group = NULL;
configuration->num_yp_directories = 0;
configuration->relay_username = xmlStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
configuration->relay_username = (char *)xmlCharStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
configuration->relay_password = NULL;
/* default to a typical prebuffer size used by clients */
configuration->burst_size = CONFIG_DEFAULT_BURST_SIZE;
@ -380,21 +379,21 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "location") == 0) {
if (xmlStrcmp (node->name, XMLSTR("location")) == 0) {
if (configuration->location) xmlFree(configuration->location);
configuration->location = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "admin") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("admin")) == 0) {
if (configuration->admin) xmlFree(configuration->admin);
configuration->admin = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "server-id") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("server-id")) == 0) {
xmlFree (configuration->server_id);
configuration->server_id = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if(strcmp(node->name, "authentication") == 0) {
} else if(xmlStrcmp (node->name, XMLSTR("authentication")) == 0) {
_parse_authentication(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "source-password") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
/* TODO: This is the backwards-compatibility location */
char *mount, *pass;
if ((mount = (char *)xmlGetProp(node, "mount")) != NULL) {
if ((mount = (char *)xmlGetProp(node, XMLSTR("mount"))) != NULL) {
pass = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
/* FIXME: This is a placeholder for per-mount passwords */
}
@ -402,68 +401,68 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
if (configuration->source_password) xmlFree(configuration->source_password);
configuration->source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
}
} else if (strcmp(node->name, "icelogin") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("icelogin")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->ice_login = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "fileserve") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("fileserve")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->fileserve = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "relays-on-demand") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("relays-on-demand")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->on_demand = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "hostname") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("hostname")) == 0) {
if (configuration->hostname) xmlFree(configuration->hostname);
configuration->hostname = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "mime-types") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("mime-types")) == 0) {
if (configuration->mimetypes_fn) xmlFree(configuration->mimetypes_fn);
configuration->mimetypes_fn = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "listen-socket") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("listen-socket")) == 0) {
_parse_listen_socket(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "port") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("port")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->port = atoi(tmp);
configuration->listeners[0].port = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "bind-address") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("bind-address")) == 0) {
if (configuration->listeners[0].bind_address)
xmlFree(configuration->listeners[0].bind_address);
configuration->listeners[0].bind_address = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "master-server") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("master-server")) == 0) {
if (configuration->master_server) xmlFree(configuration->master_server);
configuration->master_server = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "master-username") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("master-username")) == 0) {
if (configuration->master_username) xmlFree(configuration->master_username);
configuration->master_username = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "master-password") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("master-password")) == 0) {
if (configuration->master_password) xmlFree(configuration->master_password);
configuration->master_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "master-server-port") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("master-server-port")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->master_server_port = atoi(tmp);
xmlFree (tmp);
} else if (strcmp(node->name, "master-update-interval") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("master-update-interval")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->master_update_interval = atoi(tmp);
xmlFree (tmp);
} else if (strcmp(node->name, "shoutcast-mount") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("shoutcast-mount")) == 0) {
if (configuration->shoutcast_mount) xmlFree(configuration->shoutcast_mount);
configuration->shoutcast_mount = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "limits") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("limits")) == 0) {
_parse_limits(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "relay") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("relay")) == 0) {
_parse_relay(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "mount") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("mount")) == 0) {
_parse_mount(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "directory") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("directory")) == 0) {
_parse_directory(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "paths") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("paths")) == 0) {
_parse_paths(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "logging") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("logging")) == 0) {
_parse_logging(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "security") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("security")) == 0) {
_parse_security(doc, node->xmlChildrenNode, configuration);
}
} while ((node = node->next));
@ -478,40 +477,40 @@ static void _parse_limits(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "clients") == 0) {
if (xmlStrcmp (node->name, XMLSTR("clients")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->client_limit = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "sources") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("sources")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->source_limit = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "queue-size") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("queue-size")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->queue_size_limit = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "threadpool") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("threadpool")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->threadpool_size = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "client-timeout") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("client-timeout")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->client_timeout = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "header-timeout") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("header-timeout")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->header_timeout = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "source-timeout") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("source-timeout")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->source_timeout = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "burst-on-connect") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("burst-on-connect")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if (atoi(tmp) == 0)
configuration->burst_size = 0;
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "burst-size") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("burst-size")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->burst_size = atoi(tmp);
if (tmp) xmlFree(tmp);
@ -538,127 +537,126 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "mount-name") == 0) {
mount->mountname = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
if (xmlStrcmp (node->name, XMLSTR("mount-name")) == 0) {
mount->mountname = (char *)xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "username") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("username")) == 0) {
mount->username = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "password") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("password")) == 0) {
mount->password = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "dump-file") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("dump-file")) == 0) {
mount->dumpfile = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "intro") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("intro")) == 0) {
mount->intro_filename = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "fallback-mount") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("fallback-mount")) == 0) {
mount->fallback_mount = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "fallback-when-full") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("fallback-when-full")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->fallback_when_full = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "max-listeners") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("max-listeners")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->max_listeners = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "charset") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("charset")) == 0) {
mount->charset = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "mp3-metadata-interval") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("mp3-metadata-interval")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->mp3_meta_interval = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "fallback-override") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("fallback-override")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->fallback_override = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "no-mount") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("no-mount")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->no_mount = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "no-yp") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("no-yp")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->yp_public = atoi(tmp) == 0 ? -1 : 0;
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "hidden") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("hidden")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->hidden = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "authentication") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("authentication")) == 0) {
mount->auth = auth_get_authenticator (node);
}
else if (strcmp(node->name, "on-connect") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("on-connect")) == 0) {
mount->on_connect = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "on-disconnect") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("on-disconnect")) == 0) {
mount->on_disconnect = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "max-listener-duration") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("max-listener-duration")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->max_listener_duration = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "queue-size") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("queue-size")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->queue_size_limit = atoi (tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "source-timeout") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("source-timeout")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if (tmp)
{
mount->source_timeout = atoi (tmp);
xmlFree(tmp);
}
} else if (strcmp(node->name, "burst-size") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("burst-size")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->burst_size = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "cluster-password") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("cluster-password")) == 0) {
mount->cluster_password = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "stream-name") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("stream-name")) == 0) {
mount->stream_name = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "stream-description") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("stream-description")) == 0) {
mount->stream_description = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "stream-url") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("stream-url")) == 0) {
mount->stream_url = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "genre") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("genre")) == 0) {
mount->stream_genre = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "bitrate") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("bitrate")) == 0) {
mount->bitrate = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "public") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("public")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->yp_public = atoi (tmp);
if(tmp) xmlFree(tmp);
} else if (strcmp(node->name, "type") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("type")) == 0) {
mount->type = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "subtype") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("subtype")) == 0) {
mount->subtype = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
@ -671,7 +669,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
return;
}
if (mount->auth)
mount->auth->mount = strdup (mount->mountname);
mount->auth->mount = strdup ((char *)mount->mountname);
while(current) {
last = current;
current = current->next;
@ -710,44 +708,44 @@ static void _parse_relay(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "server") == 0) {
if (xmlStrcmp (node->name, XMLSTR("server")) == 0) {
relay->server = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "port") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("port")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
relay->port = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "mount") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("mount")) == 0) {
relay->mount = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "local-mount") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("local-mount")) == 0) {
relay->localmount = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "relay-shoutcast-metadata") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("relay-shoutcast-metadata")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
relay->mp3metadata = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "username") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("username")) == 0) {
relay->username = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "password") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("password")) == 0) {
relay->password = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "on-demand") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("on-demand")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
relay->on_demand = atoi(tmp);
if (tmp) xmlFree(tmp);
}
} while ((node = node->next));
if (relay->localmount == NULL)
relay->localmount = xmlStrdup (relay->mount);
relay->localmount = (char *)xmlStrdup (XMLSTR(relay->mount));
}
static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
@ -770,24 +768,24 @@ static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "port") == 0) {
if (xmlStrcmp (node->name, XMLSTR("port")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if(configuration->port == 0)
configuration->port = atoi(tmp);
listener->port = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "ssl") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("ssl")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
listener->ssl = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "shoutcast-compat") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("shoutcast-compat")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
listener->shoutcast_compat = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "bind-address") == 0) {
else if (xmlStrcmp (node->name, XMLSTR("bind-address")) == 0) {
listener->bind_address = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
}
@ -801,9 +799,9 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "source-password") == 0) {
if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
char *mount, *pass;
if ((mount = (char *)xmlGetProp(node, "mount")) != NULL) {
if ((mount = (char *)xmlGetProp(node, XMLSTR("mount"))) != NULL) {
pass = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
/* FIXME: This is a placeholder for per-mount passwords */
}
@ -813,22 +811,22 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
configuration->source_password =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
}
} else if (strcmp(node->name, "admin-password") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("admin-password")) == 0) {
if(configuration->admin_password)
xmlFree(configuration->admin_password);
configuration->admin_password =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "admin-user") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("admin-user")) == 0) {
if(configuration->admin_username)
xmlFree(configuration->admin_username);
configuration->admin_username =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "relay-password") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("relay-password")) == 0) {
if(configuration->relay_password)
xmlFree(configuration->relay_password);
configuration->relay_password =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "relay-user") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("relay-user")) == 0) {
if(configuration->relay_username)
xmlFree(configuration->relay_username);
configuration->relay_username =
@ -850,19 +848,19 @@ static void _parse_directory(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "yp-url") == 0) {
if (xmlStrcmp (node->name, XMLSTR("yp-url")) == 0) {
if (configuration->yp_url[configuration->num_yp_directories])
xmlFree(configuration->yp_url[configuration->num_yp_directories]);
configuration->yp_url[configuration->num_yp_directories] =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "yp-url-timeout") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("yp-url-timeout")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->yp_url_timeout[configuration->num_yp_directories] =
atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "server") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("server")) == 0) {
_add_server(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "touch-interval") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("touch-interval")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->yp_touch_interval[configuration->num_yp_directories] =
atoi(tmp);
@ -882,52 +880,52 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "basedir") == 0) {
if (xmlStrcmp (node->name, XMLSTR("basedir")) == 0) {
if (configuration->base_dir) xmlFree(configuration->base_dir);
configuration->base_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "logdir") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("logdir")) == 0) {
if (configuration->log_dir) xmlFree(configuration->log_dir);
configuration->log_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "pidfile") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("pidfile")) == 0) {
if (configuration->pidfile) xmlFree(configuration->pidfile);
configuration->pidfile = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "ssl-certificate") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("ssl-certificate")) == 0) {
if (configuration->cert_file) xmlFree(configuration->cert_file);
configuration->cert_file = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "webroot") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("webroot")) == 0) {
if (configuration->webroot_dir) xmlFree(configuration->webroot_dir);
configuration->webroot_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if(configuration->webroot_dir[strlen(configuration->webroot_dir)-1] == '/')
configuration->webroot_dir[strlen(configuration->webroot_dir)-1] = 0;
} else if (strcmp(node->name, "adminroot") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("adminroot")) == 0) {
if (configuration->adminroot_dir)
xmlFree(configuration->adminroot_dir);
configuration->adminroot_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if(configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] == '/')
configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] = 0;
} else if (strcmp(node->name, "alias") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("alias")) == 0) {
alias = malloc(sizeof(aliases));
alias->next = NULL;
alias->source = xmlGetProp(node, "source");
alias->source = (char *)xmlGetProp(node, XMLSTR("source"));
if(alias->source == NULL) {
free(alias);
continue;
}
alias->destination = xmlGetProp(node, "dest");
alias->destination = (char *)xmlGetProp(node, XMLSTR("dest"));
if(alias->destination == NULL) {
xmlFree(alias->source);
free(alias);
continue;
}
temp = NULL;
temp = xmlGetProp(node, "port");
temp = (char *)xmlGetProp(node, XMLSTR("port"));
if(temp != NULL) {
alias->port = atoi(temp);
xmlFree(temp);
}
else
alias->port = -1;
alias->bind_address = xmlGetProp(node, "bind-address");
alias->bind_address = (char *)xmlGetProp(node, XMLSTR("bind-address"));
current = configuration->aliases;
last = NULL;
while(current) {
@ -949,24 +947,24 @@ static void _parse_logging(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "accesslog") == 0) {
if (xmlStrcmp (node->name, XMLSTR("accesslog")) == 0) {
if (configuration->access_log) xmlFree(configuration->access_log);
configuration->access_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "errorlog") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("errorlog")) == 0) {
if (configuration->error_log) xmlFree(configuration->error_log);
configuration->error_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "playlistlog") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("playlistlog")) == 0) {
if (configuration->playlist_log) xmlFree(configuration->playlist_log);
configuration->playlist_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "logsize") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("logsize")) == 0) {
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->logsize = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "loglevel") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("loglevel")) == 0) {
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->loglevel = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "logarchive") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("logarchive")) == 0) {
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->logarchive = atoi(tmp);
if (tmp) xmlFree(tmp);
@ -984,21 +982,21 @@ static void _parse_security(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "chroot") == 0) {
if (xmlStrcmp (node->name, XMLSTR("chroot")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->chroot = atoi(tmp);
if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "changeowner") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("changeowner")) == 0) {
configuration->chuid = 1;
oldnode = node;
node = node->xmlChildrenNode;
do {
if(node == NULL) break;
if(xmlIsBlankNode(node)) continue;
if(strcmp(node->name, "user") == 0) {
if(xmlStrcmp (node->name, XMLSTR("user")) == 0) {
if(configuration->user) xmlFree(configuration->user);
configuration->user = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if(strcmp(node->name, "group") == 0) {
} else if(xmlStrcmp (node->name, XMLSTR("group")) == 0) {
if(configuration->group) xmlFree(configuration->group);
configuration->group = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
}
@ -1024,11 +1022,11 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (strcmp(node->name, "host") == 0) {
if (xmlStrcmp (node->name, XMLSTR("host")) == 0) {
server->host = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
addnode = 1;
} else if (strcmp(node->name, "touch-interval") == 0) {
} else if (xmlStrcmp (node->name, XMLSTR("touch-interval")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
server->touch_interval = atoi(tmp);
if (tmp) xmlFree(tmp);

View File

@ -27,6 +27,8 @@ struct _mount_proxy;
#include "auth.h"
#include "global.h"
#define XMLSTR(str) ((xmlChar *)(str))
typedef struct ice_config_dir_tag
{
char *host;

View File

@ -74,7 +74,7 @@ ogg_codec_t *initial_speex_page (format_plugin_t *plugin, ogg_page *page)
ogg_stream_packetout (&codec->os, &packet);
DEBUG0("checking for speex codec");
header = speex_packet_to_header (packet.packet, packet.bytes);
header = speex_packet_to_header ((char*)packet.packet, packet.bytes);
if (header == NULL)
{
ogg_stream_clear (&codec->os);

View File

@ -91,13 +91,13 @@ relay_server *relay_copy (relay_server *r)
if (copy)
{
copy->server = xmlStrdup (r->server);
copy->mount = xmlStrdup (r->mount);
copy->localmount = xmlStrdup (r->localmount);
copy->server = (char *)xmlCharStrdup (r->server);
copy->mount = (char *)xmlCharStrdup (r->mount);
copy->localmount = (char *)xmlCharStrdup (r->localmount);
if (r->username)
copy->username = xmlStrdup (r->username);
copy->username = (char *)xmlCharStrdup (r->username);
if (r->password)
copy->password = xmlStrdup (r->password);
copy->password = (char *)xmlCharStrdup (r->password);
copy->port = r->port;
copy->mp3metadata = r->mp3metadata;
copy->on_demand = r->on_demand;
@ -646,10 +646,10 @@ static int update_from_master(ice_config_t *config)
r = calloc (1, sizeof (relay_server));
if (r)
{
r->server = xmlStrdup (master);
r->server = (char *)xmlCharStrdup (master);
r->port = port;
r->mount = xmlStrdup (buf);
r->localmount = xmlStrdup (buf);
r->mount = (char *)xmlCharStrdup (buf);
r->localmount = (char *)xmlCharStrdup (buf);
r->mp3metadata = 1;
r->on_demand = on_demand;
r->next = new_relays;

View File

@ -911,8 +911,8 @@ static xmlNodePtr _find_xml_node(char *mount, source_xml_t **list, xmlNodePtr ro
/* build node */
node = (source_xml_t *)malloc(sizeof(source_xml_t));
node->mount = strdup(mount);
node->node = xmlNewChild(root, NULL, "source", NULL);
xmlSetProp(node->node, "mount", mount);
node->node = xmlNewChild (root, NULL, XMLSTR("source"), NULL);
xmlSetProp (node->node, XMLSTR("mount"), XMLSTR(mount));
node->next = NULL;
/* add node */
@ -952,8 +952,8 @@ void stats_get_xml(xmlDocPtr *doc, int show_hidden, const char *show_mount)
event_queue_init (&queue);
_dump_stats_to_queue (&queue);
*doc = xmlNewDoc("1.0");
node = xmlNewDocNode(*doc, NULL, "icestats", NULL);
*doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode(*doc, NULL, XMLSTR("icestats"), NULL);
xmlDocSetRootElement(*doc, node);
event = _get_event_from_queue(&queue);
@ -964,8 +964,8 @@ void stats_get_xml(xmlDocPtr *doc, int show_hidden, const char *show_mount)
do
{
xmlChar *name, *value;
name = xmlEncodeEntitiesReentrant (*doc, event->name);
value = xmlEncodeEntitiesReentrant (*doc, event->value);
name = xmlEncodeEntitiesReentrant (*doc, XMLSTR(event->name));
value = xmlEncodeEntitiesReentrant (*doc, XMLSTR(event->value));
srcnode = node;
if (event->source)
{
@ -975,7 +975,7 @@ void stats_get_xml(xmlDocPtr *doc, int show_hidden, const char *show_mount)
}
else
srcnode = node;
xmlNewChild(srcnode, NULL, name, value);
xmlNewChild(srcnode, NULL, XMLSTR(name), XMLSTR(value));
xmlFree (value);
xmlFree (name);
} while (0);
@ -1007,18 +1007,18 @@ void stats_sendxml(client_t *client)
event_queue_init (&queue);
_dump_stats_to_queue (&queue);
doc = xmlNewDoc("1.0");
node = xmlNewDocNode(doc, NULL, "icestats", NULL);
doc = xmlNewDoc (XMLSTR("1.0"));
node = xmlNewDocNode (doc, NULL, XMLSTR("icestats"), NULL);
xmlDocSetRootElement(doc, node);
event = _get_event_from_queue(&queue);
while (event) {
if (event->source == NULL) {
xmlNewChild(node, NULL, event->name, event->value);
xmlNewChild (node, NULL, XMLSTR(event->name), XMLSTR(event->value));
} else {
srcnode = _find_xml_node(event->source, &src_nodes, node);
xmlNewChild(srcnode, NULL, event->name, event->value);
xmlNewChild (srcnode, NULL, XMLSTR(event->name), XMLSTR(event->value));
}
_free_event(event);

View File

@ -160,7 +160,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
xsltFreeStylesheet(cache[i].stylesheet);
cache[i].last_modified = file.st_mtime;
cache[i].stylesheet = xsltParseStylesheetFile(fn);
cache[i].stylesheet = xsltParseStylesheetFile (XMLSTR(fn));
cache[i].cache_age = time(NULL);
}
DEBUG1("Using cached sheet %i", i);
@ -178,7 +178,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
cache[i].last_modified = file.st_mtime;
cache[i].filename = strdup(fn);
cache[i].stylesheet = xsltParseStylesheetFile(fn);
cache[i].stylesheet = xsltParseStylesheetFile (XMLSTR(fn));
cache[i].cache_age = time(NULL);
return cache[i].stylesheet;
}
@ -216,10 +216,10 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
else
{
/* check method for the default, a missing method assumes xml */
if (cur->method && xmlStrcmp (cur->method, "html") == 0)
if (cur->method && xmlStrcmp (cur->method, XMLSTR("html")) == 0)
mediatype = "text/html";
else
if (cur->method && xmlStrcmp (cur->method, "text") == 0)
if (cur->method && xmlStrcmp (cur->method, XMLSTR("text")) == 0)
mediatype = "text/plain";
else
mediatype = "text/xml";