diff options
Diffstat (limited to 'src/xine-utils')
-rw-r--r-- | src/xine-utils/monitor.c | 18 | ||||
-rw-r--r-- | src/xine-utils/ring_buffer.c | 4 | ||||
-rw-r--r-- | src/xine-utils/sorted_array.c | 4 | ||||
-rw-r--r-- | src/xine-utils/sorted_array.h | 4 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 8 | ||||
-rw-r--r-- | src/xine-utils/xine_buffer.c | 21 | ||||
-rw-r--r-- | src/xine-utils/xine_buffer.h | 6 | ||||
-rw-r--r-- | src/xine-utils/xine_mutex.c | 11 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 10 |
9 files changed, 37 insertions, 49 deletions
diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index ecc420377..6d7cba367 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: monitor.c,v 1.7 2003/12/09 00:02:39 f1rmb Exp $ + * $Id: monitor.c,v 1.8 2006/06/23 18:24:22 dsalt Exp $ * * debug print and profiling functions - implementation * @@ -35,10 +35,10 @@ #ifdef DEBUG -long long int profiler_times[MAX_ID] ; -long long int profiler_start[MAX_ID] ; -long profiler_calls[MAX_ID] ; -char * profiler_label[MAX_ID] ; +static long long int profiler_times[MAX_ID] ; +static long long int profiler_start[MAX_ID] ; +static long profiler_calls[MAX_ID] ; +static const char *profiler_label[MAX_ID] ; void xine_profiler_init () { int i; @@ -50,7 +50,7 @@ void xine_profiler_init () { } } -int xine_profiler_allocate_slot (char *label) { +int xine_profiler_allocate_slot (const char *label) { int id; for (id = 0; id < MAX_ID && profiler_label[id] != NULL; id++) @@ -65,7 +65,7 @@ int xine_profiler_allocate_slot (char *label) { #if defined(ARCH_X86) || defined(ARCH_X86_64) -__inline__ unsigned long long int rdtsc() +__inline__ unsigned long long int rdtsc(void) { unsigned long long int x; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); @@ -92,7 +92,7 @@ void xine_profiler_stop_count (int id) { profiler_calls[id]++; } -void xine_profiler_print_results () { +void xine_profiler_print_results (void) { int i; #if defined(ARCH_X86) || defined(ARCH_X86_64) @@ -143,7 +143,7 @@ void xine_profiler_print_results () { void xine_profiler_init (void) { NO_PROFILER_MSG } -int xine_profiler_allocate_slot (char *label) { +int xine_profiler_allocate_slot (const char *label) { return -1; } void xine_profiler_start_count (int id) { diff --git a/src/xine-utils/ring_buffer.c b/src/xine-utils/ring_buffer.c index a98e1f261..dbad685d1 100644 --- a/src/xine-utils/ring_buffer.c +++ b/src/xine-utils/ring_buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: ring_buffer.c,v 1.3 2006/04/05 22:12:20 valtri Exp $ + * $Id: ring_buffer.c,v 1.4 2006/06/23 18:24:22 dsalt Exp $ * */ #ifdef HAVE_CONFIG_H @@ -138,7 +138,7 @@ void xine_ring_buffer_delete(xine_ring_buffer_t *ring_buffer) { free (ring_buffer); } -static void xine_ring_buffer_display_stat(xine_ring_buffer_t *ring_buffer) { +static void xine_ring_buffer_display_stat(const xine_ring_buffer_t *ring_buffer) { #if DEBUG_RING_BUFFER size_t free_size, full_size; diff --git a/src/xine-utils/sorted_array.c b/src/xine-utils/sorted_array.c index 3046969f5..fe5edf277 100644 --- a/src/xine-utils/sorted_array.c +++ b/src/xine-utils/sorted_array.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sorted_array.c,v 1.1 2006/01/16 08:04:44 tmattern Exp $ + * $Id: sorted_array.c,v 1.2 2006/06/23 18:24:22 dsalt Exp $ * */ #ifdef HAVE_CONFIG_H @@ -56,7 +56,7 @@ void xine_sarray_delete(xine_sarray_t *sarray) { free(sarray); } -size_t xine_sarray_size(xine_sarray_t *sarray) { +size_t xine_sarray_size(const xine_sarray_t *sarray) { return xine_array_size(sarray->array); } diff --git a/src/xine-utils/sorted_array.h b/src/xine-utils/sorted_array.h index c5fe1b413..5ca537f88 100644 --- a/src/xine-utils/sorted_array.h +++ b/src/xine-utils/sorted_array.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sorted_array.h,v 1.1 2006/01/16 08:04:44 tmattern Exp $ + * $Id: sorted_array.h,v 1.2 2006/06/23 18:24:22 dsalt Exp $ * * Sorted array which grows automatically when you add elements. * A binary search is used to find the position of a new element. @@ -72,7 +72,7 @@ xine_sarray_t *xine_sarray_new(size_t initial_size, xine_sarray_comparator_t com void xine_sarray_delete(xine_sarray_t *sarray); /* Returns the number of element stored in the array */ -size_t xine_sarray_size(xine_sarray_t *sarray); +size_t xine_sarray_size(const xine_sarray_t *sarray); /* Removes all elements from an array */ void xine_sarray_clear(xine_sarray_t *sarray); diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 477789e3b..cb072e99a 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.44 2006/06/10 00:21:51 dgp85 Exp $ + * $Id: utils.c,v 1.45 2006/06/23 18:24:22 dsalt Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -70,7 +70,7 @@ typedef struct { /* * information about locales used in xine */ -static lang_locale_t lang_locales[] = { +static const lang_locale_t lang_locales[] = { { "af_ZA", "iso-8859-1", "iso-8859-1", NULL }, { "ar_AE", "iso-8859-6", "iso-8859-6", NULL }, { "ar_BH", "iso-8859-6", "iso-8859-6", NULL }, @@ -488,12 +488,12 @@ void xine_hexdump (const char *buf, int length) { } -static const lang_locale_t *_get_first_lang_locale(char *lcal) { +static const lang_locale_t *_get_first_lang_locale(const char *lcal) { const lang_locale_t *llocale; int lang_len; char *mod; - if(lcal && strlen(lcal)) { + if(lcal && *lcal) { llocale = &*lang_locales; if ((mod = strchr(lcal, '@'))) diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c index 0a10f80a2..17b3a79db 100644 --- a/src/xine-utils/xine_buffer.c +++ b/src/xine-utils/xine_buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_buffer.c,v 1.10 2006/06/20 00:35:08 dgp85 Exp $ + * $Id: xine_buffer.c,v 1.11 2006/06/23 18:24:22 dsalt Exp $ * * * generic dynamic buffer functions. The goals @@ -152,7 +152,7 @@ void *_xine_buffer_free(void *buf) { /* * duplicates a buffer */ -void *xine_buffer_dup(void *buf) { +void *xine_buffer_dup(const void *buf) { uint8_t *new; @@ -242,26 +242,13 @@ void *_xine_buffer_set(void *buf, int index, uint8_t b, int len) { } /* - * concatnates given buf (which schould contain a null terminated string) + * concatenates given buf (which should contain a null terminated string) * with another string. */ #define xine_buffer_strcat(buf,data) \ buf=_xine_buffer_strcat(buf,data) void *_xine_buffer_strcat(void *buf, const char *data) { - -#ifdef CHECKS - if (!buf || !data) { - lprintf("warning: got NULL pointer\n"); - return NULL; - } - CHECK_MAGIC(buf); -#endif - - GROW_TO(buf, strlen(buf)+strlen(data)+1); - - strcat(buf, data); - - return buf; + return _xine_buffer_strcpy(buf, strlen(buf), data); } /* diff --git a/src/xine-utils/xine_buffer.h b/src/xine-utils/xine_buffer.h index 2cb7dfe72..197807d57 100644 --- a/src/xine-utils/xine_buffer.h +++ b/src/xine-utils/xine_buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_buffer.h,v 1.5 2006/02/14 19:12:16 dsalt Exp $ + * $Id: xine_buffer.h,v 1.6 2006/06/23 18:24:22 dsalt Exp $ * * * generic dynamic buffer functions. The goals @@ -76,7 +76,7 @@ void *_xine_buffer_free(void *buf); /* * duplicates a buffer */ -void *xine_buffer_dup(void *buf); +void *xine_buffer_dup(const void *buf); /* * will copy len bytes of data into buf at position index. @@ -100,7 +100,7 @@ void xine_buffer_copyout(const void *buf, int index, void *data, int len); void *_xine_buffer_set(void *buf, int index, uint8_t b, int len); /* - * concatnates given buf (which schould contain a null terminated string) + * concatenates given buf (which should contain a null terminated string) * with another string. */ #define xine_buffer_strcat(buf,data) \ diff --git a/src/xine-utils/xine_mutex.c b/src/xine-utils/xine_mutex.c index 677aeb913..d32483363 100644 --- a/src/xine-utils/xine_mutex.c +++ b/src/xine-utils/xine_mutex.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_mutex.c,v 1.2 2003/12/09 00:02:39 f1rmb Exp $ + * $Id: xine_mutex.c,v 1.3 2006/06/23 18:24:22 dsalt Exp $ * */ @@ -32,16 +32,17 @@ #define DBG_MUTEX int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr, - char *id) { + const char *id) { #ifdef DBG_MUTEX - strcpy (mutex->id, id); + strncpy (mutex->id, sizeof (mutex->id), id); + mutex->id[sizeof (mutex->id) - 1] = 0; #endif return pthread_mutex_init (&mutex->mutex, mutexattr); } -int xine_mutex_lock (xine_mutex_t *mutex, char *who) { +int xine_mutex_lock (xine_mutex_t *mutex, const char *who) { #ifndef DBG_MUTEX @@ -65,7 +66,7 @@ int xine_mutex_lock (xine_mutex_t *mutex, char *who) { #endif } -int xine_mutex_unlock (xine_mutex_t *mutex, char *who) { +int xine_mutex_unlock (xine_mutex_t *mutex, const char *who) { printf ("xine_mutex: mutex %s unlocked by %s\n", mutex->id, who); diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index c3b56c8c7..32579edee 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.101 2006/04/08 16:42:38 valtri Exp $ + * $Id: xineutils.h,v 1.102 2006/06/23 18:24:22 dsalt Exp $ * */ #ifndef XINEUTILS_H @@ -86,10 +86,10 @@ extern "C" { } xine_mutex_t; int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr, - char *id); + const char *id); - int xine_mutex_lock (xine_mutex_t *mutex, char *who); - int xine_mutex_unlock (xine_mutex_t *mutex, char *who); + int xine_mutex_lock (xine_mutex_t *mutex, const char *who); + int xine_mutex_unlock (xine_mutex_t *mutex, const char *who); int xine_mutex_destroy (xine_mutex_t *mutex); @@ -615,7 +615,7 @@ void xine_probe_fast_memcpy(xine_t *xine); * profiling (unworkable in non DEBUG isn't defined) */ void xine_profiler_init (void); -int xine_profiler_allocate_slot (char *label); +int xine_profiler_allocate_slot (const char *label); void xine_profiler_start_count (int id); void xine_profiler_stop_count (int id); void xine_profiler_print_results (void); |