From: Dana Jansens Date: Sun, 18 Mar 2007 15:07:30 +0000 (+0000) Subject: use const char*'s when we should be X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=3678f8df8a3d2f5fb20d07d9124c3f0b8618ca5d;p=chaz%2Fopenbox use const char*'s when we should be --- diff --git a/openbox/client_menu.c b/openbox/client_menu.c index e9922bdd..7f188456 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -136,7 +136,7 @@ static void send_to_update(ObMenuFrame *frame, gpointer data) return; for (i = 0; i <= screen_num_desktops; ++i) { - gchar *name; + const gchar *name; guint desk; if (i >= screen_num_desktops) { diff --git a/openbox/debug.c b/openbox/debug.c index 4152c15e..102c8891 100644 --- a/openbox/debug.c +++ b/openbox/debug.c @@ -28,7 +28,7 @@ void ob_debug_show_output(gboolean enable) show = enable; } -void ob_debug(gchar *a, ...) +void ob_debug(const gchar *a, ...) { va_list vl; diff --git a/openbox/debug.h b/openbox/debug.h index f7988c28..fea52c06 100644 --- a/openbox/debug.h +++ b/openbox/debug.h @@ -23,6 +23,6 @@ void ob_debug_show_output(gboolean enable); -void ob_debug(gchar *a, ...); +void ob_debug(const gchar *a, ...); #endif diff --git a/openbox/menu.c b/openbox/menu.c index 868293c6..462b92fe 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -243,7 +243,7 @@ parse_menu_fail: g_free(script); } -ObMenu* menu_new(gchar *name, gchar *title, gpointer data) +ObMenu* menu_new(const gchar *name, const gchar *title, gpointer data) { ObMenu *self; @@ -405,7 +405,7 @@ void menu_entry_remove(ObMenuEntry *self) menu_entry_free(self); } -ObMenuEntry* menu_add_normal(ObMenu *self, gint id, gchar *label, +ObMenuEntry* menu_add_normal(ObMenu *self, gint id, const gchar *label, GSList *actions) { ObMenuEntry *e; @@ -418,7 +418,7 @@ ObMenuEntry* menu_add_normal(ObMenu *self, gint id, gchar *label, return e; } -ObMenuEntry* menu_add_submenu(ObMenu *self, gint id, gchar *submenu) +ObMenuEntry* menu_add_submenu(ObMenu *self, gint id, const gchar *submenu) { ObMenuEntry *e; diff --git a/openbox/menu.h b/openbox/menu.h index 829c751a..f9daef10 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -120,7 +120,7 @@ struct _ObMenuEntry void menu_startup(gboolean reconfig); void menu_shutdown(gboolean reconfig); -ObMenu* menu_new(gchar *name, gchar *title, gpointer data); +ObMenu* menu_new(const gchar *name, const gchar *title, gpointer data); void menu_free(ObMenu *menu); /* Repopulate a pipe-menu by running its command */ @@ -133,9 +133,9 @@ void menu_set_execute_func(ObMenu *menu, ObMenuExecuteFunc func); void menu_set_destroy_func(ObMenu *menu, ObMenuDestroyFunc func); /* functions for building menus */ -ObMenuEntry* menu_add_normal(ObMenu *menu, gint id, gchar *label, +ObMenuEntry* menu_add_normal(ObMenu *menu, gint id, const gchar *label, GSList *actions); -ObMenuEntry* menu_add_submenu(ObMenu *menu, gint id, gchar *submenu); +ObMenuEntry* menu_add_submenu(ObMenu *menu, gint id, const gchar *submenu); ObMenuEntry* menu_add_separator(ObMenu *menu, gint id); void menu_clear_entries(ObMenu *menu); diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 6a860c8e..d078f52a 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -73,7 +73,7 @@ void moveresize_shutdown(gboolean reconfig) popup = NULL; } -static void popup_coords(ObClient *c, gchar *format, gint a, gint b) +static void popup_coords(ObClient *c, const gchar *format, gint a, gint b) { gchar *text; diff --git a/openbox/openbox.c b/openbox/openbox.c index c355747f..4a15edd6 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -440,7 +440,7 @@ static void parse_args(gint argc, gchar **argv) } } -void ob_exit_with_error(gchar *msg) +void ob_exit_with_error(const gchar *msg) { g_critical(msg); session_shutdown(TRUE); diff --git a/openbox/openbox.h b/openbox/openbox.h index 4d410201..4c018666 100644 --- a/openbox/openbox.h +++ b/openbox/openbox.h @@ -54,7 +54,7 @@ void ob_exit_replace(); void ob_reconfigure(); -void ob_exit_with_error(gchar *msg); +void ob_exit_with_error(const gchar *msg); Cursor ob_cursor(ObCursor cursor); diff --git a/openbox/prop.c b/openbox/prop.c index 91dca5cb..3b73b8f2 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -401,7 +401,7 @@ void prop_set_array32(Window win, Atom prop, Atom type, gulong *val, (guchar*)val, num); } -void prop_set_string_utf8(Window win, Atom prop, gchar *val) +void prop_set_string_utf8(Window win, Atom prop, const gchar *val) { XChangeProperty(ob_display, win, prop, prop_atoms.utf8, 8, PropModeReplace, (guchar*)val, strlen(val)); diff --git a/openbox/prop.h b/openbox/prop.h index 08aa83bb..18193663 100644 --- a/openbox/prop.h +++ b/openbox/prop.h @@ -186,7 +186,7 @@ gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret); void prop_set32(Window win, Atom prop, Atom type, gulong val); void prop_set_array32(Window win, Atom prop, Atom type, gulong *val, guint num); -void prop_set_string_utf8(Window win, Atom prop, gchar *val); +void prop_set_string_utf8(Window win, Atom prop, const gchar *val); void prop_set_strings_utf8(Window win, Atom prop, gchar **strs); void prop_erase(Window win, Atom prop); diff --git a/render/font.c b/render/font.c index c3353b67..e91925b5 100644 --- a/render/font.c +++ b/render/font.c @@ -52,7 +52,7 @@ static void measure_font(const RrInstance *inst, RrFont *f) g_free(locale); } -RrFont *RrFontOpen(const RrInstance *inst, gchar *name, gint size, +RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size, RrFontWeight weight, RrFontSlant slant) { RrFont *out; diff --git a/render/render.h b/render/render.h index 979bc933..7beef9c9 100644 --- a/render/render.h +++ b/render/render.h @@ -121,7 +121,7 @@ struct _RrTextureText { RrFont *font; RrJustify justify; RrColor *color; - gchar *string; + const gchar *string; gint shadow_offset_x; gint shadow_offset_y; RrColor *shadow_color; @@ -229,7 +229,7 @@ RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex); RrAppearance *RrAppearanceCopy (RrAppearance *a); void RrAppearanceFree (RrAppearance *a); -RrFont *RrFontOpen (const RrInstance *inst, gchar *name, gint size, +RrFont *RrFontOpen (const RrInstance *inst, const gchar *name, gint size, RrFontWeight weight, RrFontSlant slant); RrFont *RrFontOpenDefault (const RrInstance *inst); void RrFontClose (RrFont *f); diff --git a/render/theme.c b/render/theme.c index 4c38dbd2..507ec70f 100644 --- a/render/theme.c +++ b/render/theme.c @@ -40,27 +40,27 @@ static void parse_style(gchar *tex, RrSurfaceColorType *grad, RrReliefType *relief, RrBevelType *bevel, gboolean *interlaced, gboolean *border, gboolean allow_trans); -static gboolean read_mask(ParseState *ps, gchar *maskname, +static gboolean read_mask(ParseState *ps, const gchar *maskname, RrPixmapMask **value); static RrPixel32* read_c_image(gint width, gint height, const guint8 *data); static void set_default_appearance(RrAppearance *a); -static xmlNodePtr find_node(xmlNodePtr n, gchar *names[]); -static gboolean find_int(ParseState *ps, xmlNodePtr n, gchar *names[], +static xmlNodePtr find_node(xmlNodePtr n, const gchar *names[]); +static gboolean find_int(ParseState *ps, xmlNodePtr n, const gchar *names[], gint *integer, gint lower, gint upper); -static gboolean find_string(ParseState *ps, xmlNodePtr n, gchar *names[], - gchar **string); -static gboolean find_color(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_string(ParseState *ps, xmlNodePtr n, const gchar *names[], + const gchar **string); +static gboolean find_color(ParseState *ps, xmlNodePtr n, const gchar *names[], RrColor **color, gchar *alpha); - static gboolean find_point(ParseState *ps, xmlNodePtr n, gchar *names[], + static gboolean find_point(ParseState *ps, xmlNodePtr n, const gchar *names[], gint *x, gint *y, gint lowx, gint lowy, gint upx, gint upy); -static gboolean find_shadow(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_shadow(ParseState *ps, xmlNodePtr n, const gchar *names[], RrAppearance *a); -static gboolean find_appearance(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_appearance(ParseState *ps, xmlNodePtr n, const gchar *names[], RrAppearance *a, gboolean allow_trans); /* make a null terminated array out of a list of strings */ -#define L(args...) (gchar*[]){args,NULL} +#define L(args...) (const gchar*[]){args,NULL} /* shortcut to the various find_* functions */ #define FIND(type, args...) find_##type(&ps, root, args) @@ -71,7 +71,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name, ParseState ps; xmlNodePtr root; RrJustify winjust, mtitlejust; - gchar *str; + const gchar *str; RrTheme *theme; if (name) { @@ -1131,7 +1131,7 @@ void RrThemeFree(RrTheme *theme) } } -static gboolean read_mask(ParseState *ps, gchar *maskname, +static gboolean read_mask(ParseState *ps, const gchar *maskname, RrPixmapMask **value) { gboolean ret = FALSE; @@ -1245,7 +1245,7 @@ static void parse_style(gchar *tex, RrSurfaceColorType *grad, } } -static xmlNodePtr find_node(xmlNodePtr n, gchar *names[]) +static xmlNodePtr find_node(xmlNodePtr n, const gchar *names[]) { gint i; @@ -1254,7 +1254,7 @@ static xmlNodePtr find_node(xmlNodePtr n, gchar *names[]) return n; } -static gboolean find_int(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_int(ParseState *ps, xmlNodePtr n, const gchar *names[], gint *integer, gint lower, gint upper) { gint i; @@ -1269,8 +1269,8 @@ static gboolean find_int(ParseState *ps, xmlNodePtr n, gchar *names[], return FALSE; } -static gboolean find_string(ParseState *ps, xmlNodePtr n, gchar *names[], - gchar **string) +static gboolean find_string(ParseState *ps, xmlNodePtr n, const gchar *names[], + const gchar **string) { if ((n = find_node(n, names))) { *string = parse_string(ps->doc, n); @@ -1279,7 +1279,7 @@ static gboolean find_string(ParseState *ps, xmlNodePtr n, gchar *names[], return FALSE; } -static gboolean find_color(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_color(ParseState *ps, xmlNodePtr n, const gchar *names[], RrColor **color, gchar *alpha) { if ((n = find_node(n, names))) { @@ -1299,7 +1299,7 @@ static gboolean find_color(ParseState *ps, xmlNodePtr n, gchar *names[], return FALSE; } -static gboolean find_point(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_point(ParseState *ps, xmlNodePtr n, const gchar *names[], gint *x, gint *y, gint lowx, gint upx, gint lowy, gint upy) { @@ -1316,7 +1316,7 @@ static gboolean find_point(ParseState *ps, xmlNodePtr n, gchar *names[], return FALSE; } -static gboolean find_shadow(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_shadow(ParseState *ps, xmlNodePtr n, const gchar *names[], RrAppearance *a) { return find_point(ps, n, names, @@ -1325,7 +1325,7 @@ static gboolean find_shadow(ParseState *ps, xmlNodePtr n, gchar *names[], -20, 20, -20, 20); } -static gboolean find_appearance(ParseState *ps, xmlNodePtr n, gchar *names[], +static gboolean find_appearance(ParseState *ps, xmlNodePtr n, const gchar *names[], RrAppearance *a, gboolean allow_trans) { xmlNodePtr n2;