sane.ds: Move a few static functions so they can be shared.
diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c
index 859b4be..20fd2c3 100644
--- a/dlls/sane.ds/capability.c
+++ b/dlls/sane.ds/capability.c
@@ -315,33 +315,6 @@
return TRUE;
}
-
-static TW_UINT16 sane_status_to_twcc(SANE_Status rc)
-{
- switch (rc)
- {
- case SANE_STATUS_GOOD:
- return TWCC_SUCCESS;
- case SANE_STATUS_UNSUPPORTED:
- return TWCC_CAPUNSUPPORTED;
- case SANE_STATUS_JAMMED:
- return TWCC_PAPERJAM;
- case SANE_STATUS_NO_MEM:
- return TWCC_LOWMEMORY;
- case SANE_STATUS_ACCESS_DENIED:
- return TWCC_DENIED;
-
- case SANE_STATUS_IO_ERROR:
- case SANE_STATUS_NO_DOCS:
- case SANE_STATUS_COVER_OPEN:
- case SANE_STATUS_EOF:
- case SANE_STATUS_INVAL:
- case SANE_STATUS_CANCELLED:
- case SANE_STATUS_DEVICE_BUSY:
- default:
- return TWCC_BUMMER;
- }
-}
#endif
/* ICAP_PIXELTYPE */
@@ -696,31 +669,6 @@
return twCC;
}
-#ifdef SONAME_LIBSANE
-static void convert_double_fix32(double d, TW_FIX32 *fix32)
-{
- TW_INT32 value = (TW_INT32) (d * 65536.0 + 0.5);
- fix32->Whole = value >> 16;
- fix32->Frac = value & 0x0000ffffL;
-}
-
-static BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype)
-{
- double d;
-
- if (unit != SANE_UNIT_MM)
- return FALSE;
-
- if (twtype != TWUN_INCHES)
- return FALSE;
-
- d = (sane_res / 10.0) / 2.54;
- convert_double_fix32((sane_res / 10.0) / 2.54, twain_res);
-
- return TRUE;
-}
-#endif
-
/* ICAP_PHYSICALHEIGHT, ICAP_PHYSICALWIDTH */
static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
{
diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c
index 44cd34e..c2e5020 100644
--- a/dlls/sane.ds/options.c
+++ b/dlls/sane.ds/options.c
@@ -218,4 +218,53 @@
return rc;
}
+
+TW_UINT16 sane_status_to_twcc(SANE_Status rc)
+{
+ switch (rc)
+ {
+ case SANE_STATUS_GOOD:
+ return TWCC_SUCCESS;
+ case SANE_STATUS_UNSUPPORTED:
+ return TWCC_CAPUNSUPPORTED;
+ case SANE_STATUS_JAMMED:
+ return TWCC_PAPERJAM;
+ case SANE_STATUS_NO_MEM:
+ return TWCC_LOWMEMORY;
+ case SANE_STATUS_ACCESS_DENIED:
+ return TWCC_DENIED;
+
+ case SANE_STATUS_IO_ERROR:
+ case SANE_STATUS_NO_DOCS:
+ case SANE_STATUS_COVER_OPEN:
+ case SANE_STATUS_EOF:
+ case SANE_STATUS_INVAL:
+ case SANE_STATUS_CANCELLED:
+ case SANE_STATUS_DEVICE_BUSY:
+ default:
+ return TWCC_BUMMER;
+ }
+}
+static void convert_double_fix32(double d, TW_FIX32 *fix32)
+{
+ TW_INT32 value = (TW_INT32) (d * 65536.0 + 0.5);
+ fix32->Whole = value >> 16;
+ fix32->Frac = value & 0x0000ffffL;
+}
+
+BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype)
+{
+ double d;
+
+ if (unit != SANE_UNIT_MM)
+ return FALSE;
+
+ if (twtype != TWUN_INCHES)
+ return FALSE;
+
+ d = (sane_res / 10.0) / 2.54;
+ convert_double_fix32((sane_res / 10.0) / 2.54, twain_res);
+
+ return TRUE;
+}
#endif
diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h
index 72b4b79..30fde23 100644
--- a/dlls/sane.ds/sane_i.h
+++ b/dlls/sane.ds/sane_i.h
@@ -234,6 +234,8 @@
SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status);
SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status);
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status);
+TW_UINT16 sane_status_to_twcc(SANE_Status rc);
+BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype);
#endif