winspool.drv: Write-strings warnings fix (Resent)

Andrew Talbot Andrew.Talbot at talbotville.com
Mon Jul 10 15:42:19 CDT 2006


Changelog:
    winspool.drv: Write-strings warnings fix.

diff -urN a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
--- a/dlls/winspool.drv/info.c	2006-06-21 17:24:50.000000000 +0100
+++ b/dlls/winspool.drv/info.c	2006-07-10 21:24:14.000000000 +0100
@@ -376,24 +376,33 @@
             RegDeleteValueW(hkeyPrinter, May_Delete_Value);
             RegCloseKey(hkeyPrinter);
         } else {
+            CHAR data_type[]   = "RAW",
+                 print_proc[]  = "WinPrint",
+                 driver_name[] = "PS Driver",
+                 comment[]     = "WINEPS Printer using CUPS",
+                 location[]    = "<physical location of printer>",
+                 params[]      = "<parameters?>",
+                 share_name[]  = "<share name?>",
+                 sep_file[]    = "<sep file?>";
+
             memset(&pinfo2a,0,sizeof(pinfo2a));
-            pinfo2a.pPrinterName	= dests[i].name;
-            pinfo2a.pDatatype	= "RAW";
-            pinfo2a.pPrintProcessor	= "WinPrint";
-            pinfo2a.pDriverName	= "PS Driver";
-            pinfo2a.pComment	= "WINEPS Printer using CUPS";
-            pinfo2a.pLocation	= "<physical location of printer>";
-            pinfo2a.pPortName	= port;
-            pinfo2a.pParameters	= "<parameters?>";
-            pinfo2a.pShareName	= "<share name?>";
-            pinfo2a.pSepFile	= "<sep file?>";
+            pinfo2a.pPrinterName    = dests[i].name;
+            pinfo2a.pDatatype       = data_type;
+            pinfo2a.pPrintProcessor = print_proc;
+            pinfo2a.pDriverName     = driver_name;
+            pinfo2a.pComment        = comment;
+            pinfo2a.pLocation       = location;
+            pinfo2a.pPortName       = port;
+            pinfo2a.pParameters     = params;
+            pinfo2a.pShareName      = share_name;
+            pinfo2a.pSepFile        = sep_file;
 
             if (!AddPrinterA(NULL,2,(LPBYTE)&pinfo2a)) {
                 if (GetLastError() != ERROR_PRINTER_ALREADY_EXISTS)
                     ERR("printer '%s' not added by AddPrinterA (error %ld)\n",dests[i].name,GetLastError());
             }
         }
-	HeapFree(GetProcessHeap(),0,port);
+        HeapFree(GetProcessHeap(),0,port);
 
         hadprinter = TRUE;
         if (dests[i].is_default)
@@ -406,9 +415,10 @@
 
 static BOOL
 PRINTCAP_ParseEntry(char *pent,BOOL isfirst) {
-    PRINTER_INFO_2A	pinfo2a;
-    char		*e,*s,*name,*prettyname,*devname;
-    BOOL		ret = FALSE, set_default = FALSE;
+    PRINTER_INFO_2A     pinfo2a;
+    char                *e,*s,*name,*prettyname,*devname;
+    CHAR                empty[] = "";
+    BOOL                ret = FALSE, set_default = FALSE;
     char                *port,*devline,*env_default;
     HKEY                hkeyPrinter, hkeyPrinters, hkey;
 
@@ -421,7 +431,7 @@
         *s=':';
         pent = s;
     } else
-        pent = "";
+        pent = empty;
 
     TRACE("name=%s entry=%s\n",name, pent);
 
@@ -459,7 +469,7 @@
      * if it is too long, we use it as comment below. */
     devname = prettyname;
     if (strlen(devname)>=CCHDEVICENAME-1)
-	 devname = name;
+        devname = name;
     if (strlen(devname)>=CCHDEVICENAME-1) {
         ret = FALSE;
         goto end;
@@ -476,11 +486,11 @@
         RegCloseKey(hkey);
     }
     HeapFree(GetProcessHeap(),0,devline);
