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

Christophe de Dinechin christophe at dinechin.org
Fri Feb 16 16:15:40 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 f845bd0..f0d79ae 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -43,19 +43,24 @@ using namespace spice::streaming_agent;
 
 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;
@@ -80,6 +85,9 @@ private:
     int fd = -1;
 };
 
+}} // namespace spice::streaming_agent
+
+
 static bool streaming_requested = false;
 static bool quit_requested = false;
 static bool log_binary = false;
@@ -185,9 +193,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
@@ -212,8 +220,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
@@ -297,13 +305,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