diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-02-02 17:14:32 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-02-02 17:14:32 +0100 |
commit | 5dadc28ea784db1ba1f56c2ea8618d2db67af1c8 (patch) | |
tree | 808b2499b54563b3290f34d70d159b1024310873 /backend/hp3900_rts8822.c | |
parent | 5bb4cf12855ec0151de15d6c5a2354ff08766957 (diff) | |
parent | 3dade5db2a37543f19f0967901d8d80a52a1e459 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'backend/hp3900_rts8822.c')
-rw-r--r-- | backend/hp3900_rts8822.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/backend/hp3900_rts8822.c b/backend/hp3900_rts8822.c index bbd1e38..d76763d 100644 --- a/backend/hp3900_rts8822.c +++ b/backend/hp3900_rts8822.c @@ -63,7 +63,7 @@ #include <stdio.h> #include <stdlib.h> -#include <string.h> /* bzero() */ +#include <string.h> /* memset() */ #include <time.h> /* clock() */ #include <math.h> /* truncf() */ #include <ctype.h> /* tolower() */ @@ -630,12 +630,12 @@ RTS_Alloc () { SANE_Int rst = OK; - bzero (dev, sizeof (struct st_device)); + memset (dev, 0, sizeof (struct st_device)); /* initial registers */ dev->init_regs = malloc (sizeof (SANE_Byte) * RT_BUFFER_LEN); if (dev->init_regs != NULL) - bzero (dev->init_regs, sizeof (SANE_Byte) * RT_BUFFER_LEN); + memset (dev->init_regs, 0, sizeof (SANE_Byte) * RT_BUFFER_LEN); else rst = ERROR; @@ -643,7 +643,7 @@ RTS_Alloc () { dev->scanning = malloc (sizeof (struct st_scanning)); if (dev->scanning != NULL) - bzero (dev->scanning, sizeof (struct st_scanning)); + memset (dev->scanning, 0, sizeof (struct st_scanning)); else rst = ERROR; } @@ -652,7 +652,7 @@ RTS_Alloc () { dev->Reading = malloc (sizeof (struct st_readimage)); if (dev->Reading != NULL) - bzero (dev->Reading, sizeof (struct st_readimage)); + memset (dev->Reading, 0, sizeof (struct st_readimage)); else rst = ERROR; } @@ -661,7 +661,7 @@ RTS_Alloc () { dev->Resize = malloc (sizeof (struct st_resize)); if (dev->Resize != NULL) - bzero (dev->Resize, sizeof (struct st_resize)); + memset (dev->Resize, 0, sizeof (struct st_resize)); else rst = ERROR; } @@ -670,7 +670,7 @@ RTS_Alloc () { dev->status = malloc (sizeof (struct st_status)); if (dev->status != NULL) - bzero (dev->status, sizeof (struct st_status)); + memset (dev->status, 0, sizeof (struct st_status)); else rst = ERROR; } @@ -1255,7 +1255,7 @@ Load_Chipset (struct st_device *dev) { SANE_Int model; - bzero (dev->chipset, sizeof (struct st_chip)); + memset (dev->chipset, 0, sizeof (struct st_chip)); /* get chipset model of selected scanner */ model = cfg_chipset_model_get (RTS_Debug->dev_model); @@ -1611,7 +1611,7 @@ RTS_Scanner_SetParams (struct st_device *dev, struct params *param) compression = FALSE; /* resetting low level config */ - bzero (&hwdcfg, sizeof (struct st_hwdconfig)); + memset (&hwdcfg, 0, sizeof (struct st_hwdconfig)); /* setting low level config */ hwdcfg.scantype = scan.scantype; @@ -1650,7 +1650,7 @@ SetScanParams (struct st_device *dev, SANE_Byte * Regs, dbg_ScanParams (scancfg); dbg_hwdcfg (hwdcfg); - bzero (&mycoords, sizeof (struct st_coords)); + memset (&mycoords, 0, sizeof (struct st_coords)); /* Copy scancfg to scan2 */ memcpy (&scan2, scancfg, sizeof (struct st_scanparams)); @@ -3675,7 +3675,7 @@ Init_Registers (struct st_device *dev) DBG (DBG_FNC, "+ Init_Registers:\n"); /* Lee dev->init_regs */ - bzero (dev->init_regs, RT_BUFFER_LEN); + memset (dev->init_regs, 0, RT_BUFFER_LEN); RTS_ReadRegs (dev->usb_handle, dev->init_regs); Read_FE3E (dev, &v1619); @@ -4116,7 +4116,7 @@ Lamp_Status_Get (struct st_device *dev, SANE_Byte * flb_lamp, case RTS8822BL_03A: *flb_lamp = ((data2 & 0x40) != 0) ? 1 : 0; *tma_lamp = (((data2 & 0x20) != 0) - && ((data1 & 0x10) == 1)) ? 1 : 0; + && ((data1 & 0x10) != 0)) ? 1 : 0; break; default: if ((_B1 (data1) & 0x10) == 0) @@ -4825,8 +4825,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg, if ((scancfg->coord.width - dist) > 1) { /* clear buffers */ - bzero (color_sum, sizeof (double) * buffersize); - bzero (color_dif, sizeof (double) * buffersize); + memset (color_sum, 0, sizeof (double) * buffersize); + memset (color_dif, 0, sizeof (double) * buffersize); for (xpos = 0; xpos < scancfg->coord.width; xpos++) { @@ -4875,8 +4875,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg, if ((scancfg->coord.height - dist) > 1) { /* clear buffers */ - bzero (color_sum, sizeof (double) * buffersize); - bzero (color_dif, sizeof (double) * buffersize); + memset (color_sum, 0, sizeof (double) * buffersize); + memset (color_dif, 0, sizeof (double) * buffersize); for (ypos = 0; ypos < scancfg->coord.height; ypos++) { @@ -4924,8 +4924,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg, if ((scancfg->coord.width - dist) > 1) { /* clear buffers */ - bzero (color_sum, sizeof (double) * buffersize); - bzero (color_dif, sizeof (double) * buffersize); + memset (color_sum, 0, sizeof (double) * buffersize); + memset (color_dif, 0, sizeof (double) * buffersize); for (xpos = 0; xpos < scancfg->coord.width; xpos++) { @@ -6188,7 +6188,7 @@ Reading_DestroyBuffers (struct st_device *dev) dev->scanning->imagebuffer = NULL; } - bzero (dev->Reading, sizeof (struct st_readimage)); + memset (dev->Reading, 0, sizeof (struct st_readimage)); return OK; } @@ -6462,7 +6462,7 @@ RTS_ScanCounter_Inc (struct st_device *dev) break; default: /* value is 4 bytes size starting from address 0x21 in lsb format */ - bzero (&somebuffer, sizeof (somebuffer)); + memset (&somebuffer, 0, sizeof (somebuffer)); somebuffer[4] = 0x0c; RTS_EEPROM_ReadInteger (dev->usb_handle, 0x21, &idata); @@ -7786,7 +7786,7 @@ Scan_Read_BufferA (struct st_device *dev, SANE_Int buffer_size, SANE_Int arg2, opStatus = Reading_Wait (dev, rd->Channels_per_dot, rd->Channel_size, iAmount, - &rd->Bytes_Available, 10, sc); + &rd->Bytes_Available, 60, sc); /* If something fails, perhaps we can read some bytes... */ if (opStatus != OK) @@ -8072,7 +8072,7 @@ Scan_Start (struct st_device *dev) dbg_ScanParams (&scancfg); /* reserva buffer 6 dwords en fa84-fa9f */ - bzero (&hwdcfg, sizeof (struct st_hwdconfig)); + memset (&hwdcfg, 0, sizeof (struct st_hwdconfig)); /* wait till lamp is at home (should use timeout windows driver doesn't use it) @@ -10009,7 +10009,7 @@ Shading_apply (struct st_device *dev, SANE_Byte * Regs, } /*3d4c */ - bzero (&calbuffers, sizeof (struct st_cal2)); + memset (&calbuffers, 0, sizeof (struct st_cal2)); /* If black shading correction is enabled ... */ if ((Regs[0x1cf] & 8) != 0) @@ -10340,7 +10340,7 @@ RTS_GetImage (struct st_device *dev, SANE_Byte * Regs, (struct st_hwdconfig *) malloc (sizeof (struct st_hwdconfig)); if (hwdcfg != NULL) { - bzero (hwdcfg, sizeof (struct st_hwdconfig)); + memset (hwdcfg, 0, sizeof (struct st_hwdconfig)); if (((options & 2) != 0) || ((_B1 (options) & 1) != 0)) { @@ -10404,7 +10404,7 @@ RTS_GetImage (struct st_device *dev, SANE_Byte * Regs, sizeof (SANE_Byte)); if (myRegs != NULL) { - bzero (myRegs, + memset (myRegs, 0, RT_BUFFER_LEN * sizeof (SANE_Byte)); RTS_Setup (dev, myRegs, &scan, hwdcfg, gain_offset); @@ -10547,7 +10547,7 @@ Refs_Detect (struct st_device *dev, SANE_Byte * Regs, SANE_Int resolution_x, *x = *y = 0; /* default */ /* set configuration to scan a little area at the top-left corner */ - bzero (&scancfg, sizeof (struct st_scanparams)); + memset (&scancfg, 0, sizeof (struct st_scanparams)); scancfg.depth = 8; scancfg.colormode = CM_GRAY; scancfg.channel = CL_RED; @@ -10588,7 +10588,7 @@ Refs_Detect (struct st_device *dev, SANE_Byte * Regs, SANE_Int resolution_x, pwmlamplevel = 0; Lamp_PWM_use (dev, 1); - bzero (&gain_offset, sizeof (struct st_gain_offset)); + memset (&gain_offset, 0, sizeof (struct st_gain_offset)); for (C = CL_RED; C <= CL_BLUE; C++) { gain_offset.pag[C] = 3; @@ -11290,7 +11290,7 @@ Head_Relocate (struct st_device *dev, SANE_Int speed, SANE_Int direction, struct st_motormove mymotor; struct st_motorpos mtrpos; - bzero (&mymotor, sizeof (struct st_motormove)); + memset (&mymotor, 0, sizeof (struct st_motormove)); memcpy (Regs, dev->init_regs, RT_BUFFER_LEN * sizeof (SANE_Byte)); if (speed < dev->motormove_count) @@ -11338,7 +11338,7 @@ Calib_CreateFixedBuffers () (USHORT *) malloc (0x7f8 * sizeof (USHORT)); if (fixed_black_shading[channel] != NULL) - bzero (fixed_black_shading[channel], 0x7f8 * sizeof (USHORT)); + memset (fixed_black_shading[channel], 0, 0x7f8 * sizeof (USHORT)); else ret = ERROR; @@ -11348,7 +11348,7 @@ Calib_CreateFixedBuffers () (USHORT *) malloc (0x7f8 * sizeof (USHORT)); if (fixed_white_shading[channel] != NULL) - bzero (fixed_white_shading[channel], 0x7f8 * sizeof (USHORT)); + memset (fixed_white_shading[channel], 0, 0x7f8 * sizeof (USHORT)); else ret = ERROR; @@ -12779,7 +12779,7 @@ Calib_WhiteShading_3 (struct st_device *dev, /*a743 */ if (lf130 > 0) - bzero (buffer1, lf130 * sizeof (double)); + memset (buffer1, 0, lf130 * sizeof (double)); /*a761 */ if (lf12c > 0) @@ -12959,7 +12959,7 @@ Calib_WhiteShading_3 (struct st_device *dev, /*a743 */ if (lf130 > 0) - bzero (buffer1, lf130 * sizeof (double)); + memset (buffer1, 0, lf130 * sizeof (double)); /*a761 */ if (lf12c > 0) @@ -13325,14 +13325,14 @@ Calib_BlackShading (struct st_device *dev, if (scancfg.depth > 8) { /*8bb2 */ - bzero (&dbvalue, 6 * sizeof (double)); + memset (&dbvalue, 0, 6 * sizeof (double)); position = 0; if (bytes_per_line > 0) { do { - bzero (&buff3, 0x8000 * sizeof (SANE_Int)); + memset (&buff3, 0, 0x8000 * sizeof (SANE_Int)); sumatorio = 0; ptr = buffer + position; current_line = 0; @@ -13435,14 +13435,14 @@ Calib_BlackShading (struct st_device *dev, else { /*8eb6 */ - bzero (&dbvalue, 6 * sizeof (double)); + memset (&dbvalue, 0, 6 * sizeof (double)); position = 0; if (bytes_per_line > 0) { do { - bzero (&buff2, 256 * sizeof (SANE_Byte)); + memset (&buff2, 0, 256 * sizeof (SANE_Byte)); sumatorio = 0; /* ptr points to the next position of the first line */ ptr = buffer + position; @@ -13634,7 +13634,7 @@ Calibration (struct st_device *dev, SANE_Byte * Regs, Calib_LoadConfig (dev, &calibcfg, scan.scantype, scancfg->resolution_x, scancfg->depth); - bzero (&calibdata->gain_offset, sizeof (struct st_gain_offset)); /*[42b3654] */ + memset (&calibdata->gain_offset, 0, sizeof (struct st_gain_offset)); /*[42b3654] */ for (a = CL_RED; a <= CL_BLUE; a++) { myCalib->WRef[a] = calibcfg.WRef[a]; @@ -14110,7 +14110,7 @@ Init_Vars (void) hp_gamma = malloc (sizeof (struct st_gammatables)); if (hp_gamma != NULL) - bzero (hp_gamma, sizeof (struct st_gammatables)); + memset (hp_gamma, 0, sizeof (struct st_gammatables)); else rst = ERROR; @@ -14118,7 +14118,7 @@ Init_Vars (void) { RTS_Debug = malloc (sizeof (struct st_debug_opts)); if (RTS_Debug != NULL) - bzero (RTS_Debug, sizeof (struct st_debug_opts)); + memset (RTS_Debug, 0, sizeof (struct st_debug_opts)); else rst = ERROR; } @@ -14127,7 +14127,7 @@ Init_Vars (void) { default_gain_offset = malloc (sizeof (struct st_gain_offset)); if (default_gain_offset != NULL) - bzero (default_gain_offset, sizeof (struct st_gain_offset)); + memset (default_gain_offset, 0, sizeof (struct st_gain_offset)); else rst = ERROR; } @@ -14136,7 +14136,7 @@ Init_Vars (void) { calibdata = malloc (sizeof (struct st_calibration_data)); if (calibdata != NULL) - bzero (calibdata, sizeof (struct st_calibration_data)); + memset (calibdata, 0, sizeof (struct st_calibration_data)); else rst = ERROR; } @@ -14145,7 +14145,7 @@ Init_Vars (void) { wshading = malloc (sizeof (struct st_shading)); if (wshading != NULL) - bzero (wshading, sizeof (struct st_shading)); + memset (wshading, 0, sizeof (struct st_shading)); else rst = ERROR; } @@ -14467,7 +14467,7 @@ WShading_Calibrate (struct st_device *dev, SANE_Byte * Regs, DBG (DBG_FNC, "> WShading_Calibrate(*myCalib)\n"); - bzero (&myCalibTable, sizeof (struct st_gain_offset)); + memset (&myCalibTable, 0, sizeof (struct st_gain_offset)); for (C = CL_RED; C <= CL_BLUE; C++) { myCalibTable.pag[C] = 3; @@ -14687,7 +14687,7 @@ motor_pos (struct st_device *dev, SANE_Byte * Regs, DBG (DBG_FNC, "> Calib_test(*myCalib)\n"); - bzero (&myCalibTable, sizeof (struct st_gain_offset)); + memset (&myCalibTable, 0, sizeof (struct st_gain_offset)); calibcfg = (struct st_calibration_config *) @@ -14821,7 +14821,7 @@ Calib_BlackShading_jkd (struct st_device *dev, SANE_Byte * Regs, DBG (DBG_FNC, "> Calib_BlackShading_jkd(*myCalib)\n"); - bzero (&myCalibTable, sizeof (struct st_gain_offset)); + memset (&myCalibTable, 0, sizeof (struct st_gain_offset)); for (C = CL_RED; C <= CL_BLUE; C++) { myCalibTable.pag[C] = 3; @@ -14955,7 +14955,7 @@ Calib_test (struct st_device *dev, SANE_Byte * Regs, DBG (DBG_FNC, "> Calib_test(*myCalib)\n"); - bzero (&myCalibTable, sizeof (struct st_gain_offset)); + memset (&myCalibTable, 0, sizeof (struct st_gain_offset)); calibcfg = (struct st_calibration_config *) |