[janitor] dlls/wineps -Wwrite-strings cleanup

Daniel Marmier d.marmier at bluewin.ch
Sun Oct 12 13:02:33 CDT 2003


Fixed warnings with gcc option "-Wwrite-strings".

Notes:
   - changed WriteSpool16
   - changed PSDRV_WriteSpool

-------------- next part --------------
Index: include/wine/wingdi16.h
===================================================================
RCS file: /home/wine/wine/include/wine/wingdi16.h,v
retrieving revision 1.29
diff -u -r1.29 wingdi16.h
--- include/wine/wingdi16.h	5 Sep 2003 23:15:44 -0000	1.29
+++ include/wine/wingdi16.h	12 Oct 2003 17:41:13 -0000
@@ -637,7 +637,7 @@
 INT16       WINAPI UpdateColors16(HDC16);
 BOOL16      WINAPI WidenPath16(HDC16);
 INT16       WINAPI WriteDialog16(HPJOB16,LPSTR,INT16);
-INT16       WINAPI WriteSpool16(HPJOB16,LPSTR,INT16);
+INT16       WINAPI WriteSpool16(HPJOB16,LPCSTR,INT16);
 
 
 inline static void CONV_POINT16TO32( const POINT16 *p16, POINT *p32 )
Index: dlls/gdi/printdrv.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/printdrv.c,v
retrieving revision 1.34
diff -u -r1.34 printdrv.c
--- dlls/gdi/printdrv.c	5 Sep 2003 23:08:38 -0000	1.34
+++ dlls/gdi/printdrv.c	12 Oct 2003 17:41:16 -0000
@@ -620,7 +620,7 @@
  *           WriteSpool   (GDI.241)
  *
  */
-INT16 WINAPI WriteSpool16(HPJOB16 hJob, LPSTR lpData, INT16 cch)
+INT16 WINAPI WriteSpool16(HPJOB16 hJob, LPCSTR lpData, INT16 cch)
 {
     int nRet = SP_ERROR;
     PPRINTJOB pPrintJob = NULL;
Index: dlls/wineps/download.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/download.c,v
retrieving revision 1.6
diff -u -r1.6 download.c
--- dlls/wineps/download.c	5 Sep 2003 23:08:28 -0000	1.6
+++ dlls/wineps/download.c	12 Oct 2003 17:41:18 -0000
@@ -234,7 +234,7 @@
     DOWNLOAD *pdl, *old;
     char undef[] = "/%s findfont 40 scalefont setfont /%s undefinefont\n";
     char buf[sizeof(undef) + 200];
-    char *default_font = physDev->pi->ppd->DefaultFont ?
+    const char *default_font = physDev->pi->ppd->DefaultFont ?
         physDev->pi->ppd->DefaultFont : "Courier";
 
     if(physDev->font.fontloc == Download) {
Index: dlls/wineps/init.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/init.c,v
retrieving revision 1.51
diff -u -r1.51 init.c
--- dlls/wineps/init.c	12 Aug 2003 20:42:18 -0000	1.51
+++ dlls/wineps/init.c	12 Oct 2003 17:41:21 -0000
@@ -519,6 +519,7 @@
     char* ppdFileName = NULL;
     HKEY hkey;
     BOOL using_default_devmode = FALSE;
+    char paperSize[] = "Paper Size";
 
     TRACE("'%s'\n", name);
 
@@ -586,10 +587,11 @@
     }
 #endif
     if (!ppdFileName) {
-        res = GetPrinterDataA(hPrinter, "PPD File", NULL, NULL, 0, &needed);
+        char ppd_file[] = "PPD File";
+        res = GetPrinterDataA(hPrinter, ppd_file, NULL, NULL, 0, &needed);
         if ((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA)) {
             ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed);
-            res = GetPrinterDataA(hPrinter, "PPD File", &ppdType, ppdFileName, needed, &needed);
+            res = GetPrinterDataA(hPrinter, ppd_file, &ppdType, ppdFileName, needed, &needed);
         }
     }
     /* Look for a ppd file for this printer in the config file.
@@ -671,7 +673,7 @@
      *	the Devmode structure, but Wine doesn't currently provide a convenient
      *	way to configure printers.
      */
