canon backend driver fix

From: doj (doj@cubic.org)
Date: Sun Jan 21 2001 - 12:57:05 PST

  • Next message: Adam Tauno Williams: "Re: scanning to cd-rom"

    Hello Scanner Developers,

    I am using an CanoScan 300. The 0.99 versions of SANE were working with
    my scanner, but since v1.0 the driver complained. Now I have worked
    myself through the sources and found some glitches, which I think result
    from another bug beeing solved not 100% correct.

    With the patch I have attached everything is working fine with my system
    again. I think the patch should work with others as well.

    -- 
    --->
    ----> doj / cubic
    -----> http://www.cubic.org
    -----> http://llg.cubic.org
    
    

    diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon-sane.c sane-backends-1.0.4.doj/backend/canon-sane.c --- sane-backends-1.0.4/backend/canon-sane.c Sat Aug 12 17:09:02 2000 +++ sane-backends-1.0.4.doj/backend/canon-sane.c Sun Dec 31 00:36:39 2000 @@ -103,22 +103,22 @@ for (dev = first_dev; dev; dev = dev->next) { if (strcmp (dev->sane.name, devnam) == 0) break; } + } + else + { + dev = first_dev; + } if (!dev) { status = attach (devnam, &dev); if (status != SANE_STATUS_GOOD) return (status); } - } - else - { - dev = first_dev; - } if (!dev) return (SANE_STATUS_INVAL); s = malloc (sizeof (*s)); @@ -1065,11 +1065,11 @@ /* { */ /* DBG (1, "attach: GET SCAN MODE for scan control conditions failed\n"); */ /* sanei_scsi_close (s->fd); */ /* return (SANE_STATUS_INVAL); */ /* } */ - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode control byte[%d] = %d\n", i, ebuf[i]); } DBG (3, "attach: sending GET SCAN MODE for transparency unit\n"); @@ -1081,11 +1081,11 @@ { DBG (1, "attach: GET SCAN MODE for transparency unit failed\n"); sanei_scsi_close (s->fd); return (SANE_STATUS_INVAL); } - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode control byte[%d] = %d\n", i, ebuf[i]); } #endif @@ -1291,11 +1291,11 @@ { DBG (1, "sane_start: GET SCAN MODE for scan control conditions failed\n"); sanei_scsi_close (s->fd); return (SANE_STATUS_INVAL); } - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode byte[%d] = %d\n", i, ebuf[i]); } #endif diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon-scsi.c sane-backends-1.0.4.doj/backend/canon-scsi.c --- sane-backends-1.0.4/backend/canon-scsi.c Sat Aug 12 17:09:02 2000 +++ sane-backends-1.0.4.doj/backend/canon-scsi.c Sun Dec 31 00:29:26 2000 @@ -377,11 +377,11 @@ (page == SCAN_CONTROL_CONDITIONS) ? 0x14 : 0x24; memcpy (cmd + 10, data, (page == TRANSPARENCY_UNIT) ? 8 : (page == SCAN_CONTROL_CONDITIONS) ? 16 : 24); - for(i = 0; i < sizeof(cmd); i++) + for(i = 0; i <(int) sizeof(cmd); i++) { DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]); } cmdlen = (page == TRANSPARENCY_UNIT) ? 18 : (page == SCAN_CONTROL_CONDITIONS) ? 26 : 34; diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon.c sane-backends-1.0.4.doj/backend/canon.c --- sane-backends-1.0.4/backend/canon.c Sat Aug 12 17:09:03 2000 +++ sane-backends-1.0.4.doj/backend/canon.c Sun Dec 31 00:27:48 2000 @@ -226,11 +226,11 @@ { DBG (1, "get scan mode failed: %s\n", sane_strstatus (status)); return; } - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode control byte[%d] = %d\n", i, tbuf[i]); } dev->tpu.Status = ( tbuf[2 + 4 + 5] >> 7 ) ? TPU_STAT_INACTIVE : TPU_STAT_NONE; @@ -280,11 +280,11 @@ DBG (1, "get scan mode failed: %s\n", sane_strstatus (status)); perror("get scan mode failed"); return; } - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode control byte[%d] = %d\n", i, abuf[i]); /* printf("scan mode control byte[%d] = %d\n", i, abuf[i]); */ } @@ -594,11 +594,11 @@ { DBG (1, "attach: GET SCAN MODE for scan control conditions failed\n"); sanei_scsi_close (fd); return (SANE_STATUS_INVAL); } - for (i=0; i<buf_size; i++) + for (i=0; i<(int)buf_size; i++) { DBG(3, "scan mode byte[%d] = %d\n", i, ebuf[i]); } DBG (3, "attach: sending (extended) INQUIRY\n"); @@ -1123,11 +1123,11 @@ /* Build the histograms */ DBG(7, "sizeof(histo)='%lu'\n", (unsigned long) sizeof(histo)); memset (histo, 0, sizeof(histo)); - for(i=0; i<bread; i+=3) + for(i=0; i<(int)bread; i+=3) { /* j = (int)adjbuf[i] - 71; */ /* j = (j<0) ? -j : j; */ /* ++histo[RED][j]; */ ++histo[RED][(int)adjbuf[i]]; Binary files sane-backends-1.0.4/core and sane-backends-1.0.4.doj/core differ

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Sun Jan 21 2001 - 13:04:02 PST