diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cursor.c | 4 | ||||
-rw-r--r-- | src/events.c | 2 | ||||
-rw-r--r-- | src/gram.y | 6 | ||||
-rw-r--r-- | src/menus.c | 18 | ||||
-rw-r--r-- | src/menus.h | 18 | ||||
-rw-r--r-- | src/parse.c | 9 | ||||
-rw-r--r-- | src/session.c | 20 | ||||
-rw-r--r-- | src/twm.c | 2 | ||||
-rw-r--r-- | src/twm.h | 12 | ||||
-rw-r--r-- | src/util.c | 20 | ||||
-rw-r--r-- | src/util.h | 18 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/version.h | 2 |
13 files changed, 67 insertions, 66 deletions
diff --git a/src/cursor.c b/src/cursor.c index 5bfc4f9..bbe05f0 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "util.h" static struct _CursorName { - char *name; + const char *name; unsigned int shape; Cursor cursor; } cursor_names[] = { @@ -123,7 +123,7 @@ static struct _CursorName { }; void -NewFontCursor (Cursor *cp, char *str) +NewFontCursor (Cursor *cp, const char *str) { int i; diff --git a/src/events.c b/src/events.c index 2239e6f..dbc94dc 100644 --- a/src/events.c +++ b/src/events.c @@ -76,7 +76,7 @@ in this Software without prior written authorization from The Open Group. #define MAX_X_EVENT 256 event_proc EventHandler[MAX_X_EVENT]; /* event handler jump table */ -char *Action; +const char *Action; int Context = C_NO_CONTEXT; /* current button press context */ TwmWindow *ButtonWindow; /* button press window structure */ XEvent ButtonEvent; /* button press event */ @@ -82,7 +82,7 @@ static char *Action = ""; static char *Name = ""; static MenuRoot *root, *pull = NULL; -static MenuRoot *GetRoot ( char *name, char *fore, char *back ); +static MenuRoot *GetRoot ( const char *name, const char *fore, const char *back ); static void GotButton ( int butt, int func ); static void GotKey ( char *key, int func ); static void GotTitleButton ( char *bitmapname, int func, Bool rightside ); @@ -660,7 +660,7 @@ number : NUMBER { $$ = $1; } %% void -yyerror(char *s) +yyerror(const char *s) { twmrc_error_prefix(); fprintf (stderr, "error in input file: %s\n", s ? s : ""); @@ -751,7 +751,7 @@ RemoveDQuote(char *str) *o = '\0'; } -static MenuRoot *GetRoot(char *name, char* fore, char *back) +static MenuRoot *GetRoot(const char *name, const char* fore, const char *back) { MenuRoot *tmp; diff --git a/src/menus.c b/src/menus.c index 4c0e22a..cb6cb5b 100644 --- a/src/menus.c +++ b/src/menus.c @@ -213,8 +213,8 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, -int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, - Bool rightside, Bool append) +int CreateTitleButton (const char *name, int func, const char *action, + MenuRoot *menuroot, Bool rightside, Bool append) { TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton)); @@ -617,7 +617,7 @@ UpdateMenu() * \param name the name of the menu root */ MenuRoot * -NewMenuRoot(char *name) +NewMenuRoot(const char *name) { MenuRoot *tmp; @@ -676,8 +676,8 @@ NewMenuRoot(char *name) * \param back background color string */ MenuItem * -AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, - char *fore, char *back) +AddToMenu(MenuRoot *menu, const char *item, const char *action, + MenuRoot *sub, int func, const char *fore, const char *back) { MenuItem *tmp; int width; @@ -1123,7 +1123,7 @@ PopDownMenu() * \param name the name of the menu root */ MenuRoot * -FindMenuRoot(char *name) +FindMenuRoot(const char *name) { MenuRoot *tmp; @@ -1279,7 +1279,7 @@ WarpThere(TwmWindow *t) int -ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, +ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown) { static Time last_time = 0; @@ -2336,7 +2336,7 @@ NeedToDefer(MenuRoot *root) * \param s the string containing the command */ static int -System (char *s) +System (const char *s) { int pid, status; if ((pid = fork ()) == 0) { @@ -2351,7 +2351,7 @@ System (char *s) #endif void -Execute(char *s) +Execute(const char *s) { /* FIXME: is all this stuff needed? There could be security problems here. */ static char buf[256]; diff --git a/src/menus.h b/src/menus.h index 0a75622..7314c89 100644 --- a/src/menus.h +++ b/src/menus.h @@ -72,8 +72,8 @@ typedef struct MenuItem struct MenuItem *prev; /* prev menu item */ struct MenuRoot *sub; /* MenuRoot of a pull right menu */ struct MenuRoot *root; /* back pointer to my MenuRoot */ - char *item; /* the character string displayed */ - char *action; /* action to be performed */ + const char *item; /* the character string displayed */ + const char *action; /* action to be performed */ Pixel fore; /* foreground color */ Pixel back; /* background color */ Pixel hi_fore; /* highlight foreground */ @@ -92,7 +92,7 @@ typedef struct MenuRoot struct MenuItem *last; /* last item in menu */ struct MenuRoot *prev; /* previous root menu if pull right */ struct MenuRoot *next; /* next in list of root menus */ - char *name; /* name of root */ + const char *name; /* name of root */ Window w; /* the window of the menu */ Window shadow; /* the shadow window */ Pixel hi_fore; /* highlight foreground */ @@ -166,25 +166,25 @@ extern int MenuDepth; extern void InitMenus ( void ); extern Bool AddFuncKey ( char *name, int cont, int mods, int func, char *win_name, char *action ); -extern int CreateTitleButton ( char *name, int func, char *action, MenuRoot *menuroot, Bool rightside, Bool append ); +extern int CreateTitleButton ( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append ); extern void InitTitlebarButtons ( void ); extern void PaintEntry ( MenuRoot *mr, MenuItem *mi, int exposure ); extern void PaintMenu ( MenuRoot *mr, XEvent *e ); extern void UpdateMenu ( void ); -extern MenuRoot * NewMenuRoot ( char *name ); -extern MenuItem * AddToMenu ( MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, char *fore, char *back ); +extern MenuRoot * NewMenuRoot ( const char *name ); +extern MenuItem * AddToMenu ( MenuRoot *menu, const char *item, const char *action, MenuRoot *sub, int func, const char *fore, const char *back ); extern void MakeMenus ( void ); extern void MakeMenu ( MenuRoot *mr ); extern Bool PopUpMenu ( MenuRoot *menu, int x, int y, Bool center ); extern void PopDownMenu ( void ); -extern MenuRoot * FindMenuRoot ( char *name ); +extern MenuRoot * FindMenuRoot ( const char *name ); extern void resizeFromCenter ( Window w, TwmWindow *tmp_win ); extern int WarpThere ( TwmWindow * t ); -extern int ExecuteFunction ( int func, char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown ); +extern int ExecuteFunction ( int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown ); extern int DeferExecution ( int context, int func, Cursor cursor ); extern void ReGrab ( void ); extern Bool NeedToDefer ( MenuRoot *root ); -extern void Execute ( char *s ); +extern void Execute ( const char *s ); extern void FocusOnRoot ( void ); extern void DeIconify ( TwmWindow *tmp_win ); extern void Iconify ( TwmWindow *tmp_win, int def_x, int def_y ); diff --git a/src/parse.c b/src/parse.c index 26f5ebd..ebdb9c1 100644 --- a/src/parse.c +++ b/src/parse.c @@ -83,7 +83,7 @@ static unsigned char overflowbuff[20]; /* really only need one */ static int overflowlen; static unsigned char **stringListSource, *currentString; -static int doparse ( int (*ifunc)(void), char *srctypename, char *srcname ); +static int doparse ( int (*ifunc)(void), const char *srctypename, const char *srcname ); static int twmFileInput ( void ); static int twmStringListInput ( void ); static int ParseUsePPosition ( char *s ); @@ -99,7 +99,8 @@ int (*twmInputFunc)(void); * parse the .twmrc file * \param filename the filename to parse. NULL indicates $HOME/.twmrc */ -static int doparse (int (*ifunc)(void), char *srctypename, char*srcname) +static int doparse (int (*ifunc)(void), + const char *srctypename, const char *srcname) { mods = 0; ptr = 0; @@ -160,7 +161,7 @@ int ParseTwmrc (char *filename) int i; char *home = NULL; int homelen = 0; - char *cp = NULL; + const char *cp = NULL; char tmpfilename[257]; /* @@ -302,7 +303,7 @@ TwmOutput(int c) ***********************************************************************/ typedef struct _TwmKeyword { - char *name; + const char *name; int value; int subnum; } TwmKeyword; diff --git a/src/session.c b/src/session.c index fd91942..5dce03f 100644 --- a/src/session.c +++ b/src/session.c @@ -72,9 +72,9 @@ Bool sent_save_done = 0; #define SAVEFILE_VERSION 2 #ifndef HAVE_MKSTEMP -static char *unique_filename ( char *path, char *prefix ); +static char *unique_filename ( const char *path, const char *prefix ); #else -static char *unique_filename ( char *path, char *prefix, int *pFd ); +static char *unique_filename ( const char *path, const char *prefix, int *pFd ); #endif @@ -719,15 +719,15 @@ Bool *height_ever_changed_by_user; #ifndef HAVE_MKSTEMP static char * -unique_filename (path, prefix) -char *path; -char *prefix; +unique_filename ( + const char *path, + const char *prefix #else static char * -unique_filename (path, prefix, pFd) -char *path; -char *prefix; -int *pFd; +unique_filename ( + const char *path, + const char *prefix, + int *pFd) #endif { @@ -778,7 +778,7 @@ SmPointer clientData; TwmWindow *theWindow; char *clientId, *windowRole; FILE *configFile = NULL; - char *path; + const char *path; char *filename = NULL; Bool success = False; SmProp prop1, prop2, prop3, *props[3]; @@ -127,7 +127,7 @@ XClassHint NoClass; /* for applications with no class */ XGCValues Gcv; -char *Home; /* the HOME environment variable */ +const char *Home; /* the HOME environment variable */ int HomeLen; /* length of Home */ int ParseError; /* error parsing the .twmrc file */ @@ -147,7 +147,7 @@ typedef SIGNAL_T (*SigProc)(int); /* type of function returned by signal() */ typedef struct MyFont { - char *name; /* name of the font */ + const char *name; /* name of the font */ XFontStruct *font; /* font structure */ XFontSet fontset; /* fontset structure */ int height; /* height of the font */ @@ -163,13 +163,13 @@ typedef struct ColorPair typedef struct _TitleButton { struct _TitleButton *next; /* next link in chain */ - char *name; /* bitmap name in case of deferal */ + const char *name; /* bitmap name in case of deferal */ Pixmap bitmap; /* image to display in button */ int srcx, srcy; /* from where to start copying */ unsigned int width, height; /* size of pixmap */ int dstx, dsty; /* to where to start copying */ int func; /* function to execute */ - char *action; /* optional action arg */ + const char *action; /* optional action arg */ struct MenuRoot *menuroot; /* menu to pop on F_MENU */ Bool rightside; /* t: on right, f: on left */ } TitleButton; @@ -379,7 +379,7 @@ extern XContext IconManagerContext; extern XContext ScreenContext; extern XContext ColormapContext; -extern char *Home; +extern const char *Home; extern int HomeLen; extern int ParseError; @@ -395,7 +395,7 @@ extern int InfoLines; extern char Info[][INFO_SIZE]; extern int Argc; extern char **Argv; -extern void NewFontCursor ( Cursor *cp, char *str ); +extern void NewFontCursor ( Cursor *cp, const char *str ); extern void NewBitmapCursor ( Cursor *cp, char *source, char *mask ); extern Pixmap CreateMenuIcon ( int height, unsigned int *widthp, unsigned int *heightp ); @@ -411,7 +411,7 @@ extern void twmrc_error_prefix ( void ); extern int yyparse ( void ); extern int yylex ( void ); -extern void yyerror ( char *s ); +extern void yyerror ( const char *s ); extern int doinput ( char *buf, int size ); extern void RemoveDQuote ( char *str ); @@ -281,7 +281,7 @@ ExpandFilename(char *name) * \param name the filename to read */ void -GetUnknownIcon(char *name) +GetUnknownIcon(const char *name) { if ((Scr->UnknownPm = GetBitmap(name)) != None) { @@ -300,7 +300,7 @@ GetUnknownIcon(char *name) * \param[out] heightp pointer to height of bitmap */ Pixmap -FindBitmap (char *name, unsigned *widthp, unsigned *heightp) +FindBitmap (const char *name, unsigned *widthp, unsigned *heightp) { char *bigname; Pixmap pm; @@ -315,7 +315,7 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) if (name[0] == ':') { int i; static struct { - char *name; + const char *name; Pixmap (*proc)(unsigned int *, unsigned int *); } pmtab[] = { { TBPM_DOT, CreateDotPixmap }, @@ -378,7 +378,7 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) } Pixmap -GetBitmap (char *name) +GetBitmap (const char *name) { return FindBitmap (name, &JunkWidth, &JunkHeight); } @@ -464,7 +464,7 @@ LocateStandardColormaps() } void -GetColor(int kind, Pixel *what, char *name) +GetColor(int kind, Pixel *what, const char *name) { XColor color, junkcolor; Status stat = 0; @@ -542,7 +542,7 @@ GetColor(int kind, Pixel *what, char *name) } void -GetColorValue(int kind, XColor *what, char *name) +GetColorValue(int kind, XColor *what, const char *name) { XColor junkcolor; Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; @@ -579,7 +579,7 @@ GetColorValue(int kind, XColor *what, char *name) void GetFont(MyFont *font) { - char *deffontname = "fixed"; + const char *deffontname = "fixed"; char **missing_charset_list_return; int missing_charset_count_return; char *def_string_return; @@ -651,7 +651,7 @@ GetFont(MyFont *font) } int -MyFont_TextWidth(MyFont *font, char *string, int len) +MyFont_TextWidth(MyFont *font, const char *string, int len) { XRectangle ink_rect; XRectangle logical_rect; @@ -666,7 +666,7 @@ MyFont_TextWidth(MyFont *font, char *string, int len) void MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, - int x, int y, char *string, int len) + int x, int y, const char *string, int len) { if (use_fontset) { XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len); @@ -677,7 +677,7 @@ MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, void MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, - int x, int y, char *string, int len) + int x, int y, const char *string, int len) { if (use_fontset) { XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len); @@ -65,23 +65,23 @@ extern void MoveOutline ( Window root, int x, int y, int width, int height, int bw, int th ); extern void Zoom ( Window wf, Window wt ); extern char * ExpandFilename ( char *name ); -extern void GetUnknownIcon ( char *name ); -extern Pixmap FindBitmap ( char *name, unsigned int *widthp, +extern void GetUnknownIcon ( const char *name ); +extern Pixmap FindBitmap ( const char *name, unsigned int *widthp, unsigned int *heightp ); -extern Pixmap GetBitmap ( char *name ); +extern Pixmap GetBitmap ( const char *name ); extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, Bool replace ); extern void RemoveRGBColormap ( Atom a ); extern void LocateStandardColormaps ( void ); -extern void GetColor ( int kind, Pixel *what, char *name ); -extern void GetColorValue ( int kind, XColor *what, char *name ); +extern void GetColor ( int kind, Pixel *what, const char *name ); +extern void GetColorValue ( int kind, XColor *what, const char *name ); extern void GetFont ( MyFont *font ); -extern int MyFont_TextWidth( MyFont *font, char *string, int len); +extern int MyFont_TextWidth( MyFont *font, const char *string, int len); extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, - GC gc, int x, int y, char * string, + GC gc, int x, int y, const char * string, int len); -extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, - GC gc, int x, int y, char * string, int len); +extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, GC gc, + int x, int y, const char * string, int len); extern void MyFont_ChangeGC( unsigned long fix_fore, unsigned long fix_back, MyFont *fix_font); extern Status I18N_FetchName( Display *dpy, Window win, char **winname); diff --git a/src/version.c b/src/version.c index b50a129..cf06076 100644 --- a/src/version.c +++ b/src/version.c @@ -49,5 +49,5 @@ in this Software without prior written authorization from The Open Group. /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -char *Version = XVENDORNAME", "XORG_RELEASE; +const char *Version = XVENDORNAME", "XORG_RELEASE; diff --git a/src/version.h b/src/version.h index 0239c2b..24ed8bd 100644 --- a/src/version.h +++ b/src/version.h @@ -60,6 +60,6 @@ in this Software without prior written authorization from The Open Group. #ifndef _VERSION_ #define _VERSION_ -extern char *Version; +extern const char *Version; #endif /* _VERSION_ */ |