diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-01-12 14:43:29 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-01-12 15:26:41 -0800 |
commit | 140ff1b6359c0af684f5469fc4e191229667e038 (patch) | |
tree | edd38d9aeb097f6e11b1d86a382cd9518ba044e4 /libusb | |
parent | 5ffd4e9cc1aa6e12d56f2ecc444e2a8a5723602c (diff) | |
download | libusb-140ff1b6359c0af684f5469fc4e191229667e038.tar.gz |
Windows: Remove unused safe_* macro definitions
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/os/windows_common.h | 21 | ||||
-rw-r--r-- | libusb/os/windows_winusb.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
3 files changed, 4 insertions, 21 deletions
diff --git a/libusb/os/windows_common.h b/libusb/os/windows_common.h index 77ed4a2..55344ca 100644 --- a/libusb/os/windows_common.h +++ b/libusb/os/windows_common.h @@ -41,36 +41,19 @@ #if defined(__CYGWIN__ ) #define _stricmp strcasecmp -#define _snprintf snprintf #define _strdup strdup // _beginthreadex is MSVCRT => unavailable for cygwin. Fallback to using CreateThread #define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, (LPTHREAD_START_ROUTINE)c, d, e, (LPDWORD)f) #endif -#define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0) -#define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0) -#define safe_min(a, b) MIN((size_t)(a), (size_t)(b)) -#define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \ - ((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0) -#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1) -#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1)) -#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1) -#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2)) -#define safe_stricmp(str1, str2) _stricmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2)) -#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count) -#define safe_strlen(str) ((str==NULL)?0:strlen(str)) -#define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0) -#define safe_stprintf _sntprintf -#define safe_tcslen(str) ((str==NULL)?0:_tcslen(str)) -#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0) -#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL) +#define safe_free(p) do {if (p != NULL) {free((void *)p); p = NULL;}} while (0) + #ifndef ARRAYSIZE #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) #endif #define ERR_BUFFER_SIZE 256 - /* * API macros - leveraged from libusb-win32 1.x */ diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index f547f13..0dce0ea 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -431,7 +431,7 @@ static SP_DEVICE_INTERFACE_DETAIL_DATA_A *get_interface_details_filter(struct li if (libusb0_symboliclink_index < 256) { // libusb0.sys is connected to this device instance. // If the the device interface guid is {F9F3FF14-AE21-48A0-8A25-8011A7A931D9} then it's a filter. - safe_sprintf(filter_path, sizeof("\\\\.\\libusb0-0000"), "\\\\.\\libusb0-%04u", (unsigned int)libusb0_symboliclink_index); + sprintf(filter_path, "\\\\.\\libusb0-%04u", (unsigned int)libusb0_symboliclink_index); usbi_dbg("assigned libusb0 symbolic link %s", filter_path); } else { // libusb0.sys was connected to this device instance at one time; but not anymore. diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 1e12755..2bed80a 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11180 +#define LIBUSB_NANO 11181 |