-    
+
     if(RegCreateKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters) !=
        ERROR_SUCCESS) {
         ERR("Can't create Printers key\n");
-	ret = FALSE;
+        ret = FALSE;
         goto end;
     }
     if(RegOpenKeyA(hkeyPrinters, devname, &hkeyPrinter) == ERROR_SUCCESS) {
@@ -490,17 +500,25 @@
         RegDeleteValueW(hkeyPrinter, May_Delete_Value);
         RegCloseKey(hkeyPrinter);
     } else {
+        CHAR data_type[]   = "RAW",
+             print_proc[]  = "WinPrint",
+             driver_name[] = "PS Driver",
+             comment[]     = "WINEPS Printer using LPR",
+             params[]      = "<parameters?>",
+             share_name[]  = "<share name?>",
+             sep_file[]    = "<sep file?>";
+
         memset(&pinfo2a,0,sizeof(pinfo2a));
-        pinfo2a.pPrinterName            = devname;
-        pinfo2a.pDatatype               = "RAW";
-        pinfo2a.pPrintProcessor	        = "WinPrint";
-        pinfo2a.pDriverName             = "PS Driver";
-        pinfo2a.pComment                = "WINEPS Printer using LPR";
-        pinfo2a.pLocation               = prettyname;
-        pinfo2a.pPortName               = port;
-        pinfo2a.pParameters             = "<parameters?>";
-        pinfo2a.pShareName              = "<share name?>";
-        pinfo2a.pSepFile                = "<sep file?>";
+        pinfo2a.pPrinterName    = devname;
+        pinfo2a.pDatatype       = data_type;
+        pinfo2a.pPrintProcessor = print_proc;
+        pinfo2a.pDriverName     = driver_name;
+        pinfo2a.pComment        = comment;
+        pinfo2a.pLocation       = prettyname;
+        pinfo2a.pPortName       = port;
+        pinfo2a.pParameters     = params;
+        pinfo2a.pShareName      = share_name;
+        pinfo2a.pSepFile        = sep_file;
 
         if (!AddPrinterA(NULL,2,(LPBYTE)&pinfo2a)) {
             if (GetLastError()!=ERROR_PRINTER_ALREADY_EXISTS)
@@ -585,22 +603,30 @@
     DRIVER_INFO_3A      di3a;
     HANDLE              hprn;
     DWORD               needed, num, i;
+    static CHAR         name[]              = "PS Driver",
+                        driver_path[]       = "wineps16",
+                        data_file[]         = "<datafile?>",
+                        config_file[]       = "wineps16",
+                        help_file[]         = "<helpfile?>",
+                        dep_file[]          = "<dependend files?>",
+                        monitor_name[]      = "<monitor name?>",
+                        default_data_type[] = "RAW";
     WCHAR               PrinterName[256];
     BOOL                done = FALSE;
 
     di3a.cVersion = (GetVersion() & 0x80000000) ? 0 : 3; /* FIXME: add 1, 2 */
-    di3a.pName = "PS Driver";
-    di3a.pEnvironment = NULL;	/* NULL means auto */
-    di3a.pDriverPath = "wineps16";
-    di3a.pDataFile = "<datafile?>";
-    di3a.pConfigFile = "wineps16";
-    di3a.pHelpFile = "<helpfile?>";
-    di3a.pDependentFiles = "<dependend files?>";
-    di3a.pMonitorName = "<monitor name?>";
-    di3a.pDefaultDataType = "RAW";
+    di3a.pName            = name;
+    di3a.pEnvironment     = NULL;	/* NULL means auto */
+    di3a.pDriverPath      = driver_path;
+    di3a.pDataFile        = data_file;
+    di3a.pConfigFile      = config_file;
+    di3a.pHelpFile        = help_file;
+    di3a.pDependentFiles  = dep_file;
+    di3a.pMonitorName     = monitor_name;
+    di3a.pDefaultDataType = default_data_type;
 
     if (!AddPrinterDriverA(NULL,3,(LPBYTE)&di3a)) {
-	ERR("Failed adding PS Driver (%ld)\n",GetLastError());
+        ERR("Failed adding PS Driver (%ld)\n",GetLastError());
         return;
     }
 
@@ -3935,6 +3961,8 @@
 {
     DRIVER_INFO_3A di3;
     HKEY hkeyDrivers, hkeyName;
+    static CHAR empty[]    = "",
+                nullnull[] = "\0";
 
     TRACE("(%s,%ld,%p)\n",debugstr_a(pName),level,pDriverInfo);
 
@@ -3965,10 +3993,10 @@
         SetLastError(ERROR_INVALID_PARAMETER);
 	return FALSE;
     }
-    if(!di3.pDefaultDataType) di3.pDefaultDataType = "";
-    if(!di3.pDependentFiles) di3.pDependentFiles = "\0";
-    if(!di3.pHelpFile) di3.pHelpFile = "";
-    if(!di3.pMonitorName) di3.pMonitorName = "";
+    if(!di3.pDefaultDataType) di3.pDefaultDataType = empty;
+    if(!di3.pDependentFiles) di3.pDependentFiles = nullnull;
+    if(!di3.pHelpFile) di3.pHelpFile = empty;
+    if(!di3.pMonitorName) di3.pMonitorName = empty;
 
     hkeyDrivers = WINSPOOL_OpenDriverReg(di3.pEnvironment, FALSE);
 



More information about the wine-patches mailing list