Applied patch [ 1042241 ] Fixes print setup problem (MSW UNICODE build)
authorJulian Smart <julian@anthemion.co.uk>
Thu, 7 Oct 2004 16:26:58 +0000 (16:26 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 7 Oct 2004 16:26:58 +0000 (16:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cmndata.cpp

index c6208b0e8ce49c9dbb202a222f6e1f4b3eaad406..e10ea9b085952a3cb974fce44cab1350c1bed079 100644 (file)
@@ -293,16 +293,16 @@ static HGLOBAL wxCreateDevNames(const wxString& driverName, const wxString& prin
             printerName.Length() + 1 +
                              portName.Length()+1 ) * sizeof(wxChar) );
         LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
-        lpDev->wDriverOffset = sizeof(WORD)*4;
-        wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDriverOffset ), driverName);
+        lpDev->wDriverOffset = sizeof(WORD) * 4 / sizeof(wxChar);
+        wxStrcpy((wxChar*)lpDev + lpDev->wDriverOffset, driverName);
 
         lpDev->wDeviceOffset = (WORD)( lpDev->wDriverOffset +
-                                       sizeof(wxChar) * ( driverName.Length() + 1 ) );
-        wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDeviceOffset ), printerName);
+                                       driverName.Length() + 1 );
+        wxStrcpy((wxChar*)lpDev + lpDev->wDeviceOffset, printerName);
 
         lpDev->wOutputOffset = (WORD)( lpDev->wDeviceOffset +
-                                       sizeof(wxChar) * ( printerName.Length() + 1 ) );
-        wxStrcpy((wxChar*)((char*) lpDev + lpDev->wOutputOffset ), portName);
+                                       printerName.Length() + 1 );
+        wxStrcpy((wxChar*)lpDev + lpDev->wOutputOffset, portName);
 
         lpDev->wDefault = 0;