Alexandre Julliard : sane.ds: Build with msvcrt.
Alexandre Julliard
julliard at winehq.org
Thu Oct 28 16:07:44 CDT 2021
Module: wine
Branch: master
Commit: 1fe2a12bfbc051ed49a1bd3ea28d10ee36226507
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1fe2a12bfbc051ed49a1bd3ea28d10ee36226507
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 27 16:59:23 2021 +0200
sane.ds: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/sane.ds/Makefile.in | 2 --
dlls/sane.ds/capability.c | 2 --
dlls/sane.ds/ds_ctrl.c | 5 -----
dlls/sane.ds/ds_image.c | 2 --
dlls/sane.ds/options.c | 14 ++++----------
dlls/sane.ds/sane_i.h | 4 ----
dlls/sane.ds/sane_main.c | 6 +-----
dlls/sane.ds/ui.c | 39 ++++++++++++++++-----------------------
8 files changed, 21 insertions(+), 53 deletions(-)
diff --git a/dlls/sane.ds/Makefile.in b/dlls/sane.ds/Makefile.in
index 3e7c1291093..59ceeda3fac 100644
--- a/dlls/sane.ds/Makefile.in
+++ b/dlls/sane.ds/Makefile.in
@@ -4,8 +4,6 @@ IMPORTS = comctl32 user32 gdi32
EXTRALIBS = $(SANE_LIBS)
EXTRAINCL = $(SANE_CFLAGS)
-EXTRADLLFLAGS = -mcygwin
-
C_SRCS = \
capability.c \
ds_ctrl.c \
diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c
index edddfe9344a..8c0922ca176 100644
--- a/dlls/sane.ds/capability.c
+++ b/dlls/sane.ds/capability.c
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
diff --git a/dlls/sane.ds/ds_ctrl.c b/dlls/sane.ds/ds_ctrl.c
index 513086ac8de..915f085a481 100644
--- a/dlls/sane.ds/ds_ctrl.c
+++ b/dlls/sane.ds/ds_ctrl.c
@@ -16,11 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#include <stdlib.h>
#include "sane_i.h"
#include "wine/debug.h"
diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c
index da75dac9d4b..b2fad94c848 100644
--- a/dlls/sane.ds/ds_image.c
+++ b/dlls/sane.ds/ds_image.c
@@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-
#include <stdarg.h>
#include "sane_i.h"
diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c
index a8e7e232b07..52e73a99925 100644
--- a/dlls/sane.ds/options.c
+++ b/dlls/sane.ds/options.c
@@ -16,15 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "sane_i.h"
-#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
@@ -143,14 +140,11 @@ TW_UINT16 sane_option_probe_mode(TW_UINT16 *current, TW_UINT32 *choices, int *co
*count = 0;
if (opt.constraint_type == CONSTRAINT_STRING_LIST)
{
- for (p = opt.constraint.strings; *p; p += strlenW(p) + 1)
+ for (p = opt.constraint.strings; *p; p += lstrlenW(p) + 1)
{
- static const WCHAR lineartW[] = {'L','i','n','e','a','r','t',0};
- static const WCHAR colorW[] = {'C','o','l','o','r',0};
- static const WCHAR grayW[] = {'G','r','a','y',0};
- if (!strcmpW( p, lineartW )) choices[(*count)++] = TWPT_BW;
- else if (!strcmpW( p, colorW )) choices[(*count)++] = TWPT_RGB;
- else if (!strncmpW( p, grayW, 4 )) choices[(*count)++] = TWPT_GRAY;
+ if (!wcscmp( p, L"Lineart" )) choices[(*count)++] = TWPT_BW;
+ else if (!wcscmp( p, L"Color" )) choices[(*count)++] = TWPT_RGB;
+ else if (!wcsncmp( p, L"Gray", 4 )) choices[(*count)++] = TWPT_GRAY;
}
}
return rc;
diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h
index 18ba582877f..db71b87995e 100644
--- a/dlls/sane.ds/sane_i.h
+++ b/dlls/sane.ds/sane_i.h
@@ -19,10 +19,6 @@
#ifndef _TWAIN32_H
#define _TWAIN32_H
-#ifndef __WINE_CONFIG_H
-# error You must include config.h first
-#endif
-
#include <stdarg.h>
#include "windef.h"
diff --git a/dlls/sane.ds/sane_main.c b/dlls/sane.ds/sane_main.c
index 78e0ac06afd..c67ad8e5f8b 100644
--- a/dlls/sane.ds/sane_main.c
+++ b/dlls/sane.ds/sane_main.c
@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
#include <stdio.h>
@@ -64,8 +61,7 @@ static TW_UINT16 SANE_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self)
if (SANE_dsmentry == NULL)
{
- static const WCHAR twain32W[] = {'t','w','a','i','n','_','3','2',0};
- HMODULE moddsm = GetModuleHandleW(twain32W);
+ HMODULE moddsm = GetModuleHandleW(L"twain_32");
if (moddsm)
SANE_dsmentry = (void*)GetProcAddress(moddsm, "DSM_Entry");
diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c
index 9c4aedc73ec..918dbe47a88 100644
--- a/dlls/sane.ds/ui.c
+++ b/dlls/sane.ds/ui.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
@@ -33,7 +31,6 @@
#include "prsht.h"
#include "wine/debug.h"
#include "resource.h"
-#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
@@ -60,7 +57,7 @@ static int create_leading_static(HDC hdc, const WCHAR *text,
base = GetDialogBaseUnits();
- len = strlenW(text) * sizeof(WCHAR);
+ len = lstrlenW(text) * sizeof(WCHAR);
len += sizeof(DLGITEMTEMPLATE);
len += 4*sizeof(WORD);
@@ -78,8 +75,8 @@ static int create_leading_static(HDC hdc, const WCHAR *text,
ptr = (WORD *)(tpl + 1);
*ptr++ = 0xffff;
*ptr++ = 0x0082;
- strcpyW( ptr, text );
- ptr += strlenW(ptr) + 1;
+ lstrcpyW( ptr, text );
+ ptr += lstrlenW(ptr) + 1;
*ptr = 0;
*template_out = tpl;
@@ -99,7 +96,7 @@ static int create_trailing_edit(HDC hdc, LPDLGITEMTEMPLATEW* template_out, int i
base = GetDialogBaseUnits();
- len = strlenW(text) * sizeof(WCHAR);
+ len = lstrlenW(text) * sizeof(WCHAR);
len += sizeof(DLGITEMTEMPLATE);
len += 4*sizeof(WORD);
@@ -121,8 +118,8 @@ static int create_trailing_edit(HDC hdc, LPDLGITEMTEMPLATEW* template_out, int i
ptr = (WORD *)(tpl + 1);
*ptr++ = 0xffff;
*ptr++ = 0x0081;
- strcpyW( ptr, text );
- ptr += strlenW(ptr) + 1;
+ lstrcpyW( ptr, text );
+ ptr += lstrlenW(ptr) + 1;
*ptr = 0;
*template_out = tpl;
@@ -165,9 +162,8 @@ static int create_item(HDC hdc, const struct option_descriptor *opt,
case TYPE_INT:
{
int i;
- static const WCHAR fmtW[] = {'%','i',0};
sane_option_get_value( id - ID_BASE, &i );
- sprintfW(buffer,fmtW,i);
+ swprintf(buffer, ARRAY_SIZE(buffer), L"%i", i);
switch (opt->constraint_type)
{
@@ -193,12 +189,11 @@ static int create_item(HDC hdc, const struct option_descriptor *opt,
}
case TYPE_FIXED:
{
- static const WCHAR fmtW[] = {'%','f',0};
int *i = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(int));
sane_option_get_value( id - ID_BASE, i );
- sprintfW(buffer,fmtW, *i / 65536.0);
+ swprintf(buffer, ARRAY_SIZE(buffer), L"%f", *i / 65536.0);
HeapFree(GetProcessHeap(),0,i);
switch (opt->constraint_type)
@@ -253,7 +248,7 @@ static int create_item(HDC hdc, const struct option_descriptor *opt,
}
local_len += sizeof(DLGITEMTEMPLATE);
- if (title) local_len += strlenW(title) * sizeof(WCHAR);
+ if (title) local_len += lstrlenW(title) * sizeof(WCHAR);
local_len += 4*sizeof(WORD);
if (lead_static)
@@ -299,8 +294,8 @@ static int create_item(HDC hdc, const struct option_descriptor *opt,
*ptr++ = class;
if (title)
{
- strcpyW( ptr, title );
- ptr += strlenW(ptr);
+ lstrcpyW( ptr, title );
+ ptr += lstrlenW(ptr);
}
*ptr++ = 0;
*ptr = 0;
@@ -513,8 +508,8 @@ BOOL DoScannerUI(void)
if (opt.type == TYPE_GROUP)
{
- LPWSTR title = HeapAlloc(GetProcessHeap(),0,(strlenW(opt.title) + 1) * sizeof(WCHAR));
- strcpyW( title, opt.title );
+ LPWSTR title = HeapAlloc(GetProcessHeap(),0,(lstrlenW(opt.title) + 1) * sizeof(WCHAR));
+ lstrcpyW( title, opt.title );
psp[page_count].pszTitle = title;
}
@@ -575,7 +570,6 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i
{
case TYPE_INT:
{
- static const WCHAR formatW[] = {'%','i',0};
INT si;
if (opt->constraint.range.quant)
@@ -583,12 +577,11 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i
else
si = position;
- len = sprintfW( buffer, formatW, si );
+ len = swprintf( buffer, ARRAY_SIZE(buffer), L"%i", si );
break;
}
case TYPE_FIXED:
{
- static const WCHAR formatW[] = {'%','f',0};
double dd;
if (opt->constraint.range.quant)
@@ -596,7 +589,7 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i
else
dd = position * 0.01;
- len = sprintfW( buffer, formatW, dd );
+ len = swprintf( buffer, ARRAY_SIZE(buffer), L"%f", dd );
break;
}
default:
@@ -679,7 +672,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
CHAR buffer[255];
WCHAR *p;
- for (p = opt.constraint.strings; *p; p += strlenW(p) + 1)
+ for (p = opt.constraint.strings; *p; p += lstrlenW(p) + 1)
SendMessageW( control,CB_ADDSTRING,0, (LPARAM)p );
sane_option_get_value( i, buffer );
SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
More information about the wine-cvs
mailing list