[Spice-devel] [PATCH spice-server 1/3] red-stream-device: Constify stream_device_get_device_display_info result

Frediano Ziglio fziglio at redhat.com
Mon Feb 4 14:27:51 UTC 2019


There should be no reason for the caller to modify the internal
structure.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-stream-device.c | 2 +-
 server/red-stream-device.h | 2 +-
 server/reds.c              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 2a210cc7..70829fbf 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -807,7 +807,7 @@ stream_device_init(StreamDevice *dev)
     dev->msg_len = sizeof(*dev->msg);
 }
 
-StreamDeviceDisplayInfo *stream_device_get_device_display_info(StreamDevice *dev)
+const StreamDeviceDisplayInfo *stream_device_get_device_display_info(StreamDevice *dev)
 {
     return &dev->device_display_info;
 }
diff --git a/server/red-stream-device.h b/server/red-stream-device.h
index d7ab5e41..aa2b23a2 100644
--- a/server/red-stream-device.h
+++ b/server/red-stream-device.h
@@ -56,7 +56,7 @@ StreamDevice *stream_device_connect(RedsState *reds, SpiceCharDeviceInstance *si
  */
 void stream_device_create_channel(StreamDevice *dev);
 
-StreamDeviceDisplayInfo *stream_device_get_device_display_info(StreamDevice *dev);
+const StreamDeviceDisplayInfo *stream_device_get_device_display_info(StreamDevice *dev);
 
 /**
  * Returns -1 if the StreamDevice doesn't have a channel yet.
diff --git a/server/reds.c b/server/reds.c
index 87715c48..24047bda 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -978,7 +978,7 @@ void reds_send_device_display_info(RedsState *reds)
     GLIST_FOREACH(reds->char_devices, RedCharDevice, dev) {
         if (IS_STREAM_DEVICE(dev)) {
             StreamDevice *stream_dev = STREAM_DEVICE(dev);
-            StreamDeviceDisplayInfo *info = stream_device_get_device_display_info(stream_dev);
+            const StreamDeviceDisplayInfo *info = stream_device_get_device_display_info(stream_dev);
             size_t device_address_len = strlen(info->device_address);
 
             if (device_address_len == 0) {
-- 
2.20.1



More information about the Spice-devel mailing list