Permalink
Browse files

Merge pull request #264 from rtucker/win-mingw-fixes-inttypes

Support Windows builds with MinGW
  • Loading branch information...
jynik committed Jun 21, 2014
2 parents d685097 + c9f3945 commit 15340770ca59d30b82109ad8670aa0fe027ca9fe
View
@@ -122,7 +122,7 @@ License: BSD-2-clause
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files: host/common/include/windows/inttypes.h
Files: host/common/include/windows/inttypes_msvc.h
Copyright: 2006-2013 Alexander Chemeris
Comment: Not used in building Debian packages
License: BSD-3-clause
@@ -152,24 +152,28 @@
#elif BLADERF_OS_WINDOWS
/* Rename a few functions and types */
#include <Windows.h>
#define strtok_r strtok_s
#define strtoull _strtoui64
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define fileno _fileno
#define strdup _strdup
#include <windows.h>
#define usleep(x) Sleep((x+999)/1000)
/* Changes specific to Microsoft Visual Studio and its C89-compliant ways */
#if _MSC_VER
# define strtok_r strtok_s
# define strtoull _strtoui64
# define snprintf _snprintf
# define vsnprintf _vsnprintf
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
# define fileno _fileno
# define strdup _strdup
/* ssize_t lives elsewhere */
#include <BaseTsd.h>
#define ssize_t SSIZE_T
# include <BaseTsd.h>
# define ssize_t SSIZE_T
/* With msvc, inline is only available for C++. Otherwise we need to use __inline:
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx */
#define inline __inline
# define inline __inline
#endif // _MSC_VER
#endif
@@ -184,10 +188,17 @@
* Here's a sample regexep you could use in vim to clean these up in your code:
* @\(\s\+\)\(\.[a-zA-Z0-9_]\+\)\s*=\s*\([a-zA-Z0-9_]\+\)\(,\)\?@\1FIELD_INIT(\2,\3)\4@gc
*/
#if BLADERF_OS_WINDOWS
#if _MSC_VER
# define FIELD_INIT(field, ...) __VA_ARGS__
#else
# define FIELD_INIT(field, ...) field = __VA_ARGS__
#endif
#endif // _MSC_VER
/* MSVC doesn't have inttypes.h. We'll use a local version for this environment. */
#if _MSC_VER
# include <inttypes_msvc.h>
#else
# include <inttypes.h>
#endif // _MSC_VER
#endif
@@ -25,7 +25,6 @@
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>
#include <libbladeRF.h>
#include "host_config.h"
#include "file_ops.h"
@@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <inttypes.h>
#include "rel_assert.h"
#include "libbladeRF.h"
#include "host_config.h"
#include "bladerf_priv.h"
#include "log.h"
@@ -23,9 +23,10 @@
#include <stdio.h>
#include <limits.h>
#include <time.h>
#include <inttypes.h>
#include <libbladeRF.h>
#include "host_config.h"
#include "cmd.h"
#include "common.h"
#include "conversions.h"
@@ -20,7 +20,7 @@
#include <limits.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include "host_config.h"
#include "cmd.h"
#include "conversions.h"
@@ -25,7 +25,6 @@
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include "rel_assert.h"
#include "host_config.h"
@@ -21,9 +21,9 @@
#include <limits.h>
#include <pthread.h>
#include <errno.h>
#include <inttypes.h>
#include "host_config.h"
#if BLADERF_OS_WINDOWS || BLADERF_OS_OSX
#include "clock_gettime.h"
#else

0 comments on commit 1534077

Please sign in to comment.