summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-11-18 12:24:37 +0000
committerPete Batard <pbatard@gmail.com>2010-11-18 12:24:37 +0000
commit727bb1d499607694b66287618a85c8f3b44e9f30 (patch)
tree8a78276c61b95e09670a647bf0b171e5dfb65661
parentfa4cd28da39f2398d178ab4a1a55bfc8fba395d6 (diff)
downloadlibusb-727bb1d499607694b66287618a85c8f3b44e9f30.tar.gz
removed dependency on stdint.h for MS binary snapshot users
* binary snapshot users, with a version of Visual Studio < 10 don't have stdint.h available * stdint.h is referenced in libusb.h * ssize_t, uint8_t and uint16_t are now defined in libusb.h when required
-rw-r--r--examples/_lsusb_2008.vcproj8
-rw-r--r--examples/lsusb.dsp4
-rw-r--r--examples/lsusb.vcproj8
-rw-r--r--examples/lsusb_sources2
-rw-r--r--examples/xusb.c2
-rw-r--r--libusb/libusb.h21
-rw-r--r--msvc/stdint.h11
7 files changed, 31 insertions, 25 deletions
diff --git a/examples/_lsusb_2008.vcproj b/examples/_lsusb_2008.vcproj
index 70de59d..e643d9b 100644
--- a/examples/_lsusb_2008.vcproj
+++ b/examples/_lsusb_2008.vcproj
@@ -45,7 +45,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
RuntimeLibrary="1"
WarningLevel="3"
@@ -117,7 +117,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
RuntimeLibrary="1"
WarningLevel="3"
@@ -188,7 +188,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="0"
WarningLevel="3"
@@ -258,7 +258,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="0"
WarningLevel="3"
diff --git a/examples/lsusb.dsp b/examples/lsusb.dsp
index c2184b8..af78cba 100644
--- a/examples/lsusb.dsp
+++ b/examples/lsusb.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../msvc" /I ".." /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /EHsc /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -66,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../msvc" /I ".." /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /EHsc /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/lsusb.vcproj b/examples/lsusb.vcproj
index ec6c439..dda751f 100644
--- a/examples/lsusb.vcproj
+++ b/examples/lsusb.vcproj
@@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -120,7 +120,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
@@ -198,7 +198,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -276,7 +276,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\msvc;..\"
+ AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
diff --git a/examples/lsusb_sources b/examples/lsusb_sources
index ed7fe74..444a1e9 100644
--- a/examples/lsusb_sources
+++ b/examples/lsusb_sources
@@ -14,6 +14,6 @@ USE_MSVCRT=1
!ENDIF
UMTYPE=console
-INCLUDES=..\..\msvc;..\..;$(DDK_INC_PATH)
+INCLUDES=..\..;$(DDK_INC_PATH)
UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib
SOURCES=..\lsusb.c
diff --git a/examples/xusb.c b/examples/xusb.c
index 777a698..f90f2c9 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -24,7 +24,7 @@
#include <config.h>
#include <stdio.h>
-#include <inttypes.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
diff --git a/libusb/libusb.h b/libusb/libusb.h
index d46c68b..72917ca 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -21,12 +21,29 @@
#ifndef __LIBUSB_H__
#define __LIBUSB_H__
-/* MSVC doesn't like inline, but does accept __inline ?? */
#ifdef _MSC_VER
+/* on MS environments, the inline keyword is available in C++ only */
#define inline __inline
+/* ssize_t is also not available (copy/paste from MinGW) */
+#ifndef _SSIZE_T_DEFINED
+#define _SSIZE_T_DEFINED
+#undef ssize_t
+#ifdef _WIN64
+ typedef __int64 ssize_t;
+#else
+ typedef int ssize_t;
+#endif /* _WIN64 */
+#endif /* _SSIZE_T_DEFINED */
+#endif /* _MSC_VER */
+
+/* stdint.h is also not usually available on MS */
+#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+#else
+#include <stdint.h>
#endif
-#include <stdint.h>
#include <sys/types.h>
#include <time.h>
#include <limits.h>
diff --git a/msvc/stdint.h b/msvc/stdint.h
index d102772..51687f7 100644
--- a/msvc/stdint.h
+++ b/msvc/stdint.h
@@ -29,17 +29,6 @@
#ifndef _STDINT_H
#define _STDINT_H
-/* from stddef.h and _mingw.h */
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
- typedef __int64 ssize_t;
-#else
- typedef int ssize_t;
-#endif /* _WIN64 */
-#endif /* _SSIZE_T_DEFINED */
-
#ifndef _INTPTR_T_DEFINED
#define _INTPTR_T_DEFINED
#ifndef __intptr_t_defined