Made all non-sane-api functions static. Fixed some warnings.

Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2001-05-26 12:29:23 +00:00
rodzic 6f038c7c40
commit 9904ee4f24
8 zmienionych plików z 87 dodań i 78 usunięć

Wyświetl plik

@ -62,7 +62,7 @@ ReadNextColorLine()
********************************************************************** */ ********************************************************************** */
TState ReadNextColorLine(PTInstance this) static TState ReadNextColorLine(PTInstance this)
{ {
int iWrite,i; int iWrite,i;
int iRead; /* read position in raw line */ int iRead; /* read position in raw line */
@ -142,7 +142,7 @@ StartScanColor()
====================================================================== */ ====================================================================== */
/* Parameter are in resolution units! */ /* Parameter are in resolution units! */
TState StartScanColor(TInstance *this) static TState StartScanColor(TInstance *this)
{ {
/* live could be easy: Simple calculate a window, start the scan, /* live could be easy: Simple calculate a window, start the scan,

Wyświetl plik

@ -202,7 +202,7 @@ ReadNextGrayLine()
====================================================================== */ ====================================================================== */
TState ReadNextGrayLine(PTInstance this) static TState ReadNextGrayLine(PTInstance this)
{ {
int iWrite; int iWrite;
int iDot; int iDot;
@ -310,7 +310,7 @@ StartScanGray()
====================================================================== */ ====================================================================== */
TState StartScanGray(TInstance *this) static TState StartScanGray(TInstance *this)
{ {
unsigned char *puchRegs; unsigned char *puchRegs;
int i; int i;

Wyświetl plik

@ -197,7 +197,7 @@ static TLineType GetLineType(TInstance *this)
return ltUnknown; return ltUnknown;
} }
TState DoOriginate(TInstance *this, TBool bStepOut) static TState DoOriginate(TInstance *this, TBool bStepOut)
{ {
TLineType lt; TLineType lt;
if (this->bVerbose) if (this->bVerbose)
@ -233,7 +233,7 @@ The distance is given in 600 DPI.
********************************************************************** */ ********************************************************************** */
TState DoJog(TInstance *this, int nDistance) static TState DoJog(TInstance *this, int nDistance)
{ {
int cSteps; int cSteps;
int nSpeed,nRest; int nSpeed,nRest;

Wyświetl plik

@ -65,7 +65,7 @@ Replay the first initialisation block (no slider movement).
********************************************************************** */ ********************************************************************** */
TState DoInit(TInstance *this) static TState DoInit(TInstance *this)
{ {
unsigned char uchRegs2466[]={ unsigned char uchRegs2466[]={
0x00 /*0x01*/, 0x00 /*0x02*/, 0x3F /*0x03*/, 0x00 /*0x01*/, 0x00 /*0x02*/, 0x3F /*0x03*/,
@ -105,7 +105,7 @@ Resets Scanner after CANCEL in current scan job.
********************************************************************** */ ********************************************************************** */
TState DoReset(TInstance *this) static TState DoReset(TInstance *this)
{ {
RegWrite(this,0x43, 1, 0x03); /* #1533[038.1] */ RegWrite(this,0x43, 1, 0x03); /* #1533[038.1] */
RegWrite(this,0x43, 1, 0x03); /* #1534[038.1] */ RegWrite(this,0x43, 1, 0x03); /* #1534[038.1] */
@ -165,7 +165,7 @@ NOTE: Semantics changed: 0 on success, -1 else
********************************************************************** */ ********************************************************************** */
TState WaitWhileBusy(TInstance *this, int cSecs) static TState WaitWhileBusy(TInstance *this, int cSecs)
{ {
int cTimeOut=cSecs*10; int cTimeOut=cSecs*10;
int value; int value;
@ -188,7 +188,7 @@ NOTE: Semantics changed: 0 on success, -1 else
********************************************************************** */ ********************************************************************** */
TState WaitWhileScanning(TInstance *this, int cSecs) static TState WaitWhileScanning(TInstance *this, int cSecs)
{ {
int cTimeOut=cSecs*10; int cTimeOut=cSecs*10;
int value; int value;
@ -212,7 +212,7 @@ DoLampSwitch(nRegister)
********************************************************************** */ ********************************************************************** */
TState DoLampSwitch(TInstance *this, int nPattern) static TState DoLampSwitch(TInstance *this, int nPattern)
{ {
return RegWrite(this, R_LMP, 1, nPattern); return RegWrite(this, R_LMP, 1, nPattern);
} }
@ -223,7 +223,7 @@ DoCalibration
********************************************************************** */ ********************************************************************** */
TState DoCalibration(TInstance *this) static TState DoCalibration(TInstance *this)
{ {
return WaitWhileBusy(this,1); return WaitWhileBusy(this,1);
} }
@ -234,7 +234,7 @@ UploadGammaTable()
********************************************************************** */ ********************************************************************** */
TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma) static TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma)
{ {
unsigned char *puchGamma; unsigned char *puchGamma;
TState rc; TState rc;

Wyświetl plik

@ -106,7 +106,7 @@ RegWriteArray(iRegister, cb, unsigned char uchValues)
********************************************************************** */ ********************************************************************** */
TState RegWrite(TInstance *this, int iRegister, int cb, unsigned long ulValue) static TState RegWrite(TInstance *this, int iRegister, int cb, unsigned long ulValue)
{ {
char *pchBuffer; char *pchBuffer;
int i; int i;
@ -141,7 +141,7 @@ TState RegWrite(TInstance *this, int iRegister, int cb, unsigned long ulValue)
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
TState RegWriteArray(TInstance *this, int iRegister, int cb, unsigned char *pchBuffer) static TState RegWriteArray(TInstance *this, int iRegister, int cb, unsigned char *pchBuffer)
{ {
int i; int i;
INST_ASSERT(); INST_ASSERT();
@ -164,7 +164,7 @@ MemWriteArray(iAddress, cb, ulValue)
********************************************************************** */ ********************************************************************** */
TState MemWriteArray(TInstance *this, int iAddress, static TState MemWriteArray(TInstance *this, int iAddress,
int cb, unsigned char *pchBuffer) int cb, unsigned char *pchBuffer)
{ {
int i; int i;
@ -188,7 +188,7 @@ MemReadArray(iRegister, cb, ulValue)
********************************************************************** */ ********************************************************************** */
TState MemReadArray(TInstance *this, int iAddress, int cb, unsigned char *pchBuffer) static TState MemReadArray(TInstance *this, int iAddress, int cb, unsigned char *pchBuffer)
{ {
int i; int i;
INST_ASSERT(); INST_ASSERT();
@ -211,7 +211,7 @@ RegCheck(iRegister, cb, ulValue)
********************************************************************** */ ********************************************************************** */
TState RegCheck(TInstance *this, int iRegister, int cch, unsigned long ulValue) static TState RegCheck(TInstance *this, int iRegister, int cch, unsigned long ulValue)
{ {
char *pchBuffer,*pchTransfer; char *pchBuffer,*pchTransfer;
int i,rcCode; int i,rcCode;
@ -270,7 +270,7 @@ cchRead=BulkRead(fh,cchBulk)
********************************************************************** */ ********************************************************************** */
int BulkRead(TInstance *this, FILE *fhOut, unsigned int cchBulk) static int BulkRead(TInstance *this, FILE *fhOut, unsigned int cchBulk)
{ {
int cchRead,rc; int cchRead,rc;
char *pchBuffer; char *pchBuffer;
@ -327,7 +327,7 @@ cchRead=BulkReadBuffer(puchBuffer, cchBulk)
********************************************************************** */ ********************************************************************** */
int BulkReadBuffer(TInstance *this, static int BulkReadBuffer(TInstance *this,
unsigned char *puchBufferOut, unsigned char *puchBufferOut,
unsigned int cchBulk) unsigned int cchBulk)
{ {
@ -380,7 +380,7 @@ Read register in big endian (INTEL-) format.
********************************************************************** */ ********************************************************************** */
unsigned int RegRead(TInstance *this, int iRegister, int cch) static unsigned int RegRead(TInstance *this, int iRegister, int cch)
{ {
char *pchTransfer; char *pchTransfer;
int i; int i;

Wyświetl plik

@ -68,7 +68,7 @@ void DBG(int nLevel, const char *szFormat, ...)
} }
#endif #endif
void debug_printf(unsigned long ulType, const char *szFormat, ...) static void debug_printf(unsigned long ulType, const char *szFormat, ...)
{ {
va_list ap; va_list ap;
if ((ulDebugMask & ulType)!=ulType) return; if ((ulDebugMask & ulType)!=ulType) return;
@ -90,7 +90,7 @@ being global) and the user gets a nice panic screen :-)
********************************************************************** */ ********************************************************************** */
int SetError(TInstance *this, int nError, const char *szFormat, ...) static int SetError(TInstance *this, int nError, const char *szFormat, ...)
{ {
va_list ap; va_list ap;
if (this->nErrorState) return 0; /* do not overwrite error state */ if (this->nErrorState) return 0; /* do not overwrite error state */
@ -113,7 +113,7 @@ DumpBuffer(fh,pch,cch)
********************************************************************** */ ********************************************************************** */
void DumpBuffer(FILE *fh, const char *pch, int cch) static void DumpBuffer(FILE *fh, const char *pch, int cch)
{ {
int i=0; int i=0;
while (i<cch) while (i<cch)
@ -138,7 +138,7 @@ augmenting the result around the middle value of 128.
********************************************************************** */ ********************************************************************** */
void FixExposure(unsigned char *pchBuf, static void FixExposure(unsigned char *pchBuf,
int cchBulk, int cchBulk,
int nBrightness, int nBrightness,
int nContrast) int nContrast)
@ -166,7 +166,7 @@ Frees all dynamical memory for scan buffering.
********************************************************************** */ ********************************************************************** */
TState FreeState(TInstance *this, TState nReturn) static TState FreeState(TInstance *this, TState nReturn)
{ {
if (this->state.ppchLines) if (this->state.ppchLines)
{ {
@ -192,7 +192,7 @@ EndScan()
====================================================================== */ ====================================================================== */
TState EndScan(TInstance *this) static TState EndScan(TInstance *this)
{ {
if (!this->state.bScanning) return SANE_STATUS_GOOD; if (!this->state.bScanning) return SANE_STATUS_GOOD;
/* move slider back to start */ /* move slider back to start */
@ -208,7 +208,7 @@ TState CancelScan(TInstance *this)
====================================================================== */ ====================================================================== */
TState CancelScan(TInstance *this) static TState CancelScan(TInstance *this)
{ {
TBool bCanceled; TBool bCanceled;
DBG(DEBUG_INFO,"CancelScan() called\n"); DBG(DEBUG_INFO,"CancelScan() called\n");
@ -239,7 +239,7 @@ ReadChunk()
====================================================================== */ ====================================================================== */
TState ReadChunk(TInstance *this, unsigned char *achOut, static TState ReadChunk(TInstance *this, unsigned char *achOut,
int cchMax, int *pcchRead) int cchMax, int *pcchRead)
{ {
/* have we to copy more than we have? */ /* have we to copy more than we have? */
@ -298,7 +298,7 @@ GetAreaSize()
====================================================================== */ ====================================================================== */
void GetAreaSize(TInstance *this) static void GetAreaSize(TInstance *this)
{ {
/* this->state.cxPixel : pixels, we *want* (after interpolation) /* this->state.cxPixel : pixels, we *want* (after interpolation)
this->state.cxMax : pixels, we *need* (before interpolation) */ this->state.cxMax : pixels, we *need* (before interpolation) */
@ -326,7 +326,7 @@ Init gammy tables and gain tables within controller memory.
====================================================================== */ ====================================================================== */
TState InitGammaTables(TInstance *this) static TState InitGammaTables(TInstance *this)
{ {
int i; int i;
for (i=0; i<4096; i++) for (i=0; i<4096; i++)
@ -351,7 +351,7 @@ Top level caller for scantool.
#define APP_CHUNK_SIZE 8192 #define APP_CHUNK_SIZE 8192
TState DoScanFile(TInstance *this) static TState DoScanFile(TInstance *this)
{ {
int cx,cy; int cx,cy;
long lcchRead; long lcchRead;

Wyświetl plik

@ -71,12 +71,12 @@ Start: 2.4.2001
#define PATH_MAX 1024 #define PATH_MAX 1024
#endif #endif
#include "sane/sane.h" #include "../include/sane/sane.h"
#include "sane/config.h" #include "../include/sane/config.h"
#include "sane/sanei.h" #include "../include/sane/sanei.h"
#include "sane/sanei_backend.h" #include "../include/sane/sanei_backend.h"
#include "sane/sanei_config.h" #include "../include/sane/sanei_config.h"
#include "sane/saneopts.h" #include "../include/sane/saneopts.h"
/* prevent inclusion of scantool.h */ /* prevent inclusion of scantool.h */
#define SCANTOOL_H #define SCANTOOL_H
@ -135,7 +135,7 @@ static const SANE_Range rangeGamma = { 0, 4095, 1 };
static const SANE_Int setResolutions[] = { 6, 75,100,200,300,600 }; static const SANE_Int setResolutions[] = { 6, 75,100,200,300,600 };
SANE_Status static SANE_Status
InitOptions(TInstance *this) InitOptions(TInstance *this)
{ {
TOptionIndex iOpt; TOptionIndex iOpt;
@ -351,9 +351,7 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authCB)
DBG_INIT(); DBG_INIT();
authCB++; /* compiler */ DBG(DEBUG_VERBOSE,"SM3600 init (authCB %s NULL)\n", authCB ? "!=" : "=");
DBG(DEBUG_VERBOSE,"SM3600 init\n");
if (version_code) if (version_code)
{ {
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD); *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD);
@ -768,7 +766,9 @@ sane_cancel (SANE_Handle handle)
SANE_Status SANE_Status
sane_set_io_mode(SANE_Handle h, SANE_Bool m) sane_set_io_mode(SANE_Handle h, SANE_Bool m)
{ {
h++; SANE_Handle h_tmp;
h_tmp = h;
if (m==SANE_TRUE) /* no non-blocking-mode */ if (m==SANE_TRUE) /* no non-blocking-mode */
return SANE_STATUS_UNSUPPORTED; return SANE_STATUS_UNSUPPORTED;
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
@ -777,6 +777,11 @@ sane_set_io_mode(SANE_Handle h, SANE_Bool m)
SANE_Status SANE_Status
sane_get_select_fd(SANE_Handle handle, SANE_Int *fd) sane_get_select_fd(SANE_Handle handle, SANE_Int *fd)
{ {
handle++; fd++; SANE_Handle handle_tmp;
SANE_Int *fd_tmp;
handle_tmp = handle;
fd_tmp = fd;
return SANE_STATUS_UNSUPPORTED; /* we have no file IO */ return SANE_STATUS_UNSUPPORTED; /* we have no file IO */
} }

Wyświetl plik

@ -235,50 +235,54 @@ typedef enum { none, hpos, hposH, hres } TRegIndex;
#define USB_CHUNK_SIZE 0x8000 #define USB_CHUNK_SIZE 0x8000
/* scanutil.c */ /* scanutil.c */
int SetError(TInstance *this, int nError, const char *szFormat, ...); static int SetError(TInstance *this, int nError, const char *szFormat, ...);
void debug_printf(unsigned long ulType, const char *szFormat, ...); static void debug_printf(unsigned long ulType, const char *szFormat, ...);
void DumpBuffer(FILE *fh, const char *pch, int cch); static void DumpBuffer(FILE *fh, const char *pch, int cch);
void FixExposure(unsigned char *pchBuf, static void FixExposure(unsigned char *pchBuf,
int cchBulk, int cchBulk,
int nBrightness, int nBrightness,
int nContrast); int nContrast);
TState FreeState(TInstance *this, TState nReturn); static TState FreeState(TInstance *this, TState nReturn);
TState EndScan(TInstance *this); static TState EndScan(TInstance *this);
TState ReadChunk(TInstance *this, unsigned char *achOut, static TState ReadChunk(TInstance *this, unsigned char *achOut,
int cchMax, int *pcchRead); int cchMax, int *pcchRead);
TState DoScanFile(TInstance *this); static TState DoScanFile(TInstance *this);
void GetAreaSize(TInstance *this); static void GetAreaSize(TInstance *this);
TState InitGammaTables(TInstance *this); static TState InitGammaTables(TInstance *this);
TState CancelScan(TInstance *this); static TState CancelScan(TInstance *this);
/* scanmtek.c */ /* scanmtek.c */
extern unsigned short aidProduct[]; extern unsigned short aidProduct[];
TState DoInit(TInstance *this); static TState DoInit(TInstance *this);
TState DoReset(TInstance *this); static TState DoReset(TInstance *this);
TState WaitWhileBusy(TInstance *this,int cSecs); static TState WaitWhileBusy(TInstance *this,int cSecs);
TState WaitWhileScanning(TInstance *this,int cSecs); static TState WaitWhileScanning(TInstance *this,int cSecs);
TState DoJog(TInstance *this,int nDistance); static TState DoJog(TInstance *this,int nDistance);
TState DoLampSwitch(TInstance *this,int nPattern); static TState DoLampSwitch(TInstance *this,int nPattern);
TState DoCalibration(TInstance *this); static TState DoCalibration(TInstance *this);
TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma); static TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma);
/* scanusb.c */ /* scanusb.c */
TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue); static TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue);
TState RegWriteArray(TInstance *this,int iRegister, int cb, unsigned char *pchBuffer); static TState RegWriteArray(TInstance *this,int iRegister, int cb,
TState RegCheck(TInstance *this,int iRegister, int cch, unsigned long ulValue); unsigned char *pchBuffer);
int BulkRead(TInstance *this,FILE *fhOut, unsigned int cchBulk); static TState RegCheck(TInstance *this,int iRegister, int cch, unsigned long ulValue);
int BulkReadBuffer(TInstance *this,unsigned char *puchBufferOut, unsigned int cchBulk); /* gives count */ static int BulkRead(TInstance *this,FILE *fhOut, unsigned int cchBulk);
unsigned int RegRead(TInstance *this,int iRegister, int cch); static int BulkReadBuffer(TInstance *this,unsigned char *puchBufferOut,
TState MemReadArray(TInstance *this, int iAddress, int cb, unsigned char *pchBuffer); unsigned int cchBulk); /* gives count */
TState MemWriteArray(TInstance *this, int iAddress, int cb, unsigned char *pchBuffer); static unsigned int RegRead(TInstance *this,int iRegister, int cch);
static TState MemReadArray(TInstance *this, int iAddress, int cb,
unsigned char *pchBuffer);
static TState MemWriteArray(TInstance *this, int iAddress, int cb,
unsigned char *pchBuffer);
/* gray.c */ /* gray.c */
TState StartScanGray(TInstance *this); static TState StartScanGray(TInstance *this);
/* color.c */ /* color.c */
TState StartScanColor(TInstance *this); static TState StartScanColor(TInstance *this);
/* homerun.c */ /* homerun.c */
TState DoOriginate(TInstance *this, TBool bStepOut); static TState DoOriginate(TInstance *this, TBool bStepOut);
/* ====================================================================== */ /* ====================================================================== */