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 #define CDIO_FREE_IF_NOT_NULL(p_obj) \ 71 if (NULL != p_obj) { free(p_obj); p_obj=NULL; }; 76 _cdio_ceil2block (
unsigned offset, uint16_t i_blocksize)
78 return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
82 _cdio_ofs_add (
unsigned offset,
unsigned length, uint16_t i_blocksize)
84 if (i_blocksize - (offset % i_blocksize) < length)
85 offset = _cdio_ceil2block (offset, i_blocksize);
93 _cdio_bool_str (
bool b)
95 return b ?
"yes" :
"no";
131 #ifdef WANT_FOLLOW_SYMLINK_COMPATIBILITY 132 # 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)