[Spice-commits] server/dcc.h server/inputs-channel.h server/jpeg-encoder.h server/main-channel-client.cpp server/main-channel-client.h server/main-channel.h server/red-parse-qxl.h server/sound.cpp server/spice-audio.h server/spice-char.h server/spice-qxl.h server/stat-file.h server/stream-channel.h server/tests server/websocket.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun May 9 11:23:15 UTC 2021


 server/dcc.h                     |    2 -
 server/inputs-channel.h          |    2 -
 server/jpeg-encoder.h            |    2 -
 server/main-channel-client.cpp   |   42 +++++++++++++++++++--------------------
 server/main-channel-client.h     |    2 -
 server/main-channel.h            |   10 ++++-----
 server/red-parse-qxl.h           |    4 +--
 server/sound.cpp                 |   13 ++++++------
 server/spice-audio.h             |    2 -
 server/spice-char.h              |    2 -
 server/spice-qxl.h               |    4 +--
 server/stat-file.h               |    2 -
 server/stream-channel.h          |    2 -
 server/tests/test-display-base.h |    4 +--
 server/websocket.c               |    8 +++----
 15 files changed, 51 insertions(+), 50 deletions(-)

New commits:
commit 9462537d24abc3693c561df30b43b8a09c9bc639
Author: Rosen Penev <rosenp at gmail.com>
Date:   Sat May 8 15:10:46 2021 -0700

    clang-tidy: fix inconsistent declarations
    
    Found with readability-inconsistent-declaration-parameter-name
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Acked-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/server/dcc.h b/server/dcc.h
index 8e463239..19005579 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -46,7 +46,7 @@ public:
     virtual void disconnect() override;
 
 protected:
-    virtual bool handle_message(uint16_t type, uint32_t size, void *message) override;
+    virtual bool handle_message(uint16_t type, uint32_t size, void *msg) override;
     virtual bool config_socket() override;
     virtual void on_disconnect() override;
     virtual void send_item(RedPipeItem *item) override;
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index 3f78f304..d8093ef9 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -76,7 +76,7 @@ private:
 
 red::shared_ptr<InputsChannel> inputs_channel_new(RedsState *reds);
 
-RedsState* spice_tablet_state_get_server(SpiceTabletState *dev);
+RedsState *spice_tablet_state_get_server(SpiceTabletState *st);
 
 #include "pop-visibility.h"
 
diff --git a/server/jpeg-encoder.h b/server/jpeg-encoder.h
index da24cb0f..4d1a5ee9 100644
--- a/server/jpeg-encoder.h
+++ b/server/jpeg-encoder.h
@@ -57,7 +57,7 @@ void jpeg_encoder_destroy(JpegEncoderContext *encoder);
 
 /* returns the total size of the encoded data. Images must be supplied from the
    top line to the bottom */
