Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: tests/fib/fib_array.c

Issue 5622003: Restructure the structs/unions involved in SRPC argument passing. This will... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/fake_browser/deferred_srpc_init.c ('k') | tests/inbrowser_test_runner/test_runner.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Native Client Authors. All rights reserved. 2 * Copyright 2008 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * A Fibonacci RPC method. 8 * A Fibonacci RPC method.
9 */ 9 */
10 10
11 11
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <stdio.h> 13 #include <stdio.h>
14 14
15 #include <nacl/nacl_srpc.h> 15 #include <nacl/nacl_srpc.h>
16 16
17 /* 17 /*
18 * FibonacciArray is an rpc method that computes the vitally important 18 * FibonacciArray is an rpc method that computes the vitally important
19 * fibonacci recurrence. The two input arguments are the first two 19 * fibonacci recurrence. The two input arguments are the first two
20 * values of the sequence. The size of the output array determines how many 20 * values of the sequence. The size of the output array determines how many
21 * elements of the sequence to compute, which are returned in the output array. 21 * elements of the sequence to compute, which are returned in the output array.
22 */ 22 */
23 void FibonacciArray(NaClSrpcRpc *rpc, 23 void FibonacciArray(NaClSrpcRpc *rpc,
24 NaClSrpcArg **in_args, 24 NaClSrpcArg **in_args,
25 NaClSrpcArg **out_args, 25 NaClSrpcArg **out_args,
26 NaClSrpcClosure *done) { 26 NaClSrpcClosure *done) {
27 int v0 = in_args[0]->u.ival; 27 int v0 = in_args[0]->u.ival;
28 int v1 = in_args[1]->u.ival; 28 int v1 = in_args[1]->u.ival;
29 int v2; 29 int v2;
30 int num = out_args[0]->u.iaval.count; 30 int num = out_args[0]->u.count;
31 int32_t *dest = out_args[0]->u.iaval.iarr; 31 int32_t *dest = out_args[0]->arrays.iarr;
32 int i; 32 int i;
33 33
34 if (num < 2) { 34 if (num < 2) {
35 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 35 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
36 done->Run(done); 36 done->Run(done);
37 return; 37 return;
38 } 38 }
39 *dest++ = v0; 39 *dest++ = v0;
40 *dest++ = v1; 40 *dest++ = v1;
41 for (i = 2; i < num; ++i) { 41 for (i = 2; i < num; ++i) {
(...skipping 13 matching lines...) Expand all
55 int main() { 55 int main() {
56 if (!NaClSrpcModuleInit()) { 56 if (!NaClSrpcModuleInit()) {
57 return 1; 57 return 1;
58 } 58 }
59 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { 59 if (!NaClSrpcAcceptClientConnection(srpc_methods)) {
60 return 1; 60 return 1;
61 } 61 }
62 NaClSrpcModuleFini(); 62 NaClSrpcModuleFini();
63 return 0; 63 return 0;
64 } 64 }
OLDNEW
« no previous file with comments | « tests/fake_browser/deferred_srpc_init.c ('k') | tests/inbrowser_test_runner/test_runner.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698