Reformat of source code to get rid of different coding styles used by different

authors over the years.
merge-requests/1/head
Karl Heinz Kremer 2004-02-08 18:32:33 +00:00
rodzic db44edb31c
commit 5a3f789018
7 zmienionych plików z 4702 dodań i 4513 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2004-02-08 Karl Heinz Kremer <khk@khk.net>
* backend/epson*.[ch]: Reformat source code to get rid of different coding styles
used over the years (and by different authors).
2004-02-08 Frank Zago <fzago at austin dot rr dot com>
* README.windows: added info about USB scanners.

Plik diff jest za duży Load Diff

Wyświetl plik

@ -80,8 +80,9 @@
#define SANE_EPSON_MAX_RETRIES (120) /* how often do we retry during warmup ? */
typedef struct {
char * level;
typedef struct
{
char *level;
unsigned char request_identity;
unsigned char request_identity2; /* new request identity command for Dx command level */
@ -118,63 +119,25 @@ typedef struct {
unsigned char set_threshold;
unsigned char set_focus_position; /* B8 only */
unsigned char request_focus_position; /* B8 only */
} EpsonCmdRec, * EpsonCmd;
} EpsonCmdRec, *EpsonCmd;
enum
{ OPT_NUM_OPTS = 0
, OPT_MODE_GROUP
, OPT_MODE
, OPT_BIT_DEPTH
, OPT_HALFTONE
, OPT_DROPOUT
, OPT_BRIGHTNESS
, OPT_SHARPNESS
, OPT_GAMMA_CORRECTION
, OPT_COLOR_CORRECTION
, OPT_RESOLUTION
, OPT_THRESHOLD
, OPT_ADVANCED_GROUP
, OPT_MIRROR
, OPT_SPEED
, OPT_AAS
, OPT_LIMIT_RESOLUTION
, OPT_ZOOM
/* , OPT_GAMMA_VECTOR */
, OPT_GAMMA_VECTOR_R
, OPT_GAMMA_VECTOR_G
, OPT_GAMMA_VECTOR_B
, OPT_WAIT_FOR_BUTTON
, OPT_CCT_GROUP
, OPT_CCT_1
, OPT_CCT_2
, OPT_CCT_3
, OPT_CCT_4
, OPT_CCT_5
, OPT_CCT_6
, OPT_CCT_7
, OPT_CCT_8
, OPT_CCT_9
, OPT_PREVIEW_GROUP
, OPT_PREVIEW
, OPT_PREVIEW_SPEED
, OPT_GEOMETRY_GROUP
, OPT_TL_X
, OPT_TL_Y
, OPT_BR_X
, OPT_BR_Y
, OPT_QUICK_FORMAT
, OPT_EQU_GROUP
, OPT_SOURCE
, OPT_AUTO_EJECT
, OPT_FILM_TYPE
, OPT_FOCUS
, OPT_BAY
, OPT_EJECT
, OPT_ADF_MODE
, NUM_OPTIONS
};
{ OPT_NUM_OPTS =
0, OPT_MODE_GROUP, OPT_MODE, OPT_BIT_DEPTH, OPT_HALFTONE, OPT_DROPOUT,
OPT_BRIGHTNESS, OPT_SHARPNESS, OPT_GAMMA_CORRECTION, OPT_COLOR_CORRECTION,
OPT_RESOLUTION, OPT_THRESHOLD, OPT_ADVANCED_GROUP, OPT_MIRROR, OPT_SPEED,
OPT_AAS, OPT_LIMIT_RESOLUTION, OPT_ZOOM, /* OPT_GAMMA_VECTOR */
OPT_GAMMA_VECTOR_R, OPT_GAMMA_VECTOR_G, OPT_GAMMA_VECTOR_B,
OPT_WAIT_FOR_BUTTON, OPT_CCT_GROUP, OPT_CCT_1, OPT_CCT_2, OPT_CCT_3,
OPT_CCT_4, OPT_CCT_5, OPT_CCT_6, OPT_CCT_7, OPT_CCT_8, OPT_CCT_9,
OPT_PREVIEW_GROUP, OPT_PREVIEW, OPT_PREVIEW_SPEED, OPT_GEOMETRY_GROUP,
OPT_TL_X, OPT_TL_Y, OPT_BR_X, OPT_BR_Y, OPT_QUICK_FORMAT, OPT_EQU_GROUP,
OPT_SOURCE, OPT_AUTO_EJECT, OPT_FILM_TYPE, OPT_FOCUS, OPT_BAY,
OPT_EJECT, OPT_ADF_MODE, NUM_OPTIONS
};
typedef enum { /* hardware connection to the scanner */
typedef enum
{ /* hardware connection to the scanner */
SANE_EPSON_NODEV, /* default, no HW specified yet */
SANE_EPSON_SCSI, /* SCSI interface */
SANE_EPSON_PIO, /* parallel interface */
@ -207,14 +170,15 @@ typedef struct
} Epson_Identity2;
struct Epson_Device {
struct Epson_Device
{
struct Epson_Device *next;
SANE_Device sane;
SANE_Int level;
SANE_Range dpi_range;
SANE_Range * x_range; /* x range w/out extension */
SANE_Range * y_range; /* y range w/out extension */
SANE_Range *x_range; /* x range w/out extension */
SANE_Range *y_range; /* y range w/out extension */
SANE_Range fbf_x_range; /* flattbed x range */
SANE_Range fbf_y_range; /* flattbed y range */
@ -266,22 +230,23 @@ typedef struct Epson_Device Epson_Device;
struct Epson_Scanner {
struct Epson_Scanner
{
struct Epson_Scanner *next;
int fd;
Epson_Device * hw;
SANE_Option_Descriptor opt [ NUM_OPTIONS];
Option_Value val [ NUM_OPTIONS];
Epson_Device *hw;
SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS];
SANE_Parameters params;
SANE_Bool block;
SANE_Bool eof;
SANE_Byte * buf, * end, * ptr;
SANE_Byte *buf, *end, *ptr;
SANE_Bool canceling;
SANE_Bool invert_image;
SANE_Bool focusOnGlass;
SANE_Byte currentFocusPosition;
/* SANE_Word gamma_table [ 4] [ 256]; */
SANE_Word gamma_table [ 3] [ 256];
SANE_Word gamma_table[3][256];
SANE_Int retry_count;
SANE_Byte *line_buffer[LINES_SHUFFLE_MAX];
/* buffer lines for color shuffling */

Wyświetl plik

@ -1,5 +1,5 @@
#ifdef _AIX
# include "../include/lalloca.h" /* MUST come first for AIX! */
#include "../include/lalloca.h" /* MUST come first for AIX! */
#endif
#include "../include/sane/config.h"
#include <sane/sanei_debug.h>
@ -27,13 +27,13 @@
* sense handler for the sanei_scsi_XXX comands
*/
SANE_Status
sanei_epson_scsi_sense_handler(int scsi_fd, u_char *result, void *arg)
sanei_epson_scsi_sense_handler (int scsi_fd, u_char * result, void *arg)
{
/* to get rid of warnings */
scsi_fd = scsi_fd;
arg = arg;
if (result[0] && result[0]!=0x70)
if (result[0] && result[0] != 0x70)
{
DBG (2, "sense_handler() : sense code = 0x%02x\n", result[0]);
return SANE_STATUS_IO_ERROR;
@ -49,16 +49,16 @@ sanei_epson_scsi_sense_handler(int scsi_fd, u_char *result, void *arg)
*
*/
SANE_Status
sanei_epson_scsi_inquiry(int fd, int page_code, void * buf, size_t * buf_size)
sanei_epson_scsi_inquiry (int fd, int page_code, void *buf, size_t * buf_size)
{
u_char cmd [ 6];
u_char cmd[6];
int status;
memset( cmd, 0, 6);
cmd[ 0] = INQUIRY_COMMAND;
cmd[ 2] = page_code;
cmd[ 4] = *buf_size > 255 ? 255 : *buf_size;
status = sanei_scsi_cmd( fd, cmd, sizeof cmd, buf, buf_size);
memset (cmd, 0, 6);
cmd[0] = INQUIRY_COMMAND;
cmd[2] = page_code;
cmd[4] = *buf_size > 255 ? 255 : *buf_size;
status = sanei_scsi_cmd (fd, cmd, sizeof cmd, buf, buf_size);
return status;
}
@ -68,17 +68,19 @@ sanei_epson_scsi_inquiry(int fd, int page_code, void * buf, size_t * buf_size)
*
*/
int
sanei_epson_scsi_read(int fd, void * buf, size_t buf_size, SANE_Status * status)
sanei_epson_scsi_read (int fd, void *buf, size_t buf_size,
SANE_Status * status)
{
u_char cmd [ 6];
u_char cmd[6];
memset( cmd, 0, 6);
cmd[ 0] = READ_6_COMMAND;
cmd[ 2] = buf_size >> 16;
cmd[ 3] = buf_size >> 8;
cmd[ 4] = buf_size;
memset (cmd, 0, 6);
cmd[0] = READ_6_COMMAND;
cmd[2] = buf_size >> 16;
cmd[3] = buf_size >> 8;
cmd[4] = buf_size;
if( SANE_STATUS_GOOD == ( *status = sanei_scsi_cmd( fd, cmd, sizeof( cmd), buf, &buf_size)))
if (SANE_STATUS_GOOD ==
(*status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, &buf_size)))
return buf_size;
return 0;
@ -89,21 +91,22 @@ sanei_epson_scsi_read(int fd, void * buf, size_t buf_size, SANE_Status * status)
*
*/
int
sanei_epson_scsi_write(int fd, const void * buf, size_t buf_size, SANE_Status * status)
sanei_epson_scsi_write (int fd, const void *buf, size_t buf_size,
SANE_Status * status)
{
u_char * cmd;
u_char *cmd;
cmd = alloca(8 + buf_size);
memset( cmd, 0, 8);
cmd[ 0] = WRITE_6_COMMAND;
cmd[ 2] = buf_size >> 16;
cmd[ 3] = buf_size >> 8;
cmd[ 4] = buf_size;
memcpy( cmd + 8, buf, buf_size);
cmd = alloca (8 + buf_size);
memset (cmd, 0, 8);
cmd[0] = WRITE_6_COMMAND;
cmd[2] = buf_size >> 16;
cmd[3] = buf_size >> 8;
cmd[4] = buf_size;
memcpy (cmd + 8, buf, buf_size);
if( SANE_STATUS_GOOD == ( *status = sanei_scsi_cmd2( fd, cmd, 6, cmd + 8, buf_size, NULL, NULL)))
if (SANE_STATUS_GOOD ==
(*status = sanei_scsi_cmd2 (fd, cmd, 6, cmd + 8, buf_size, NULL, NULL)))
return buf_size;
return 0;
}

Wyświetl plik

@ -12,9 +12,13 @@
#define INQUIRY_BUF_SIZE (36)
SANE_Status sanei_epson_scsi_sense_handler(int scsi_fd, u_char *result, void *arg);
SANE_Status sanei_epson_scsi_inquiry(int fd, int page_code, void * buf, size_t * buf_size);
int sanei_epson_scsi_read(int fd, void * buf, size_t buf_size, SANE_Status * status);
int sanei_epson_scsi_write(int fd, const void * buf, size_t buf_size, SANE_Status * status);
SANE_Status sanei_epson_scsi_sense_handler (int scsi_fd, u_char * result,
void *arg);
SANE_Status sanei_epson_scsi_inquiry (int fd, int page_code, void *buf,
size_t * buf_size);
int sanei_epson_scsi_read (int fd, void *buf, size_t buf_size,
SANE_Status * status);
int sanei_epson_scsi_write (int fd, const void *buf, size_t buf_size,
SANE_Status * status);
#endif

Wyświetl plik

@ -3,8 +3,7 @@
#include "epson_usb.h"
SANE_Word sanei_epson_usb_product_ids [] =
{
SANE_Word sanei_epson_usb_product_ids[] = {
0x101, /* Perfection 636 */
0x103, /* Perfection 610 */
0x10c, /* Perfection 640 */
@ -30,7 +29,8 @@ SANE_Word sanei_epson_usb_product_ids [] =
int sanei_epson_getNumberOfUSBProductIds(void)
int
sanei_epson_getNumberOfUSBProductIds (void)
{
return sizeof(sanei_epson_usb_product_ids)/sizeof(SANE_Word);
return sizeof (sanei_epson_usb_product_ids) / sizeof (SANE_Word);
}

Wyświetl plik

@ -3,8 +3,8 @@
#define SANE_EPSON_VENDOR_ID (0x4b8)
extern SANE_Word sanei_epson_usb_product_ids [];
extern SANE_Word sanei_epson_usb_product_ids[];
extern int sanei_epson_getNumberOfUSBProductIds(void);
extern int sanei_epson_getNumberOfUSBProductIds (void);
#endif