libgpac
Documentation of the core library of GPAC
cutils.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "cutils.h"
+ Include dependency graph for cutils.c:

Typedefs

typedef void(* exchange_f) (void *a, void *b, size_t size)
 
typedef int(* cmp_f) (const void *, const void *, void *opaque)
 

Functions

void pstrcpy (char *buf, int buf_size, const char *str)
 
char * pstrcat (char *buf, int buf_size, const char *s)
 
int strstart (const char *str, const char *val, const char **ptr)
 
int has_suffix (const char *str, const char *suffix)
 
static void * dbuf_default_realloc (void *opaque, void *ptr, size_t size)
 
void dbuf_init2 (DynBuf *s, void *opaque, DynBufReallocFunc *realloc_func)
 
void dbuf_init (DynBuf *s)
 
int dbuf_realloc (DynBuf *s, size_t new_size)
 
int dbuf_write (DynBuf *s, size_t offset, const uint8_t *data, size_t len)
 
int dbuf_put (DynBuf *s, const uint8_t *data, size_t len)
 
int dbuf_put_self (DynBuf *s, size_t offset, size_t len)
 
int dbuf_putc (DynBuf *s, uint8_t c)
 
int dbuf_putstr (DynBuf *s, const char *str)
 
int __attribute__ ((format(printf, 2, 3)))
 
void dbuf_free (DynBuf *s)
 
int unicode_to_utf8 (uint8_t *buf, unsigned int c)
 
int unicode_from_utf8 (const uint8_t *p, int max_len, const uint8_t **pp)
 
static void exchange_bytes (void *a, void *b, size_t size)
 
static void exchange_one_byte (void *a, void *b, size_t size)
 
static void exchange_int16s (void *a, void *b, size_t size)
 
static void exchange_one_int16 (void *a, void *b, size_t size)
 
static void exchange_int32s (void *a, void *b, size_t size)
 
static void exchange_one_int32 (void *a, void *b, size_t size)
 
static void exchange_int64s (void *a, void *b, size_t size)
 
static void exchange_one_int64 (void *a, void *b, size_t size)
 
static void exchange_int128s (void *a, void *b, size_t size)
 
static void exchange_one_int128 (void *a, void *b, size_t size)
 
static exchange_f exchange_func (const void *base, size_t size)
 
static void heapsortx (void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque)
 
static void * med3 (void *a, void *b, void *c, cmp_f cmp, void *opaque)
 
void rqsort (void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque)
 

Variables

static const unsigned int utf8_min_code [5]
 
static const unsigned char utf8_first_code_mask [5]
 

Typedef Documentation

◆ exchange_f

typedef void(* exchange_f) (void *a, void *b, size_t size)

◆ cmp_f

typedef int(* cmp_f) (const void *, const void *, void *opaque)

Function Documentation

◆ pstrcpy()

void pstrcpy ( char *  buf,
int  buf_size,
const char *  str 
)
+ Here is the caller graph for this function:

◆ pstrcat()

char* pstrcat ( char *  buf,
int  buf_size,
const char *  s 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strstart()

int strstart ( const char *  str,
const char *  val,
const char **  ptr 
)
+ Here is the caller graph for this function:

◆ has_suffix()

int has_suffix ( const char *  str,
const char *  suffix 
)
+ Here is the caller graph for this function:

◆ dbuf_default_realloc()

static void* dbuf_default_realloc ( void *  opaque,
void *  ptr,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ dbuf_init2()

void dbuf_init2 ( DynBuf s,
void *  opaque,
DynBufReallocFunc realloc_func 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbuf_init()

void dbuf_init ( DynBuf s)
+ Here is the call graph for this function:

◆ dbuf_realloc()

int dbuf_realloc ( DynBuf s,
size_t  new_size 
)
+ Here is the caller graph for this function:

◆ dbuf_write()

int dbuf_write ( DynBuf s,
size_t  offset,
const uint8_t data,
size_t  len 
)
+ Here is the call graph for this function:

◆ dbuf_put()

int dbuf_put ( DynBuf s,
const uint8_t data,
size_t  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbuf_put_self()

int dbuf_put_self ( DynBuf s,
size_t  offset,
size_t  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbuf_putc()

int dbuf_putc ( DynBuf s,
uint8_t  c 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbuf_putstr()

int dbuf_putstr ( DynBuf s,
const char *  str 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __attribute__()

static int __attribute__ ( (format(printf, 2, 3))  )
+ Here is the call graph for this function:

◆ dbuf_free()

void dbuf_free ( DynBuf s)
+ Here is the caller graph for this function:

◆ unicode_to_utf8()

int unicode_to_utf8 ( uint8_t buf,
unsigned int  c 
)
+ Here is the caller graph for this function:

◆ unicode_from_utf8()

int unicode_from_utf8 ( const uint8_t p,
int  max_len,
const uint8_t **  pp 
)
+ Here is the caller graph for this function:

◆ exchange_bytes()

static void exchange_bytes ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_one_byte()

static void exchange_one_byte ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_int16s()

static void exchange_int16s ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_one_int16()

static void exchange_one_int16 ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_int32s()

static void exchange_int32s ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_one_int32()

static void exchange_one_int32 ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_int64s()

static void exchange_int64s ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_one_int64()

static void exchange_one_int64 ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_int128s()

static void exchange_int128s ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_one_int128()

static void exchange_one_int128 ( void *  a,
void *  b,
size_t  size 
)
static
+ Here is the caller graph for this function:

◆ exchange_func()

static exchange_f exchange_func ( const void *  base,
size_t  size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ heapsortx()

static void heapsortx ( void *  base,
size_t  nmemb,
size_t  size,
cmp_f  cmp,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ med3()

static void* med3 ( void *  a,
void *  b,
void *  c,
cmp_f  cmp,
void *  opaque 
)
static
+ Here is the caller graph for this function:

◆ rqsort()

void rqsort ( void *  base,
size_t  nmemb,
size_t  size,
cmp_f  cmp,
void *  opaque 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ utf8_min_code

const unsigned int utf8_min_code[5]
static
Initial value:
= {
0x80, 0x800, 0x10000, 0x00200000, 0x04000000,
}

◆ utf8_first_code_mask

const unsigned char utf8_first_code_mask[5]
static
Initial value:
= {
0x1f, 0xf, 0x7, 0x3, 0x1,
}