[PATCH:xkbcomp 4/4] Fix many const char * warnings from gcc

Jasper St. Pierre jstpierre at mecheye.net
Wed Oct 30 03:09:19 CET 2013


Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>


On Tue, Oct 29, 2013 at 9:51 PM, Alan Coopersmith <
alan.coopersmith at oracle.com> wrote:

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  action.c     |    8 ++++----
>  action.h     |    4 ++--
>  compat.c     |    2 +-
>  expr.c       |   12 ++++++------
>  geometry.c   |   26 +++++++++++++-------------
>  indicators.c |    2 +-
>  indicators.h |    2 +-
>  keytypes.c   |    2 +-
>  symbols.c    |    8 ++++----
>  9 files changed, 33 insertions(+), 33 deletions(-)
>
> diff --git a/action.c b/action.c
> index 3b82e64..4623c0c 100644
> --- a/action.c
> +++ b/action.c
> @@ -41,7 +41,7 @@ static ExprDef constFalse;
>
>  /***====================================================================***/
>
>  static Bool
> -stringToAction(char *str, unsigned *type_rtrn)
> +stringToAction(const char *str, unsigned *type_rtrn)
>  {
>      if (str == NULL)
>          return False;
> @@ -134,7 +134,7 @@ stringToAction(char *str, unsigned *type_rtrn)
>  }
>
>  static Bool
> -stringToField(char *str, unsigned *field_rtrn)
> +stringToField(const char *str, unsigned *field_rtrn)
>  {
>
>      if (str == NULL)
> @@ -1397,8 +1397,8 @@ HandleActionDef(ExprDef * def,
>
>  int
>  SetActionField(XkbDescPtr xkb,
> -               char *elem,
> -               char *field,
> +               const char *elem,
> +               const char *field,
>                 ExprDef * array_ndx, ExprDef * value, ActionInfo **
> info_rtrn)
>  {
>      ActionInfo *new, *old;
> diff --git a/action.h b/action.h
> index 2fb7a5e..983b06e 100644
> --- a/action.h
> +++ b/action.h
> @@ -72,8 +72,8 @@ extern int HandleActionDef(ExprDef * /* def */ ,
>      );
>
>  extern int SetActionField(XkbDescPtr /* xkb */ ,
> -                          char * /* elem */ ,
> -                          char * /* field */ ,
> +                          const char * /* elem */ ,
> +                          const char * /* field */ ,
>                            ExprDef * /* index */ ,
>                            ExprDef * /* value */ ,
>                            ActionInfo ** /* info_rtrn */
> diff --git a/compat.c b/compat.c
> index f4d82a6..82fd4e6 100644
> --- a/compat.c
> +++ b/compat.c
> @@ -494,7 +494,7 @@ static LookupEntry useModMapValues[] = {
>  static int
>  SetInterpField(SymInterpInfo * si,
>                 XkbDescPtr xkb,
> -               char *field,
> +               const char *field,
>                 ExprDef * arrayNdx, ExprDef * value, CompatInfo * info)
>  {
>      int ok = 1;
> diff --git a/expr.c b/expr.c
> index 195e0f3..e0f957c 100644
> --- a/expr.c
> +++ b/expr.c
> @@ -292,7 +292,7 @@ ExprResolveModIndex(ExprDef * expr,
>                      IdentLookupFunc lookup, XPointer lookupPriv)
>  {
>      int ok = 0;
> -    char *bogus = NULL;
> +    const char *bogus = NULL;
>
>      switch (expr->op)
>      {
> @@ -382,7 +382,7 @@ ExprResolveBoolean(ExprDef * expr,
>                     IdentLookupFunc lookup, XPointer lookupPriv)
>  {
>      int ok = 0;
> -    char *bogus = NULL;
> +    const char *bogus = NULL;
>
>      switch (expr->op)
>      {
> @@ -715,7 +715,7 @@ ExprResolveString(ExprDef * expr,
>      ExprResult leftRtrn, rightRtrn;
>      ExprDef *left;
>      ExprDef *right;
> -    char *bogus = NULL;
> +    const char *bogus = NULL;
>
>      switch (expr->op)
>      {
> @@ -729,7 +729,7 @@ ExprResolveString(ExprDef * expr,
>          val_rtrn->str = XkbAtomGetString(NULL, expr->value.str);
>          if (val_rtrn->str == NULL)
>          {
> -            static char *empty = "";
> +            static const char *empty = "";
>              val_rtrn->str = empty;
>          }
>          return True;
> @@ -822,7 +822,7 @@ ExprResolveKeyName(ExprDef * expr,
>      int ok = 0;
>      ExprDef *left;
>      ExprResult leftRtrn;
> -    char *bogus = NULL;
> +    const char *bogus = NULL;
>
>      switch (expr->op)
>      {
> @@ -941,7 +941,7 @@ ExprResolveMask(ExprDef * expr,
>      int ok = 0;
>      ExprResult leftRtrn, rightRtrn;
>      ExprDef *left, *right;
> -    char *bogus = NULL;
> +    const char *bogus = NULL;
>
>      switch (expr->op)
>      {
> diff --git a/geometry.c b/geometry.c
> index cfd1f51..2daa213 100644
> --- a/geometry.c
> +++ b/geometry.c
> @@ -967,7 +967,7 @@ AddDoodad(SectionInfo * si, GeometryInfo * info,
> DoodadInfo * new)
>  }
>
>  static DoodadInfo *
> -FindDfltDoodadByTypeName(char *name, SectionInfo * si, GeometryInfo *
> info)
> +FindDfltDoodadByTypeName(const char *name, SectionInfo *si, GeometryInfo
> *info)
>  {
>      DoodadInfo *dflt;
>      unsigned type;
> @@ -1408,7 +1408,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, XkbDescPtr
> xkb, GeometryInfo * info,
>
>  static int
>  SetShapeField(ShapeInfo * si,
> -              char *field,
> +              const char *field,
>                ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info)
>  {
>      ExprResult tmp;
> @@ -1440,7 +1440,7 @@ SetShapeField(ShapeInfo * si,
>
>  static int
>  SetShapeDoodadField(DoodadInfo * di,
> -                    char *field,
> +                    const char *field,
>                      ExprDef * arrayNdx,
>                      ExprDef * value, SectionInfo * si, GeometryInfo *
> info)
>  {
> @@ -1510,14 +1510,14 @@ SetShapeDoodadField(DoodadInfo * di,
>
>  static int
>  SetTextDoodadField(DoodadInfo * di,
> -                   char *field,
> +                   const char *field,
>                     ExprDef * arrayNdx,
>                     ExprDef * value, SectionInfo * si, GeometryInfo * info)
>  {
>      ExprResult tmp;
>      unsigned def;
>      unsigned type;
> -    char *typeName = "text doodad";
> +    const char *typeName = "text doodad";
>      union
>      {
>          Atom *str;
> @@ -1660,7 +1660,7 @@ SetTextDoodadField(DoodadInfo * di,
>
>  static int
>  SetIndicatorDoodadField(DoodadInfo * di,
> -                        char *field,
> +                        const char *field,
>                          ExprDef * arrayNdx,
>                          ExprDef * value,
>                          SectionInfo * si, GeometryInfo * info)
> @@ -1705,12 +1705,12 @@ SetIndicatorDoodadField(DoodadInfo * di,
>
>  static int
>  SetLogoDoodadField(DoodadInfo * di,
> -                   char *field,
> +                   const char *field,
>                     ExprDef * arrayNdx,
>                     ExprDef * value, SectionInfo * si, GeometryInfo * info)
>  {
>      ExprResult tmp;
> -    char *typeName = "logo doodad";
> +    const char *typeName = "logo doodad";
>
>      if ((!uStrCaseCmp(field, "corner"))
>          || (!uStrCaseCmp(field, "cornerradius")))
> @@ -1786,7 +1786,7 @@ SetLogoDoodadField(DoodadInfo * di,
>
>  static int
>  SetDoodadField(DoodadInfo * di,
> -               char *field,
> +               const char *field,
>                 ExprDef * arrayNdx,
>                 ExprDef * value, SectionInfo * si, GeometryInfo * info)
>  {
> @@ -1889,7 +1889,7 @@ SetDoodadField(DoodadInfo * di,
>
>  static int
>  SetSectionField(SectionInfo * si,
> -                char *field,
> +                const char *field,
>                  ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info)
>  {
>      unsigned short *pField;
> @@ -1977,7 +1977,7 @@ SetSectionField(SectionInfo * si,
>
>  static int
>  SetRowField(RowInfo * row,
> -            char *field,
> +            const char *field,
>              ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info)
>  {
>      ExprResult tmp;
> @@ -2841,7 +2841,7 @@ HandleGeometryFile(XkbFile * file,
>                     XkbDescPtr xkb, unsigned merge, GeometryInfo * info)
>  {
>      ParseCommon *stmt;
> -    char *failWhat;
> +    const char *failWhat;
>
>      if (merge == MergeDefault)
>          merge = MergeAugment;
> @@ -3273,7 +3273,7 @@ FontFromParts(Atom fontTok,
>                Atom setWidthTok, Atom varTok, int size, Atom encodingTok)
>  {
>      int totalSize;
> -    char *font, *weight, *slant, *setWidth, *variant, *encoding;
> +    const char *font, *weight, *slant, *setWidth, *variant, *encoding;
>      char *rtrn;
>
>      font = (fontTok != None ? XkbAtomGetString(NULL, fontTok) :
> DFLT_FONT);
> diff --git a/indicators.c b/indicators.c
> index d4a362f..421ad58 100644
> --- a/indicators.c
> +++ b/indicators.c
> @@ -200,7 +200,7 @@ static LookupEntry groupComponentNames[] = {
>  int
>  SetIndicatorMapField(LEDInfo * led,
>                       XkbDescPtr xkb,
> -                     char *field, ExprDef * arrayNdx, ExprDef * value)
> +                     const char *field, ExprDef *arrayNdx, ExprDef *value)
>  {
>      ExprResult rtrn;
>      Bool ok;
> diff --git a/indicators.h b/indicators.h
> index 35ae38a..8e7884d 100644
> --- a/indicators.h
> +++ b/indicators.h
> @@ -62,7 +62,7 @@ extern LEDInfo *AddIndicatorMap(LEDInfo * /* oldLEDs */ ,
>
>  extern int SetIndicatorMapField(LEDInfo * /* led */ ,
>                                  XkbDescPtr /* xkb */ ,
> -                                char * /* field */ ,
> +                                const char * /* field */ ,
>                                  ExprDef * /* arrayNdx */ ,
>                                  ExprDef *       /* value */
>      );
> diff --git a/keytypes.c b/keytypes.c
> index da55d75..375ca3e 100644
> --- a/keytypes.c
> +++ b/keytypes.c
> @@ -879,7 +879,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx,
> ExprDef * value)
>  static Bool
>  SetKeyTypeField(KeyTypeInfo * type,
>                  XkbDescPtr xkb,
> -                char *field,
> +                const char *field,
>                  ExprDef * arrayNdx, ExprDef * value, KeyTypesInfo * info)
>  {
>      ExprResult tmp;
> diff --git a/symbols.c b/symbols.c
> index 5547999..d43ba9f 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -928,7 +928,7 @@ GetGroupIndex(KeyInfo * key,
>  static Bool
>  AddSymbolsToKey(KeyInfo * key,
>                  XkbDescPtr xkb,
> -                char *field,
> +                const char *field,
>                  ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
>  {
>      unsigned ndx, nSyms;
> @@ -982,7 +982,7 @@ AddSymbolsToKey(KeyInfo * key,
>  static Bool
>  AddActionsToKey(KeyInfo * key,
>                  XkbDescPtr xkb,
> -                char *field,
> +                const char *field,
>                  ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
>  {
>      register int i;
> @@ -1118,7 +1118,7 @@ static LookupEntry rgEntries[] = {
>  static Bool
>  SetSymbolsField(KeyInfo * key,
>                  XkbDescPtr xkb,
> -                char *field,
> +                const char *field,
>                  ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
>  {
>      Bool ok = True;
> @@ -1235,7 +1235,7 @@ SetSymbolsField(KeyInfo * key,
>               uStrCasePrefix("permanentoverlay", field))
>      {
>          Bool permanent = False;
> -        char *which;
> +        const char *which;
>          int overlayNdx;
>          if (uStrCasePrefix("permanent", field))
>          {
> --
> 1.7.9.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131029/e86f2769/attachment-0001.html>


More information about the xorg-devel mailing list