Pete Batard's patches offset types especially for MinGW and MS Visual C.

This commit is contained in:
R. Bernstein
2012-03-03 12:10:53 -05:00
parent f269abeb07
commit 739928df7b
18 changed files with 151 additions and 79 deletions

View File

@@ -1,5 +1,6 @@
/*
Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2004, 2005, 2006, 2008, 2010, 2012
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
This program is free software: you can redistribute it and/or modify
@@ -28,6 +29,18 @@
#include <stdlib.h>
#include <cdio/types.h>
#if !defined CDIO_INLINE
#if defined(__cplusplus) || defined(inline)
#define CDIO_INLINE inline
#elif defined(__GNUC__)
#define CDIO_INLINE __inline__
#elif defined(_MSC_VER)
#define CDIO_INLINE __inline
#else
#define CDIO_INLINE
#endif
#endif /* CDIO_INLINE */
#undef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
@@ -40,7 +53,7 @@
#undef CLAMP
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
static inline uint32_t
static CDIO_INLINE uint32_t
_cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
{
uint32_t i_blocks;
@@ -53,13 +66,13 @@ _cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
}
/* round up to next block boundary */
static inline unsigned
static CDIO_INLINE unsigned
_cdio_ceil2block (unsigned offset, uint16_t i_blocksize)
{
return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
}
static inline unsigned int
static CDIO_INLINE unsigned int
_cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
{
if (i_blocksize - (offset % i_blocksize) < length)
@@ -70,7 +83,7 @@ _cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
return offset;
}
static inline const char *
static CDIO_INLINE const char *
_cdio_bool_str (bool b)
{
return b ? "yes" : "no";