* hp5400: removing more compilation warnings

merge-requests/1/head
Thomas Soumarmon 2004-10-03 11:14:03 +00:00
rodzic 59b80e8c46
commit f50c42d4fb
5 zmienionych plików z 29 dodań i 12 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2004-10-03 Thomas Soumarmon <thomas.soumarmon@cogitae.net>
* backend/hp5400_debug.c backend/hp5400_debug.h
backend/hp5400_internal.c backend/hp5400_sane.c:
removing more hp5400 compilation warnings
2004-10-03 Henning Meier-Geinitz <henning@meier-geinitz.de> 2004-10-03 Henning Meier-Geinitz <henning@meier-geinitz.de>
* doc/descriptions/unsupported.desc: Added Nikon LS-5000 ED (bug * doc/descriptions/unsupported.desc: Added Nikon LS-5000 ED (bug

Wyświetl plik

@ -63,6 +63,7 @@ void hp5400_dbg_start() {
#else #else
/* #define DEBUG_NOT_STATIC */
#undef DEBUG_DECLARE_ONLY #undef DEBUG_DECLARE_ONLY
#undef _SANEI_DEBUG_H #undef _SANEI_DEBUG_H
#include "../include/sane/sanei_debug.h" #include "../include/sane/sanei_debug.h"

Wyświetl plik

@ -50,6 +50,7 @@
#ifndef STANDALONE #ifndef STANDALONE
#define DEBUG_NOT_STATIC
#define DEBUG_DECLARE_ONLY #define DEBUG_DECLARE_ONLY
#include "../include/sane/sanei_debug.h" #include "../include/sane/sanei_debug.h"

Wyświetl plik

@ -211,6 +211,11 @@ SetCalibration (int iHandle, int numPixels, unsigned int *low_vals[3],
unsigned int *high_vals[3], int dpi) unsigned int *high_vals[3], int dpi)
{ {
char cmd[8]; char cmd[8];
/* unsigned char cmd[8]; */ /* should fix the compilation warning
but I don't have a scanner right now
to check that the fix does not break
calibration */
int i, j; int i, j;
struct CalPixel struct CalPixel
{ {
@ -238,7 +243,7 @@ SetCalibration (int iHandle, int numPixels, unsigned int *low_vals[3],
int calSize = numLoop * calBlockSize * numCalBlock; int calSize = numLoop * calBlockSize * numCalBlock;
calinfo = malloc (calSize); calinfo = malloc (calSize);
bzero (calinfo, calSize); memset (calinfo, 0, calSize);
for (j = 0; j < numLoop * numCalBlock * CALPIXBYBLOCK; j++) for (j = 0; j < numLoop * numCalBlock * CALPIXBYBLOCK; j++)
{ {
@ -735,7 +740,7 @@ Calibrate (int iHandle, int dpi)
#endif #endif
/* The first calibration scan. Finds maximum of each CCD */ /* The first calibration scan. Finds maximum of each CCD */
bzero (&req, sizeof (req)); memset(&req, 0, sizeof(req));
req.x1 = 0x08; req.x1 = 0x08;
req.dpix = htons (300); /* = 300 dpi */ req.dpix = htons (300); /* = 300 dpi */
@ -793,7 +798,7 @@ Calibrate (int iHandle, int dpi)
#endif #endif
/* The second calibration scan. Finds minimum of each CCD */ /* The second calibration scan. Finds minimum of each CCD */
bzero (&req, sizeof (req)); memset(&req, 0, sizeof(req));
req.x1 = 0x08; req.x1 = 0x08;
req.dpix = htons (300); /* = 300 dpi */ req.dpix = htons (300); /* = 300 dpi */
@ -877,7 +882,7 @@ hp5400_scan (int iHandle, TScanParams * params, THWParams * pHWParams,
HP5400_DBG (DBG_MSG, " height : %d\n", params->iHeight); HP5400_DBG (DBG_MSG, " height : %d\n", params->iHeight);
HP5400_DBG (DBG_MSG, "\n"); HP5400_DBG (DBG_MSG, "\n");
bzero (&req, sizeof (req)); memset(&req, 0, sizeof(req));
req.x1 = 0x08; req.x1 = 0x08;
req.dpix = htons (params->iDpi); req.dpix = htons (params->iDpi);
@ -999,8 +1004,8 @@ InitScan (enum ScanType scantype, TScanParams * pParams,
struct ScanRequest req; struct ScanRequest req;
struct ScanResponse res; struct ScanResponse res;
int ret; int ret;
bzero (&req, sizeof (req)); memset(&req, 0, sizeof(req));
req.x1 = 0x08; req.x1 = 0x08;
req.dpix = htons (pParams->iDpi); /* = 300 dpi */ req.dpix = htons (pParams->iDpi); /* = 300 dpi */
@ -1053,7 +1058,7 @@ InitScan2 (enum ScanType scantype, struct ScanRequest *req,
struct ScanResponse res; struct ScanResponse res;
int iHandle = pHWParams->iXferHandle; int iHandle = pHWParams->iXferHandle;
bzero (&res, sizeof (res)); memset(&res, 0, sizeof(res));
/* Protect scanner from damage. This stops stpuid errors. It basically /* Protect scanner from damage. This stops stpuid errors. It basically
* limits you to the scanner glass. Stuff like calibrations which need * limits you to the scanner glass. Stuff like calibrations which need

Wyświetl plik

@ -50,6 +50,7 @@
Parts of this source were inspired by other backends. Parts of this source were inspired by other backends.
*/ */
#include "../include/sane/config.h"
/* definitions for debug */ /* definitions for debug */
#include "hp5400_debug.h" #include "hp5400_debug.h"
@ -59,7 +60,6 @@
#include "../include/sane/sanei_backend.h" #include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h" #include "../include/sane/sanei_config.h"
#include "../include/sane/saneopts.h" #include "../include/sane/saneopts.h"
#include "../include/sane/config.h"
#include "../include/sane/sanei_usb.h" #include "../include/sane/sanei_usb.h"
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */
@ -174,6 +174,7 @@ typedef struct TDevListEntry
{ {
struct TDevListEntry *pNext; struct TDevListEntry *pNext;
SANE_Device dev; SANE_Device dev;
char* devname;
} }
TDevListEntry; TDevListEntry;
@ -428,7 +429,11 @@ static int _ReportDevice(TScannerModel *pModel, const char *pszDeviceName)
/* fill in new element */ /* fill in new element */
pNew->pNext = 0; pNew->pNext = 0;
pNew->dev.name = (char*)strdup(pszDeviceName); /* we use devname to avoid having to free a const
* pointer */
pNew->devname = (char*)strdup(pszDeviceName);
pNew->dev.name = pNew->devname;
(char*)strdup(pszDeviceName);
pNew->dev.vendor = pModel->pszVendor; pNew->dev.vendor = pModel->pszVendor;
pNew->dev.model = pModel->pszName; pNew->dev.model = pModel->pszName;
pNew->dev.type = "flatbed scanner"; pNew->dev.type = "flatbed scanner";
@ -536,7 +541,6 @@ void
sane_exit (void) sane_exit (void)
{ {
TDevListEntry *pDev, *pNext; TDevListEntry *pDev, *pNext;
HP5400_DBG (DBG_MSG, "sane_exit\n"); HP5400_DBG (DBG_MSG, "sane_exit\n");
/* free device list memory */ /* free device list memory */
@ -545,8 +549,8 @@ sane_exit (void)
for (pDev = _pFirstSaneDev; pDev; pDev = pNext) for (pDev = _pFirstSaneDev; pDev; pDev = pNext)
{ {
pNext = pDev->pNext; pNext = pDev->pNext;
/* free ((void *) (pDev->dev.name)); */ free (pDev->devname);
free (pDev->dev.name); /* pDev->dev.name is the same pointer that pDev->devname */
free (pDev); free (pDev);
} }
_pFirstSaneDev = 0; _pFirstSaneDev = 0;