compile and warnings fixes for p5 backen

merge-requests/1/head
Stphane Voltz 2010-02-15 21:47:04 +01:00
rodzic 982bf43a64
commit 372f9985f9
3 zmienionych plików z 21 dodań i 12 usunięć

Wyświetl plik

@ -232,7 +232,7 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
if (devlist)
{
for (i = 0; devlist[i] != NULL; i++)
free ((SANE_Device *) devlist[i]);
free ((void *)devlist[i]);
free (devlist);
devlist = NULL;
}
@ -1466,7 +1466,7 @@ sane_close (SANE_Handle handle)
/* free per session data */
free (session->options[OPT_MODE].value.s);
free (session->options[OPT_RESOLUTION].descriptor.constraint.word_list);
free ((void *)session->options[OPT_RESOLUTION].descriptor.constraint.word_list);
free (session);
@ -1643,6 +1643,10 @@ attach_p5 (const char *devicename, SANEI_Config * config)
struct P5_Model *model;
DBG (DBG_proc, "attach(%s): start\n", devicename);
if(config==NULL)
{
DBG (DBG_warn, "attach: config is NULL\n");
}
/* search if we already have it attached */
for (device = devices; device; device = device->next)

Wyświetl plik

@ -54,10 +54,10 @@
#include "../include/sane/sanei_backend.h"
/**< macro to enable an option */
#define ENABLE(OPTION) session->options[OPTION].cap &= ~SANE_CAP_INACTIVE
#define ENABLE(OPTION) session->options[OPTION].descriptor.cap &= ~SANE_CAP_INACTIVE
/**< macro to disable an option */
#define DISABLE(OPTION) session->options[OPTION].cap |= SANE_CAP_INACTIVE
#define DISABLE(OPTION) session->options[OPTION].descriptor.cap |= SANE_CAP_INACTIVE
/** macro to test is an option is active */
#define IS_ACTIVE(OPTION) (((s->opt[OPTION].cap) & SANE_CAP_INACTIVE) == 0)
@ -203,4 +203,6 @@ static SANE_Status attach_p5 (const char *name, SANEI_Config * config);
static SANE_Status init_options (struct P5_Session *session);
static SANE_Status compute_parameters (struct P5_Session *session);
/* vim: set sw=2 cino=>2se-1sn-1s{s^-1st0(0u0 smarttab expandtab: */
#endif /* not P5_H */

Wyświetl plik

@ -459,7 +459,7 @@ setadresses (int fd, u_int16_t start, u_int16_t end)
* @return file descriptor in cas of successn -1 otherwise
*/
static int
open_pp (char *devicename)
open_pp (const char *devicename)
{
int fd, rc, mode = 0;
char *name;
@ -468,11 +468,11 @@ open_pp (char *devicename)
/* TODO improve auto device finding */
if (strncmp (devicename, "auto", 4) == 0)
{
name = "/dev/parport0";
name = strdup("/dev/parport0");
}
else
{
name = devicename;
name = strdup(devicename);
}
/* open device */
@ -501,6 +501,7 @@ open_pp (char *devicename)
}
return -1;
}
free(name);
/* claim device and set it to EPP */
rc = ioctl (fd, PPCLAIM);
@ -707,10 +708,10 @@ static SANE_Status
start_scan (P5_Device * dev, int mode, unsigned int dpi, unsigned int startx,
unsigned int width)
{
u_int8_t reg0;
u_int8_t reg2;
u_int8_t regF;
u_int16_t addr;
u_int8_t reg0=0;
u_int8_t reg2=0;
u_int8_t regF=0;
u_int16_t addr=0;
u_int16_t start, end;
unsigned int xdpi;
@ -1208,6 +1209,7 @@ is_white_line (u_int8_t * buffer, unsigned int pixels, int mode)
/* ------------------------------------------------------------------------- */
/* writes gray data to a pnm file */
/*
static void
write_gray_data (unsigned char *image, char *name, SANE_Int width,
SANE_Int height)
@ -1221,6 +1223,7 @@ write_gray_data (unsigned char *image, char *name, SANE_Int width,
fwrite (image, width, height, fdbg);
fclose (fdbg);
}
*/
/* ------------------------------------------------------------------------- */
/* writes rgb data to a pnm file */
@ -1243,7 +1246,7 @@ write_rgb_data (char *name, unsigned char *image, SANE_Int width,
* backend name and device
*/
static char *
calibration_file (char *devicename)
calibration_file (const char *devicename)
{
char *ptr = NULL;
char tmp_str[PATH_MAX];