1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

const updates, no functional changes

svn path=/icecast/trunk/icecast/; revision=13559
This commit is contained in:
Karl Heyes 2007-08-16 22:49:13 +00:00
parent eebb33b8a1
commit 5f8cfd70f7
13 changed files with 63 additions and 59 deletions

View File

@ -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_send_response (xmlDocPtr doc, client_t *client,
}
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 @@ void admin_handle_request(client_t *client, char *uri)
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 html_success(client_t *client, char *message)
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 @@ static void command_show_listeners(client_t *client, source_t *source,
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_show_listeners(client_t *client, source_t *source,
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 @@ static void command_manageauth(client_t *client, source_t *source,
{
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_source(client_t *client, source_t *source,
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_kill_client(client_t *client, source_t *source,
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_fallback(client_t *client, source_t *source,
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_metadata(client_t *client, source_t *source,
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");

View File

@ -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);

View File

@ -47,7 +47,7 @@ static thread_type *auth_thread;
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;

View File

@ -515,7 +515,7 @@ int connection_complete_source (source_t *source, int response)
if (global.sources < config->source_limit)
{
char *contenttype;
const char *contenttype;
mount_proxy *mountinfo;
format_type_t format_type;
@ -590,10 +590,10 @@ int connection_complete_source (source_t *source, int response)
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 @@ static int _check_pass_http(http_parser_t *parser,
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 @@ static int _check_pass_icy(http_parser_t *parser, char *correctpass)
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 @@ int connection_check_admin_pass(http_parser_t *parser)
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 @@ int connection_check_source_pass(http_parser_t *parser, const char *mount)
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_shoutcast_compatible (client_queue_t *node)
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 @@ static void *_handle_connection(void *arg)
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;

View File

@ -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 */

View File

@ -39,7 +39,7 @@ typedef struct _format_plugin_tag
/* 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 @@ typedef struct _format_plugin_tag
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 @@ typedef struct _format_plugin_tag
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);

View File

@ -61,7 +61,7 @@ static int format_mp3_create_client_data (source_t *source, client_t *client);
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 @@ typedef struct {
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 @@ int format_mp3_get_plugin (source_t *source)
}
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 @@ static void format_mp3_apply_settings (client_t *client, format_plugin_t *format
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)
{

View File

@ -67,7 +67,7 @@ static int process_vorbis_headers (ogg_state_t *ogg_info, ogg_codec_t *codec);
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 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
/* 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;

View File

@ -375,7 +375,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
{
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 @@ int fserve_client_create (client_t *httpclient, const char *path)
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, '.');

View File

@ -115,7 +115,7 @@ void logging_access(client_t *client)
struct tm thetime;
time_t now;
time_t stayed;
char *referrer, *user_agent, *username;
const char *referrer, *user_agent, *username;
now = time(NULL);

View File

@ -564,7 +564,8 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
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 @@ static void _parse_audio_info (source_t *source, const char *s)
/* 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;

View File

@ -140,7 +140,7 @@ char *util_get_extension(const char *path) {
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 @@ static char safechars[256] = {
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 @@ char *util_url_escape(char *src)
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 @@ char *util_url_unescape(char *src)
* 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 @@ char *util_bin_to_hex(unsigned char *data, int len)
}
/* 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 @@ char *util_base64_encode(char *data)
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];

View File

@ -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 */