-    res = GetPrinterDataA (hPrinter, "Paper Size", NULL, (LPBYTE) &dwPaperSize,
+    res = GetPrinterDataA (hPrinter, paperSize, NULL, (LPBYTE) &dwPaperSize,
 	    sizeof (DWORD), &needed);
     if (res == ERROR_SUCCESS)
 	pi->Devmode->dmPublic.u1.s1.dmPaperSize = (SHORT) dwPaperSize;
Index: dlls/wineps/ppd.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/ppd.c,v
retrieving revision 1.14
diff -u -r1.14 ppd.c
--- dlls/wineps/ppd.c	5 Sep 2003 23:08:28 -0000	1.14
+++ dlls/wineps/ppd.c	12 Oct 2003 17:41:25 -0000
@@ -43,7 +43,7 @@
 /* map of page names in ppd file to Windows paper constants */
 
 static struct {
-  char *PSName;
+  const char *PSName;
   WORD WinPage;
 } PageTrans[] = {
   {"10x11",                   DMPAPER_10X11},
@@ -576,7 +576,7 @@
      *	The Windows PostScript drivers create the following "virtual bin" for
      *	every PostScript printer
      */
-    if (PSDRV_AddSlot(ppd, NULL, "Automatically Select", NULL,
+    if (PSDRV_AddSlot(ppd, NULL, FAKE_LPSTR("Automatically Select"), NULL,
 	    DMBIN_FORMSOURCE))
     {
 	HeapFree (PSDRV_Heap, 0, ppd);
@@ -793,7 +793,7 @@
 		!strcmp ("True", tuple.option))
 	{
 	    /* FIXME - should check for failure */
-	    PSDRV_AddSlot(ppd, "Manual Feed", "Manual Feed", tuple.value, DMBIN_MANUAL);
+	    PSDRV_AddSlot(ppd, FAKE_LPSTR("Manual Feed"), FAKE_LPSTR("Manual Feed"), tuple.value, DMBIN_MANUAL);
 	    tuple.value = NULL;
 	}
 
Index: dlls/wineps/ps.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/ps.c,v
retrieving revision 1.18
diff -u -r1.18 ps.c
--- dlls/wineps/ps.c	23 Jun 2003 19:57:08 -0000	1.18
+++ dlls/wineps/ps.c	12 Oct 2003 17:41:29 -0000
@@ -193,7 +193,7 @@
 "/%s %d array def\n";
 
 
-int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch)
+int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPCSTR lpData, WORD cch)
 {
     if(physDev->job.quiet) {
         TRACE("ignoring output\n");
@@ -208,8 +208,8 @@
 }
 
 
-INT PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value,
-			 char *invocation)
+INT PSDRV_WriteFeature(HANDLE16 hJob, const char *feature, const char *value,
+			 const char *invocation)
 {
 
     char *buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psbeginfeature) +
Index: dlls/wineps/psdrv.h
===================================================================
RCS file: /home/wine/wine/dlls/wineps/psdrv.h,v
retrieving revision 1.41
diff -u -r1.41 psdrv.h
--- dlls/wineps/psdrv.h	5 Sep 2003 23:08:28 -0000	1.41
+++ dlls/wineps/psdrv.h	12 Oct 2003 17:41:32 -0000
@@ -29,6 +29,8 @@
 #include "wine/wingdi16.h"
 #include "winspool.h"
 
+#define FAKE_LPSTR(s)	((LPSTR)(unsigned long)(s))
+
 typedef struct {
     INT		    index;
     LPCSTR	    sz;
@@ -439,7 +441,7 @@
 extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
 extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
 extern BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
-extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch);
+extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPCSTR lpData, WORD cch);
 extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits);
 extern BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage);
 extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord);


More information about the wine-patches mailing list