Clean-ups and fixes to compile with more warnings enabled and with g++.
[invirt/third/libt4.git] / rpc / marshall_wrap.h
index 2d7fbfb..4ba7a20 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "marshall.h"
 
-typedef function<int(unmarshall &, marshall &)> handler;
+typedef function<rpc_protocol::status(unmarshall &&, marshall &)> handler;
 
 //
 // Automatic marshalling wrappers for RPC handlers
@@ -43,7 +43,7 @@ struct VerifyOnFailure {
 // One for function pointers...
 
 template <class F, class R, class RV, class args_type, size_t... Indices>
-typename enable_if<!is_member_function_pointer<F>::value, RV>::type
+typename enable_if<!is_member_function_pointer<F>::value, RV>::type inline 
 invoke(RV, F f, void *, R & r, args_type & t, tuple_indices<Indices...>) {
     return f(r, move(get<Indices>(t))...);
 }
@@ -51,7 +51,7 @@ invoke(RV, F f, void *, R & r, args_type & t, tuple_indices<Indices...>) {
 // And one for pointers to member functions...
 
 template <class F, class C, class RV, class R, class args_type, size_t... Indices>
-typename enable_if<is_member_function_pointer<F>::value, RV>::type
+typename enable_if<is_member_function_pointer<F>::value, RV>::type inline 
 invoke(RV, F f, C *c, R & r, args_type & t, tuple_indices<Indices...>) {
     return (c->*f)(r, move(get<Indices>(t))...);
 }
@@ -71,7 +71,7 @@ template <class Functor, class Instance, class Signature,
 // between various types of callable objects at this level of abstraction.
 
 template <class F, class C, class ErrorHandler, class R, class RV, class... Args>
-struct marshalled_func_imp<F, C, RV(R&, Args...), ErrorHandler> {
+struct marshalled_func_imp<F, C, RV(R &, Args...), ErrorHandler> {
     static inline handler *wrap(F f, C *c=nullptr) {
         // This type definition corresponds to an empty struct with
         // template parameters running from 0 up to (# args) - 1.
@@ -82,10 +82,10 @@ struct marshalled_func_imp<F, C, RV(R&, Args...), ErrorHandler> {
         using ArgsStorage = tuple<typename decay<Args>::type...>;
         // Allocate a handler (i.e. function) to hold the lambda
         // which will unmarshall RPCs and call f.
-        return new handler([=](unmarshall &u, marshall &m) -> RV {
+        return new handler([=](unmarshall && u, marshall & m) -> RV {
             // Unmarshall each argument with the correct type and store the
             // result in a tuple.
-            ArgsStorage t = {u.grab<typename decay<Args>::type>()...};
+            ArgsStorage t{u._grab<typename decay<Args>::type>()...};
             // Verify successful unmarshalling of the entire input stream.
             if (!u.okdone())
                 return (RV)ErrorHandler::unmarshall_args_failure();