Mikhail Maroukhine : programs: Fix compiler warnings with flag -Wcast-qual.

Alexandre Julliard julliard at winehq.org
Mon Mar 29 09:57:57 CDT 2010


Module: wine
Branch: master
Commit: 93d9d8a3af4419e7913d9aa7818d4131864b7672
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=93d9d8a3af4419e7913d9aa7818d4131864b7672

Author: Mikhail Maroukhine <mikolg at yandex.ru>
Date:   Sun Mar 28 22:24:36 2010 +0700

programs: Fix compiler warnings with flag -Wcast-qual.

---

 programs/cmd/directory.c                   |    6 +++---
 programs/services/services.c               |    2 +-
 programs/wineboot/wineboot.c               |    2 +-
 programs/winedbg/tgt_active.c              |    4 ++--
 programs/winemenubuilder/winemenubuilder.c |   14 +++++++-------
 programs/winhlp32/hlpfile.c                |    4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index 6d32ea6..4e72d33 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -123,8 +123,8 @@ static WCHAR * WCMD_filesize64 (ULONGLONG n) {
  */
 static int WCMD_dir_sort (const void *a, const void *b)
 {
-  WIN32_FIND_DATAW *filea = (WIN32_FIND_DATAW *)a;
-  WIN32_FIND_DATAW *fileb = (WIN32_FIND_DATAW *)b;
+  const WIN32_FIND_DATAW *filea = (const WIN32_FIND_DATAW *)a;
+  const WIN32_FIND_DATAW *fileb = (const WIN32_FIND_DATAW *)b;
   int result = 0;
 
   /* If /OG or /O-G supplied, dirs go at the top or bottom, ignoring the
@@ -154,7 +154,7 @@ static int WCMD_dir_sort (const void *a, const void *b)
   /* Order by Date: (Takes into account which date (/T option) */
   } else if (dirOrder == Date) {
 
-    FILETIME *ft;
+    const FILETIME *ft;
     ULONG64 timea, timeb;
 
     if (dirTime == Written) {
diff --git a/programs/services/services.c b/programs/services/services.c
index d6f5e6d..a5eb2f7 100644
--- a/programs/services/services.c
+++ b/programs/services/services.c
@@ -149,7 +149,7 @@ static DWORD reg_set_string_value(HKEY hKey, LPCWSTR value_name, LPCWSTR string)
         return ERROR_SUCCESS;
     }
 
-    return RegSetValueExW(hKey, value_name, 0, REG_SZ, (LPBYTE)string, sizeof(WCHAR)*(strlenW(string) + 1));
+    return RegSetValueExW(hKey, value_name, 0, REG_SZ, (const BYTE*)string, sizeof(WCHAR)*(strlenW(string) + 1));
 }
 
 DWORD save_service_config(struct service_entry *entry)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 8748a6a..15dfe14 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -161,7 +161,7 @@ done:
 /* wrapper for RegSetValueExW */
 static DWORD set_reg_value( HKEY hkey, const WCHAR *name, const WCHAR *value )
 {
-    return RegSetValueExW( hkey, name, 0, REG_SZ, (BYTE *)value, (strlenW(value) + 1) * sizeof(WCHAR) );
+    return RegSetValueExW( hkey, name, 0, REG_SZ, (const BYTE *)value, (strlenW(value) + 1) * sizeof(WCHAR) );
 }
 
 /* create the volatile hardware registry keys */
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 232b2cc..cbcc297 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -245,7 +245,7 @@ static void dbg_exception_epilog(void)
 static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance)
 {
     BOOL                is_debug = FALSE;
-    THREADNAME_INFO*    pThreadName;
+    const THREADNAME_INFO*    pThreadName;
     struct dbg_thread*  pThread;
 
     assert(dbg_curr_thread);
@@ -260,7 +260,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
         is_debug = TRUE;
         break;
     case EXCEPTION_NAME_THREAD:
-        pThreadName = (THREADNAME_INFO*)(rec->ExceptionInformation);
+        pThreadName = (const THREADNAME_INFO*)(rec->ExceptionInformation);
         if (pThreadName->dwThreadID == -1)
             pThread = dbg_curr_thread;
         else
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 62165f6..0ab3639 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -922,7 +922,7 @@ static BOOL write_desktop_entry(const char *unix_link, const char *location, con
         HKEY hkey = open_menus_reg_key();
         if (hkey)
         {
-            RegSetValueExA(hkey, location, 0, REG_SZ, (BYTE*) unix_link, lstrlenA(unix_link) + 1);
+            RegSetValueExA(hkey, location, 0, REG_SZ, (const BYTE*) unix_link, lstrlenA(unix_link) + 1);
             RegCloseKey(hkey);
         }
         else
@@ -1061,7 +1061,7 @@ end:
         HKEY hkey = open_menus_reg_key();
         if (hkey)
         {
-            RegSetValueExA(hkey, menuPath, 0, REG_SZ, (BYTE*) unix_link, lstrlenA(unix_link) + 1);
+            RegSetValueExA(hkey, menuPath, 0, REG_SZ, (const BYTE*) unix_link, lstrlenA(unix_link) + 1);
             RegCloseKey(hkey);
         }
     }
@@ -1748,12 +1748,12 @@ static void update_association(LPCWSTR extension, LPCSTR mimeType, LPCWSTR progI
         HKEY subkey;
         if (RegCreateKeyW(assocKey, extension, &subkey) == ERROR_SUCCESS)
         {
-            RegSetValueExA(subkey, "MimeType", 0, REG_SZ, (BYTE*) mimeType, lstrlenA(mimeType) + 1);
-            RegSetValueExW(subkey, ProgIDW, 0, REG_SZ, (BYTE*) progId, (lstrlenW(progId) + 1) * sizeof(WCHAR));
-            RegSetValueExA(subkey, "AppName", 0, REG_SZ, (BYTE*) appName, lstrlenA(appName) + 1);
+            RegSetValueExA(subkey, "MimeType", 0, REG_SZ, (const BYTE*) mimeType, lstrlenA(mimeType) + 1);
+            RegSetValueExW(subkey, ProgIDW, 0, REG_SZ, (const BYTE*) progId, (lstrlenW(progId) + 1) * sizeof(WCHAR));
+            RegSetValueExA(subkey, "AppName", 0, REG_SZ, (const BYTE*) appName, lstrlenA(appName) + 1);
             if (docName)
-                RegSetValueExW(subkey, DocNameW, 0, REG_SZ, (BYTE*) docName, (lstrlenW(docName) + 1) * sizeof(WCHAR));
-            RegSetValueExA(subkey, "DesktopFile", 0, REG_SZ, (BYTE*) desktopFile, (lstrlenA(desktopFile) + 1));
+                RegSetValueExW(subkey, DocNameW, 0, REG_SZ, (const BYTE*) docName, (lstrlenW(docName) + 1) * sizeof(WCHAR));
+            RegSetValueExA(subkey, "DesktopFile", 0, REG_SZ, (const BYTE*) desktopFile, (lstrlenA(desktopFile) + 1));
             RegCloseKey(subkey);
         }
         else
diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c
index 2d685ae..7031c76 100644
--- a/programs/winhlp32/hlpfile.c
+++ b/programs/winhlp32/hlpfile.c
@@ -492,7 +492,7 @@ static int comp_FindSubFile(void *p, const void *key,
                             int leaf, void** next)
 {
     *next = (char *)p+strlen(p)+(leaf?5:3);
-    WINE_TRACE("Comparing '%s' with '%s'\n", (char *)p, (char *)key);
+    WINE_TRACE("Comparing '%s' with '%s'\n", (char *)p, (const char *)key);
     return strcmp(p, key);
 }
 
@@ -1601,7 +1601,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd,
             case 0xEE:
             case 0xEF:
                 {
-                    char*       ptr = (char*) format + 8;
+                    const char*       ptr = (const char*) format + 8;
                     BYTE        type = format[3];
                     int         wnd = -1;
 




More information about the wine-cvs mailing list