GDI: convert StartDoc to unicode
Mike McCormack
mike at codeweavers.com
Mon Jan 3 21:30:50 CST 2005
This isn't a real unicode conversion, it's just moving the problem
about. However, by doing this, we fix the DC_FUNCS structure, and move
the non-unicode code into the same module.
I started trying to fix wineps but it's a bit of a tarpit...
Mike
ChangeLog:
* convert StartDoc to unicode
-------------- next part --------------
Index: dlls/wineps/escape.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/escape.c,v
retrieving revision 1.26
diff -u -r1.26 escape.c
--- dlls/wineps/escape.c 23 Dec 2004 20:31:56 -0000 1.26
+++ dlls/wineps/escape.c 4 Jan 2005 03:17:34 -0000
@@ -28,6 +28,7 @@
#include "psdrv.h"
#include "wine/debug.h"
#include "winspool.h"
+#include "heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
@@ -345,9 +346,9 @@
/************************************************************************
- * PSDRV_StartDoc
+ * PSDRV_StartDocA
*/
-INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
+INT PSDRV_StartDocA( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
{
LPCSTR output = "LPT1:";
BYTE buf[300];
@@ -393,6 +394,31 @@
return physDev->job.hJob;
}
+/************************************************************************
+ * PSDRV_StartDoc
+ */
+INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOW *doc )
+{
+ DOCINFOA docA;
+ INT ret;
+
+ docA.cbSize = doc->cbSize;
+ docA.lpszDocName = doc->lpszDocName ?
+ HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDocName ) : NULL;
+ docA.lpszOutput = doc->lpszOutput ?
+ HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszOutput ) : NULL;
+ docA.lpszDatatype = doc->lpszDatatype ?
+ HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDatatype ) : NULL;
+ docA.fwType = doc->fwType;
+
+ ret = PSDRV_StartDocA(physDev, &docA);
+
+ HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
+ HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
+ HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
+
+ return ret;
+}
/************************************************************************
* PSDRV_EndDoc
Index: dlls/wineps/psdrv.h
===================================================================
RCS file: /home/wine/wine/dlls/wineps/psdrv.h,v
retrieving revision 1.54
diff -u -r1.54 psdrv.h
--- dlls/wineps/psdrv.h 2 Nov 2004 19:25:51 -0000 1.54
+++ dlls/wineps/psdrv.h 4 Jan 2005 03:17:34 -0000
@@ -495,7 +495,7 @@
extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
-extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
+extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOW *doc );
extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT xSrc,
Index: dlls/gdi/gdi_private.h
===================================================================
RCS file: /home/wine/wine/dlls/gdi/gdi_private.h,v
retrieving revision 1.17
diff -u -r1.17 gdi_private.h
--- dlls/gdi/gdi_private.h 23 Nov 2004 12:19:24 -0000 1.17
+++ dlls/gdi/gdi_private.h 4 Jan 2005 03:17:34 -0000
@@ -162,7 +162,7 @@
INT (*pSetWindowExt)(PHYSDEV,INT,INT);
INT (*pSetWindowOrg)(PHYSDEV,INT,INT);
BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
- INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
+ INT (*pStartDoc)(PHYSDEV,const DOCINFOW*);
INT (*pStartPage)(PHYSDEV);
BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
Index: dlls/gdi/printdrv.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/printdrv.c,v
retrieving revision 1.41
diff -u -r1.41 printdrv.c
--- dlls/gdi/printdrv.c 23 Dec 2004 18:41:06 -0000 1.41
+++ dlls/gdi/printdrv.c 4 Jan 2005 03:17:34 -0000
@@ -50,7 +50,6 @@
#include "wine/debug.h"
#include "gdi.h"
#include "gdi_private.h"
-#include "heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(print);
@@ -70,13 +69,14 @@
*
* Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
*/
-INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
+INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
{
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
TRACE("DocName = '%s' Output = '%s' Datatype = '%s'\n",
- doc->lpszDocName, doc->lpszOutput, doc->lpszDatatype);
+ debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
+ debugstr_w(doc->lpszDatatype));
if(!dc) return SP_ERROR;
@@ -86,28 +86,45 @@
}
/*************************************************************************
- * StartDocW [GDI32.@]
+ * StartDocA [GDI32.@]
*
*/
-INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
+INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
{
- DOCINFOA docA;
- INT ret;
-
- docA.cbSize = doc->cbSize;
- docA.lpszDocName = doc->lpszDocName ?
- HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDocName ) : NULL;
- docA.lpszOutput = doc->lpszOutput ?
- HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszOutput ) : NULL;
- docA.lpszDatatype = doc->lpszDatatype ?
- HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDatatype ) : NULL;
- docA.fwType = doc->fwType;
-
- ret = StartDocA(hdc, &docA);
-
- HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
- HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
- HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
+ LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
+ DOCINFOW docW;
+ INT ret, len;
+
+ docW.cbSize = doc->cbSize;
+ if (doc->lpszDocName)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,NULL,0);
+ szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,szDocName,len);
+ }
+ if (doc->lpszOutput)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,NULL,0);
+ szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,szOutput,len);
+ }
+ if (doc->lpszDatatype)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,NULL,0);
+ szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,szDatatype,len);
+ }
+
+ docW.lpszDocName = szDocName;
+ docW.lpszOutput = szOutput;
+ docW.lpszDatatype = szDatatype;
+ docW.fwType = doc->fwType;
+
+ ret = StartDocW(hdc, &docW);
+
+ HeapFree( GetProcessHeap(), 0, szDocName );
+ HeapFree( GetProcessHeap(), 0, szOutput );
+ HeapFree( GetProcessHeap(), 0, szDatatype );
return ret;
}
More information about the wine-patches
mailing list