[
Thread Prev][
Thread Next] >
Date Index
>
Thread Index
[wmx] [PATCH] fix char vs const char issues in wm2
Bernhard R. Link -
Sun Jan 03 16:34:47 2010
String literals are const char, so everything reachable by those
should be const char, too, or modern compilers may complain.
--- a/Manager.C
+++ b/Manager.C
@@ -312,7 +312,7 @@ void WindowManager::initialiseScreen()
}
-unsigned long WindowManager::allocateColour(char *name, char *desc)
+unsigned long WindowManager::allocateColour(const char *name, const char *desc)
{
XColor nearest, ideal;
diff --git a/Manager.h b/Manager.h
index 0ea2ca5..6db2ac6 100644
--- a/Manager.h
+++ b/Manager.h
@@ -40,7 +40,7 @@ public:
void installCursor(RootCursor);
void installCursorOnWindow(RootCursor, Window);
void installColormap(Colormap);
- unsigned long allocateColour(char *, char *);
+ unsigned long allocateColour(const char *, const char *);
void considerFocusChange(Client *, Window, Time timestamp);
void stopConsideringFocus();
diff --git a/Rotated.C b/Rotated.C
index 09fdfe2..e0f09ff 100644
--- a/Rotated.C
+++ b/Rotated.C
@@ -28,8 +28,8 @@
int xv_errno;
-static char *my_strdup(char *);
-static char *my_strtok(char *, char *);
+static char *my_strdup(const char *);
+static char *my_strtok(char *, const char *);
/* ---------------------------------------------------------------------- */
@@ -37,7 +37,7 @@ static char *my_strtok(char *, char *);
/* *** Routine to mimic `strdup()' (some machines don't have it) *** */
-static char *my_strdup(char *str)
+static char *my_strdup(const char *str)
{
char *s;
@@ -61,7 +61,7 @@ static char *my_strdup(char *str)
/* *** Routine to replace `strtok' : this one returns a zero
length string if it encounters two consecutive delimiters *** */
-static char *my_strtok(char *str1, char *str2)
+static char *my_strtok(char *str1, const char *str2)
{
char *ret;
size_t i, j, stop;
@@ -121,7 +121,7 @@ float XRotVersion(char *str, int n)
/* *** Load the rotated version of a given font *** */
-XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle)
+XRotFontStruct *XRotLoadFont(Display *dpy, const char *fontname, float angle)
{
char val;
XImage *I1, *I2;
@@ -470,7 +470,8 @@ void XRotDrawAlignedString(Display *dpy, XRotFontStruct *rotfont,
int xp = 0, yp = 0, dir;
size_t i;
int nl = 1, max_width = 0, this_width;
- char *str1, *str2 = "\n\0", *str3;
+ char *str1, *str3;
+ const char *str2 = "\n\0";
if (text == NULL)
return;
diff --git a/Rotated.h b/Rotated.h
index a3be0a8..539b45a 100644
--- a/Rotated.h
+++ b/Rotated.h
@@ -58,7 +58,7 @@ struct XRotFontStruct {
extern float XRotVersion(char *, int);
-extern XRotFontStruct *XRotLoadFont(Display *, char *, float);
+extern XRotFontStruct *XRotLoadFont(Display *, const char *, float);
extern void XRotUnloadFont(Display *, XRotFontStruct *);
extern int XRotTextWidth(XRotFontStruct *, char *, int);
extern void XRotDrawString(Display *, XRotFontStruct *, Drawable, GC,
Next: