kopia lustrzana https://gitlab.com/sane-project/backends
epsonds: corrections from Epson following first review.
Contains some rework to address concerns from pipeline build.release-1.1.x
rodzic
9282aac9be
commit
b74dfb3004
|
@ -288,7 +288,7 @@ static int decode_value(char *buf, int len)
|
|||
}
|
||||
|
||||
/* h000 */
|
||||
static char *decode_binary(char *buf, int len)
|
||||
static char *decode_binary(char *buf)
|
||||
{
|
||||
char tmp[6];
|
||||
int hl;
|
||||
|
@ -314,7 +314,7 @@ static char *decode_binary(char *buf, int len)
|
|||
|
||||
static char *decode_string(char *buf, int len)
|
||||
{
|
||||
char *p, *s = decode_binary(buf, len);
|
||||
char *p, *s = decode_binary(buf);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -712,7 +712,6 @@ static SANE_Status capa_cb(void *userdata, char *token, int len)
|
|||
if (strncmp("COLLIST", token, 3 + 4) == 0)
|
||||
{
|
||||
char *p = token + 3 + 4;
|
||||
int i;
|
||||
int count = (len - 4);
|
||||
int readBytes = 0;
|
||||
s->hw->has_mono = 0;
|
||||
|
@ -750,7 +749,6 @@ static SANE_Status capa_cb(void *userdata, char *token, int len)
|
|||
char *p = token + 3 + 4;
|
||||
|
||||
|
||||
int i;
|
||||
int count = (len - 4);
|
||||
int readBytes = 0;
|
||||
|
||||
|
@ -782,8 +780,6 @@ SANE_Status esci2_capa(epsonds_scanner *s)
|
|||
|
||||
static SANE_Status stat_cb(void *userdata, char *token, int len)
|
||||
{
|
||||
|
||||
epsonds_scanner *s = (epsonds_scanner *)userdata;
|
||||
char *value = token + 3;
|
||||
|
||||
userdata = userdata;
|
||||
|
|
|
@ -33,8 +33,6 @@ typedef struct my_error_mgr * my_error_ptr;
|
|||
METHODDEF(void) my_error_exit (j_common_ptr cinfo)
|
||||
{
|
||||
|
||||
my_error_ptr myerr = (my_error_ptr) cinfo->err;
|
||||
|
||||
char buffer[JMSG_LENGTH_MAX];
|
||||
(*cinfo->err->format_message) (cinfo, buffer);
|
||||
|
||||
|
@ -199,7 +197,7 @@ void eds_decode_jpeg(epsonds_scanner*s, SANE_Byte *data, SANE_Int size, ring_buf
|
|||
DBG(10,"decodded lines = %d\n", sum);
|
||||
|
||||
// abandon unncessary data
|
||||
if (sum < jpeg_cinfo.output_height)
|
||||
if ((JDIMENSION)sum < jpeg_cinfo.output_height)
|
||||
{
|
||||
// unncessary data
|
||||
while(1)
|
||||
|
|
|
@ -37,7 +37,7 @@ static ssize_t
|
|||
epsonds_net_read_raw(epsonds_scanner *s, unsigned char *buf, ssize_t wanted,
|
||||
SANE_Status *status)
|
||||
{
|
||||
DBG(15, "%s: wanted: %d\n", __func__, wanted);
|
||||
DBG(15, "%s: wanted: %ld\n", __func__, wanted);
|
||||
|
||||
if (wanted == 0)
|
||||
{
|
||||
|
@ -357,8 +357,15 @@ epsonds_resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex
|
|||
AvahiLookupResultFlags flags,
|
||||
void *userdata)
|
||||
{
|
||||
// unused parameter
|
||||
(void)r;
|
||||
(void)type;
|
||||
(void)domain;
|
||||
(void)host_name;
|
||||
(void)port;
|
||||
(void)flags;
|
||||
EDSAvahiUserData* data = userdata;
|
||||
char ipAddr[AVAHI_ADDRESS_STR_MAX], *t;
|
||||
char ipAddr[AVAHI_ADDRESS_STR_MAX];
|
||||
|
||||
DBG(10, "epsonds_searchDevices resolve_callback\n");
|
||||
|
||||
|
@ -377,7 +384,7 @@ epsonds_resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex
|
|||
{
|
||||
while(txt != NULL)
|
||||
{
|
||||
char* text = avahi_string_list_get_text(txt);
|
||||
char* text = (char*)avahi_string_list_get_text(txt);
|
||||
DBG(10, "avahi string = %s\n", text);
|
||||
|
||||
if (strlen(text) > 4 && strncmp(text, "mdl=", 4) == 0)
|
||||
|
@ -407,6 +414,9 @@ browse_callback(AvahiServiceBrowser *b, AvahiIfIndex interface,
|
|||
{
|
||||
DBG(10, "browse_callback event = %d\n", event);
|
||||
|
||||
//unused parameter
|
||||
(void)b;
|
||||
(void)flags;
|
||||
|
||||
EDSAvahiUserData *data = userdata;
|
||||
switch (event) {
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "sane/saneopts.h"
|
||||
#include "sane/sanei_config.h"
|
||||
|
@ -2437,9 +2438,9 @@ sane_control_option(SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
}
|
||||
|
||||
|
||||
static void setBit (SANE_Byte* bytes, SANE_Unit bitIndex, SANE_Bool isTrue)
|
||||
static void setBit (SANE_Byte* bytes, SANE_Int bitIndex, SANE_Bool isTrue)
|
||||
{
|
||||
SANE_Unit octet = bitIndex / 8;
|
||||
SANE_Int octet = bitIndex / 8;
|
||||
SANE_Byte bit = 7 - (bitIndex % 8);
|
||||
|
||||
if (isTrue) {
|
||||
|
@ -2449,9 +2450,9 @@ static void setBit (SANE_Byte* bytes, SANE_Unit bitIndex, SANE_Bool isTrue)
|
|||
}
|
||||
}
|
||||
|
||||
static SANE_Bool getBit (SANE_Byte* bytes, SANE_Unit bitIndex)
|
||||
static SANE_Bool getBit (SANE_Byte* bytes, SANE_Int bitIndex)
|
||||
{
|
||||
SANE_Unit octet = bitIndex / 8;
|
||||
SANE_Int octet = bitIndex / 8;
|
||||
SANE_Byte mask = 1 << (7 - (bitIndex % 8));
|
||||
|
||||
if( bytes[octet] & mask ){
|
||||
|
@ -2461,17 +2462,17 @@ static SANE_Bool getBit (SANE_Byte* bytes, SANE_Unit bitIndex)
|
|||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
static void swapPixel1(SANE_Unit x1,
|
||||
SANE_Unit y1,
|
||||
SANE_Unit x2,
|
||||
SANE_Unit y2,
|
||||
static void swapPixel1(SANE_Int x1,
|
||||
SANE_Int y1,
|
||||
SANE_Int x2,
|
||||
SANE_Int y2,
|
||||
SANE_Byte* bytes,
|
||||
SANE_Byte bitsPerSample,
|
||||
SANE_Unit samplesPerPixel,
|
||||
SANE_Unit bytesPerRow)
|
||||
SANE_Int samplesPerPixel,
|
||||
SANE_Int bytesPerRow)
|
||||
{
|
||||
SANE_Unit pixelBits = bitsPerSample * samplesPerPixel;
|
||||
SANE_Unit widthBits = bytesPerRow * 8;
|
||||
SANE_Int pixelBits = bitsPerSample * samplesPerPixel;
|
||||
SANE_Int widthBits = bytesPerRow * 8;
|
||||
|
||||
SANE_Byte temp = getBit(bytes, widthBits * y1 + x1 * pixelBits);
|
||||
{
|
||||
|
@ -2481,16 +2482,16 @@ static void swapPixel1(SANE_Unit x1,
|
|||
setBit(bytes, widthBits * y2 + x2 * pixelBits, temp);
|
||||
}
|
||||
|
||||
static void swapPixel8(SANE_Unit x1,
|
||||
SANE_Unit y1,
|
||||
SANE_Unit x2,
|
||||
SANE_Unit y2,
|
||||
static void swapPixel8(SANE_Int x1,
|
||||
SANE_Int y1,
|
||||
SANE_Int x2,
|
||||
SANE_Int y2,
|
||||
SANE_Byte* bytes,
|
||||
SANE_Byte bitsPerSample,
|
||||
SANE_Unit samplesPerPixel,
|
||||
SANE_Unit bytesPerRow)
|
||||
SANE_Int samplesPerPixel,
|
||||
SANE_Int bytesPerRow)
|
||||
{
|
||||
SANE_Unit pixelBytes = samplesPerPixel * bitsPerSample / 8;
|
||||
SANE_Int pixelBytes = samplesPerPixel * bitsPerSample / 8;
|
||||
|
||||
for (SANE_Byte i = 0; i < pixelBytes; i++) {
|
||||
SANE_Byte temp = bytes[y1 * bytesPerRow + (pixelBytes * x1 + i)];
|
||||
|
@ -2501,14 +2502,14 @@ static void swapPixel8(SANE_Unit x1,
|
|||
|
||||
|
||||
|
||||
static void swapPixel(SANE_Unit x1,
|
||||
SANE_Unit y1,
|
||||
SANE_Unit x2,
|
||||
SANE_Unit y2,
|
||||
static void swapPixel(SANE_Int x1,
|
||||
SANE_Int y1,
|
||||
SANE_Int x2,
|
||||
SANE_Int y2,
|
||||
SANE_Byte* bytes,
|
||||
SANE_Byte bitsPerSample,
|
||||
SANE_Unit samplesPerPixel,
|
||||
SANE_Unit bytesPerRow)
|
||||
SANE_Int samplesPerPixel,
|
||||
SANE_Int bytesPerRow)
|
||||
{
|
||||
if (bitsPerSample == 1) {
|
||||
swapPixel1(x1, y1, x2, y2, bytes, bitsPerSample, samplesPerPixel, bytesPerRow);
|
||||
|
@ -2551,15 +2552,15 @@ upside_down_backside_image(epsonds_scanner *s)
|
|||
}
|
||||
|
||||
if((s->height_back % 2) == 1) {
|
||||
uint32_t ymid = ( (s->height_back - 1 ) / 2 );
|
||||
for(uint32_t x = 0;x < (s->width_back / 2); x++) {
|
||||
SANE_Int ymid = ( (s->height_back - 1 ) / 2 );
|
||||
for(SANE_Int x = 0;x < (s->width_back / 2); x++) {
|
||||
swapPixel(x, ymid, s->width_back - x - 1, ymid, workBuffer, s->params.depth, samplesPerPxel, s->params.bytes_per_line);
|
||||
}
|
||||
}
|
||||
|
||||
if (s->height_back != 1) {
|
||||
for(uint32_t x = 0; x < s->width_back; x++) {
|
||||
for(uint32_t y = 0;y <= half; y++) {
|
||||
for(SANE_Int x = 0; x < s->width_back; x++) {
|
||||
for(SANE_Int y = 0;y <= half; y++) {
|
||||
swapPixel(x, y, s->width_back - x - 1, s->height_back - y -1, workBuffer, s->params.depth, samplesPerPxel, s->params.bytes_per_line);
|
||||
}
|
||||
}
|
||||
|
@ -3249,7 +3250,7 @@ sane_start(SANE_Handle handle)
|
|||
int val = rounded[row * 3 + col];
|
||||
unsigned char oct = (unsigned char)abs(val);
|
||||
oct |= ((val < 0) ? (1 << 7) : 0);
|
||||
ordered[index[row * 3 + col]] = oct;
|
||||
ordered[(signed char)index[row * 3 + col]] = oct;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
|
@ -180,7 +180,7 @@ struct epsonds_scanner
|
|||
|
||||
SANE_Int width_front, height_front;
|
||||
SANE_Int width_back , height_back;
|
||||
SANE_Int width_temp, height_temp;;
|
||||
SANE_Int width_temp, height_temp;
|
||||
|
||||
/* jpeg stuff */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue