summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--libusb/libusb_version.h2
-rw-r--r--libusb/os/windows_usb.c12
-rw-r--r--libusb/os/windows_usb.h1
4 files changed, 9 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index ba6e938..cf12516 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
m4_define(LIBUSB_MAJOR, [1])
m4_define(LIBUSB_MINOR, [0])
m4_define(LIBUSB_MICRO, [8])
-m4_define(LIBUSB_NANO, [10313])
+m4_define(LIBUSB_NANO, [10314])
AC_INIT([libusb], LIBUSB_MAJOR.LIBUSB_MINOR.LIBUSB_MICRO, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
diff --git a/libusb/libusb_version.h b/libusb/libusb_version.h
index 151e963..9dc179d 100644
--- a/libusb/libusb_version.h
+++ b/libusb/libusb_version.h
@@ -24,6 +24,6 @@
#define LIBUSB_VERSION_MAJOR 1
#define LIBUSB_VERSION_MINOR 0
#define LIBUSB_VERSION_MICRO 8
-#define LIBUSB_VERSION_NANO 10313
+#define LIBUSB_VERSION_NANO 10314
#endif
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index dbea297..c6e1456 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -431,7 +431,7 @@ int htab_create(struct libusb_context *ctx, unsigned long nel)
nel += 2;
htab_size = nel;
- usbi_dbg("using %d elements hash table", nel);
+ usbi_dbg("using %d entries hash table", nel);
htab_filled = 0;
// allocate memory and zero out.
@@ -495,7 +495,7 @@ unsigned long htab_hash(char* str)
if ( (htab_table[idx].used == hval)
&& (safe_strcmp(str, htab_table[idx].str) == 0) ) {
// existing hash
- return r;
+ return idx;
}
usbi_dbg("hash collision ('%s' vs '%s')", str, htab_table[idx].str);
@@ -518,7 +518,7 @@ unsigned long htab_hash(char* str)
// If entry is found use it.
if ( (htab_table[idx].used == hval)
&& (safe_strcmp(str, htab_table[idx].str) == 0) ) {
- return r;
+ return idx;
}
}
while (htab_table[idx].used);
@@ -550,7 +550,7 @@ unsigned long htab_hash(char* str)
++htab_filled;
usbi_mutex_unlock(&htab_write_mutex);
- return r;
+ return idx;
}
/*
@@ -858,8 +858,8 @@ static int windows_init(struct libusb_context *ctx)
}
SetThreadAffinityMask(timer_thread, 0);
- // Create a hash table to store session ids (769 is prime)
- htab_create(ctx, 769);
+ // Create a hash table to store session ids. Second parameter is better if prime
+ htab_create(ctx, HTAB_SIZE);
r = LIBUSB_SUCCESS;
}
diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
index e8ab43d..2de40dd 100644
--- a/libusb/os/windows_usb.h
+++ b/libusb/os/windows_usb.h
@@ -89,6 +89,7 @@ inline void upperize(char* str) {
#define TIMER_REQUEST_RETRY_MS 100
#define ERR_BUFFER_SIZE 256
#define LIST_SEPARATOR ';'
+#define HTAB_SIZE 1021
// Handle code for HID interface that have been claimed ("dibs")
#define INTERFACE_CLAIMED ((HANDLE)(intptr_t)0xD1B5)