From 12b08f2c3e07cea617255bedfd97b2eedf0f180f Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 19 Jul 2010 14:10:16 +0200 Subject: codegen: Various cleanups Remove all uses of @end in the marshaller, instead just using the C struct array-at-end-of-struct. To make this work we also remove all use of @end for switches (making them C unions). We drop the zero member of the notify message so that we can avoid this use of @end for a primitive in the marshaller (plus its useless to send over the wire). We change the offsets and stuff in the migration messages to real pointers. --- client/red_client.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'client/red_client.cpp') diff --git a/client/red_client.cpp b/client/red_client.cpp index 3f4f8bf3..9a8078ea 100644 --- a/client/red_client.cpp +++ b/client/red_client.cpp @@ -223,13 +223,11 @@ void Migrate::start(const SpiceMsgMainMigrationBegin* migrate) _sport = old_migrate->sport ? old_migrate->sport : -1;; _auth_options = _client.get_host_auth_options(); } else { - _host.assign(((char*)migrate) + migrate->host_offset); + _host.assign((char *)migrate->host_data); _port = migrate->port ? migrate->port : -1; _sport = migrate->sport ? migrate->sport : -1; _auth_options.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_PUBKEY; - _auth_options.host_pubkey.assign(((uint8_t*)migrate)+ migrate->pub_key_offset, - ((uint8_t*)migrate)+ migrate->pub_key_offset + - migrate->pub_key_size); + _auth_options.host_pubkey.assign(migrate->pub_key_data, migrate->pub_key_data + migrate->pub_key_size); } _con_ciphers = _client.get_connection_ciphers(); @@ -1008,7 +1006,7 @@ void RedClient::handle_agent_tokens(RedPeer::InMessage* message) void RedClient::handle_migrate_switch_host(RedPeer::InMessage* message) { SpiceMsgMainMigrationSwitchHost* migrate = (SpiceMsgMainMigrationSwitchHost*)message->data(); - char* host = ((char*)migrate) + migrate->host_offset; + char* host = (char *)migrate->host_data; char* subject = NULL; if (host[migrate->host_size - 1] != '\0') { @@ -1016,7 +1014,7 @@ void RedClient::handle_migrate_switch_host(RedPeer::InMessage* message) } if (migrate->cert_subject_size) { - subject = ((char*)migrate)+ migrate->cert_subject_offset; + subject = (char *)migrate->cert_subject_data; if (subject[migrate->cert_subject_size - 1] != '\0') { THROW("cert subject is not a null-terminated string"); } -- cgit