[Spice-devel] [PATCH 2/3] Fix 'recive' typo throughout the code base

Christophe Fergeau cfergeau at redhat.com
Tue Oct 8 12:37:36 CEST 2013


'receive' was mispelt 'recive' in multiple places.
---
 server/red_worker.c   |  8 +++---
 server/reds-private.h |  6 ++---
 server/reds.c         | 72 +++++++++++++++++++++++++--------------------------
 server/snd_worker.c   | 40 ++++++++++++++--------------
 4 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 451c8ab..afbdd91 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -383,7 +383,7 @@ typedef struct LocalCursor {
 } LocalCursor;
 
 #define MAX_PIPE_SIZE 50
-#define CHANNEL_RECIVE_BUF_SIZE 1024
+#define CHANNEL_RECEIVE_BUF_SIZE 1024
 
 #define WIDE_CLIENT_ACK_WINDOW 40
 #define NARROW_CLIENT_ACK_WINDOW 20
@@ -654,7 +654,7 @@ typedef struct GlzSharedDictionary {
 typedef struct CommonChannel {
     RedChannel base; // Must be the first thing
     struct RedWorker *worker;
-    uint8_t recv_buf[CHANNEL_RECIVE_BUF_SIZE];
+    uint8_t recv_buf[CHANNEL_RECEIVE_BUF_SIZE];
     uint32_t id_alloc; // bitfield. TODO - use this instead of shift scheme.
     int during_target_migrate; /* TRUE when the client that is associated with the channel
                                   is during migration. Turned off when the vm is started.
@@ -1591,8 +1591,8 @@ static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint
         return spice_malloc(size);
     }
 
-    if (size > CHANNEL_RECIVE_BUF_SIZE) {
-        spice_critical("unexpected message size %u (max is %d)", size, CHANNEL_RECIVE_BUF_SIZE);
+    if (size > CHANNEL_RECEIVE_BUF_SIZE) {
+        spice_critical("unexpected message size %u (max is %d)", size, CHANNEL_RECEIVE_BUF_SIZE);
         return NULL;
     }
     return common->recv_buf;
diff --git a/server/reds-private.h b/server/reds-private.h
index 9d8b5d1..a33a1d7 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -57,9 +57,9 @@ typedef struct VDIPortState {
     /* read from agent */
     Ring read_bufs;
     uint32_t read_state;
-    uint32_t message_recive_len;
-    uint8_t *recive_pos;
-    uint32_t recive_len;
+    uint32_t message_receive_len;
+    uint8_t *receive_pos;
+    uint32_t receive_len;
     VDIReadBuf *current_read_buf;
     AgentMsgFilter read_filter;
 
diff --git a/server/reds.c b/server/reds.c
index 18743a3..dd1bd68 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -476,9 +476,9 @@ static void reds_reset_vdp(void)
     SpiceCharDeviceInterface *sif;
 
     state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
-    state->recive_pos = (uint8_t *)&state->vdi_chunk_header;
-    state->recive_len = sizeof(state->vdi_chunk_header);
-    state->message_recive_len = 0;
+    state->receive_pos = (uint8_t *)&state->vdi_chunk_header;
+    state->receive_len = sizeof(state->vdi_chunk_header);
+    state->message_receive_len = 0;
     if (state->current_read_buf) {
         vdi_port_read_buf_unref(state->current_read_buf);
         state->current_read_buf = NULL;
@@ -786,43 +786,43 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
     while (vdagent) {
         switch (state->read_state) {
         case VDI_PORT_READ_STATE_READ_HEADER:
-            n = sif->read(vdagent, state->recive_pos, state->recive_len);
+            n = sif->read(vdagent, state->receive_pos, state->receive_len);
             if (!n) {
                 return NULL;
             }
-            if ((state->recive_len -= n)) {
-                state->recive_pos += n;
+            if ((state->receive_len -= n)) {
+                state->receive_pos += n;
                 return NULL;
             }
-            state->message_recive_len = state->vdi_chunk_header.size;
+            state->message_receive_len = state->vdi_chunk_header.size;
             state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
         case VDI_PORT_READ_STATE_GET_BUFF: {
             if (!(state->current_read_buf = vdi_port_read_buf_get())) {
                 return NULL;
             }
-            state->recive_pos = state->current_read_buf->data;
-            state->recive_len = MIN(state->message_recive_len,
+            state->receive_pos = state->current_read_buf->data;
+            state->receive_len = MIN(state->message_receive_len,
                                     sizeof(state->current_read_buf->data));
-            state->current_read_buf->len = state->recive_len;
-            state->message_recive_len -= state->recive_len;
+            state->current_read_buf->len = state->receive_len;
+            state->message_receive_len -= state->receive_len;
             state->read_state = VDI_PORT_READ_STATE_READ_DATA;
         }
         case VDI_PORT_READ_STATE_READ_DATA:
-            n = sif->read(vdagent, state->recive_pos, state->recive_len);
+            n = sif->read(vdagent, state->receive_pos, state->receive_len);
             if (!n) {
                 return NULL;
             }
-            if ((state->recive_len -= n)) {
-                state->recive_pos += n;
+            if ((state->receive_len -= n)) {
+                state->receive_pos += n;
                 break;
             }
             dispatch_buf = state->current_read_buf;
             state->current_read_buf = NULL;
-            state->recive_pos = NULL;
-            if (state->message_recive_len == 0) {
+            state->receive_pos = NULL;
+            if (state->message_receive_len == 0) {
                 state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
-                state->recive_pos = (uint8_t *)&state->vdi_chunk_header;
-                state->recive_len = sizeof(state->vdi_chunk_header);
+                state->receive_pos = (uint8_t *)&state->vdi_chunk_header;
+                state->receive_len = sizeof(state->vdi_chunk_header);
             } else {
                 state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
             }
@@ -1183,8 +1183,8 @@ void reds_on_main_channel_migrate(MainChannelClient *mcc)
         return;
     }
     spice_assert(agent_state->current_read_buf->data &&
-                 agent_state->recive_pos > agent_state->current_read_buf->data);
-    read_data_len = agent_state->recive_pos - agent_state->current_read_buf->data;
+                 agent_state->receive_pos > agent_state->current_read_buf->data);
+    read_data_len = agent_state->receive_pos - agent_state->current_read_buf->data;
 
     if (agent_state->read_filter.msg_data_to_read ||
         read_data_len > sizeof(VDAgentMessage)) { /* msg header has been read */
@@ -1204,11 +1204,11 @@ void reds_on_main_channel_migrate(MainChannelClient *mcc)
             vdi_port_read_buf_unref(read_buf);
         }
 
-        spice_assert(agent_state->recive_len);
-        agent_state->message_recive_len += agent_state->recive_len;
+        spice_assert(agent_state->receive_len);
+        agent_state->message_receive_len += agent_state->receive_len;
         agent_state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
         agent_state->current_read_buf = NULL;
-        agent_state->recive_pos = NULL;
+        agent_state->receive_pos = NULL;
     }
 }
 
@@ -1247,7 +1247,7 @@ void reds_marshall_migrate_data(SpiceMarshaller *m)
 
     /* agent to client partial msg */
     if (agent_state->read_state == VDI_PORT_READ_STATE_READ_HEADER) {
-        mig_data.agent2client.chunk_header_size = agent_state->recive_pos -
+        mig_data.agent2client.chunk_header_size = agent_state->receive_pos -
             (uint8_t *)&agent_state->vdi_chunk_header;
 
         mig_data.agent2client.msg_header_done = FALSE;
@@ -1255,12 +1255,12 @@ void reds_marshall_migrate_data(SpiceMarshaller *m)
         spice_assert(!agent_state->read_filter.msg_data_to_read);
     } else {
         mig_data.agent2client.chunk_header_size = sizeof(VDIChunkHeader);
-        mig_data.agent2client.chunk_header.size = agent_state->message_recive_len;
+        mig_data.agent2client.chunk_header.size = agent_state->message_receive_len;
         if (agent_state->read_state == VDI_PORT_READ_STATE_READ_DATA) {
             /* in the middle of reading the message header (see reds_on_main_channel_migrate) */
             mig_data.agent2client.msg_header_done = FALSE;
             mig_data.agent2client.msg_header_partial_len =
-                agent_state->recive_pos - agent_state->current_read_buf->data;
+                agent_state->receive_pos - agent_state->current_read_buf->data;
             spice_assert(mig_data.agent2client.msg_header_partial_len < sizeof(VDAgentMessage));
             spice_assert(!agent_state->read_filter.msg_data_to_read);
         } else {
@@ -1305,11 +1305,11 @@ static int reds_agent_state_restore(SpiceMigrateDataMain *mig_data)
     chunk_header_remaining = sizeof(VDIChunkHeader) - mig_data->agent2client.chunk_header_size;
     if (chunk_header_remaining) {
         agent_state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
-        agent_state->recive_pos = (uint8_t *)&agent_state->vdi_chunk_header +
+        agent_state->receive_pos = (uint8_t *)&agent_state->vdi_chunk_header +
             mig_data->agent2client.chunk_header_size;
-        agent_state->recive_len = chunk_header_remaining;
+        agent_state->receive_len = chunk_header_remaining;
     } else {
-        agent_state->message_recive_len = agent_state->vdi_chunk_header.size;
+        agent_state->message_receive_len = agent_state->vdi_chunk_header.size;
     }
 
     if (!mig_data->agent2client.msg_header_done) {
@@ -1326,21 +1326,21 @@ static int reds_agent_state_restore(SpiceMigrateDataMain *mig_data)
             memcpy(agent_state->current_read_buf->data,
                    partial_msg_header,
                    mig_data->agent2client.msg_header_partial_len);
-            agent_state->recive_pos = agent_state->current_read_buf->data +
+            agent_state->receive_pos = agent_state->current_read_buf->data +
                                       mig_data->agent2client.msg_header_partial_len;
             cur_buf_size = sizeof(agent_state->current_read_buf->data) -
                            mig_data->agent2client.msg_header_partial_len;
-            agent_state->recive_len = MIN(agent_state->message_recive_len, cur_buf_size);
-            agent_state->current_read_buf->len = agent_state->recive_len +
+            agent_state->receive_len = MIN(agent_state->message_receive_len, cur_buf_size);
+            agent_state->current_read_buf->len = agent_state->receive_len +
                                                  mig_data->agent2client.msg_header_partial_len;
-            agent_state->message_recive_len -= agent_state->recive_len;
+            agent_state->message_receive_len -= agent_state->receive_len;
         } else {
             spice_assert(mig_data->agent2client.msg_header_partial_len == 0);
         }
     } else {
             agent_state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
             agent_state->current_read_buf = NULL;
-            agent_state->recive_pos = NULL;
+            agent_state->receive_pos = NULL;
             agent_state->read_filter.msg_data_to_read = mig_data->agent2client.msg_remaining;
             agent_state->read_filter.result = mig_data->agent2client.msg_filter_result;
     }
@@ -3888,8 +3888,8 @@ static void init_vd_agent_resources(void)
                           agent_file_xfer, TRUE);
 
     state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
-    state->recive_pos = (uint8_t *)&state->vdi_chunk_header;
-    state->recive_len = sizeof(state->vdi_chunk_header);
+    state->receive_pos = (uint8_t *)&state->vdi_chunk_header;
+    state->receive_len = sizeof(state->vdi_chunk_header);
 
     for (i = 0; i < REDS_VDI_PORT_NUM_RECEIVE_BUFFS; i++) {
         VDIReadBuf *buf = spice_new0(VDIReadBuf, 1);
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 19171e3..5346d96 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -42,7 +42,7 @@
 #define IOV_MAX 1024
 #endif
 
-#define SND_RECIVE_BUF_SIZE (16 * 1024 * 2)
+#define SND_RECEIVE_BUF_SIZE (16 * 1024 * 2)
 
 #define FRAME_SIZE 256
 #define PLAYBACK_BUF_SIZE (FRAME_SIZE * 4)
@@ -50,7 +50,7 @@
 #define CELT_BIT_RATE (64 * 1024)
 #define CELT_COMPRESSED_FRAME_BYTES (FRAME_SIZE * CELT_BIT_RATE / SPICE_INTERFACE_PLAYBACK_FREQ / 8)
 
-#define RECORD_SAMPLES_SIZE (SND_RECIVE_BUF_SIZE >> 2)
+#define RECORD_SAMPLES_SIZE (SND_RECEIVE_BUF_SIZE >> 2)
 
 enum PlaybackeCommand {
     SND_PLAYBACK_MIGRATE,
@@ -112,11 +112,11 @@ struct SndChannel {
     } send_data;
 
     struct {
-        uint8_t buf[SND_RECIVE_BUF_SIZE];
+        uint8_t buf[SND_RECEIVE_BUF_SIZE];
         uint8_t *message_start;
         uint8_t *now;
         uint8_t *end;
-    } recive_data;
+    } receive_data;
 
     snd_channel_send_messages_proc send_messages;
     snd_channel_handle_message_proc handle_message;
@@ -420,9 +420,9 @@ static void snd_receive(void* data)
 
     for (;;) {
         ssize_t n;
-        n = channel->recive_data.end - channel->recive_data.now;
+        n = channel->receive_data.end - channel->receive_data.now;
         spice_assert(n);
-        n = reds_stream_read(channel->stream, channel->recive_data.now, n);
+        n = reds_stream_read(channel->stream, channel->receive_data.now, n);
         if (n <= 0) {
             if (n == 0) {
                 snd_disconnect_channel(channel);
@@ -443,16 +443,16 @@ static void snd_receive(void* data)
                 return;
             }
         } else {
-            channel->recive_data.now += n;
+            channel->receive_data.now += n;
             for (;;) {
-                uint8_t *msg_start = channel->recive_data.message_start;
+                uint8_t *msg_start = channel->receive_data.message_start;
                 uint8_t *data = msg_start + header->header_size;
                 size_t parsed_size;
                 uint8_t *parsed;
                 message_destructor_t parsed_free;
 
                 header->data = msg_start;
-                n = channel->recive_data.now - msg_start;
+                n = channel->receive_data.now - msg_start;
 
                 if (n < header->header_size ||
                     n < header->header_size + header->get_msg_size(header)) {
@@ -473,16 +473,16 @@ static void snd_receive(void* data)
                     return;
                 }
                 parsed_free(parsed);
-                channel->recive_data.message_start = msg_start + header->header_size +
+                channel->receive_data.message_start = msg_start + header->header_size +
                                                      header->get_msg_size(header);
             }
-            if (channel->recive_data.now == channel->recive_data.message_start) {
-                channel->recive_data.now = channel->recive_data.buf;
-                channel->recive_data.message_start = channel->recive_data.buf;
-            } else if (channel->recive_data.now == channel->recive_data.end) {
-                memcpy(channel->recive_data.buf, channel->recive_data.message_start, n);
-                channel->recive_data.now = channel->recive_data.buf + n;
-                channel->recive_data.message_start = channel->recive_data.buf;
+            if (channel->receive_data.now == channel->receive_data.message_start) {
+                channel->receive_data.now = channel->receive_data.buf;
+                channel->receive_data.message_start = channel->receive_data.buf;
+            } else if (channel->receive_data.now == channel->receive_data.end) {
+                memcpy(channel->receive_data.buf, channel->receive_data.message_start, n);
+                channel->receive_data.now = channel->receive_data.buf + n;
+                channel->receive_data.message_start = channel->receive_data.buf;
             }
         }
     }
@@ -938,9 +938,9 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
     channel->parser = spice_get_client_channel_parser(channel_id, NULL);
     channel->stream = stream;
     channel->worker = worker;
-    channel->recive_data.message_start = channel->recive_data.buf;
-    channel->recive_data.now = channel->recive_data.buf;
-    channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
+    channel->receive_data.message_start = channel->receive_data.buf;
+    channel->receive_data.now = channel->receive_data.buf;
+    channel->receive_data.end = channel->receive_data.buf + sizeof(channel->receive_data.buf);
     channel->send_data.marshaller = spice_marshaller_new();
 
     stream->watch = core->watch_add(stream->socket, SPICE_WATCH_EVENT_READ,
-- 
1.8.3.1



More information about the Spice-devel mailing list