Mainly consists of removing code for #ifdef __KERNEL__
In order to keep it really clear what code has been removed, I have
not corrected any formatting issues.
Specify -Werror in both CFLAGS and CXXFLAGS for all build jobs.
For the updated build targets, temporarily allow the build job to fail
while outstanding issues that cause compiler warnings are being fixed.
Functions called by pthread_create() have the return type (void *).
However, the return statements in read_data() use a value of type
SANE_Status rather than a pointer, which causes a compiler warning.
This return value is never actually used, so return NULL instead.
GCC warns that an unsigned value is passed to abs(), which may not be
intended. To resolve this warning, adjust the code so abs() is not used
and the behavior is more explicit.
If the weights file pathname is longer than PATH_MAX, it may be written
past the end of the buffer on the stack; or it may be truncated when it
is written to allocated memory (such that it is not null-terminated).
Adjust the code to fix both issues. Dynamically allocate memory for the
actual length of the pathname so that it is not constrained by PATH_MAX.
labs() has a signed parameter. However the argument to it here was the
difference between two unsigned values, which itself remains unsigned.
GCC warned that using this in labs() might not have the intended result.
By definition though, dwInc >= m_dwIdealGain >= dwDec, so labs() is not
even needed in this expression.
The output from the SCSI inquiry command uses fixed-length space-padded
strings, which are copied into null-terminated strings before use.
This is currently done using strncpy(), with the count parameter set to
the string's fixed length. Because a null terminator is not encountered
in the input, strncpy() does not write one in the output, and GCC warns
about potential string truncation. A null terminator is added manually,
but this is error prone (as shown by the fix for the microtek backend).
Use snprintf() instead, which guarantees a null-terminated result and
resolves the warnings from GCC.
These were intended to suppress GCC warnings about unused variables.
However, this leads to different warnings from Clang instead.
Use another approach that suppresses warnings from both compilers.
Remove an extraneous log message.
Ensure that a separate log message is only printed when the preceding
if-statement is true (and its string argument has actually been set).
Both issues were identified from GCC warnings about indentation.
abs() has an integer parameter and returns an integer value. Floating-
point values should be passed to fabs() instead.
In particular, this affected calculations for gain and offset, where a
value with floating-point precision is clearly expected.
The Product Revision Level field in the SCSI inquiry data has a fixed
length of 4 bytes. When copying it as a null-terminated string, place
the null terminator in the correct position; currently the string has
an extra character that is never initialized in memory.
Reduce the length of each string buffer, so it does not extend beyond
the null terminator.
Fix the USB VID/PID in device descriptions to use lowercase hex digits.
Remove an extraneous description, having no name or USB VID, from the
epsonds file. Remove an extraneous interface in the description for the
Brother MFC-J1300DW.
Additionally, fix mispellings of "Flatbed" and "WiFi".