[Spice-devel] [PATCH v2 10/24] Since we use a namespace, simplify name of local classes

Christophe de Dinechin christophe at dinechin.org
Wed Feb 21 17:46:22 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 src/spice-streaming-agent.cpp | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index dbdc0e2..3c4fb67 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -45,19 +45,24 @@ static size_t write_all(int fd, const void *buf, const size_t len);
 
 static ConcreteAgent agent;
 
-struct SpiceStreamFormatMessage
+namespace spice
+{
+namespace streaming_agent
+{
+
+struct FormatMessage
 {
     StreamDevHeader hdr;
     StreamMsgFormat msg;
 };
 
-struct SpiceStreamDataMessage
+struct DataMessage
 {
     StreamDevHeader hdr;
     StreamMsgData msg;
 };
 
-struct SpiceStreamCursorMessage
+struct CursorMessage
 {
     StreamDevHeader hdr;
     StreamMsgCursorSet msg;
@@ -82,6 +87,9 @@ private:
     int fd = -1;
 };
 
+}} // namespace spice::streaming_agent
+
+
 static bool streaming_requested = false;
 static bool quit_requested = false;
 static bool log_binary = false;
@@ -223,9 +231,9 @@ write_all(int fd, const void *buf, const size_t len)
 
 static int spice_stream_send_format(int streamfd, unsigned w, unsigned h, uint8_t c)
 {
-    const size_t msgsize = sizeof(SpiceStreamFormatMessage);
+    const size_t msgsize = sizeof(FormatMessage);
     const size_t hdrsize  = sizeof(StreamDevHeader);
-    SpiceStreamFormatMessage msg = {
+    FormatMessage msg = {
         .hdr = {
             .protocol_version = STREAM_DEVICE_PROTOCOL,
             .padding = 0,       // Workaround GCC "not implemented" bug
@@ -250,8 +258,8 @@ static int spice_stream_send_format(int streamfd, unsigned w, unsigned h, uint8_
 static int spice_stream_send_frame(int streamfd, const void *buf, const unsigned size)
 {
     ssize_t n;
-    const size_t msgsize = sizeof(SpiceStreamFormatMessage);
-    SpiceStreamDataMessage msg = {
+    const size_t msgsize = sizeof(FormatMessage);
+    DataMessage msg = {
         .hdr = {
             .protocol_version = STREAM_DEVICE_PROTOCOL,
             .padding = 0,       // Workaround GCC "not implemented" bug
@@ -335,13 +343,13 @@ send_cursor(int streamfd,
         return;
 
     const uint32_t cursor_msgsize =
-        sizeof(SpiceStreamCursorMessage) + width * height * sizeof(uint32_t);
+        sizeof(CursorMessage) + width * height * sizeof(uint32_t);
     const uint32_t hdrsize  = sizeof(StreamDevHeader);
 
     std::unique_ptr<uint8_t[]> storage(new uint8_t[cursor_msgsize]);
 
-    SpiceStreamCursorMessage *cursor_msg =
-        new(storage.get()) SpiceStreamCursorMessage {
+    CursorMessage *cursor_msg =
+        new(storage.get()) CursorMessage {
         .hdr = {
             .protocol_version = STREAM_DEVICE_PROTOCOL,
             .padding = 0,       // Workaround GCC internal / not implemented compiler error
-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list