Janitorial dlls/gdi/mfdrv/init.c W->A cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change Log: Janitorial. Get rid of W->A call

Files Changed: dlls/gdi/mfdrv/init.c

--

Tony Lambregts



Index: init.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/mfdrv/init.c,v
retrieving revision 1.16
diff -u -r1.16 init.c
--- init.c	12 Feb 2003 01:17:25 -0000	1.16
+++ init.c	6 Mar 2003 21:24:24 -0000
@@ -213,14 +213,16 @@
  * RETURNS
  *  A handle to the metafile DC if successful, NULL on failure.
  */
-HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile */
+HDC WINAPI CreateMetaFileW( LPCWSTR filename ) /* [in] Filename of disk metafile */
 {
+    char *filenameA;
+    DWORD len;
     HDC ret;
     DC *dc;
     METAFILEDRV_PDEVICE *physDev;
     HANDLE hFile;
 
-    TRACE("'%s'\n", filename );
+    TRACE("'%s'\n", debugstr_w(filename) );
 
     if (!(dc = MFDRV_AllocMetaFile())) return 0;
     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
@@ -228,8 +230,8 @@
     if (filename)  /* disk based metafile */
     {
         physDev->mh->mtType = METAFILE_DISK;
-        if ((hFile = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
-				CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
+        if ((hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL,
+		CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
             MFDRV_DeleteDC( dc->physDev );
             return 0;
         }
@@ -241,7 +243,12 @@
 	physDev->hFile = hFile;
 
 	/* Grow METAHEADER to include filename */
-	physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename);
+        len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
+        filenameA = HeapAlloc(GetProcessHeap(), 0, len);
+        WideCharToMultiByte(CP_ACP, 0, filename, -1, filenameA, len,
+            NULL, NULL);
+	physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filenameA);
+        HeapFree( GetProcessHeap(), 0, filenameA );
     }
     else  /* memory based metafile */
 	physDev->mh->mtType = METAFILE_MEMORY;
@@ -253,25 +260,15 @@
 }
 
 /**********************************************************************
- *          CreateMetaFileW   (GDI32.@)
+ *          CreateMetaFileA   (GDI32.@)
  */
-HDC WINAPI CreateMetaFileW(LPCWSTR filename)
+HDC WINAPI CreateMetaFileA(LPCSTR filename)
 {
-    LPSTR filenameA;
-    DWORD len;
-    HDC hReturnDC;
-
-    len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
-    filenameA = HeapAlloc( GetProcessHeap(), 0, len );
-    WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
-
-    hReturnDC = CreateMetaFileA(filenameA);
-
-    HeapFree( GetProcessHeap(), 0, filenameA );
-
-    return hReturnDC;
+    WCHAR filenameW[MAX_PATH];
+    
+    MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, MAX_PATH);
+    return CreateMetaFileW(filenameW);     
 }
-
 
 /**********************************************************************
  *          MFDRV_CloseMetaFile

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux