*** snapscan.c Mon Mar 19 20:02:13 2001 --- ../../sane-backends-1.0.4/backend/snapscan.c Tue Apr 10 02:06:51 2001 *************** static const SANE_Range y_range_fb = *** 156,162 **** }; /* mm */ static const SANE_Range x_range_tpo = { ! SANE_FIX (0.0), SANE_FIX (130.0), SANE_FIX (1.0) }; /* mm */ static const SANE_Range y_range_tpo = { --- 156,162 ---- }; /* mm */ static const SANE_Range x_range_tpo = { ! SANE_FIX (0.0), SANE_FIX (129.0), SANE_FIX (1.0) }; /* mm */ static const SANE_Range y_range_tpo = { *************** static SANE_Status init_gamma(SnapScan_S *** 324,330 **** /* init_options -- initialize the option set for a scanner; expects the scanner structure's hardware configuration byte (hconfig) to be valid. ! ARGS: a pointer to an existing scanner structure RET: nothing SIDE: the option set of *ps is initialized; this includes both --- 324,330 ---- /* init_options -- initialize the option set for a scanner; expects the scanner structure's hardware configuration byte (hconfig) to be valid. ! ARGS: a pointer to an existing scanner structure RET: nothing SIDE: the option set of *ps is initialized; this includes both *************** SANE_Status sane_open (SANE_String_Const *** 1355,1361 **** /* create and initialize the scanner structure */ ! *h = (SnapScan_Scanner *) malloc (sizeof (SnapScan_Scanner)); if (!*h) { DBG (DL_MAJOR_ERROR, --- 1355,1361 ---- /* create and initialize the scanner structure */ ! *h = (SnapScan_Scanner *) calloc (sizeof (SnapScan_Scanner),1); if (!*h) { DBG (DL_MAJOR_ERROR, *************** SANE_Status sane_control_option (SANE_Ha *** 1881,1890 **** pss->source = SRC_FLATBED; pss->pdev->x_range.max = x_range_fb.max; pss->pdev->y_range.max = y_range_fb.max; - if (pss->brx > pss->pdev->x_range.max) - pss->brx = pss->pdev->x_range.max; - if (pss->bry > pss->pdev->y_range.max) - pss->bry = pss->pdev->y_range.max; } else if (strcmp(v, src_tpo) == 0) { --- 1881,1886 ---- *************** SANE_Status sane_control_option (SANE_Ha *** 1893,1910 **** pss->pdev->y_range.max = y_range_tpo.max; } else ! { DBG (DL_MAJOR_ERROR, "%s: internal error: given illegal source string " "\"%s\"\n", me, (char *) v); } if (pss->source_s) free (pss->source_s); pss->source_s = (SANE_Char *) strdup(v); if (i) ! *i |= SANE_INFO_RELOAD_PARAMS + SANE_INFO_RELOAD_OPTIONS; break; case OPT_TLX: pss->tlx = *(SANE_Fixed *) v; --- 1889,1912 ---- pss->pdev->y_range.max = y_range_tpo.max; } else ! { DBG (DL_MAJOR_ERROR, "%s: internal error: given illegal source string " "\"%s\"\n", me, (char *) v); } + // Adjust actual range values to new max values + if (pss->brx > pss->pdev->x_range.max) + pss->brx = pss->pdev->x_range.max; + if (pss->bry > pss->pdev->y_range.max) + pss->bry = pss->pdev->y_range.max; + pss->predef_window = pdw_none; if (pss->source_s) free (pss->source_s); pss->source_s = (SANE_Char *) strdup(v); if (i) ! *i = SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS; break; case OPT_TLX: pss->tlx = *(SANE_Fixed *) v;