replace u_int8_t and u_int16_t by uint8_t and uint16_t

merge-requests/1/head
Stphane Voltz 2010-04-06 21:35:17 +02:00
rodzic 15572c9cd9
commit af71eda58a
5 zmienionych plików z 52 dodań i 48 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2010-03-25 Stéphane Voltz <stef.dev at free.fr>
* backend/p5.c backend/p5_device.[ch] backend/genesys_gl646.c:
replace u_int8_t and u_int16_t by uint8_t and uint16_t
2010-04-06 Chris Bagwell <chris at cnpbagwell dot com> 2010-04-06 Chris Bagwell <chris at cnpbagwell dot com>
* configure.in, tools/sane-backends.pc.in: Add stub for future * configure.in, tools/sane-backends.pc.in: Add stub for future
pkg-config support to configure. This allows distributes pkg-config support to configure. This allows distributes

Wyświetl plik

@ -4929,7 +4929,7 @@ simple_scan (Genesys_Device * dev, Genesys_Settings settings, SANE_Bool move,
SANE_Bool empty, split; SANE_Bool empty, split;
unsigned char *buffer; unsigned char *buffer;
int count; int count;
u_int8_t val; uint8_t val;
DBG (DBG_proc, "simple_scan: starting\n"); DBG (DBG_proc, "simple_scan: starting\n");
DBG (DBG_io, "simple_scan: move=%d, forward=%d, shading=%d\n", move, DBG (DBG_io, "simple_scan: move=%d, forward=%d, shading=%d\n", move,

Wyświetl plik

@ -893,7 +893,7 @@ sane_start (SANE_Handle handle)
dev->bottom = dev->bytes_per_line * 2 * dev->lds; dev->bottom = dev->bytes_per_line * 2 * dev->lds;
/* computes buffer size, 66 color lines plus eventual amount needed for lds */ /* computes buffer size, 66 color lines plus eventual amount needed for lds */
dev->size = dev->pixels * 3 * 66 + dev->bottom; dev->size = dev->pixels * 3 * 66 + dev->bottom;
dev->buffer = (u_int8_t *) malloc (dev->size); dev->buffer = (uint8_t *) malloc (dev->size);
if (dev->buffer == NULL) if (dev->buffer == NULL)
{ {
DBG (DBG_error, "sane_start: failed to allocate %d bytes\n", dev->size); DBG (DBG_error, "sane_start: failed to allocate %d bytes\n", dev->size);

Wyświetl plik

@ -25,7 +25,7 @@ static P5_Model pagepartner_model = {
#ifdef HAVE_LINUX_PPDEV_H #ifdef HAVE_LINUX_PPDEV_H
static char * static char *
addr_name (u_int16_t addr) addr_name (uint16_t addr)
{ {
switch (addr) switch (addr)
{ {
@ -54,11 +54,11 @@ addr_name (u_int16_t addr)
* @{ * @{
*/ */
static u_int8_t static uint8_t
inb (int fd, u_int16_t addr) inb (int fd, uint16_t addr)
{ {
#ifdef HAVE_LINUX_PPDEV_H #ifdef HAVE_LINUX_PPDEV_H
u_int8_t val = 0xff; uint8_t val = 0xff;
int rc, mode = 0xff; int rc, mode = 0xff;
switch (addr) switch (addr)
@ -100,7 +100,7 @@ inb (int fd, u_int16_t addr)
} }
static void static void
outb (int fd, u_int16_t addr, u_int8_t value) outb (int fd, uint16_t addr, uint8_t value)
{ {
#ifdef HAVE_LINUX_PPDEV_H #ifdef HAVE_LINUX_PPDEV_H
int rc = 0, mode = 0xff; int rc = 0, mode = 0xff;
@ -149,9 +149,9 @@ outb (int fd, u_int16_t addr, u_int8_t value)
} }
static void static void
write_reg (int fd, u_int8_t index, u_int8_t value) write_reg (int fd, uint8_t index, uint8_t value)
{ {
u_int8_t idx; uint8_t idx;
/* both nibbles hold the same value */ /* both nibbles hold the same value */
idx = index & 0x0F; idx = index & 0x0F;
@ -161,10 +161,10 @@ write_reg (int fd, u_int8_t index, u_int8_t value)
outb (fd, EPPDATA, value); outb (fd, EPPDATA, value);
} }
static u_int8_t static uint8_t
read_reg (int fd, u_int8_t index) read_reg (int fd, uint8_t index)
{ {
u_int8_t idx; uint8_t idx;
/* both nibbles hold the same value */ /* both nibbles hold the same value */
idx = index & 0x0F; idx = index & 0x0F;
@ -175,7 +175,7 @@ read_reg (int fd, u_int8_t index)
#ifdef HAVE_LINUX_PPDEV_H #ifdef HAVE_LINUX_PPDEV_H
static int static int
read_data (int fd, u_int8_t * data, int length) read_data (int fd, uint8_t * data, int length)
{ {
int mode, rc, nb; int mode, rc, nb;
unsigned char bval; unsigned char bval;
@ -212,7 +212,7 @@ read_data (int fd, u_int8_t * data, int length)
} }
static void static void
index_write_data (int fd, u_int8_t index, u_int8_t * data, int length) index_write_data (int fd, uint8_t index, uint8_t * data, int length)
{ {
int mode, rc; int mode, rc;
unsigned char bval; unsigned char bval;
@ -231,15 +231,15 @@ index_write_data (int fd, u_int8_t index, u_int8_t * data, int length)
} }
static void static void
write_data (int fd, u_int8_t * data, int length) write_data (int fd, uint8_t * data, int length)
{ {
index_write_data (fd, REG8, data, length); index_write_data (fd, REG8, data, length);
} }
static void static void
write_reg2 (int fd, u_int8_t index, u_int16_t value) write_reg2 (int fd, uint8_t index, uint16_t value)
{ {
u_int8_t data2[2]; uint8_t data2[2];
data2[0] = value & 0xff; data2[0] = value & 0xff;
data2[1] = value >> 8; data2[1] = value >> 8;
@ -248,7 +248,7 @@ write_reg2 (int fd, u_int8_t index, u_int16_t value)
#else #else
static int static int
read_data (int fd, u_int8_t * data, int length) read_data (int fd, uint8_t * data, int length)
{ {
if(fd && data && length) if(fd && data && length)
return -1; return -1;
@ -256,14 +256,14 @@ read_data (int fd, u_int8_t * data, int length)
} }
static void static void
write_data (int fd, u_int8_t * data, int length) write_data (int fd, uint8_t * data, int length)
{ {
if(fd && data && length) if(fd && data && length)
return; return;
} }
static void static void
write_reg2 (int fd, u_int8_t index, u_int16_t value) write_reg2 (int fd, uint8_t index, uint16_t value)
{ {
if(fd && index && value) if(fd && index && value)
return; return;
@ -283,16 +283,16 @@ write_reg2 (int fd, u_int8_t index, u_int16_t value)
* @return SANE_TRUE on succes, SANE_FALSE otherwise * @return SANE_TRUE on succes, SANE_FALSE otherwise
*/ */
static int static int
memtest (int fd, u_int16_t addr) memtest (int fd, uint16_t addr)
{ {
u_int8_t sent[256]; uint8_t sent[256];
u_int8_t back[256]; uint8_t back[256];
int i; int i;
write_reg2 (fd, REG1, addr); write_reg2 (fd, REG1, addr);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
sent[i] = (u_int8_t) i; sent[i] = (uint8_t) i;
back[i] = 0; back[i] = 0;
} }
write_data (fd, sent, 256); write_data (fd, sent, 256);
@ -321,7 +321,7 @@ memtest (int fd, u_int16_t addr)
static int static int
connect (int fd) connect (int fd)
{ {
u_int8_t val; uint8_t val;
inb (fd, CONTROL); inb (fd, CONTROL);
outb (fd, CONTROL, 0x04); outb (fd, CONTROL, 0x04);
@ -390,7 +390,7 @@ connect (int fd)
static int static int
disconnect (int fd) disconnect (int fd)
{ {
u_int8_t val; uint8_t val;
outb (fd, CONTROL, 0x04); outb (fd, CONTROL, 0x04);
outb (fd, DATA, 0x00); outb (fd, DATA, 0x00);
@ -451,7 +451,7 @@ disconnect (int fd)
} }
static void static void
setadresses (int fd, u_int16_t start, u_int16_t end) setadresses (int fd, uint16_t start, uint16_t end)
{ {
write_reg (fd, REG3, start & 0xff); write_reg (fd, REG3, start & 0xff);
write_reg (fd, REG4, start >> 8); write_reg (fd, REG4, start >> 8);
@ -666,7 +666,7 @@ build_correction (P5_Device * dev, unsigned int dpi, unsigned int mode,
"build_correction: failed to allocate memory for gain!\n"); "build_correction: failed to allocate memory for gain!\n");
return SANE_STATUS_NO_MEM; return SANE_STATUS_NO_MEM;
} }
dev->offset = (u_int8_t *) malloc (width); dev->offset = (uint8_t *) malloc (width);
if (dev->offset == NULL) if (dev->offset == NULL)
{ {
DBG (DBG_error, DBG (DBG_error,
@ -720,11 +720,11 @@ static SANE_Status
start_scan (P5_Device * dev, int mode, unsigned int dpi, unsigned int startx, start_scan (P5_Device * dev, int mode, unsigned int dpi, unsigned int startx,
unsigned int width) unsigned int width)
{ {
u_int8_t reg0=0; uint8_t reg0=0;
u_int8_t reg2=0; uint8_t reg2=0;
u_int8_t regF=0; uint8_t regF=0;
u_int16_t addr=0; uint16_t addr=0;
u_int16_t start, end; uint16_t start, end;
unsigned int xdpi; unsigned int xdpi;
DBG (DBG_proc, "start_scan: start \n"); DBG (DBG_proc, "start_scan: start \n");
@ -864,11 +864,11 @@ start_scan (P5_Device * dev, int mode, unsigned int dpi, unsigned int startx,
* @returns number of data lines read, -1 in case of error * @returns number of data lines read, -1 in case of error
*/ */
static int static int
read_line (P5_Device * dev, u_int8_t * data, size_t length, int ltr, read_line (P5_Device * dev, uint8_t * data, size_t length, int ltr,
SANE_Bool retry, SANE_Bool x2, int mode, SANE_Bool correction) SANE_Bool retry, SANE_Bool x2, int mode, SANE_Bool correction)
{ {
u_int8_t counter, read, cnt; uint8_t counter, read, cnt;
u_int8_t inbuffer[MAX_SENSOR_PIXELS * 2 * 3 + 2]; uint8_t inbuffer[MAX_SENSOR_PIXELS * 2 * 3 + 2];
unsigned int i, factor; unsigned int i, factor;
float val; float val;
@ -999,10 +999,10 @@ eject (int fd)
* @param fd file descriptor of the physical device * @param fd file descriptor of the physical device
*/ */
/* static int /* static int
wait_document (int fd, u_int8_t detector) wait_document (int fd, uint8_t detector)
{ {
int count = 0; int count = 0;
u_int8_t val; uint8_t val;
write_reg (fd, REG1, 0x00); write_reg (fd, REG1, 0x00);
write_reg (fd, REG7, 0x00); write_reg (fd, REG7, 0x00);
@ -1130,7 +1130,7 @@ cleanup_calibration (P5_Device * dev)
* @returns SANE_TRUE if it is considered as a white line * @returns SANE_TRUE if it is considered as a white line
*/ */
static SANE_Bool static SANE_Bool
is_black_line (u_int8_t * buffer, unsigned int pixels, int mode) is_black_line (uint8_t * buffer, unsigned int pixels, int mode)
{ {
unsigned int i, start, end, count, width; unsigned int i, start, end, count, width;
@ -1179,7 +1179,7 @@ is_black_line (u_int8_t * buffer, unsigned int pixels, int mode)
* @returns SANE_TRUE if it is considered as a white line * @returns SANE_TRUE if it is considered as a white line
*/ */
static SANE_Bool static SANE_Bool
is_white_line (u_int8_t * buffer, unsigned int pixels, int mode) is_white_line (uint8_t * buffer, unsigned int pixels, int mode)
{ {
unsigned int i, start, end, count, width; unsigned int i, start, end, count, width;
@ -1414,9 +1414,9 @@ save_calibration (P5_Device * dev)
static SANE_Status static SANE_Status
sheetfed_calibration (P5_Device * dev) sheetfed_calibration (P5_Device * dev)
{ {
u_int8_t buffer[MAX_SENSOR_PIXELS * 3]; uint8_t buffer[MAX_SENSOR_PIXELS * 3];
u_int16_t white_data[MAX_SENSOR_PIXELS * 3]; uint16_t white_data[MAX_SENSOR_PIXELS * 3];
u_int16_t black_data[MAX_SENSOR_PIXELS * 3]; uint16_t black_data[MAX_SENSOR_PIXELS * 3];
unsigned int i, j, k, dpi, pixels, read, black, white; unsigned int i, j, k, dpi, pixels, read, black, white;
float coeff; float coeff;
unsigned int red, green, blue; unsigned int red, green, blue;

Wyświetl plik

@ -31,10 +31,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../include/_stdint.h"
#ifdef HAVE_LINUX_PPDEV_H #ifdef HAVE_LINUX_PPDEV_H
#include <errno.h> #include <errno.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -79,8 +79,8 @@
typedef struct P5_Calibration_Data typedef struct P5_Calibration_Data
{ {
unsigned int dpi; unsigned int dpi;
u_int8_t black_data[MAX_SENSOR_PIXELS * 3]; uint8_t black_data[MAX_SENSOR_PIXELS * 3];
u_int8_t white_data[MAX_SENSOR_PIXELS * 3]; uint8_t white_data[MAX_SENSOR_PIXELS * 3];
} P5_Calibration_Data; } P5_Calibration_Data;
/** /**
@ -236,7 +236,7 @@ typedef struct P5_Device
/** /**
* work buffer for scans * work buffer for scans
*/ */
u_int8_t *buffer; uint8_t *buffer;
/** /**
* buffer size * buffer size
@ -267,7 +267,7 @@ typedef struct P5_Device
/**> correction coefficient for the current scan */ /**> correction coefficient for the current scan */
float *gain; float *gain;
u_int8_t *offset; uint8_t *offset;
} P5_Device; } P5_Device;