Fixed sizeof(long) issue for 64bit platforms, see

bugreport #302195.
merge-requests/1/head
Gerhard Jaeger 2005-11-17 11:05:12 +00:00
rodzic 99dcba3669
commit 379684a3ed
4 zmienionych plików z 22 dodań i 21 usunięć

Wyświetl plik

@ -345,9 +345,9 @@ typedef const struct mode_param
#define _PTDRV_GET_CROPINFO _IOR('x', 5, CropInfo) /* get crop */
#define _PTDRV_SET_ENV _IOWR('x',6, ScanInfo) /* set env. */
#define _PTDRV_START_SCAN _IOR('x', 7, StartScan) /* start scan */
#define _PTDRV_STOP_SCAN _IOWR('x', 8, int) /* stop scan */
#define _PTDRV_STOP_SCAN _IOWR('x', 8, short) /* stop scan */
#define _PTDRV_CLOSE_DEVICE _IO('x', 9) /* close */
#define _PTDRV_ACTION_BUTTON _IOR('x', 10, int) /* rd act. button*/
#define _PTDRV_ACTION_BUTTON _IOR('x', 10, unsigned char)/* rd act. button*/
#define _PTDRV_ADJUST _IOR('x', 11, AdjDef) /* adjust driver */
#define _PTDRV_SETMAP _IOR('x', 12, MapDef) /* download gamma*/
@ -572,9 +572,9 @@ typedef struct Plustek_Device
int (*putImgInfo) ( struct Plustek_Device*, pImgDef );
int (*setScanEnv) ( struct Plustek_Device*, pScanInfo );
int (*setMap) ( struct Plustek_Device*, SANE_Word*,
SANE_Word, SANE_Word );
SANE_Word, SANE_Word );
int (*startScan) ( struct Plustek_Device*, pStartScan );
int (*stopScan) ( struct Plustek_Device*, int* );
int (*stopScan) ( struct Plustek_Device*, short* );
int (*readImage) ( struct Plustek_Device*, SANE_Byte*, unsigned long );
int (*prepare) ( struct Plustek_Device*, SANE_Byte* );

Wyświetl plik

@ -301,30 +301,30 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
switch (size)
{
#ifdef __KERNEL__
case 1:
case sizeof(u_char):
GET_USER_RET(*(u_char *)where, (u_char *) useraddr, -EFAULT);
break;
case 2:
case sizeof(u_short):
GET_USER_RET(*(u_short *)where, (u_short *) useraddr, -EFAULT);
break;
case 4:
case sizeof(u_long):
GET_USER_RET(*(u_long *)where, (u_long *) useraddr, -EFAULT);
break;
default:
copy_from_user(where, useraddr, size);
#else
case 1:
case sizeof(UChar):
*(pUChar)where = *(pUChar)useraddr;
break;
case 2:
case sizeof(UShort):
*(pUShort)where = *(pUShort)useraddr;
break;
case 4:
case sizeof(ULong):
*(pULong)where = *(pULong)useraddr;
break;
@ -388,23 +388,23 @@ static int putUserVal(const ULong value, pVoid useraddr, UInt size)
switch (size) {
#ifdef __KERNEL__
case 1:
case sizeof(u_char):
PUT_USER_RET((u_char)value, (u_char *) useraddr, -EFAULT);
break;
case 2:
case sizeof(u_short):
PUT_USER_RET((u_short)value, (u_short *) useraddr, -EFAULT);
break;
case 4:
case sizeof(u_long):
PUT_USER_RET((u_long)value, (u_long *) useraddr, -EFAULT);
break;
#else
case 1:
case sizeof(UChar):
*(pUChar)useraddr = (UChar)value;
break;
case 2:
case sizeof(UShort):
*(pUShort)useraddr = (UShort)value;
break;
case 4:
case sizeof(ULong):
*(pULong)useraddr = (ULong)value;
break;
@ -947,6 +947,7 @@ static int ptdrvShutdown( pScanData ps )
*/
static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
{
UChar val;
UShort dir;
UShort version;
UInt size;
@ -1239,7 +1240,7 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
*/
case _PTDRV_ACTION_BUTTON:
DBG( DBG_LOW, "ioctl(_PTDRV_ACTION_BUTTON)\n" );
argVal = IODataRegisterFromScanner( ps, ps->RegStatus );
val = IODataRegisterFromScanner( ps, ps->RegStatus );
retval = putUserVal( argVal, arg, size );
break;

Wyświetl plik

@ -323,7 +323,7 @@ static int ppDev_setMap( Plustek_Device *dev, SANE_Word *map,
/**
*/
static int ppDev_stopScan( Plustek_Device *dev, int *mode )
static int ppDev_stopScan( Plustek_Device *dev, short *mode )
{
int retval, tmp;

Wyświetl plik

@ -83,7 +83,7 @@
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#define BACKEND_VERSION "0.43-8"
#define BACKEND_VERSION "0.43-9"
#define BACKEND_NAME plustek_pp
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h"
@ -271,7 +271,7 @@ static int drvopen( Plustek_Device *dev )
*/
static SANE_Status drvclose( Plustek_Device *dev )
{
int int_cnt;
short int_cnt;
if( dev->fd >= 0 ) {
@ -462,7 +462,7 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
{
struct SIGACTION act;
pid_t res;
int int_cnt;
short int_cnt;
DBG( _DBG_PROC,"do_cancel\n" );