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

Submitted by Christophe de Dinechin on Feb. 21, 2018, 5:46 p.m.

Details

Message ID 20180221174636.37758-11-christophe@dinechin.org
State New
Headers show
Series "WIP: Refactor the streaming agent towards a more standard C++ style" ( rev: 2 ) in Spice

Not browsing as part of any series.

Commit Message

Christophe de Dinechin Feb. 21, 2018, 5:46 p.m.
From: Christophe de Dinechin <dinechin@redhat.com>

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

Patch hide | download patch | download mbox

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