From c5dc281934a8ca01ac6a41eb6c1fafcdb51d7038 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 7 Apr 2016 23:32:41 +0300 Subject: [PATCH] reserved message ids and little endian for client --- ipc/codegen/src/codegen.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index 47fd9a1ba..08944196f 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -249,7 +249,7 @@ fn implement_dispatch_arm( buffer: bool, ) -> ast::Arm { - let index_ident = builder.id(format!("{}", index).as_str()); + let index_ident = builder.id(format!("{}", index + (RESERVED_MESSAGE_IDS as u32)).as_str()); let invoke_expr = implement_dispatch_arm_invoke(cx, builder, dispatch, buffer); quote_arm!(cx, $index_ident => { $invoke_expr } ) } @@ -387,7 +387,7 @@ fn implement_client_method_body( request_serialization_statements.push( quote_stmt!(cx, let serialized_payload = ::bincode::serde::serialize(&payload, ::bincode::SizeLimit::Infinite).unwrap())); - let index_ident = builder.id(format!("{}", index).as_str()); + let index_ident = builder.id(format!("{}", index + RESERVED_MESSAGE_IDS).as_str()); request_serialization_statements.push( quote_stmt!(cx, ::ipc::invoke($index_ident, &Some(serialized_payload), &mut socket))); @@ -559,7 +559,8 @@ fn implement_interface( Err(e) => { panic!("ipc read error: {:?}, aborting", e); } _ => { } } - match method_num[0] as u16 + (method_num[1] as u16)*256 { + // method_num is a 16-bit little-endian unsigned number + match method_num[1] as u16 + (method_num[0] as u16)*256 { $dispatch_arms _ => vec![] }