-int jpeg_encode(JpegEncoderContext *jpeg, int quality, JpegEncoderImageType type,
+int jpeg_encode(JpegEncoderContext *enc, int quality, JpegEncoderImageType type,
                 int width, int height, uint8_t *lines, unsigned int num_lines, int stride,
                 uint8_t *io_ptr, unsigned int num_io_bytes);
 
diff --git a/server/main-channel-client.cpp b/server/main-channel-client.cpp
index 4c6b845b..c922ee5c 100644
--- a/server/main-channel-client.cpp
+++ b/server/main-channel-client.cpp
@@ -775,7 +775,7 @@ static void main_channel_marshall_registered_channel(RedChannelClient *rcc,
     spice_marshall_msg_main_channels_list(m, channels_info);
 }
 
-void MainChannelClient::send_item(RedPipeItem *base)
+void MainChannelClient::send_item(RedPipeItem *item)
 {
     SpiceMarshaller *m = get_marshaller();
 
@@ -785,72 +785,72 @@ void MainChannelClient::send_item(RedPipeItem *base)
      * it stopped on the src side. */
     if (!priv->init_sent &&
         !priv->seamless_mig_dst &&
-        base->type != RED_PIPE_ITEM_TYPE_MAIN_INIT) {
+        item->type != RED_PIPE_ITEM_TYPE_MAIN_INIT) {
         red_channel_warning(get_channel(),
                             "Init msg for client %p was not sent yet "
                             "(client is probably during semi-seamless migration). Ignoring msg type %d",
-                            get_client(), base->type);
+                            get_client(), item->type);
         return;
     }
-    switch (base->type) {
+    switch (item->type) {
         case RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST:
-            main_channel_marshall_channels(this, m, base);
+            main_channel_marshall_channels(this, m, item);
             priv->initial_channels_list_sent = true;
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_PING:
             main_channel_marshall_ping(this, m,
-                static_cast<RedPingPipeItem*>(base));
+                static_cast<RedPingPipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MOUSE_MODE:
             main_channel_marshall_mouse_mode(this, m,
-                static_cast<RedMouseModePipeItem*>(base));
+                static_cast<RedMouseModePipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED:
-            main_channel_marshall_agent_disconnected(this, m, base);
+            main_channel_marshall_agent_disconnected(this, m, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN:
             main_channel_marshall_tokens(this, m,
-                static_cast<RedTokensPipeItem*>(base));
+                static_cast<RedTokensPipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA:
             main_channel_marshall_agent_data(this, m,
-                static_cast<RedAgentDataPipeItem*>(base));
+                static_cast<RedAgentDataPipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA:
-            main_channel_marshall_migrate_data_item(this, m, base);
+            main_channel_marshall_migrate_data_item(this, m, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_INIT:
             priv->init_sent = TRUE;
             main_channel_marshall_init(this, m,
-                static_cast<RedInitPipeItem*>(base));
+                static_cast<RedInitPipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_NOTIFY:
             main_channel_marshall_notify(this, m,
-                static_cast<RedNotifyPipeItem*>(base));
+                static_cast<RedNotifyPipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN:
-            main_channel_marshall_migrate_begin(m, this, base);
+            main_channel_marshall_migrate_begin(m, this, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS:
-            main_channel_marshall_migrate_begin_seamless(m, this, base);
+            main_channel_marshall_migrate_begin_seamless(m, this, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME:
             main_channel_marshall_multi_media_time(this, m,
-                static_cast<RedMultiMediaTimePipeItem*>(base));
+                static_cast<RedMultiMediaTimePipeItem*>(item));
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST:
-            main_channel_marshall_migrate_switch(m, this, base);
+            main_channel_marshall_migrate_switch(m, this, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_NAME:
             init_send_data(SPICE_MSG_MAIN_NAME);
-            spice_marshall_msg_main_name(m, &static_cast<RedNamePipeItem*>(base)->msg);
+            spice_marshall_msg_main_name(m, &static_cast<RedNamePipeItem*>(item)->msg);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_UUID:
             init_send_data(SPICE_MSG_MAIN_UUID);
-            spice_marshall_msg_main_uuid(m, &static_cast<RedUuidPipeItem*>(base)->msg);
+            spice_marshall_msg_main_uuid(m, &static_cast<RedUuidPipeItem*>(item)->msg);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS:
-            main_channel_marshall_agent_connected(m, this, base);
+            main_channel_marshall_agent_connected(m, this, item);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_REGISTERED_CHANNEL:
             /* The spice protocol requires that the server receive a ATTACH_CHANNELS
@@ -861,7 +861,7 @@ void MainChannelClient::send_item(RedPipeItem *base)
                 return;
             }
             main_channel_marshall_registered_channel(this, m,
-                static_cast<RedRegisteredChannelPipeItem*>(base));
+                static_cast<RedRegisteredChannelPipeItem*>(item));
             break;
         default:
             break;
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index 56401a8b..0ea2286c 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -26,7 +26,7 @@
 
 #include "push-visibility.h"
 
-class MainChannelClientPrivate;
+struct MainChannelClientPrivate;
 
 MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
                                               RedStream *stream, uint32_t connection_id,
diff --git a/server/main-channel.h b/server/main-channel.h
index aa434466..0d46dedd 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -42,14 +42,14 @@ struct MainChannel;
 
 red::shared_ptr<MainChannel> main_channel_new(RedsState *reds);
 
-/* This is a 'clone' from the reds.h Channel.link callback to allow passing link_id */
-MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
-     RedStream *stream, uint32_t link_id, int migration,
-     RedChannelCapabilities *caps);
+/* This is a 'clone' from the reds.h Channel.link callback to allow passing connect_id */
+MainChannelClient *main_channel_link(MainChannel *, RedClient *client, RedStream *stream,
+                                     uint32_t connection_id, int migration,
+                                     RedChannelCapabilities *caps);
 
 struct MainChannel final: public RedChannel
 {
-    RedClient *get_client_by_link_id(uint32_t link_id);
+    RedClient *get_client_by_link_id(uint32_t connection_id);
     void push_mouse_mode(SpiceMouseMode current_mode, int is_client_mouse_allowed);
     void push_agent_connected();
     void push_agent_disconnected();
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index c251864e..c7206516 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -145,8 +145,8 @@ void red_surface_cmd_unref(RedSurfaceCmd *cmd);
 
 RedCursorCmd *red_cursor_cmd_new(QXLInstance *qxl, RedMemSlotInfo *slots,
                                  int group_id, QXLPHYSICAL addr);
-RedCursorCmd *red_cursor_cmd_ref(RedCursorCmd *cmd);
-void red_cursor_cmd_unref(RedCursorCmd *cmd);
+RedCursorCmd *red_cursor_cmd_ref(RedCursorCmd *red);
+void red_cursor_cmd_unref(RedCursorCmd *red);
 
 SPICE_END_DECLS
 
diff --git a/server/sound.cpp b/server/sound.cpp
index 0c930191..68b890c8 100644
--- a/server/sound.cpp
+++ b/server/sound.cpp
@@ -68,10 +68,10 @@ enum PlaybackCommand {
 #define SND_PLAYBACK_PCM_MASK (1 << SND_PLAYBACK_PCM)
 #define SND_PLAYBACK_LATENCY_MASK ( 1 << SND_PLAYBACK_LATENCY)
 
-struct SndChannelClient;
+class SndChannelClient;
 struct SndChannel;
-struct PlaybackChannelClient;
-struct RecordChannelClient;
+class PlaybackChannelClient;
+class RecordChannelClient;
 struct AudioFrame;
 struct AudioFrameContainer;
 
@@ -883,11 +883,12 @@ SPICE_GNUC_VISIBLE void spice_server_playback_stop(SpicePlaybackInstance *sin)
 }
 
 SPICE_GNUC_VISIBLE void spice_server_playback_get_buffer(SpicePlaybackInstance *sin,
-                                                         uint32_t **frame, uint32_t *num_samples)
+                                                         uint32_t **samples,
+                                                         uint32_t *num_samples)
 {
     SndChannelClient *client = snd_channel_get_client(sin->st);
 
-    *frame = nullptr;
+    *samples = nullptr;
     *num_samples = 0;
     if (!client) {
         return;
@@ -902,7 +903,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_get_buffer(SpicePlaybackInstance *
         ++playback_client->frames->refs;
     }
 
-    *frame = playback_client->free_frames->samples;
+    *samples = playback_client->free_frames->samples;
     playback_client->free_frames = playback_client->free_frames->next;
     *num_samples = snd_codec_frame_size(playback_client->codec);
 }
diff --git a/server/spice-audio.h b/server/spice-audio.h
index 9da59b15..f542c88a 100644
--- a/server/spice-audio.h
+++ b/server/spice-audio.h
@@ -55,7 +55,7 @@ struct SpicePlaybackInstance {
 void spice_server_playback_start(SpicePlaybackInstance *sin);
 void spice_server_playback_stop(SpicePlaybackInstance *sin);
 void spice_server_playback_get_buffer(SpicePlaybackInstance *sin,
-                                      uint32_t **samples, uint32_t *nsamples);
+                                      uint32_t **samples, uint32_t *num_samples);
 void spice_server_playback_put_samples(SpicePlaybackInstance *sin,
                                        uint32_t *samples);
 void spice_server_playback_set_volume(SpicePlaybackInstance *sin,
diff --git a/server/spice-char.h b/server/spice-char.h
index 18117f0c..51dab055 100644
--- a/server/spice-char.h
+++ b/server/spice-char.h
@@ -83,7 +83,7 @@ struct SpiceCharDeviceInstance {
 };
 
 void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
-void spice_server_port_event(SpiceCharDeviceInstance *char_device, uint8_t event);
+void spice_server_port_event(SpiceCharDeviceInstance *sin, uint8_t event);
 /* TODO change return to const char *const * when API break */
 const char** spice_server_char_device_recognized_subtypes(void);
 
diff --git a/server/spice-qxl.h b/server/spice-qxl.h
index 01882b82..bf17476b 100644
--- a/server/spice-qxl.h
+++ b/server/spice-qxl.h
@@ -83,12 +83,12 @@ void spice_qxl_driver_unload(QXLInstance *instance);
 void spice_qxl_set_max_monitors(QXLInstance *instance,
                                 unsigned int max_monitors) SPICE_GNUC_DEPRECATED;
 /* since spice 0.13.1 */
-void spice_qxl_gl_scanout(QXLInstance *instance,
+void spice_qxl_gl_scanout(QXLInstance *qxl,
                           int fd,
                           uint32_t width, uint32_t height,
                           uint32_t stride, uint32_t format,
                           int y_0_top);
-void spice_qxl_gl_draw_async(QXLInstance *instance,
+void spice_qxl_gl_draw_async(QXLInstance *qxl,
                              uint32_t x, uint32_t y,
                              uint32_t w, uint32_t h,
                              uint64_t cookie);
diff --git a/server/stat-file.h b/server/stat-file.h
index 9e93cbff..709e41c1 100644
--- a/server/stat-file.h
+++ b/server/stat-file.h
@@ -30,7 +30,7 @@ typedef struct RedStatFile RedStatFile;
 
 RedStatFile *stat_file_new(unsigned int max_nodes);
 void stat_file_free(RedStatFile *stat_file);
-void stat_file_unlink(RedStatFile *file_stat);
+void stat_file_unlink(RedStatFile *stat_file);
 const char *stat_file_get_shm_name(RedStatFile *stat_file);
 StatNodeRef stat_file_add_node(RedStatFile *stat_file, StatNodeRef parent,
                                const char *name, int visible);
diff --git a/server/stream-channel.h b/server/stream-channel.h
index 9a65460f..5ebf374f 100644
--- a/server/stream-channel.h
+++ b/server/stream-channel.h
@@ -51,7 +51,7 @@ typedef void (*stream_channel_queue_stat_proc)(void *opaque, const StreamQueueSt
                                                StreamChannel *channel);
 
 struct StreamDataItem;
-struct StreamChannelClient;
+class StreamChannelClient;
 struct StreamChannel final: public RedChannel
 {
     friend struct StreamChannelClient;
diff --git a/server/tests/test-display-base.h b/server/tests/test-display-base.h
index 2bce1e22..4e865093 100644
--- a/server/tests/test-display-base.h
+++ b/server/tests/test-display-base.h
@@ -131,8 +131,8 @@ struct Test {
     void (*on_client_disconnected)(Test *test);
 };
 
-void test_set_simple_command_list(Test *test, const int *command, int num_commands);
-void test_set_command_list(Test *test, Command *command, int num_commands);
+void test_set_simple_command_list(Test *test, const int *simple_commands, int num_commands);
+void test_set_command_list(Test *test, Command *new_commands, int num_commands);
 void test_add_display_interface(Test *test);
 void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
 Test* test_new(SpiceCoreInterface* core);
diff --git a/server/websocket.c b/server/websocket.c
index f9b9ea32..5813bd56 100644
--- a/server/websocket.c
+++ b/server/websocket.c
@@ -326,7 +326,7 @@ static void relay_data(uint8_t* buf, size_t size, websocket_frame_t *frame)
     }
 }
 
-int websocket_read(RedsWebSocket *ws, uint8_t *buf, size_t size, unsigned *flags)
+int websocket_read(RedsWebSocket *ws, uint8_t *buf, size_t len, unsigned *flags)
 {
     int n = 0;
     int rc;
@@ -342,7 +342,7 @@ int websocket_read(RedsWebSocket *ws, uint8_t *buf, size_t size, unsigned *flags
         return 0;
     }
 
-    while (size > 0) {
+    while (len > 0) {
         // make sure we have a proper frame ready
         if (!frame->frame_ready) {
             rc = ws->raw_read(ws->raw_stream, frame->header + frame->header_pos,
@@ -375,7 +375,7 @@ int websocket_read(RedsWebSocket *ws, uint8_t *buf, size_t size, unsigned *flags
             rc = 0;
             if (frame->expected_len > frame->relayed) {
                 rc = ws->raw_read(ws->raw_stream, buf,
-                                  MIN(size, frame->expected_len - frame->relayed));
+                                  MIN(len, frame->expected_len - frame->relayed));
                 if (rc <= 0) {
                     goto read_error;
                 }
@@ -383,7 +383,7 @@ int websocket_read(RedsWebSocket *ws, uint8_t *buf, size_t size, unsigned *flags
                 relay_data(buf, rc, frame);
                 n += rc;
                 buf += rc;
-                size -= rc;
+                len -= rc;
             }
 
             *flags = frame->type;


More information about the Spice-commits mailing list