mirror of
https://github.com/RPCS3/libusb.git
synced 2026-07-19 21:03:32 -04:00
Misc: Simplify includes and misc. cleanup
* fxload sample provenance * No need for <sys/types.h> in samples as already in libusb.h * Don't bother about sscanf_s in xusb * Use HAVE_### and rely on config.h where possible * Formal inclusion of <winsock.h> in libusb.h for WinCE and WDK * Cleanup of Windows' config.h * Avoid ENAMETOOLONG and ENOTEMPTY conflict between errno.h and winsock.h for WinCE * Additional newlines & braces cleanup
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ static bool dosyslog = false;
|
||||
#endif
|
||||
|
||||
#ifndef FXLOAD_VERSION
|
||||
#define FXLOAD_VERSION (__DATE__ " (development)")
|
||||
#define FXLOAD_VERSION (__DATE__ " (libusbx)")
|
||||
#endif
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
|
||||
+1
-6
@@ -33,10 +33,6 @@
|
||||
#define msleep(msecs) usleep(1000*msecs)
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER<=1200 || defined(_WIN32_WCE)
|
||||
#define sscanf_s sscanf
|
||||
#endif
|
||||
|
||||
#if !defined(bool)
|
||||
#define bool int
|
||||
#endif
|
||||
@@ -47,7 +43,6 @@
|
||||
#define false (!true)
|
||||
#endif
|
||||
|
||||
|
||||
// Future versions of libusbx will use usb_interface instead of interface
|
||||
// in libusb_config_descriptor => catter for that
|
||||
#define usb_interface interface
|
||||
@@ -992,7 +987,7 @@ int main(int argc, char** argv)
|
||||
break;
|
||||
}
|
||||
if (i != arglen) {
|
||||
if (sscanf_s(argv[j], "%x:%x" , &tmp_vid, &tmp_pid) != 2) {
|
||||
if (sscanf(argv[j], "%x:%x" , &tmp_vid, &tmp_pid) != 2) {
|
||||
printf(" Please specify VID & PID as \"vid:pid\" in hexadecimal format\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
+3
-6
@@ -25,20 +25,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined(OS_WINCE)
|
||||
#include "missing.h" // getenv()
|
||||
#endif
|
||||
|
||||
#include "libusbi.h"
|
||||
#ifdef HAVE_MISSING_H
|
||||
#include "missing.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
const struct usbi_os_backend * const usbi_backend = &linux_usbfs_backend;
|
||||
|
||||
@@ -24,15 +24,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef USBI_TIMERFD_AVAILABLE
|
||||
#include <sys/timerfd.h>
|
||||
#endif
|
||||
|
||||
+6
-6
@@ -40,7 +40,7 @@
|
||||
#endif /* _SSIZE_T_DEFINED */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* stdint.h is also not usually available on MS */
|
||||
/* stdint.h is not available on older MSVC */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
@@ -52,13 +52,14 @@ typedef unsigned __int32 uint32_t;
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* 'interface' might be defined as a macro on Windows, so we need to
|
||||
* undefine it so as not to break the current libusbx API, because
|
||||
* libusb_config_descriptor has an 'interface' member
|
||||
@@ -69,9 +70,8 @@ typedef unsigned __int32 uint32_t;
|
||||
#if defined(interface)
|
||||
#undef interface
|
||||
#endif
|
||||
#if defined(_WIN32_WCE)
|
||||
// Needed for "struct timeval" definition
|
||||
#include <winsock2.h>
|
||||
#if !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#ifdef DDKBUILD
|
||||
#include <winsock.h> // needed for struct timeval for WDK
|
||||
#endif
|
||||
|
||||
#include "libusb.h"
|
||||
#include "version.h"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libusbi.h>
|
||||
#include "libusbi.h"
|
||||
|
||||
// Uncomment to debug the polling layer
|
||||
//#define DEBUG_POLL_WINDOWS
|
||||
|
||||
@@ -105,4 +105,3 @@
|
||||
#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure)
|
||||
#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args)
|
||||
#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <objbase.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
#include <libusbi.h>
|
||||
#include "libusbi.h"
|
||||
#include "poll_windows.h"
|
||||
#include "windows_usb.h"
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 10620
|
||||
#define LIBUSB_NANO 10621
|
||||
|
||||
+10
-17
@@ -17,28 +17,21 @@
|
||||
/* Default visibility */
|
||||
#define DEFAULT_VISIBILITY /**/
|
||||
|
||||
/* Start with debug message logging enabled */
|
||||
//#define ENABLE_DEBUG_LOGGING 1
|
||||
|
||||
/* Message logging */
|
||||
/* Enable global message logging */
|
||||
#define ENABLE_LOGGING 1
|
||||
|
||||
/* Windows/WinCE backend */
|
||||
#if defined(_WIN32_WCE)
|
||||
#define OS_WINCE 1
|
||||
#else
|
||||
#define OS_WINDOWS 1
|
||||
#endif
|
||||
/* Uncomment to start with debug message logging enabled */
|
||||
// #define ENABLE_DEBUG_LOGGING 1
|
||||
|
||||
/* type of second poll() argument */
|
||||
#define POLL_NFDS_TYPE unsigned int
|
||||
|
||||
#if !defined(_WIN32_WCE)
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
/* Windows/WinCE backend */
|
||||
#if defined(_WIN32_WCE)
|
||||
#define OS_WINCE 1
|
||||
#define HAVE_MISSING_H
|
||||
#else
|
||||
#define OS_WINDOWS 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -59,12 +59,14 @@
|
||||
/* 35 - Unknown Error */
|
||||
#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
|
||||
#define EDEADLK 36
|
||||
#if 0
|
||||
/* 37 - Unknown Error */
|
||||
#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
|
||||
#define ENOLCK 39 /* No locks available (46 in Cyg?) */
|
||||
#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
|
||||
#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
|
||||
#define EILSEQ 42 /* Illegal byte sequence */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
|
||||
|
||||
@@ -19,12 +19,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
#include "libusbx_testlib.h"
|
||||
|
||||
/** Test that creates and destroys a single concurrent context
|
||||
|
||||
Reference in New Issue
Block a user