get_media_devices: Constify arguments
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 29 May 2011 13:54:09 +0000 (10:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 29 May 2011 13:54:09 +0000 (10:54 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
utils/libmedia_dev/get_media_devices.c
utils/libmedia_dev/get_media_devices.h
utils/v4l2-sysfs-path/v4l2-sysfs-path.c

index 89164ac..c27d7f5 100644 (file)
@@ -327,7 +327,7 @@ error:
        return NULL;
 }
 
-char *media_device_type(enum device_type type)
+const char *media_device_type(enum device_type type)
 {
        switch(type) {
                /* V4L nodes */
@@ -395,11 +395,11 @@ void display_media_devices(void *opaque)
        printf("\n");
 }
 
-char *get_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           char *seek_device,
-                           enum device_type seek_type)
+const char *get_associated_device(void *opaque,
+                                 const char *last_seek,
+                                 const enum device_type desired_type,
+                                 const char *seek_device,
+                                 const enum device_type seek_type)
 {
        struct media_devices *md = opaque;
        struct media_device_entry *md_ptr = md->md_entry;
@@ -458,11 +458,11 @@ char *get_associated_device(void *opaque,
        return NULL;
 }
 
-char *fget_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           int fd_seek_device,
-                           enum device_type seek_type)
+const char *fget_associated_device(void *opaque,
+                                  const char *last_seek,
+                                  const enum device_type desired_type,
+                                  const int fd_seek_device,
+                                  const enum device_type seek_type)
 {
        struct media_devices *md = opaque;
        struct media_device_entry *md_ptr = md->md_entry;
@@ -518,10 +518,10 @@ char *fget_associated_device(void *opaque,
        return NULL;
 }
 
-char *get_not_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           enum device_type not_desired_type)
+const char *get_not_associated_device(void *opaque,
+                                     const char *last_seek,
+                                     const enum device_type desired_type,
+                                     const enum device_type not_desired_type)
 {
        struct media_devices *md = opaque;
        struct media_device_entry *md_ptr = md->md_entry;
index f005a54..6ff1d59 100644 (file)
@@ -20,7 +20,7 @@
 /*
  * Version of the API
  */
-#define GET_MEDIA_DEVICES_VERSION      0x0104
+#define GET_MEDIA_DEVICES_VERSION      0x0105
 
 /**
  * enum device_type - Enumerates the type for each device
@@ -87,7 +87,7 @@ void free_media_devices(void *opaque);
  *
  * @type:      media device type
  */
-char *media_device_type(enum device_type type);
+const char *media_device_type(const enum device_type type);
 
 /**
  * display_media_devices() - prints a list of media devices
@@ -112,11 +112,11 @@ void display_media_devices(void *opaque);
  * the seek_device is NULL or seek_type is NONE, it will just search for
  * devices of the desired_type.
  */
-char *get_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           char *seek_device,
-                           enum device_type seek_type);
+const char *get_associated_device(void *opaque,
+                                 const char *last_seek,
+                                 const enum device_type desired_type,
+                                 const char *seek_device,
+                                 const enum device_type seek_type);
 
 /**
  * fget_associated_device() - Return the next device associated with another one
@@ -133,11 +133,11 @@ char *get_associated_device(void *opaque,
  * that it is associated with a seek parameter.
  * It can be used to get an alsa device associated with an open file descriptor
  */
-char *fget_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           int fd_seek_device,
-                           enum device_type seek_type);
+const char *fget_associated_device(void *opaque,
+                                  const char *last_seek,
+                                  const enum device_type desired_type,
+                                  const int fd_seek_device,
+                                  const enum device_type seek_type);
 
 /**
  * get_not_associated_device() - Return the next device not associated with
@@ -153,7 +153,7 @@ char *fget_associated_device(void *opaque,
  * This method is useful for example to return the audio devices that are
  * provided by the motherboard.
  */
-char *get_not_associated_device(void *opaque,
-                           char *last_seek,
-                           enum device_type desired_type,
-                           enum device_type not_desired_type);
+const char *get_not_associated_device(void *opaque,
+                                     const char *last_seek,
+                                     const enum device_type desired_type,
+                                     const enum device_type not_desired_type);
index 7579612..d204ad2 100644 (file)
 #include "../libmedia_dev/get_media_devices.h"
 #include <stdio.h>
 
-static void print_all_associated_devices(void *md, char *vid,
-                                        enum device_type type)
+static void print_all_associated_devices(void *md, const char *vid,
+                                        const enum device_type type)
 {
-       char *devname = NULL;
+       const char *devname = NULL;
        int first = 1;
 
        do {
@@ -51,7 +51,7 @@ static void print_all_associated_devices(void *md, char *vid,
 
 static void print_all_alsa_independent_playback(void *md)
 {
-       char *devname = NULL;
+       const char *devname = NULL;
        int first = 1;
 
        do {
@@ -73,7 +73,7 @@ static void print_all_alsa_independent_playback(void *md)
 int main(void)
 {
        void *md;
-       char *vid;
+       const char *vid;
        int i;
 
        md = discover_media_devices();