[xiph-commits] r13559 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Thu Aug 16 15:49:13 PDT 2007
Author: karl
Date: 2007-08-16 15:49:13 -0700 (Thu, 16 Aug 2007)
New Revision: 13559
Modified:
icecast/trunk/icecast/src/admin.c
icecast/trunk/icecast/src/admin.h
icecast/trunk/icecast/src/auth.c
icecast/trunk/icecast/src/connection.c
icecast/trunk/icecast/src/format.c
icecast/trunk/icecast/src/format.h
icecast/trunk/icecast/src/format_mp3.c
icecast/trunk/icecast/src/format_vorbis.c
icecast/trunk/icecast/src/fserve.c
icecast/trunk/icecast/src/logging.c
icecast/trunk/icecast/src/source.c
icecast/trunk/icecast/src/util.c
icecast/trunk/icecast/src/util.h
Log:
const updates, no functional changes
Modified: icecast/trunk/icecast/src/admin.c
===================================================================
--- icecast/trunk/icecast/src/admin.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/admin.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -110,7 +110,7 @@
#define DEFAULT_TRANSFORMED_REQUEST ""
#define BUILDM3U_RAW_REQUEST "buildm3u"
-int admin_get_command(char *command)
+int admin_get_command(const char *command)
{
if(!strcmp(command, FALLBACK_RAW_REQUEST))
return COMMAND_RAW_FALLBACK;
@@ -303,9 +303,9 @@
}
-void admin_handle_request(client_t *client, char *uri)
+void admin_handle_request(client_t *client, const char *uri)
{
- char *mount, *command_string;
+ const char *mount, *command_string;
int command;
int noauth = 0;
@@ -337,7 +337,7 @@
if (command == COMMAND_SHOUTCAST_METADATA_UPDATE) {
ice_config_t *config;
- char *pass = httpp_get_query_param (client->parser, "pass");
+ const char *pass = httpp_get_query_param (client->parser, "pass");
if (pass == NULL)
{
client_send_400 (client, "missing pass parameter");
@@ -556,7 +556,7 @@
static void command_move_clients(client_t *client, source_t *source,
int response)
{
- char *dest_source;
+ const char *dest_source;
source_t *dest;
xmlDocPtr doc;
xmlNodePtr node;
@@ -623,7 +623,7 @@
avl_node *client_node;
client_t *current;
char buf[22];
- char *userAgent = NULL;
+ const char *userAgent = NULL;
time_t now = time(NULL);
doc = xmlNewDoc("1.0");
@@ -671,8 +671,8 @@
static void command_buildm3u(client_t *client, source_t *source,
int response)
{
- char *username = NULL;
- char *password = NULL;
+ const char *username = NULL;
+ const char *password = NULL;
ice_config_t *config;
COMMAND_REQUIRE(client, "username", username);
@@ -703,9 +703,9 @@
{
xmlDocPtr doc;
xmlNodePtr node, srcnode, msgnode;
- char *action = NULL;
- char *username = NULL;
- char *password = NULL;
+ const char *action = NULL;
+ const char *username = NULL;
+ const char *password = NULL;
char *message = NULL;
int ret = AUTH_OK;
ice_config_t *config = config_get_config ();
@@ -792,7 +792,7 @@
static void command_kill_client(client_t *client, source_t *source,
int response)
{
- char *idtext;
+ const char *idtext;
int id;
client_t *listener;
xmlDocPtr doc;
@@ -836,7 +836,7 @@
static void command_fallback(client_t *client, source_t *source,
int response)
{
- char *fallback;
+ const char *fallback;
char *old;
DEBUG0("Got fallback request");
@@ -853,8 +853,8 @@
static void command_metadata(client_t *client, source_t *source,
int response)
{
- char *action;
- char *song, *title, *artist;
+ const char *action;
+ const char *song, *title, *artist;
format_plugin_t *plugin;
xmlDocPtr doc;
xmlNodePtr node;
@@ -920,8 +920,8 @@
static void command_shoutcast_metadata(client_t *client, source_t *source)
{
- char *action;
- char *value;
+ const char *action;
+ const char *value;
DEBUG0("Got shoutcast metadata update request");
Modified: icecast/trunk/icecast/src/admin.h
===================================================================
--- icecast/trunk/icecast/src/admin.h 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/admin.h 2007-08-16 22:49:13 UTC (rev 13559)
@@ -23,7 +23,7 @@
#define TRANSFORMED 2
#define PLAINTEXT 3
-void admin_handle_request(client_t *client, char *uri);
+void admin_handle_request(client_t *client, const char *uri);
void admin_send_response(xmlDocPtr doc, client_t *client,
int response, const char *xslt_template);
Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/auth.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -47,7 +47,7 @@
static void auth_client_setup (mount_proxy *mountinfo, client_t *client)
{
/* This will look something like "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" */
- char *header = httpp_getvar(client->parser, "authorization");
+ const char *header = httpp_getvar(client->parser, "authorization");
char *userpass, *tmp;
char *username, *password;
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/connection.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -515,7 +515,7 @@
if (global.sources < config->source_limit)
{
- char *contenttype;
+ const char *contenttype;
mount_proxy *mountinfo;
format_type_t format_type;
@@ -590,10 +590,10 @@
static int _check_pass_http(http_parser_t *parser,
- char *correctuser, char *correctpass)
+ const char *correctuser, const char *correctpass)
{
/* This will look something like "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" */
- char *header = httpp_getvar(parser, "authorization");
+ const char *header = httpp_getvar(parser, "authorization");
char *userpass, *tmp;
char *username, *password;
@@ -628,9 +628,9 @@
return 1;
}
-static int _check_pass_icy(http_parser_t *parser, char *correctpass)
+static int _check_pass_icy(http_parser_t *parser, const char *correctpass)
{
- char *password;
+ const char *password;
password = httpp_getvar(parser, HTTPP_VAR_ICYPASSWORD);
if(!password)
@@ -642,9 +642,9 @@
return 1;
}
-static int _check_pass_ice(http_parser_t *parser, char *correctpass)
+static int _check_pass_ice(http_parser_t *parser, const char *correctpass)
{
- char *password;
+ const char *password;
password = httpp_getvar(parser, "ice-password");
if(!password)
@@ -662,7 +662,7 @@
ice_config_t *config = config_get_config();
char *pass = config->admin_password;
char *user = config->admin_username;
- char *protocol;
+ const char *protocol;
if(!pass || !user) {
config_release_config();
@@ -702,7 +702,7 @@
char *user = "source";
int ret;
int ice_login = config->ice_login;
- char *protocol;
+ const char *protocol;
mount_proxy *mountinfo = config_find_mount (config, mount);
@@ -995,7 +995,7 @@
static void *_handle_connection(void *arg)
{
http_parser_t *parser;
- char *rawuri, *uri;
+ const char *rawuri;
while (global.running == ICE_RUNNING) {
@@ -1018,6 +1018,8 @@
client->parser = parser;
if (httpp_parse (parser, client->refbuf->data, node->offset))
{
+ char *uri;
+
/* we may have more than just headers, so prepare for it */
if (node->stream_offset == node->offset)
client->refbuf->len = 0;
Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/format.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -52,7 +52,7 @@
static int format_prepare_headers (source_t *source, client_t *client);
-format_type_t format_get_type(char *contenttype)
+format_type_t format_get_type (const char *contenttype)
{
if(strcmp(contenttype, "application/x-ogg") == 0)
return FORMAT_TYPE_OGG; /* Backwards compatibility */
Modified: icecast/trunk/icecast/src/format.h
===================================================================
--- icecast/trunk/icecast/src/format.h 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/format.h 2007-08-16 22:49:13 UTC (rev 13559)
@@ -39,7 +39,7 @@
/* we need to know the mount to report statistics */
char *mount;
- char *contenttype;
+ const char *contenttype;
uint64_t read_bytes;
uint64_t sent_bytes;
@@ -47,7 +47,7 @@
int (*write_buf_to_client)(client_t *client);
void (*write_buf_to_file)(struct source_tag *source, refbuf_t *refbuf);
int (*create_client_data)(struct source_tag *source, client_t *client);
- void (*set_tag)(struct _format_plugin_tag *plugin, char *tag, char *value);
+ void (*set_tag)(struct _format_plugin_tag *plugin, const char *tag, const char *value);
void (*free_plugin)(struct _format_plugin_tag *self);
void (*apply_settings)(client_t *client, struct _format_plugin_tag *format, struct _mount_proxy *mount);
@@ -55,7 +55,7 @@
void *_state;
} format_plugin_t;
-format_type_t format_get_type(char *contenttype);
+format_type_t format_get_type(const char *contenttype);
char *format_get_mimetype(format_type_t type);
int format_get_plugin(format_type_t type, struct source_tag *source);
Modified: icecast/trunk/icecast/src/format_mp3.c
===================================================================
--- icecast/trunk/icecast/src/format_mp3.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/format_mp3.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -61,7 +61,7 @@
static void free_mp3_client_data (client_t *client);
static int format_mp3_write_buf_to_client(client_t *client);
static void write_mp3_to_file (struct source_tag *source, refbuf_t *refbuf);
-static void mp3_set_tag (format_plugin_t *plugin, char *tag, char *value);
+static void mp3_set_tag (format_plugin_t *plugin, const char *tag, const char *value);
static void format_mp3_apply_settings(client_t *client, format_plugin_t *format, mount_proxy *mount);
@@ -75,7 +75,7 @@
int format_mp3_get_plugin (source_t *source)
{
- char *metadata;
+ const char *metadata;
format_plugin_t *plugin;
mp3_state *state = calloc(1, sizeof(mp3_state));
refbuf_t *meta;
@@ -124,7 +124,7 @@
}
-static void mp3_set_tag (format_plugin_t *plugin, char *tag, char *value)
+static void mp3_set_tag (format_plugin_t *plugin, const char *tag, const char *value)
{
mp3_state *source_mp3 = plugin->_state;
unsigned int len;
@@ -199,7 +199,7 @@
if (mount == NULL || mount->mp3_meta_interval < 0)
{
- char *metadata = httpp_getvar (client->parser, "icy-metaint");
+ const char *metadata = httpp_getvar (client->parser, "icy-metaint");
source_mp3->interval = -1;
if (metadata)
{
Modified: icecast/trunk/icecast/src/format_vorbis.c
===================================================================
--- icecast/trunk/icecast/src/format_vorbis.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/format_vorbis.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -67,7 +67,7 @@
static refbuf_t *process_vorbis_page (ogg_state_t *ogg_info,
ogg_codec_t *codec, ogg_page *page);
static refbuf_t *process_vorbis (ogg_state_t *ogg_info, ogg_codec_t *codec);
-static void vorbis_set_tag (format_plugin_t *plugin, char *tag, char *value);
+static void vorbis_set_tag (format_plugin_t *plugin, const char *tag, const char *value);
static void free_ogg_packet (ogg_packet *packet)
@@ -413,7 +413,7 @@
/* called from the admin interface, here we update the artist/title info
* and schedule a new set of header pages
*/
-static void vorbis_set_tag (format_plugin_t *plugin, char *tag, char *value)
+static void vorbis_set_tag (format_plugin_t *plugin, const char *tag, const char *value)
{
ogg_state_t *ogg_info = plugin->_state;
ogg_codec_t *codec = ogg_info->codecs;
Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/fserve.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -375,7 +375,7 @@
{
int bytes;
struct stat file_buf;
- char *range = NULL;
+ const char *range = NULL;
int64_t new_content_len = 0;
int64_t rangenumber = 0, content_length;
int rangeproblem = 0;
@@ -414,7 +414,7 @@
if (m3u_requested && m3u_file_available == 0)
{
- char *host = httpp_getvar (httpclient->parser, "host");
+ const char *host = httpp_getvar (httpclient->parser, "host");
char *sourceuri = strdup (path);
char *dot = strrchr(sourceuri, '.');
Modified: icecast/trunk/icecast/src/logging.c
===================================================================
--- icecast/trunk/icecast/src/logging.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/logging.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -115,7 +115,7 @@
struct tm thetime;
time_t now;
time_t stayed;
- char *referrer, *user_agent, *username;
+ const char *referrer, *user_agent, *username;
now = time(NULL);
Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/source.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -564,7 +564,8 @@
static void source_init (source_t *source)
{
ice_config_t *config = config_get_config();
- char *listenurl, *str;
+ char *listenurl;
+ const char *str;
int listen_url_size;
mount_proxy *mountinfo;
@@ -929,7 +930,7 @@
/* Apply the mountinfo details to the source */
static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
{
- char *str;
+ const char *str;
int val;
http_parser_t *parser = NULL;
Modified: icecast/trunk/icecast/src/util.c
===================================================================
--- icecast/trunk/icecast/src/util.c 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/util.c 2007-08-16 22:49:13 UTC (rev 13559)
@@ -140,7 +140,7 @@
return ext+1;
}
-int util_check_valid_extension(char *uri) {
+int util_check_valid_extension(const char *uri) {
int ret = 0;
char *p2;
@@ -263,12 +263,12 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-char *util_url_escape(char *src)
+char *util_url_escape (const char *src)
{
int len = strlen(src);
/* Efficiency not a big concern here, keep the code simple/conservative */
char *dst = calloc(1, len*3 + 1);
- unsigned char *source = src;
+ unsigned char *source = (unsigned char *)src;
int i,j=0;
for(i=0; i < len; i++) {
@@ -287,10 +287,10 @@
return dst;
}
-char *util_url_unescape(char *src)
+char *util_url_unescape (const char *src)
{
int len = strlen(src);
- unsigned char *decoded;
+ char *decoded;
int i;
char *dst;
int done = 0;
@@ -340,7 +340,7 @@
* escape from the webroot) or if it cannot be URI-decoded.
* Caller should free the path.
*/
-char *util_normalise_uri(char *uri) {
+char *util_normalise_uri(const char *uri) {
char *path;
if(uri[0] != '/')
@@ -405,7 +405,7 @@
}
/* This isn't efficient, but it doesn't need to be */
-char *util_base64_encode(char *data)
+char *util_base64_encode(const char *data)
{
int len = strlen(data);
char *out = malloc(len*4/3 + 4);
@@ -438,9 +438,10 @@
return result;
}
-char *util_base64_decode(unsigned char *input)
+char *util_base64_decode(const char *data)
{
- int len = strlen(input);
+ const unsigned char *input = (const unsigned char *)data;
+ int len = strlen (data);
char *out = malloc(len*3/4 + 5);
char *result = out;
signed char vals[4];
Modified: icecast/trunk/icecast/src/util.h
===================================================================
--- icecast/trunk/icecast/src/util.h 2007-08-16 08:54:30 UTC (rev 13558)
+++ icecast/trunk/icecast/src/util.h 2007-08-16 22:49:13 UTC (rev 13559)
@@ -21,17 +21,17 @@
int util_timed_wait_for_fd(int fd, int timeout);
int util_read_header(int sock, char *buff, unsigned long len, int entire);
-int util_check_valid_extension(char *uri);
+int util_check_valid_extension(const char *uri);
char *util_get_extension(const char *path);
char *util_get_path_from_uri(char *uri);
char *util_get_path_from_normalised_uri(const char *uri);
-char *util_normalise_uri(char *uri);
-char *util_base64_encode(char *data);
-char *util_base64_decode(unsigned char *input);
+char *util_normalise_uri(const char *uri);
+char *util_base64_encode(const char *data);
+char *util_base64_decode(const char *input);
char *util_bin_to_hex(unsigned char *data, int len);
-char *util_url_unescape(char *src);
-char *util_url_escape(char *src);
+char *util_url_unescape(const char *src);
+char *util_url_escape(const char *src);
/* String dictionary type, without support for NULL keys, or multiple
* instances of the same key */
More information about the commits
mailing list