[Spice-devel] [PATCH] spice - fix typo: recive -> receive

Yaniv Kaul ykaul at redhat.com
Tue Feb 14 04:53:57 PST 2012


On 02/14/2012 02:48 PM, Alon Levy wrote:
> On Tue, Jan 31, 2012 at 09:57:19PM +0200, Yaniv Kaul wrote:
>> Fix typo: recive ->  receive
>> No functional changes, compile tested only.
>>
> The patch doesn't apply, looks like some lines are cut in the middle by
> your email client. Did you use git send-email?

No, I'm abusing the clause in spice-space that says:
"Like to send a patch but don't have time for all the “nonsense”?
If it is a simple bug fix, send the patch to 
spice-devel at lists.freedesktop.org and specify that you don't care what 
we do with the patch. We will do with it whatever seems appropriate."

But it is annoying that the mail client broke it. I can send the diff as 
a text attachment, I guess.

>
> For instance see below.
>
>> diff --git a/server/main_channel.h b/server/main_channel.h
>> index c5d407e..1a1ad59 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;
>> @@ -51,12 +51,12 @@ struct MainMigrateData {
>>   #define REDS_NUM_INTERNAL_AGENT_MESSAGES 1
>>
>>   // approximate max receive message size for main channel
>> -#define RECEIVE_BUF_SIZE \
>> +#define MAIN_RECEIVE_BUF_SIZE \
>>       (4096 + (REDS_AGENT_WINDOW_SIZE +
>> REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
> Here
>
>>   typedef struct MainChannel {
>>       RedChannel base;
>> -    uint8_t recv_buf[RECEIVE_BUF_SIZE];
>> +    uint8_t recv_buf[MAIN_RECEIVE_BUF_SIZE];
>>       RedsMigSpice mig_target; // TODO: add refs and release (afrer
>> all clients completed migration in one way or the other?)
>>       int num_clients_mig_wait;
>>   } MainChannel;
>> diff --git a/server/red_worker.c b/server/red_worker.c
>> index 80fa825..d476791 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 RECEIVE_BUF_SIZE 1024
>>
>>   #define WIDE_CLIENT_ACK_WINDOW 40
>>   #define NARROW_CLIENT_ACK_WINDOW 20
>> @@ -582,7 +582,7 @@ typedef struct CommonChannel {
>>       RedChannel base; // Must be the first thing
>>       event_listener_action_proc listener_action;
>>       struct RedWorker *worker;
>> -    uint8_t recv_buf[RECIVE_BUF_SIZE];
>> +    uint8_t recv_buf[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 2492a89..9142cfa 100644
>> --- a/server/reds.c
>> +++ b/server/reds.c
>> @@ -167,9 +167,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;
>>
>> @@ -581,9 +581,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;
>> @@ -876,18 +876,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;
>> @@ -899,31 +899,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;
>>               }
>> @@ -1127,16 +1127,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;
>> @@ -1175,8 +1175,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:
>> @@ -1185,10 +1185,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) {
>>               red_printf("invalid message receive len");
>>               reds_disconnect();
>>               return FALSE;
>> @@ -1210,7 +1210,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) {
>>               red_printf("invalid message receive len");
>>               reds_disconnect();
>>               return FALSE;
>> @@ -1226,7 +1226,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) {
>>               red_printf("bad read position");
>>               reds_disconnect();
>> @@ -1234,7 +1234,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:
>> @@ -3538,8 +3538,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 e78d1d3..f9610ac 100644
>> --- a/server/snd_worker.c
>> +++ b/server/snd_worker.c
>> @@ -38,7 +38,7 @@
>>
>>   #define MAX_SEND_VEC 100
>>
>> -#define RECIVE_BUF_SIZE (16 * 1024 * 2)
>> +#define RECEIVE_BUF_SIZE (16 * 1024 * 2)
>>
>>   #define FRAME_SIZE 256
>>   #define PLAYBACK_BUF_SIZE (FRAME_SIZE * 4)
>> @@ -46,7 +46,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 (RECEIVE_BUF_SIZE>>  2)
>>
>>   enum PlaybackeCommand {
>>       SND_PLAYBACK_MIGRATE,
>> @@ -107,11 +107,11 @@ struct SndChannel {
>>       } send_data;
>>
>>       struct {
>> -        uint8_t buf[RECIVE_BUF_SIZE];
>> +        uint8_t buf[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;
>> @@ -426,9 +426,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;
>>           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);
>> @@ -449,16 +449,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)) {
>> @@ -479,16 +479,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;
>>               }
>>           }
>>       }
>> @@ -948,9 +948,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,
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel



More information about the Spice-devel mailing list