Fixed warnings with gcc option "-Wwrite-strings". {G,S}etPrinterData[Ex]{A,W}: state that string args are constant.
Index: include/winspool.h =================================================================== RCS file: /home/wine/wine/include/winspool.h,v retrieving revision 1.23 diff -u -r1.23 winspool.h --- include/winspool.h 7 Jan 2003 23:09:22 -0000 1.23 +++ include/winspool.h 19 Oct 2003 10:59:31 -0000 @@ -984,31 +984,31 @@ PDEVMODEW pDevModeInput); #define AdvancedDocumentProperties WINELIB_NAME_AW(AdvancedDocumentProperties) -DWORD WINAPI GetPrinterDataA(HANDLE hPrinter, LPSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataA(HANDLE hPrinter, LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded); -DWORD WINAPI GetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataW(HANDLE hPrinter, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded); #define GetPrinterData WINELIB_NAME_AW(GetPrinterData) -DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPSTR pKeyName, - LPSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, + LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded); -DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPWSTR pKeyName, - LPWSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, + LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded); #define GetPrinterDataEx WINELIB_NAME_AW(GetPrinterDataEx) -DWORD WINAPI SetPrinterDataA(HANDLE hPrinter, LPSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataA(HANDLE hPrinter, LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData); -DWORD WINAPI SetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataW(HANDLE hPrinter, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData); #define SetPrinterData WINELIB_NAME_AW(SetPrinterData) -DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPSTR pKeyName, - LPSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, + LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData); -DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPWSTR pKeyName, - LPWSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, + LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData); #define SetPrinterDataEx WINELIB_NAME_AW(SetPrinterDataEx) Index: dlls/winspool/info.c =================================================================== RCS file: /home/wine/wine/dlls/winspool/info.c,v retrieving revision 1.84 diff -u -r1.84 info.c --- dlls/winspool/info.c 15 Oct 2003 21:01:05 -0000 1.84 +++ dlls/winspool/info.c 19 Oct 2003 10:59:35 -0000 @@ -57,6 +57,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winspool); +#define FAKE_LPSTR(s) ((LPSTR)(unsigned long)(s)) + static LPWSTR *printer_array; static int nb_printers; @@ -209,17 +211,17 @@ 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.pDatatype = FAKE_LPSTR("RAW"); + pinfo2a.pPrintProcessor = FAKE_LPSTR("WinPrint"); + pinfo2a.pDriverName = FAKE_LPSTR("PS Driver"); + pinfo2a.pComment = FAKE_LPSTR("WINEPS Printer using CUPS"); + pinfo2a.pLocation = FAKE_LPSTR("<physical location of printer>"); port = HeapAlloc(GetProcessHeap(),0,strlen("LPR:")+strlen(dests[i].name)+1); sprintf(port,"LPR:%s",dests[i].name); pinfo2a.pPortName = port; - pinfo2a.pParameters = "<parameters?>"; - pinfo2a.pShareName = "<share name?>"; - pinfo2a.pSepFile = "<sep file?>"; + pinfo2a.pParameters = FAKE_LPSTR("<parameters?>"); + pinfo2a.pShareName = FAKE_LPSTR("<share name?>"); + pinfo2a.pSepFile = FAKE_LPSTR("<sep file?>"); devline=HeapAlloc(GetProcessHeap(),0,strlen("WINEPS,")+strlen(port)+1); sprintf(devline,"WINEPS,%s",port); @@ -306,17 +308,17 @@ 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.pDatatype = FAKE_LPSTR("RAW"); + pinfo2a.pPrintProcessor = FAKE_LPSTR("WinPrint"); + pinfo2a.pDriverName = FAKE_LPSTR("PS Driver"); + pinfo2a.pComment = FAKE_LPSTR("WINEPS Printer using LPR"); pinfo2a.pLocation = prettyname; port = HeapAlloc(GetProcessHeap(),0,strlen("LPR:")+strlen(name)+1); sprintf(port,"LPR:%s",name); pinfo2a.pPortName = port; - pinfo2a.pParameters = "<parameters?>"; - pinfo2a.pShareName = "<share name?>"; - pinfo2a.pSepFile = "<sep file?>"; + pinfo2a.pParameters = FAKE_LPSTR("<parameters?>"); + pinfo2a.pShareName = FAKE_LPSTR("<share name?>"); + pinfo2a.pSepFile = FAKE_LPSTR("<sep file?>"); devline=HeapAlloc(GetProcessHeap(),0,strlen("WINEPS,")+strlen(port)+1); sprintf(devline,"WINEPS,%s",port); @@ -387,15 +389,15 @@ HKEY hkPPD; DRIVER_INFO_3A di3a; di3a.cVersion = 0x400; - di3a.pName = "PS Driver"; + di3a.pName = FAKE_LPSTR("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.pDriverPath = FAKE_LPSTR("wineps16"); + di3a.pDataFile = FAKE_LPSTR("<datafile?>"); + di3a.pConfigFile = FAKE_LPSTR("wineps16"); + di3a.pHelpFile = FAKE_LPSTR("<helpfile?>"); + di3a.pDependentFiles = FAKE_LPSTR("<dependend files?>"); + di3a.pMonitorName = FAKE_LPSTR("<monitor name?>"); + di3a.pDefaultDataType = FAKE_LPSTR("RAW"); if (!AddPrinterDriverA(NULL,3,(LPBYTE)&di3a)) { ERR("Failed adding PS Driver (%ld)\n",GetLastError()); @@ -705,6 +707,7 @@ LPDEVMODEA pDevModeInput,DWORD fMode ) { LPSTR lpName = pDeviceName; + CHAR lpPort[] = "LPT1:"; LONG ret; TRACE("(%p,%p,%s,%p,%p,%ld)\n", @@ -729,7 +732,7 @@ return -1; } } - ret = GDI_CallExtDeviceMode16(hWnd, pDevModeOutput, lpName, "LPT1:", + ret = GDI_CallExtDeviceMode16(hWnd, pDevModeOutput, lpName, lpPort, pDevModeInput, NULL, fMode); if(!pDeviceName) @@ -1001,15 +1004,18 @@ */ static HKEY WINSPOOL_OpenDriverReg( LPVOID pEnvironment, BOOL unicode) { HKEY retval; - LPSTR lpKey, p = NULL; + LPSTR lpKey, pa = NULL; + LPCSTR p = NULL; TRACE("%s\n", (unicode) ? debugstr_w(pEnvironment) : debugstr_a(pEnvironment)); - if(pEnvironment) - p = (unicode) ? HEAP_strdupWtoA( GetProcessHeap(), 0, pEnvironment) : - pEnvironment; - else { + if(pEnvironment) { + if(unicode) + p = pa = HEAP_strdupWtoA( GetProcessHeap(), 0, pEnvironment); + else + p = pEnvironment; + } else { OSVERSIONINFOA ver; ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); @@ -1042,7 +1048,7 @@ retval = 0; if(pEnvironment && unicode) - HeapFree( GetProcessHeap(), 0, p); + HeapFree( GetProcessHeap(), 0, pa); HeapFree( GetProcessHeap(), 0, lpKey); return retval; @@ -2611,10 +2617,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 = FAKE_LPSTR(""); + if(!di3.pDependentFiles) di3.pDependentFiles = FAKE_LPSTR("\0"); + if(!di3.pHelpFile) di3.pHelpFile = FAKE_LPSTR(""); + if(!di3.pMonitorName) di3.pMonitorName = FAKE_LPSTR(""); hkeyDrivers = WINSPOOL_OpenDriverReg(di3.pEnvironment, FALSE); @@ -3048,8 +3054,8 @@ /****************************************************************************** * SetPrinterDataExA (WINSPOOL.@) */ -DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPSTR pKeyName, - LPSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, + LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData) { HKEY hkeyPrinter, hkeySubkey; @@ -3077,8 +3083,8 @@ /****************************************************************************** * SetPrinterDataExW (WINSPOOL.@) */ -DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPWSTR pKeyName, - LPWSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, + LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData) { HKEY hkeyPrinter, hkeySubkey; @@ -3106,7 +3112,7 @@ /****************************************************************************** * SetPrinterDataA (WINSPOOL.@) */ -DWORD WINAPI SetPrinterDataA(HANDLE hPrinter, LPSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataA(HANDLE hPrinter, LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData) { return SetPrinterDataExA(hPrinter, "PrinterDriverData", pValueName, Type, @@ -3116,7 +3122,7 @@ /****************************************************************************** * SetPrinterDataW (WINSPOOL.@) */ -DWORD WINAPI SetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, DWORD Type, +DWORD WINAPI SetPrinterDataW(HANDLE hPrinter, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData) { return SetPrinterDataExW(hPrinter, PrinterDriverDataW, pValueName, Type, @@ -3126,8 +3132,8 @@ /****************************************************************************** * GetPrinterDataExA (WINSPOOL.@) */ -DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPSTR pKeyName, - LPSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, + LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded) { HKEY hkeyPrinter, hkeySubkey; @@ -3157,8 +3163,8 @@ /****************************************************************************** * GetPrinterDataExW (WINSPOOL.@) */ -DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPWSTR pKeyName, - LPWSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, + LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded) { HKEY hkeyPrinter, hkeySubkey; @@ -3188,7 +3194,7 @@ /****************************************************************************** * GetPrinterDataA (WINSPOOL.@) */ -DWORD WINAPI GetPrinterDataA(HANDLE hPrinter, LPSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataA(HANDLE hPrinter, LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded) { return GetPrinterDataExA(hPrinter, "PrinterDriverData", pValueName, pType, @@ -3198,7 +3204,7 @@ /****************************************************************************** * GetPrinterDataW (WINSPOOL.@) */ -DWORD WINAPI GetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, LPDWORD pType, +DWORD WINAPI GetPrinterDataW(HANDLE hPrinter, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded) { return GetPrinterDataExW(hPrinter, PrinterDriverDataW, pValueName, pType,