[PATCH 7/7] Fix gcc -Wwrite-strings warnings in xf86Modes code
walter harms
wharms at bfs.de
Wed Nov 9 05:54:57 PST 2011
jus 2 minor remarks,
re,
wh
Am 08.11.2011 21:42, schrieb Alan Coopersmith:
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> hw/xfree86/modes/xf86Crtc.c | 8 ++++----
> hw/xfree86/modes/xf86Crtc.h | 2 +-
> hw/xfree86/modes/xf86EdidModes.c | 2 +-
> hw/xfree86/modes/xf86Modes.c | 4 ++--
> 4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
> index aac33d3..d1b6c8c 100644
> --- a/hw/xfree86/modes/xf86Crtc.c
> +++ b/hw/xfree86/modes/xf86Crtc.c
> @@ -481,7 +481,7 @@ static void
> xf86OutputSetMonitor (xf86OutputPtr output)
> {
> char *option_name;
> - char *monitor;
> + const char *monitor;
>
> if (!output->name)
> return;
> @@ -561,7 +561,7 @@ xf86OutputIgnored (xf86OutputPtr output)
> return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
> }
>
> -static char *direction[4] = {
> +static const char *direction[4] = {
> "normal",
> "left",
> "inverted",
just nit picking:
this would be more consistent e.g with below.
static const char *direction[]= {
> @@ -3060,13 +3060,13 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
> return mon;
> }
>
> -static char *_xf86ConnectorNames[] = {
> +static const char *_xf86ConnectorNames[] = {
> "None", "VGA", "DVI-I", "DVI-D",
> "DVI-A", "Composite", "S-Video",
> "Component", "LFP", "Proprietary",
> "HDMI", "DisplayPort",
> };
> -char *
> +const char *
> xf86ConnectorGetName(xf86ConnectorType connector)
> {
> return _xf86ConnectorNames[connector];
> diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
> index 716499f..8d4a089 100644
> --- a/hw/xfree86/modes/xf86Crtc.h
> +++ b/hw/xfree86/modes/xf86Crtc.h
> @@ -900,7 +900,7 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
> /*
> * Get a standard string name for a connector type
> */
> -extern _X_EXPORT char *
> +extern _X_EXPORT const char *
> xf86ConnectorGetName(xf86ConnectorType connector);
>
> /*
> diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
> index 9ff2f0d..13d16dd 100644
> --- a/hw/xfree86/modes/xf86EdidModes.c
> +++ b/hw/xfree86/modes/xf86EdidModes.c
> @@ -225,7 +225,7 @@ static Bool quirk_dvi_single_link(int scrnIndex, xf86MonPtr DDC)
> typedef struct {
> Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
> ddc_quirk_t quirk;
> - char *description;
> + const char *description;
> } ddc_quirk_map_t;
>
> static const ddc_quirk_map_t ddc_quirks[] = {
> diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
> index dcd3a28..49cc149 100644
> --- a/hw/xfree86/modes/xf86Modes.c
> +++ b/hw/xfree86/modes/xf86Modes.c
> @@ -272,7 +272,7 @@ xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
> }
>
> static void
> -add(char **p, char *new)
> +add(char **p, const char *new)
> {
> *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
> strcat(*p, " ");
this looks like a case for asprintf()
> @@ -599,7 +599,7 @@ xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
>
> if (mode->status != MODE_OK) {
> if (verbose) {
> - char *type = "";
> + const char *type = "";
> if (mode->type & M_T_BUILTIN)
> type = "built-in ";
> else if (mode->type & M_T_DEFAULT)
More information about the xorg-devel
mailing list