[janitor] programs/winecfg -Wwrite-strings cleanup

Daniel Marmier d.marmier at bluewin.ch
Wed Oct 8 15:02:41 CDT 2003


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

-------------- next part --------------
Index: programs/winecfg/drive.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/drive.c,v
retrieving revision 1.7
diff -u -r1.7 drive.c
--- programs/winecfg/drive.c	30 Sep 2003 00:27:55 -0000	1.7
+++ programs/winecfg/drive.c	8 Oct 2003 19:48:59 -0000
@@ -47,7 +47,7 @@
 
 
 /* returns NULL on failure. caller is responsible for freeing result */
-char *getDriveValue(char letter, char *valueName) {
+char *getDriveValue(char letter, const char *valueName) {
   HKEY hkDrive = 0;
   char *subKeyName;
   char *result = NULL;
@@ -76,7 +76,7 @@
 }
 
 /* call with newValue == NULL to remove a value */
-void setDriveValue(char letter, char *valueName, char *newValue) {
+void setDriveValue(char letter, const char *valueName, const char *newValue) {
   char *driveSection = malloc(strlen("Drive X")+1);
   sprintf(driveSection, "Drive %c", letter);
   if (newValue)
@@ -226,8 +226,8 @@
 #define DRIVE_MASK_BIT(B) 1<<(toupper(B)-'A')
 
 typedef struct {
-  char *sCode;
-  char *sDesc;
+  const char *sCode;
+  const char *sDesc;
 } code_desc_pair;
 
 static code_desc_pair type_pairs[] = {
Index: programs/winecfg/winecfg.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/winecfg.c,v
retrieving revision 1.15
diff -u -r1.15 winecfg.c
--- programs/winecfg/winecfg.c	30 Sep 2003 00:27:55 -0000	1.15
+++ programs/winecfg/winecfg.c	8 Oct 2003 19:49:01 -0000
@@ -68,14 +68,14 @@
 /*****************************************************************************
  * getConfigValue: Retrieves a configuration value from the registry
  *
- * char *subKey : the name of the config section
- * char *valueName : the name of the config value
- * char *defaultResult : if the key isn't found, return this value instead
+ * const char *subKey : the name of the config section
+ * const char *valueName : the name of the config value
+ * const char *defaultResult : if the key isn't found, return this value instead
  *
  * Returns a buffer holding the value if successful, NULL if not. Caller is responsible for freeing the result.
  *
  */
-char *getConfigValue (char *subkey, char *valueName, char *defaultResult)
+char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult)
 {
     char *buffer = NULL;
     DWORD dataLength;
@@ -129,14 +129,14 @@
  * setConfigValue : Sets a configuration key in the registry. Section will be created if it doesn't already exist
  *
  * HKEY  hCurrent : the registry key that the configuration is rooted at
- * char *subKey : the name of the config section
- * char *valueName : the name of the config value
- * char *value : the value to set the configuration key to
+ * const char *subKey : the name of the config section
+ * const char *valueName : the name of the config value
+ * const char *value : the value to set the configuration key to
  *
  * Returns 0 on success, non-zero otherwise
  *
  */
-int setConfigValue (char *subkey, char *valueName, const char *value) {
+int setConfigValue (const char *subkey, const char *valueName, const char *value) {
     DWORD res = 1;
     HKEY key = NULL;
 
@@ -160,7 +160,7 @@
 }
 
 /* returns 0 on success, an HRESULT from the registry funtions otherwise */
-HRESULT doesConfigValueExist(char *subkey, char *valueName) {
+HRESULT doesConfigValueExist(const char *subkey, const char *valueName) {
     HRESULT hr;
     HKEY key;
 
@@ -184,7 +184,7 @@
 }
 
 /* removes the requested value from the registry, however, does not remove the section if empty. Returns S_OK (0) on success. */
-HRESULT removeConfigValue(char *subkey, char *valueName) {
+HRESULT removeConfigValue(const char *subkey, const char *valueName) {
     HRESULT hr;
     HKEY key;
     WINE_TRACE("subkey=%s, valueName=%s\n", subkey, valueName);
@@ -231,7 +231,7 @@
     free(trans);
 }
 
-void addTransaction(char *section, char *key, enum transaction_action action, char *newValue) {
+void addTransaction(const char *section, const char *key, enum transaction_action action, const char *newValue) {
     struct transaction *trans = calloc(sizeof(struct transaction),1);
     
     assert( section != NULL );
Index: programs/winecfg/winecfg.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/winecfg.h,v
retrieving revision 1.10
diff -u -r1.10 winecfg.h
--- programs/winecfg/winecfg.h	30 Sep 2003 00:27:55 -0000	1.10
+++ programs/winecfg/winecfg.h	8 Oct 2003 19:49:01 -0000
@@ -82,7 +82,7 @@
  *   ACTION_SET -> this transaction will change a registry key, newValue is the replacement value
  *   ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored.
  */
-void addTransaction(char *section, char *key, enum transaction_action action, char *newValue);
+void addTransaction(const char *section, const char *key, enum transaction_action action, const char *newValue);
 
 /* frees the transaction structure, all fields, and removes it from the queue if in it */
 void destroyTransaction(struct transaction *trans);
@@ -91,10 +91,10 @@
 int initialize(void);
 extern HKEY configKey;
 
-int setConfigValue (char *subkey, char *valueName, const char *value);
-char *getConfigValue (char *subkey, char *valueName, char *defaultResult);
-HRESULT doesConfigValueExist (char *subkey, char *valueName);
-HRESULT removeConfigValue (char *subkey, char *valueName);
+int setConfigValue (const char *subkey, const char *valueName, const char *value);
+char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult);
+HRESULT doesConfigValueExist (const char *subkey, const char *valueName);
+HRESULT removeConfigValue (const char *subkey, const char *valueName);
 
 /* X11DRV */
 


More information about the wine-patches mailing list