From 9c5bd55ac617d8978b36815eb711f977aee82ace Mon Sep 17 00:00:00 2001 From: Jan D Date: Wed, 11 Aug 2010 10:58:56 +0200 Subject: [PATCH] Use const char* for -Wwrite_strings. * keyboard.h (_widget_value): name, value and key are const char*. * nsfont.m (ns_descriptor_to_entity): Use const char*. * nsmenu.m (parseKeyEquiv, addSubmenuWithTitle) (addDisplayItemWithImage, update_frame_tool_bar): Use const char*. * nsterm.h (parseKeyEquiv, addSubmenuWithTitle) (addDisplayItemWithImage): Use const char*. --- src/ChangeLog | 10 ++++++++++ src/keyboard.h | 6 +++--- src/nsfont.m | 4 +++- src/nsmenu.m | 12 ++++++------ src/nsterm.h | 6 +++--- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1ec37f440c0..240af42ac47 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2010-08-11 Jan Djärv + * nsterm.h (parseKeyEquiv, addSubmenuWithTitle) + (addDisplayItemWithImage): Use const char*. + + * nsmenu.m (parseKeyEquiv, addSubmenuWithTitle) + (addDisplayItemWithImage, update_frame_tool_bar): Use const char*. + + * nsfont.m (ns_descriptor_to_entity): Use const char*. + + * keyboard.h (_widget_value): name, value and key are const char*. + * unexmacosx.c (unexec_error): Use const char *. 2010-08-09 Dan Nicolaescu diff --git a/src/keyboard.h b/src/keyboard.h index 693137b08f4..757f538560c 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -338,12 +338,12 @@ typedef struct _widget_value { /* name of widget */ Lisp_Object lname; - char* name; + const char* name; /* value (meaning depend on widget type) */ - char* value; + const char* value; /* keyboard equivalent. no implications for XtTranslations */ Lisp_Object lkey; - char* key; + const char* key; /* Help string or nil if none. GC finds this string through the frame's menu_bar_vector or through menu_items. */ diff --git a/src/nsfont.m b/src/nsfont.m index aaa5999e048..115986774d8 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -161,7 +161,9 @@ static NSFontDescriptor /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */ static Lisp_Object -ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style) +ns_descriptor_to_entity (NSFontDescriptor *desc, + Lisp_Object extra, + const char *style) { Lisp_Object font_entity = font_make_entity (); /* NSString *psName = [desc postscriptName]; */ diff --git a/src/nsmenu.m b/src/nsmenu.m index c7ea6bb90fd..86b3775e9e6 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -600,9 +600,9 @@ name_is_separator ( const char *name) NSMenuItem get ignored. For now we try to display a super-single letter combo, and return the others as strings to be appended to the item title. (This is signaled by setting keyEquivModMask to 0 for now.) */ --(NSString *)parseKeyEquiv: (char *)key +-(NSString *)parseKeyEquiv: (const char *)key { - char *tpos = key; + const char *tpos = key; keyEquivModMask = NSCommandKeyMask; if (!key || !strlen (key)) @@ -719,7 +719,7 @@ name_is_separator ( const char *name) /* adds an empty submenu and returns it */ -- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f +- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f { NSString *titleStr = [NSString stringWithUTF8String: title]; NSMenuItem *item = [self addItemWithTitle: titleStr @@ -836,7 +836,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); @@ -1033,7 +1033,7 @@ update_frame_tool_bar (FRAME_PTR f) struct image *img; Lisp_Object image; Lisp_Object helpObj; - char *helpText; + const char *helpText; /* If image is a vector, choose the image according to the button state. */ @@ -1153,7 +1153,7 @@ update_frame_tool_bar (FRAME_PTR f) } - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx - helpText: (char *)help enabled: (BOOL)enabled + helpText: (const char *)help enabled: (BOOL)enabled { /* 1) come up w/identifier */ NSString *identifier diff --git a/src/nsterm.h b/src/nsterm.h index 9b7f0accad1..21b18f15cae 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -114,10 +114,10 @@ along with GNU Emacs. If not, see . */ - initWithTitle: (NSString *)title frame: (struct frame *)f; - (void)setFrame: (struct frame *)f; - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */ -- (NSString *)parseKeyEquiv: (char *)key; +- (NSString *)parseKeyEquiv: (const char *)key; - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr; - (void)fillWithWidgetValue: (void *)wvptr; -- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f; +- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f; - (void) clear; - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f keymaps: (int)keymaps; @@ -144,7 +144,7 @@ along with GNU Emacs. If not, see . */ - (void) clearActive; - (BOOL) changed; - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx - helpText: (char *)help + helpText: (const char *)help enabled: (BOOL)enabled; /* delegate methods */ - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar -- 2.39.2