Fixes for -Wmissing-declarations and -Wwrite-strings warnings.
diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c
index 4bd9bfb..6fc92f4 100644
--- a/programs/winecfg/appdefaults.c
+++ b/programs/winecfg/appdefaults.c
@@ -69,7 +69,7 @@
HeapFree(GetProcessHeap(), 0, winver);
}
-void
+static void
init_comboboxes (HWND dialog)
{
int i;
@@ -97,14 +97,14 @@
}
}
-static void add_listview_item(HWND listview, char *text, void *association)
+static void add_listview_item(HWND listview, const char *text, void *association)
{
LVITEM item;
ZeroMemory(&item, sizeof(LVITEM));
item.mask = LVIF_TEXT | LVIF_PARAM;
- item.pszText = text;
+ item.pszText = (char*) text;
item.cchTextMax = strlen(text);
item.lParam = (LPARAM) association;
item.iItem = ListView_GetItemCount(listview);
diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c
index 7d9a9b7..8111b06 100644
--- a/programs/winecfg/audio.c
+++ b/programs/winecfg/audio.c
@@ -44,7 +44,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
/* Select the correct entry in the combobox based on drivername */
-void selectAudioDriver(HWND hDlg, char *drivername)
+static void selectAudioDriver(HWND hDlg, const char *drivername)
{
int i;
const AUDIO_DRIVER *pAudioDrv = NULL;
@@ -64,7 +64,7 @@
}
}
-void initAudioDlg (HWND hDlg)
+static void initAudioDlg (HWND hDlg)
{
char *curAudioDriver = get("Winmm", "Drivers", "winealsa.drv");
const AUDIO_DRIVER *pAudioDrv = NULL;
@@ -82,14 +82,14 @@
}
}
-char *audioAutoDetect(void)
+static const char *audioAutoDetect(void)
{
struct stat buf;
const char *argv_new[4];
int fd;
- char *driversFound[10];
- char *name[10];
+ const char *driversFound[10];
+ const char *name[10];
int numFound = 0;
argv_new[0] = "/bin/sh";
diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c
index 32979d4..d24863f 100644
--- a/programs/winecfg/drive.c
+++ b/programs/winecfg/drive.c
@@ -83,7 +83,7 @@
return result;
}
-BOOL add_drive(char letter, char *targetpath, char *label, char *serial, unsigned int type)
+BOOL add_drive(const char letter, const char *targetpath, const char *label, const char *serial, unsigned int type)
{
int driveIndex = letter_to_index(letter);
@@ -396,7 +396,7 @@
HANDLE hFile;
HKEY hKey;
- char *typeText;
+ const char *typeText;
char driveValue[256];
/* define this drive */
diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c
index 0058c07..b9987a0 100644
--- a/programs/winecfg/drivedetect.c
+++ b/programs/winecfg/drivedetect.c
@@ -50,7 +50,7 @@
{"",0}
};
-static char *ignored_fstypes[] = {
+static const char *ignored_fstypes[] = {
"devpts",
"tmpfs",
"proc",
@@ -61,7 +61,7 @@
NULL
};
-static char *ignored_mnt_dirs[] = {
+static const char *ignored_mnt_dirs[] = {
"/boot",
NULL
};
@@ -82,7 +82,7 @@
static BOOL should_ignore_fstype(char *type)
{
- char **s;
+ const char **s;
for (s = ignored_fstypes; *s; s++)
if (!strcmp(*s, type)) return TRUE;
@@ -92,7 +92,7 @@
static BOOL should_ignore_mnt_dir(char *dir)
{
- char **s;
+ const char **s;
for (s = ignored_mnt_dirs; *s; s++)
if (!strcmp(*s, dir)) return TRUE;
diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c
index c820ef6..c4313a4 100644
--- a/programs/winecfg/driveui.c
+++ b/programs/winecfg/driveui.c
@@ -143,14 +143,15 @@
#define DRIVE_TYPE_DEFAULT 1
-void fill_drive_droplist(long mask, char curletter, HWND dialog)
+static void fill_drive_droplist(long mask, char curletter, HWND dialog)
{
int i;
int selection;
int count;
int next_letter;
- char sName[4] = "A:";
+ char sName[4];
+ strcpy(sName, "A:");
for (i = 0, count = 0, selection = -1, next_letter = -1; i <= 'Z'-'A'; ++i)
{
if (mask & DRIVE_MASK_BIT('A' + i))
@@ -184,7 +185,7 @@
}
-void enable_labelserial_box(HWND dialog, int mode)
+static void enable_labelserial_box(HWND dialog, int mode)
{
WINE_TRACE("mode=%d\n", mode);
@@ -232,7 +233,7 @@
}
}
-int fill_drives_list(HWND dialog)
+static int fill_drives_list(HWND dialog)
{
int count = 0;
BOOL drivec_present = FALSE;
@@ -306,7 +307,7 @@
return count;
}
-void on_options_click(HWND dialog)
+static void on_options_click(HWND dialog)
{
if (IsDlgButtonChecked(dialog, IDC_SHOW_DIRSYM_LINK) == BST_CHECKED)
set("wine", "ShowDirSymLinks", "Y");
@@ -319,7 +320,7 @@
set("wine", "ShowDotFiles", "N");
}
-void on_add_click(HWND dialog)
+static void on_add_click(HWND dialog)
{
/* we should allocate a drive letter automatically. We also need
some way to let the user choose the mapping point, for now we
@@ -363,7 +364,7 @@
update_controls(dialog);
}
-void on_remove_click(HWND dialog)
+static void on_remove_click(HWND dialog)
{
int itemIndex;
struct drive *drive;
@@ -408,7 +409,7 @@
unsigned int type;
char *label;
char *serial;
- char *device;
+ const char *device;
int i, selection = -1;
LVITEM item;
@@ -501,7 +502,7 @@
return;
}
-void on_edit_changed(HWND dialog, WORD id)
+static void on_edit_changed(HWND dialog, WORD id)
{
if (updating_ui) return;
@@ -668,14 +669,14 @@
width = (viewRect.right - viewRect.left) / 6 - 5;
listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
- listColumn.pszText = "Letter";
+ listColumn.pszText = (char*) "Letter";
listColumn.cchTextMax = lstrlen(listColumn.pszText);
listColumn.cx = width;
SendDlgItemMessage(dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMN, 0, (LPARAM) &listColumn);
listColumn.cx = viewRect.right - viewRect.left - width;
- listColumn.pszText = "Drive Mapping";
+ listColumn.pszText = (char*) "Drive Mapping";
listColumn.cchTextMax = lstrlen(listColumn.pszText);
SendDlgItemMessage(dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMN, 1, (LPARAM) &listColumn);
diff --git a/programs/winecfg/libraries.c b/programs/winecfg/libraries.c
index ffeb644..34a7e21 100644
--- a/programs/winecfg/libraries.c
+++ b/programs/winecfg/libraries.c
@@ -77,7 +77,7 @@
}
/* Convert a dllmode to a registry string. */
-static char* mode_to_string(enum dllmode mode)
+static const char* mode_to_string(enum dllmode mode)
{
switch( mode )
{
@@ -91,7 +91,7 @@
}
/* Convert a dllmode to a pretty string for display. TODO: use translations. */
-static char* mode_to_label(enum dllmode mode)
+static const char* mode_to_label(enum dllmode mode)
{
WINE_FIXME("translate me");
return mode_to_string(mode);
@@ -197,7 +197,8 @@
for (p = overrides; *p != NULL; p++)
{
int index;
- char *str, *value, *label;
+ char *str, *value;
+ const char *label;
struct dll *dll;
value = get(keypath("DllOverrides"), *p, NULL);
@@ -259,7 +260,7 @@
enum dllmode mode;
struct dll *dll;
int sel;
- char *str;
+ const char *str;
mode = id_to_mode(id);
diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
index e981bb2..d7462c7 100644
--- a/programs/winecfg/main.c
+++ b/programs/winecfg/main.c
@@ -46,7 +46,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
-void CALLBACK
+static void CALLBACK
PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
{
switch (uMsg)
@@ -65,7 +65,7 @@
}
}
-INT_PTR CALLBACK
+static INT_PTR CALLBACK
AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
@@ -88,7 +88,7 @@
#define NUM_PROPERTY_PAGES 6
-INT_PTR
+static INT_PTR
doPropertySheet (HINSTANCE hInstance, HWND hOwner)
{
PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
@@ -202,7 +202,7 @@
* no option at all. Has to be reworked, if more options are to
* be supported.
*/
-BOOL
+static BOOL
ProcessCmdLine(LPSTR lpCmdLine)
{
if ((lpCmdLine[0] == '/' || lpCmdLine[0] == '-') &&
diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
index a809e25..be1f5fa 100644
--- a/programs/winecfg/winecfg.c
+++ b/programs/winecfg/winecfg.c
@@ -55,7 +55,7 @@
/* update the window title */
if (current_app)
{
- char *template = "Wine Configuration for %s";
+ const char *template = "Wine Configuration for %s";
newtitle = HeapAlloc(GetProcessHeap(), 0, strlen(template) + strlen(current_app) + 1);
sprintf(newtitle, template, current_app);
}
@@ -81,7 +81,7 @@
* not. Caller is responsible for releasing the result.
*
*/
-static char *get_config_key (char *subkey, char *name, char *def)
+static char *get_config_key (const char *subkey, const char *name, const char *def)
{
LPBYTE buffer = NULL;
DWORD len;
@@ -139,7 +139,7 @@
*
* If valueName or value is NULL, an empty section will be created
*/
-int set_config_key(const char *subkey, const char *name, const char *value) {
+static int set_config_key(const char *subkey, const char *name, const char *value) {
DWORD res = 1;
HKEY key = NULL;
@@ -236,7 +236,7 @@
* If already in the list, the contents as given there will be
* returned. You are expected to HeapFree the result.
*/
-char *get(char *path, char *name, char *def)
+char *get(const char *path, const char *name, const char *def)
{
struct list *cursor;
struct setting *s;
@@ -277,7 +277,7 @@
*
* These values will be copied when necessary.
*/
-void set(char *path, char *name, char *value)
+void set(const char *path, const char *name, const char *value)
{
struct list *cursor;
struct setting *s;
@@ -440,7 +440,7 @@
* returns true if the given key/value pair exists in the registry or
* has been written to.
*/
-BOOL exists(char *path, char *name)
+BOOL exists(const char *path, const char *name)
{
char *val = get(path, name, NULL);
@@ -487,7 +487,7 @@
char *current_app = NULL; /* the app we are currently editing, or NULL if editing global */
/* returns a registry key path suitable for passing to addTransaction */
-char *keypath(char *section)
+char *keypath(const char *section)
{
static char *result = NULL;
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
index b2ba0a9..009b2cb 100644
--- a/programs/winecfg/winecfg.h
+++ b/programs/winecfg/winecfg.h
@@ -48,9 +48,9 @@
be copied, so release them too when necessary.
*/
-void set(char *path, char *name, char *value);
-char *get(char *path, char *name, char *def);
-BOOL exists(char *path, char *name);
+void set(const char *path, const char *name, const char *value);
+char *get(const char *path, const char *name, const char *def);
+BOOL exists(const char *path, const char *name);
void apply(void);
char **enumerate_values(char *path);
@@ -59,7 +59,7 @@
no explicit free is needed of the string returned by this function
*/
-char *keypath(char *section);
+char *keypath(const char *section);
int initialize(void);
extern HKEY config_key;
@@ -93,7 +93,7 @@
#define DRIVE_MASK_BIT(B) 1 << (toupper(B) - 'A')
long drive_available_mask(char letter);
-BOOL add_drive(char letter, char *targetpath, char *label, char *serial, unsigned int type);
+BOOL add_drive(const char letter, const char *targetpath, const char *label, const char *serial, unsigned int type);
void delete_drive(struct drive *pDrive);
void apply_drive_changes();
extern struct drive drives[26]; /* one for each drive letter */
@@ -106,7 +106,7 @@
void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
/* returns a string in the win32 heap */
-static inline char *strdupA(char *s)
+static inline char *strdupA(const char *s)
{
char *r = HeapAlloc(GetProcessHeap(), 0, strlen(s)+1);
return strcpy(r, s);
@@ -121,7 +121,7 @@
return result;
}
-static inline void set_text(HWND dialog, WORD id, char *text)
+static inline void set_text(HWND dialog, WORD id, const char *text)
{
SetWindowText(GetDlgItem(dialog, id), text);
}
diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c
index 9756968..94da10d 100644
--- a/programs/winecfg/x11drvdlg.c
+++ b/programs/winecfg/x11drvdlg.c
@@ -38,7 +38,7 @@
int updating_ui;
-void update_gui_for_desktop_mode(HWND dialog) {
+static void update_gui_for_desktop_mode(HWND dialog) {
WINE_TRACE("\n");
updating_ui = TRUE;
@@ -161,7 +161,7 @@
HeapFree(GetProcessHeap(), 0, new);
}
-void on_enable_desktop_clicked(HWND dialog) {
+static void on_enable_desktop_clicked(HWND dialog) {
WINE_TRACE("\n");
if (IsDlgButtonChecked(dialog, IDC_ENABLE_DESKTOP) == BST_CHECKED) {
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 0d657ed..15e120b 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -611,9 +611,9 @@
return narg;
}
-static int fork_and_wait( char *linker, char *link_name, char *path,
- int desktop, char *args, char *icon_name,
- char *workdir, char *description )
+static int fork_and_wait( const char *linker, const char *link_name, const char *path,
+ int desktop, const char *args, const char *icon_name,
+ const char *workdir, const char *description )
{
int pos = 0;
const char *argv[20];
diff --git a/programs/winemine/main.c b/programs/winemine/main.c
index 59ae2d5..b076ff2 100644
--- a/programs/winemine/main.c
+++ b/programs/winemine/main.c
@@ -447,7 +447,7 @@
}
}
-void ShiftBetween(LONG* x, LONG* y, LONG a, LONG b)
+static void ShiftBetween(LONG* x, LONG* y, LONG a, LONG b)
{
if (*x < a) {
*y += a - *x;
@@ -458,7 +458,8 @@
*y = b;
}
}
-void MoveOnScreen(RECT* rect)
+
+static void MoveOnScreen(RECT* rect)
{
HMONITOR hMonitor;
MONITORINFO mi;
diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c
index 97e365d..d766a62 100644
--- a/programs/winetest/gui.c
+++ b/programs/winetest/gui.c
@@ -26,34 +26,24 @@
/* Event object to signal successful window creation to main thread.
*/
-HANDLE initEvent;
+static HANDLE initEvent;
/* Dialog handle
*/
-HWND dialog;
+static HWND dialog;
/* Progress data for the text* functions and for scaling.
*/
-unsigned int progressMax, progressCurr;
-double progressScale;
+static unsigned int progressMax, progressCurr;
+static double progressScale;
/* Progress group counter for the gui* functions.
*/
-int progressGroup;
+static int progressGroup;
-WNDPROC DefEditProc;
+static WNDPROC DefEditProc;
-char *
-renderString (va_list ap)
-{
- const char *fmt = va_arg (ap, char*);
- static char buffer[128];
-
- vsnprintf (buffer, sizeof buffer, fmt, ap);
- return buffer;
-}
-
-int
+static int
MBdefault (int uType)
{
static const int matrix[][4] = {{IDOK, 0, 0, 0},
@@ -69,7 +59,7 @@
}
/* report (R_STATUS, fmt, ...) */
-int
+static int
textStatus (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -80,7 +70,7 @@
return 0;
}
-int
+static int
guiStatus (va_list ap)
{
size_t len;
@@ -93,7 +83,7 @@
}
/* report (R_PROGRESS, barnum, steps) */
-int
+static int
textProgress (va_list ap)
{
progressGroup = va_arg (ap, int);
@@ -102,7 +92,7 @@
return 0;
}
-int
+static int
guiProgress (va_list ap)
{
unsigned int max;
@@ -123,7 +113,7 @@
}
/* report (R_STEP, fmt, ...) */
-int
+static int
textStep (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -135,7 +125,7 @@
return 0;
}
-int
+static int
guiStep (va_list ap)
{
const int pgID = IDC_ST0 + progressGroup * 2;
@@ -150,7 +140,7 @@
}
/* report (R_DELTA, inc, fmt, ...) */
-int
+static int
textDelta (va_list ap)
{
const int inc = va_arg (ap, int);
@@ -163,7 +153,7 @@
return 0;
}
-int
+static int
guiDelta (va_list ap)
{
const int inc = va_arg (ap, int);
@@ -179,7 +169,7 @@
}
/* report (R_TAG) */
-int
+static int
textTag (va_list ap)
{
fputs ("Tag: ", stderr);
@@ -188,7 +178,7 @@
return 0;
}
-int
+static int
guiTag (va_list ap)
{
SetDlgItemText (dialog, IDC_TAG, tag);
@@ -196,7 +186,7 @@
}
/* report (R_DIR, fmt, ...) */
-int
+static int
textDir (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -208,7 +198,7 @@
return 0;
}
-int
+static int
guiDir (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -219,7 +209,7 @@
}
/* report (R_OUT, fmt, ...) */
-int
+static int
textOut (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -231,7 +221,7 @@
return 0;
}
-int
+static int
guiOut (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -242,7 +232,7 @@
}
/* report (R_WARNING, fmt, ...) */
-int
+static int
textWarning (va_list ap)
{
fputs ("Warning: ", stderr);
@@ -250,7 +240,7 @@
return 0;
}
-int
+static int
guiWarning (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -261,7 +251,7 @@
}
/* report (R_ERROR, fmt, ...) */
-int
+static int
textError (va_list ap)
{
fputs ("Error: ", stderr);
@@ -269,7 +259,7 @@
return 0;
}
-int
+static int
guiError (va_list ap)
{
char *str = vstrmake (NULL, ap);
@@ -280,14 +270,14 @@
}
/* report (R_FATAL, fmt, ...) */
-int
+static int
textFatal (va_list ap)
{
textError (ap);
exit (1);
}
-int
+static int
guiFatal (va_list ap)
{
guiError (ap);
@@ -295,7 +285,7 @@
}
/* report (R_ASK, type, fmt, ...) */
-int
+static int
textAsk (va_list ap)
{
int uType = va_arg (ap, int);
@@ -308,7 +298,7 @@
return ret;
}
-int
+static int
guiAsk (va_list ap)
{
int uType = va_arg (ap, int);
@@ -320,7 +310,7 @@
return ret;
}
-BOOL CALLBACK
+static BOOL CALLBACK
EditTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -333,7 +323,7 @@
return CallWindowProcA (DefEditProc, hwnd, msg, wParam, lParam);
}
-BOOL CALLBACK
+static BOOL CALLBACK
AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int len;
@@ -368,25 +358,25 @@
}
/* Quiet functions */
-int
+static int
qNoOp (va_list ap)
{
return 0;
}
-int
+static int
qFatal (va_list ap)
{
exit (1);
}
-int
+static int
qAsk (va_list ap)
{
return MBdefault (va_arg (ap, int));
}
-BOOL CALLBACK
+static BOOL CALLBACK
AboutProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -400,7 +390,7 @@
return FALSE;
}
-BOOL CALLBACK
+static BOOL CALLBACK
DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -435,8 +425,8 @@
return FALSE;
}
-DWORD WINAPI
-DlgThreadProc ()
+static DWORD WINAPI
+DlgThreadProc (LPVOID param)
{
int ret;
diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index 71efad4..e34a4dc 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -33,10 +33,10 @@
/* Macro table */
/**************************************************/
struct MacroDesc {
- char* name;
- char* alias;
+ const char* name;
+ const char* alias;
BOOL isBool;
- char* arguments;
+ const char* arguments;
FARPROC fn;
};