[PATCH 1/7] Fix a couple of compiler warnings

Kristian Høgsberg krh at bitplanet.net
Thu May 13 06:49:45 PDT 2010


On Wed, May 12, 2010 at 5:45 PM, Keith Packard <keithp at keithp.com> wrote:
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  config/udev.c             |    6 +++---
>  hw/dmx/dmxgc.c            |    2 ++
>  hw/dmx/glxProxy/glxcmds.c |    2 +-
>  3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/config/udev.c b/config/udev.c
> index 5e8d8da..d706a77 100644
> --- a/config/udev.c
> +++ b/config/udev.c
> @@ -81,12 +81,12 @@ device_added(struct udev_device *udev_device)
>     if (!name)
>         name = "(unnamed)";
>     else
> -        attrs.product = name;
> +        attrs.product = (char *) name;
>     add_option(&options, "name", name);
>
>     add_option(&options, "path", path);
>     add_option(&options, "device", path);
> -    attrs.device = path;
> +    attrs.device = (char *) path;
>     attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");

This works for me and seems like a better way to fix those warnings:

diff --git a/include/input.h b/include/input.h
index 63f981e..eba4292 100644
--- a/include/input.h
+++ b/include/input.h
@@ -212,10 +212,10 @@ typedef struct _InputOption {
 } InputOption;

 typedef struct _InputAttributes {
-    char                *product;
-    char                *vendor;
-    char                *device;
-    char                **tags; /* null-terminated */
+    const char         *product;
+    const char         *vendor;
+    const char         *device;
+    const char        **tags; /* null-terminated */
     uint32_t            flags;
 } InputAttributes;


Kristian


More information about the xorg-devel mailing list