Run indent: astyle -A8 -U -H -k3 -W3 -o xerox_mfp.[ch]

This is purely indent commit w/o any code changes.
To prove run `git diff -w`.
merge-requests/1/head
Alex Belkin 2016-11-06 20:24:02 +03:00
rodzic e4aed53a1e
commit 83bbcfe7d5
2 zmienionych plików z 1189 dodań i 1188 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -29,135 +29,136 @@
#define SWAP_Word(x, y) { SANE_Word z = x; x = y; y = z; } #define SWAP_Word(x, y) { SANE_Word z = x; x = y; y = z; }
enum options { enum options {
OPT_NUMOPTIONS, OPT_NUMOPTIONS,
OPT_GROUP_STD, OPT_GROUP_STD,
OPT_RESOLUTION, /* dpi*/ OPT_RESOLUTION, /* dpi*/
OPT_MODE, /* color */ OPT_MODE, /* color */
OPT_THRESHOLD, /* brightness */ OPT_THRESHOLD, /* brightness */
OPT_SOURCE, /* affects max window size */ OPT_SOURCE, /* affects max window size */
OPT_GROUP_GEO, OPT_GROUP_GEO,
OPT_SCAN_TL_X, /* for (OPT_SCAN_TL_X to OPT_SCAN_BR_Y) */ OPT_SCAN_TL_X, /* for (OPT_SCAN_TL_X to OPT_SCAN_BR_Y) */
OPT_SCAN_TL_Y, OPT_SCAN_TL_Y,
OPT_SCAN_BR_X, OPT_SCAN_BR_X,
OPT_SCAN_BR_Y, OPT_SCAN_BR_Y,
NUM_OPTIONS NUM_OPTIONS
}; };
typedef struct transport transport; typedef struct transport transport;
struct device { struct device {
struct device *next; struct device *next;
SANE_Device sane; SANE_Device sane;
int dn; /* usb file descriptor */ int dn; /* usb file descriptor */
SANE_Byte res[1024]; /* buffer for responses */ SANE_Byte res[1024]; /* buffer for responses */
size_t reslen; /* response len */ size_t reslen; /* response len */
SANE_Option_Descriptor opt[NUM_OPTIONS]; SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS]; Option_Value val[NUM_OPTIONS];
SANE_Parameters para; SANE_Parameters para;
SANE_Bool non_blocking; SANE_Bool non_blocking;
int scanning; /* scanning is started */ int scanning; /* scanning is started */
int cancel; /* cancel flag */ int cancel; /* cancel flag */
int state; /* current state */ int state; /* current state */
int reserved; /* CMD_RESERVE_UNIT */ int reserved; /* CMD_RESERVE_UNIT */
int reading; /* READ_IMAGE is sent */ int reading; /* READ_IMAGE is sent */
SANE_Byte *data; /* postprocessing cyclic buffer 64k */ SANE_Byte *data; /* postprocessing cyclic buffer 64k */
int datalen; /* how data in buffer */ int datalen; /* how data in buffer */
int dataoff; /* offset of data */ int dataoff; /* offset of data */
int dataindex; /* sequental number */ int dataindex; /* sequental number */
#define DATAMASK 0xffff /* mask of data buffer */ #define DATAMASK 0xffff /* mask of data buffer */
#define DATASIZE (DATAMASK + 1) /* size of data buffer */ #define DATASIZE (DATAMASK + 1) /* size of data buffer */
/* 64K will be enough to hold whole line of 2400 dpi of 23cm */ /* 64K will be enough to hold whole line of 2400 dpi of 23cm */
#define DATATAIL(dev) ((dev->dataoff + dev->datalen) & DATAMASK) #define DATATAIL(dev) ((dev->dataoff + dev->datalen) & DATAMASK)
#define DATAROOM(dev) dataroom(dev) #define DATAROOM(dev) dataroom(dev)
#define POST_DATASIZE 0xFFFFFF #define POST_DATASIZE 0xFFFFFF
SANE_Byte *decData; SANE_Byte *decData;
int decDataSize; int decDataSize;
int currentDecDataIndex; int currentDecDataIndex;
/* data from CMD_INQUIRY: */ /* data from CMD_INQUIRY: */
int resolutions; /* supported resolution bitmask */ int resolutions; /* supported resolution bitmask */
int compositions; /* supported image compositions bitmask */ int compositions; /* supported image compositions bitmask */
int max_len; /* effective max len for current doc source */ int max_len; /* effective max len for current doc source */
int max_win_width; int max_win_width;
int max_win_len; int max_win_len;
int max_len_adf; int max_len_adf;
int max_len_fb; int max_len_fb;
int line_order; /* if need post processing */ int line_order; /* if need post processing */
SANE_Word dpi_list[30]; /* allowed resolutions */ SANE_Word dpi_list[30]; /* allowed resolutions */
int doc_loaded; int doc_loaded;
SANE_Range win_x_range; SANE_Range win_x_range;
SANE_Range win_y_range; SANE_Range win_y_range;
/* CMD_SET_WINDOW parameters we set: */ /* CMD_SET_WINDOW parameters we set: */
int win_width; /* in 1200dpi points */ int win_width; /* in 1200dpi points */
int win_len; int win_len;
double win_off_x; /* in inches (byte.byte) */ double win_off_x; /* in inches (byte.byte) */
double win_off_y; double win_off_y;
int resolution; /* dpi indexed values */ int resolution; /* dpi indexed values */
int composition; /* MODE_ */ int composition; /* MODE_ */
int doc_source; /* document source */ int doc_source; /* document source */
int threshold; /* brightness */ int threshold; /* brightness */
int compressionTypes; int compressionTypes;
/* CMD_READ data. It is per block only, image could be in many blocks */ /* CMD_READ data. It is per block only, image could be in many blocks */
int blocklen; /* image data block len (padding incl.) */ int blocklen; /* image data block len (padding incl.) */
int vertical; /* lines in block (padded) */ int vertical; /* lines in block (padded) */
int horizontal; /* b/w: bytes, gray/color: pixels (padded) */ int horizontal; /* b/w: bytes, gray/color: pixels (padded) */
int final_block; int final_block;
int pixels_per_line; int pixels_per_line;
int bytes_per_line; int bytes_per_line;
int ulines; /* up to this block including */ int ulines; /* up to this block including */
int y_off; /* up to this block excluding*/ int y_off; /* up to this block excluding*/
int blocks; int blocks;
/* stat */ /* stat */
int total_img_size; /* predicted image size */ int total_img_size; /* predicted image size */
int total_out_size; /* total we sent to user */ int total_out_size; /* total we sent to user */
int total_data_size; /* total of what scanner sent us */ int total_data_size; /* total of what scanner sent us */
/* transport to use */ /* transport to use */
transport *io; transport *io;
}; };
/* Transport abstract layer */ /* Transport abstract layer */
struct transport { struct transport {
char* ttype; char *ttype;
int (*dev_request) (struct device *dev, int (*dev_request)(struct device *dev,
SANE_Byte *cmd, size_t cmdlen, SANE_Byte *cmd, size_t cmdlen,
SANE_Byte *resp, size_t *resplen); SANE_Byte *resp, size_t *resplen);
SANE_Status (*dev_open) (struct device *dev); SANE_Status(*dev_open)(struct device *dev);
void (*dev_close) (struct device *dev); void (*dev_close)(struct device *dev);
SANE_Status (*configure_device) (const char *devname, SANE_Status (*cb)(SANE_String_Const devname)); SANE_Status(*configure_device)(const char *devname, SANE_Status(*cb)(SANE_String_Const devname));
}; };
/* USB transport */ /* USB transport */
int usb_dev_request (struct device *dev, SANE_Byte *cmd, size_t cmdlen, SANE_Byte *resp, size_t *resplen); int usb_dev_request(struct device *dev, SANE_Byte *cmd, size_t cmdlen, SANE_Byte *resp, size_t *resplen);
SANE_Status usb_dev_open (struct device *dev); SANE_Status usb_dev_open(struct device *dev);
void usb_dev_close (struct device *dev); void usb_dev_close(struct device *dev);
SANE_Status usb_configure_device (const char *devname, SANE_Status (*cb)(SANE_String_Const devname)); SANE_Status usb_configure_device(const char *devname, SANE_Status(*cb)(SANE_String_Const devname));
/* TCP unicast */ /* TCP unicast */
int tcp_dev_request (struct device *dev, SANE_Byte *cmd, size_t cmdlen, SANE_Byte *resp, size_t *resplen); int tcp_dev_request(struct device *dev, SANE_Byte *cmd, size_t cmdlen, SANE_Byte *resp, size_t *resplen);
SANE_Status tcp_dev_open (struct device *dev); SANE_Status tcp_dev_open(struct device *dev);
void tcp_dev_close (struct device *dev); void tcp_dev_close(struct device *dev);
SANE_Status tcp_configure_device (const char *devname, SANE_Status (*cb)(SANE_String_Const devname)); SANE_Status tcp_configure_device(const char *devname, SANE_Status(*cb)(SANE_String_Const devname));
/* device wants transfer buffer to be multiple of 512 */ /* device wants transfer buffer to be multiple of 512 */
#define USB_BLOCK_SIZE 512 #define USB_BLOCK_SIZE 512
#define USB_BLOCK_MASK ~(USB_BLOCK_SIZE - 1) #define USB_BLOCK_MASK ~(USB_BLOCK_SIZE - 1)
static inline int dataroom(struct device *dev) { static inline int dataroom(struct device *dev)
int tail = DATATAIL(dev); {
if (tail < dev->dataoff) int tail = DATATAIL(dev);
return dev->dataoff - tail; if (tail < dev->dataoff)
else if (dev->datalen == DATASIZE) { return dev->dataoff - tail;
return 0; else if (dev->datalen == DATASIZE) {
} else return 0;
return DATASIZE - tail; } else
return DATASIZE - tail;
} }
/* Functions from original xerox_mfp.c, used in -usb.c and -tcp.c */ /* Functions from original xerox_mfp.c, used in -usb.c and -tcp.c */