Type cleanups
[invirt/third/libt4.git] / rpc / rpctest.cc
index c43a9da..c381745 100644 (file)
@@ -24,10 +24,10 @@ int port;
 // from multiple classes.
 class srv {
        public:
-               int handle_22(const std::string a, const std::string b, std::string & r);
-               int handle_fast(const int a, int &r);
-               int handle_slow(const int a, int &r);
-               int handle_bigrep(const int a, std::string &r);
+               int handle_22(std::string & r, const std::string a, const std::string b);
+               int handle_fast(int &r, const int a);
+               int handle_slow(int &r, const int a);
+               int handle_bigrep(std::string &r, const int a);
 };
 
 // a handler. a and b are arguments, r is the result.
@@ -38,21 +38,21 @@ class srv {
 // at these argument types, so this function definition
 // does what a .x file does in SunRPC.
 int
-srv::handle_22(const std::string a, std::string b, std::string &r)
+srv::handle_22(std::string &r, const std::string a, std::string b)
 {
        r = a + b;
        return 0;
 }
 
 int
-srv::handle_fast(const int a, int &r)
+srv::handle_fast(int &r, const int a)
 {
        r = a + 1;
        return 0;
 }
 
 int
-srv::handle_slow(const int a, int &r)
+srv::handle_slow(int &r, const int a)
 {
        usleep(random() % 5000);
        r = a + 2;
@@ -60,7 +60,7 @@ srv::handle_slow(const int a, int &r)
 }
 
 int
-srv::handle_bigrep(const int len, std::string &r)
+srv::handle_bigrep(std::string &r, const int len)
 {
        r = std::string(len, 'x');
        return 0;
@@ -71,17 +71,17 @@ srv service;
 void startserver()
 {
        server = new rpcs(port);
-       server->reg(22, &service, &srv::handle_22);
-       server->reg(23, &service, &srv::handle_fast);
-       server->reg(24, &service, &srv::handle_slow);
-       server->reg(25, &service, &srv::handle_bigrep);
+       server->reg(22, &srv::handle_22, &service);
+       server->reg(23, &srv::handle_fast, &service);
+       server->reg(24, &srv::handle_slow, &service);
+       server->reg(25, &srv::handle_bigrep, &service);
 }
 
 void
 testmarshall()
 {
        marshall m;
-       req_header rh(1,2,3,4,5);
+       request_header rh{1,2,3,4,5};
        m.pack_req_header(rh);
        VERIFY(m.size()==RPC_HEADER_SZ);
        int i = 12345;
@@ -97,7 +97,7 @@ testmarshall()
        VERIFY(sz == (int)(RPC_HEADER_SZ+sizeof(i)+sizeof(l)+s.size()+sizeof(int)));
 
        unmarshall un(b,sz);
-       req_header rh1;
+       request_header rh1;
        un.unpack_req_header(&rh1);
        VERIFY(memcmp(&rh,&rh1,sizeof(rh))==0);
        int i1;
@@ -203,7 +203,7 @@ simple_tests(rpcc *c)
        int xx = 0;
        intret = c->call_timeout(23, rpcc::to(3000), xx, 77);
        VERIFY(intret == 0 && xx == 78);
-       printf("   -- no suprious timeout .. ok\n");
+       printf("   -- no spurious timeout .. ok\n");
 
        // specify a timeout value to an RPC that should succeed (tcp)
        {
@@ -211,7 +211,7 @@ simple_tests(rpcc *c)
                std::string rep;
                c->call_timeout(22, rpcc::to(3000), rep, arg, (std::string)"x");
                VERIFY(rep.size() == 1001);
-               printf("   -- no suprious timeout .. ok\n");
+               printf("   -- no spurious timeout .. ok\n");
        }
 
        // huge RPC