| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All of the API functions should take the typedef'ed versions of the
opaque libusb structures, but some recent additions to the API did not
follow this convention. Fix this by making the changes to the
declarations and definitions of the functions.
Make the placement of the asterisk in pointer variable declarations
consistent (always with the variable name, not the type).
Remove some unnecessary casts and initializations relating to
dynamically allocated memory. While at it, make casts within the core
library consistent in style with no space after the closing parenthesis
of the cast. Most of the core already used this style.
When using the 'sizeof' operator, dereference the pointer instead of
using the type. Most of the core was already doing this, so fix up the
few places that weren't.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automake does not know how to compile Windows Resource files, so we have
manually told automake how to do this. One particular short-coming is
that dependencies are not automatically generated and tracked as they
are with other known automake targets. Address this by creating an extra
makefile that contains the automake rules needed for building source for
Windows targets. This also includes outputting more accurate tags during
compilation instead of using the generic "GEN" tag.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When comparing the user-provided locale string in libusb_setlocale(), we
only care about the first two characters. The lookup strings within
libusb are always lowercase, so simplify the comparison by directly
comparing the result of tolower(). This removes the need for
strncasecmp() which was not able to be cleanly included in the first
place.
Rather than storing an index into the array of localized strings, store
a pointer to the selected sub-array instead. This trims the generated
code of libusb_strerror() by nearly half as loads can be dropped.
Also constify the arrays of strings as they should not be mutable.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor libusbi.h to include the set of common header files needed by
every main source file in the library and change these source files to
include libusbi.h first, followed by any non-common headers. Including
libusbi.h first ensures that the config definitions are pulled in and
will eliminate redundant includes in the individual sources files.
Also clean up some whitespace errors and remove unnecessary definitions
in the manually generated config.h files.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It would be more convenient in practice if the type of error code
argument in libusb_strerror was declared as "int", rather than
enum libusb_error: In practice, the value for the argument almost
always comes from a value returned by libusb function, thus its
type is "int" at that point. In which case, depending on the
checks enabled when compiling the C or C++ code of applications
using libusb's API, every call to libusb_strerror often requires
explicit type casting – while not a biggie, it gets inconvenient
as the number of logging calls using libusb_strerror grows.
It is worth of noting that the "peer" function libusb_error_name
already takes the int-type argument, thus eliminating the need in
extra value casting. Aligning the signature of libusb_strerror
to be the same would also improve the consistency between those
two parts of the libusb API.
Given that libusb_strerror does a range validation of its argument
value, there should not be any real drawbacks or negative effects
from "relaxing" the type declaration from enumeration to integer.
The existing application code that already does explicit casting
to enum, will keep compiling and running like before.
Closes #606
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
| |
Closes #493
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
|
|
|
|
|
|
| |
Closes #496
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
|
|
|
|
|
|
|
|
| |
Most strings were copied from the german `strerror` output on equivallent `errno` values and then adapted as necessary.
Closes #446
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
|
|
|
|
|
|
|
|
|
|
|
| |
This change add "libusb_" to every group and page definition (and
updates all references accordingly) so that generated man pages
are namespaced for libusb, thus avoiding possible conflict with
other packages.
Closes #131
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
* Include config.h before anything else in all files
* Remove unnecessary inclusion of libusb.h
* Use angle brackets for system headers and quotes for local headers
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
| |
|
| |
|
|
|
|
|
| |
* VS2012 (64 bit) produces the following in strerror.c(156):
warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hello,
A small patch for:
strerror.c: In function 'libusb_setlocale':
strerror.c:148: warning: comparison between signed and unsigned
strerror.c:152: warning: comparison between signed and unsigned
--
Dr. Ludovic Rousseau
From a4144845845cd0a06fb9074ba2d6669ece3a5b1a Mon Sep 17 00:00:00 2001
From: Ludovic Rousseau <ludovic.rousseau+github@gmail.com>
Date: Wed, 19 Jun 2013 13:16:31 +0200
Subject: [PATCH] Core: fix compiler warning in libusb_setlocale()
strerror.c: In function 'libusb_setlocale':
strerror.c:148: warning: comparison between signed and unsigned
strerror.c:152: warning: comparison between signed and unsigned
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This patch adds the much requested libusb_strerror() function, taking into
account all issues people raised wrt previous attempts.
Criteria / Decisions underlying this implementation:
- Must support translated messages
- Must not use gettext as that does not work well in combination with Windows
(when building with Visual C, or for Windows CE)
- API compatible with FreeBSD and various patched libusb-s floating around
- KISS:
- Do not add any (other) library dependencies
- Do not try to deal with message encodings (iconv), simply always return UTF-8
making encoding the problem of the application using libusb_strerror.
- Defaults to English, so apps which don't want translated messages,
don't need to do anything special
- Defaults to English (with pure ASCII messages), so apps which don't
call libusb_setlocale() don't need to worry about encoding
|