32 #if !defined CDIO_INLINE
33 #if defined(__cplusplus) || defined(inline)
34 #define CDIO_INLINE inline
35 #elif defined(__GNUC__)
36 #define CDIO_INLINE __inline__
37 #elif defined(_MSC_VER)
38 #define CDIO_INLINE __inline
45 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
48 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
51 #define IN(x, low, high) ((x) >= (low) && (x) <= (high))
54 #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
57 _cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
61 i_blocks = i_len / (uint32_t) i_blocksize;
62 if (i_len % i_blocksize)
70 _cdio_ceil2block (
unsigned offset, uint16_t i_blocksize)
72 return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
76 _cdio_ofs_add (
unsigned offset,
unsigned length, uint16_t i_blocksize)
78 if (i_blocksize - (offset % i_blocksize) < length)
79 offset = _cdio_ceil2block (offset, i_blocksize);
87 _cdio_bool_str (
bool b)
89 return b ?
"yes" :
"no";
124 #ifdef WANT_FOLLOW_SYMLINK_COMPATIBILITY
125 # define cdio_follow_symlink cdio_realpath
Common type definitions used pervasively in libcdio.
uint8_t cdio_from_bcd8(uint8_t p)
char ** _cdio_strsplit(const char str[], char delim)
void _cdio_strfreev(char **strv)
uint8_t cdio_to_bcd8(uint8_t n)
char * _cdio_strdup_fixpath(const char path[])
char * _cdio_strdup_upper(const char str[])
size_t _cdio_strlenv(char **str_array)
char * cdio_realpath(const char *psz_src, char *psz_dst)
#define CDIO_INLINE
Definition: util.h:40
void * _cdio_memdup(const void *mem, size_t count)