From 0807ccea59cb4df03d2e99e6e9f56c09ec74d9c8 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Sat, 25 May 2019 08:27:17 +0100 Subject: [PATCH] cursor-channel-client: Move all public functions to methods Signed-off-by: Frediano Ziglio --- server/cursor-channel-client.cpp | 14 +++++++------- server/cursor-channel-client.h | 8 ++++---- server/cursor-channel.cpp | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/cursor-channel-client.cpp b/server/cursor-channel-client.cpp index 493563d0..8746fab8 100644 --- a/server/cursor-channel-client.cpp +++ b/server/cursor-channel-client.cpp @@ -50,14 +50,14 @@ struct CursorChannelClientPrivate static int _cursor_count = 0; #endif -void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc) +void CursorChannelClient::reset_cursor_cache() { - red_cursor_cache_reset(ccc, CLIENT_CURSOR_CACHE_SIZE); + red_cursor_cache_reset(this, CLIENT_CURSOR_CACHE_SIZE); } void CursorChannelClient::on_disconnect() { - cursor_channel_client_reset_cursor_cache(this); + reset_cursor_cache(); } void CursorChannelClient::migrate() @@ -91,12 +91,12 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient return rcc; } -RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id) +RedCacheItem* CursorChannelClient::cache_find(uint64_t id) { - return red_cursor_cache_find(ccc, id); + return red_cursor_cache_find(this, id); } -int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size) +int CursorChannelClient::cache_add(uint64_t id, size_t size) { - return red_cursor_cache_add(ccc, id, size); + return red_cursor_cache_add(this, id, size); } diff --git a/server/cursor-channel-client.h b/server/cursor-channel-client.h index ff208e86..c3f1935c 100644 --- a/server/cursor-channel-client.h +++ b/server/cursor-channel-client.h @@ -37,6 +37,10 @@ public: RedClient *client, RedStream *stream, RedChannelCapabilities *caps); + void reset_cursor_cache(); + RedCacheItem* cache_find(uint64_t id); + int cache_add(uint64_t id, size_t size); + protected: virtual void on_disconnect() override; void send_item(RedPipeItem *pipe_item) override; @@ -56,10 +60,6 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, int mig_target, RedChannelCapabilities *caps); -void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc); -RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id); -int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size); - enum { RED_PIPE_ITEM_TYPE_CURSOR = RED_PIPE_ITEM_TYPE_COMMON_LAST, RED_PIPE_ITEM_TYPE_CURSOR_INIT, diff --git a/server/cursor-channel.cpp b/server/cursor-channel.cpp index d55d3923..2b2e0cf0 100644 --- a/server/cursor-channel.cpp +++ b/server/cursor-channel.cpp @@ -95,11 +95,11 @@ static void cursor_fill(CursorChannelClient *ccc, RedCursorPipeItem *cursor, *red_cursor = cursor_cmd->u.set.shape; if (red_cursor->header.unique) { - if (cursor_channel_client_cache_find(ccc, red_cursor->header.unique)) { + if (ccc->cache_find(red_cursor->header.unique)) { red_cursor->flags |= SPICE_CURSOR_FLAGS_FROM_CACHE; return; } - if (cursor_channel_client_cache_add(ccc, red_cursor->header.unique, 1)) { + if (ccc->cache_add(red_cursor->header.unique, 1)) { red_cursor->flags |= SPICE_CURSOR_FLAGS_CACHE_ME; } } @@ -206,12 +206,12 @@ void CursorChannelClient::send_item(RedPipeItem *pipe_item) red_marshall_inval(this, m, SPICE_CONTAINEROF(pipe_item, RedCacheItem, u.pipe_data)); break; case RED_PIPE_ITEM_TYPE_CURSOR_INIT: - cursor_channel_client_reset_cursor_cache(ccc); - red_marshall_cursor_init(ccc, m); + reset_cursor_cache(); + red_marshall_cursor_init(this, m); break; case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE: - cursor_channel_client_reset_cursor_cache(ccc); - ccc->init_send_data(SPICE_MSG_CURSOR_INVAL_ALL); + reset_cursor_cache(); + init_send_data(SPICE_MSG_CURSOR_INVAL_ALL); break; default: spice_error("invalid pipe item type");