2006-07-12 00:39:11 -04:00
|
|
|
/*
|
|
|
|
* simple utility functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UTIL_H_
|
|
|
|
#define _UTIL_H_
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_STDINT_H
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2006-12-31 16:28:47 -05:00
|
|
|
typedef enum {
|
|
|
|
l_err,
|
|
|
|
l_conf,
|
|
|
|
l_plugin,
|
2007-01-16 20:06:16 -05:00
|
|
|
l_memdebug,
|
2007-04-13 17:37:42 -04:00
|
|
|
l_upnp,
|
2006-12-31 16:28:47 -05:00
|
|
|
l_last
|
2007-04-05 22:57:06 -04:00
|
|
|
} ff_lock_t;
|
2006-12-31 16:28:47 -05:00
|
|
|
|
|
|
|
/* debugging lock wrappers */
|
|
|
|
|
2007-04-05 22:57:06 -04:00
|
|
|
extern void util_mutex_lock(ff_lock_t which);
|
|
|
|
extern void util_mutex_unlock(ff_lock_t which);
|
2006-12-31 16:28:47 -05:00
|
|
|
|
2006-07-12 00:39:11 -04:00
|
|
|
/* simple hashing functions */
|
|
|
|
extern uint32_t util_djb_hash_block(unsigned char *data, uint32_t len);
|
|
|
|
extern uint32_t util_djb_hash_str(char *str);
|
|
|
|
|
2006-07-13 04:29:21 -04:00
|
|
|
extern int util_must_exit(void);
|
2006-07-12 00:39:11 -04:00
|
|
|
|
2007-05-02 20:28:14 -04:00
|
|
|
/* dumb string functions */
|
|
|
|
int util_split(char *s, char *delimiters, char ***argvp);
|
|
|
|
void util_dispose_split(char **argv);
|
|
|
|
|
2006-07-17 00:49:44 -04:00
|
|
|
//extern char *util_utf16toutf8(unsigned char *utf16, int len);
|
|
|
|
//int util_utf8toutf16(unsigned char *utf16, size_t dlen, unsigned char *utf8, size_t slen);
|
|
|
|
//int util_utf16toutf8(unsigned char *utf8, size_t dlen, unsigned char *utf16, size_t slen);
|
|
|
|
//unsigned char *util_alloc_utf16toutf8(unsigned char *utf16, int slen);
|
|
|
|
|
|
|
|
extern unsigned char *util_utf8toutf16_alloc(unsigned char *utf8);
|
|
|
|
extern unsigned char *util_utf16touft8_alloc(unsigned char *utf16, int len);
|
|
|
|
extern int util_utf8toutf16_len(unsigned char *utf8);
|
|
|
|
extern int util_utf16toutf8_len(unsigned char *utf16, int len);
|
|
|
|
extern int util_utf8toutf16(unsigned char *utf16, int dlen, unsigned char *utf8, int len);
|
|
|
|
extern int util_utf16toutf8(unsigned char *utf8, int dlen, unsigned char *utf16, int len);
|
2006-08-23 01:02:08 -04:00
|
|
|
extern int util_utf16_byte_len(unsigned char *utf16);
|
2006-07-17 00:49:44 -04:00
|
|
|
|
2007-01-16 20:06:16 -05:00
|
|
|
extern void util_hexdump(unsigned char *block, int len);
|
2006-07-17 00:49:44 -04:00
|
|
|
|
|
|
|
|
2006-07-12 00:39:11 -04:00
|
|
|
#endif /* _UTIL_H_ */
|
|
|
|
|