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

Cleanup: unify util.c a bit with libshout.

This commit is contained in:
Philipp Schafft 2015-11-28 10:44:05 +00:00
parent 2608422ce4
commit 32216013b2

View File

@ -1,14 +1,15 @@
/* Icecast /* Icecast
* *
* This program is distributed under the GNU General Public License, version 2. * Copyright 2000-2004 Jack Moffitt <jack@xiph.org,
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>, * Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>, * oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org> * Karl Heyes <karl@xiph.org>
* and others (see AUTHORS for details). * and others (see AUTHORS for details).
* Copyright 2012-2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>, * Copyright 2012-2015 Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -20,28 +21,32 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifndef _WIN32 #ifndef _WIN32
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_POLL #ifdef HAVE_POLL
#include <sys/poll.h> #include <sys/poll.h>
#endif #endif
#else #else
#include <winsock2.h>
#include <windows.h> #include <windows.h>
#include <stdio.h>
#endif #endif
#include "common/net/sock.h" #include "common/net/sock.h"
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "util.h"
#include "compat.h" #include "compat.h"
#include "refbuf.h" #include "refbuf.h"
#include "connection.h" #include "connection.h"
#include "client.h" #include "client.h"
#include "util.h"
#include "source.h" #include "source.h"
#include "admin.h" #include "admin.h"
@ -820,9 +825,8 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
return 1; return 1;
} }
/* given a dictionary, URL-encode each val and /* given a dictionary, URL-encode each val and stringify it in order as
stringify it in order as key=val&key=val... if val key=val&key=val... if val is set, or just key&key if val is NULL.
is set, or just key&key if val is NULL.
TODO: Memory management needs overhaul. */ TODO: Memory management needs overhaul. */
char *util_dict_urlencode(util_dict *dict, char delim) char *util_dict_urlencode(util_dict *dict, char delim)
{ {
@ -943,4 +947,3 @@ int get_line(FILE *file, char *buf, size_t siz)
} }
return 0; return 0;
} }