[Spice-devel] [PATCH spice 2/3] spelling: s/recive/receive

Marc-André Lureau marcandre.lureau at gmail.com
Wed Apr 18 09:52:56 PDT 2012


---
 server/main_channel.h |    4 +--
 server/red_worker.c   |    4 +--
 server/reds.c         |   68 ++++++++++++++++++++++++-------------------------
 server/snd_worker.c   |   40 ++++++++++++++---------------
 4 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/server/main_channel.h b/server/main_channel.h
index afff313..ffbc7eb 100644
--- a/server/main_channel.h
+++ b/server/main_channel.h
@@ -38,8 +38,8 @@ struct MainMigrateData {
 
     uint32_t read_state;
     VDIChunkHeader vdi_chunk_header;
-    uint32_t recive_len;
-    uint32_t message_recive_len;
+    uint32_t receive_len;
+    uint32_t message_receive_len;
     uint32_t read_buf_len;
 
     uint32_t write_queue_size;
diff --git a/server/red_worker.c b/server/red_worker.c
index 07782c8..20cf2e4 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -333,7 +333,7 @@ typedef struct LocalCursor {
 } LocalCursor;
 
 #define MAX_PIPE_SIZE 50
-#define RECIVE_BUF_SIZE 1024
+#define CC_RECEIVE_BUF_SIZE 1024
 
 #define WIDE_CLIENT_ACK_WINDOW 40
 #define NARROW_CLIENT_ACK_WINDOW 20
@@ -581,7 +581,7 @@ typedef struct GlzSharedDictionary {
 typedef struct CommonChannel {
     RedChannel base; // Must be the first thing
     struct RedWorker *worker;
-    uint8_t recv_buf[RECIVE_BUF_SIZE];
+    uint8_t recv_buf[CC_RECEIVE_BUF_SIZE];
     uint32_t id_alloc; // bitfield. TODO - use this instead of shift scheme.
 } CommonChannel;
 
diff --git a/server/reds.c b/server/reds.c
index bf26864..79043f7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -173,9 +173,9 @@ typedef struct VDIPortState {
 
     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;
 
@@ -611,9 +611,9 @@ static void reds_reset_vdp(void)
         buf->free(buf);
     }
     state->read_state = VDI_PORT_READ_STATE_READ_HADER;
-    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) {
         ring_add(&state->read_bufs, &state->current_read_buf->link);
         state->current_read_buf = NULL;
@@ -906,18 +906,18 @@ static int read_from_vdi_port(void)
     while (!quit_loop && vdagent) {
         switch (state->read_state) {
         case VDI_PORT_READ_STATE_READ_HADER:
-            n = sif->read(vdagent, state->recive_pos, state->recive_len);
+            n = sif->read(vdagent, state->receive_pos, state->receive_len);
             if (!n) {
                 quit_loop = 1;
                 break;
             }
             total += n;
-            if ((state->recive_len -= n)) {
-                state->recive_pos += n;
+            if ((state->receive_len -= n)) {
+                state->receive_pos += n;
                 quit_loop = 1;
                 break;
             }
-            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: {
             RingItem *item;
@@ -929,31 +929,31 @@ static int read_from_vdi_port(void)
 
             ring_remove(item);
             state->current_read_buf = (VDIReadBuf *)item;
-            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) {
                 quit_loop = 1;
                 break;
             }
             total += n;
-            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_HADER;
-                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;
             }
@@ -1157,16 +1157,16 @@ void reds_marshall_migrate_data_item(SpiceMarshaller *m, MainMigrateData *data)
 
     data->read_state = state->read_state;
     data->vdi_chunk_header = state->vdi_chunk_header;
-    data->recive_len = state->recive_len;
-    data->message_recive_len = state->message_recive_len;
+    data->receive_len = state->receive_len;
+    data->message_receive_len = state->message_receive_len;
 
     if (state->current_read_buf) {
         data->read_buf_len = state->current_read_buf->len;
 
-        if (data->read_buf_len - data->recive_len) {
+        if (data->read_buf_len - data->receive_len) {
             spice_marshaller_add_ref(m,
                                      state->current_read_buf->data,
-                                     data->read_buf_len - data->recive_len);
+                                     data->read_buf_len - data->receive_len);
         }
     } else {
         data->read_buf_len = 0;
@@ -1205,8 +1205,8 @@ static int reds_main_channel_restore_vdi_read_state(MainMigrateData *data, uint8
 
     state->read_state = data->read_state;
     state->vdi_chunk_header = data->vdi_chunk_header;
-    state->recive_len = data->recive_len;
-    state->message_recive_len = data->message_recive_len;
+    state->receive_len = data->receive_len;
+    state->message_receive_len = data->message_receive_len;
 
     switch (state->read_state) {
     case VDI_PORT_READ_STATE_READ_HADER:
@@ -1215,10 +1215,10 @@ static int reds_main_channel_restore_vdi_read_state(MainMigrateData *data, uint8
             reds_disconnect();
             return FALSE;
         }
-        state->recive_pos = (uint8_t *)(&state->vdi_chunk_header + 1) - state->recive_len;
+        state->receive_pos = (uint8_t *)(&state->vdi_chunk_header + 1) - state->receive_len;
         break;
     case VDI_PORT_READ_STATE_GET_BUFF:
-        if (state->message_recive_len > state->vdi_chunk_header.size) {
+        if (state->message_receive_len > state->vdi_chunk_header.size) {
             spice_printerr("invalid message receive len");
             reds_disconnect();
             return FALSE;
@@ -1240,7 +1240,7 @@ static int reds_main_channel_restore_vdi_read_state(MainMigrateData *data, uint8
             return FALSE;
         }
 
-        if (state->message_recive_len > state->vdi_chunk_header.size) {
+        if (state->message_receive_len > state->vdi_chunk_header.size) {
             spice_printerr("invalid message receive len");
             reds_disconnect();
             return FALSE;
@@ -1256,7 +1256,7 @@ static int reds_main_channel_restore_vdi_read_state(MainMigrateData *data, uint8
         ring_remove(ring_item);
         buff = state->current_read_buf = (VDIReadBuf *)ring_item;
         buff->len = data->read_buf_len;
-        n = buff->len - state->recive_len;
+        n = buff->len - state->receive_len;
         if (buff->len > SPICE_AGENT_MAX_DATA_SIZE || n > SPICE_AGENT_MAX_DATA_SIZE) {
             spice_printerr("bad read position");
             reds_disconnect();
@@ -1264,7 +1264,7 @@ static int reds_main_channel_restore_vdi_read_state(MainMigrateData *data, uint8
         }
         memcpy(buff->data, pos, n);
         pos += n;
-        state->recive_pos = buff->data + n;
+        state->receive_pos = buff->data + n;
         break;
     }
     default:
@@ -3605,8 +3605,8 @@ static void init_vd_agent_resources(void)
     agent_msg_filter_init(&state->read_filter, agent_copypaste, TRUE);
 
     state->read_state = VDI_PORT_READ_STATE_READ_HADER;
-    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_AGENT_WINDOW_SIZE; i++) {
         VDAgentExtBuf *buf = spice_new0(VDAgentExtBuf, 1);
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 9cf1ebb..a0bbd3a 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -42,7 +42,7 @@
 #define IOV_MAX 1024
 #endif
 
-#define 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 (RECIVE_BUF_SIZE >> 2)
+#define RECORD_SAMPLES_SIZE (SND_RECEIVE_BUF_SIZE >> 2)
 
 enum PlaybackeCommand {
     SND_PLAYBACK_MIGRATE,
@@ -111,11 +111,11 @@ struct SndChannel {
     } send_data;
 
     struct {
-        uint8_t buf[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;
@@ -430,9 +430,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);
@@ -453,16 +453,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)) {
@@ -483,16 +483,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;
             }
         }
     }
@@ -952,9 +952,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.7.10



More information about the Spice-devel mailing list