Skip to content

Commit

Permalink
update for uint -> u32
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Oct 11, 2014
1 parent 748a9c9 commit b2e0c95
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions examples/calculator/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn evaluate_impl(
match params {
None => {Err("bad parameter".to_string())}
Some(params) => {
Ok(params.get(p as uint))
Ok(params.get(p))
}
}
}
Expand All @@ -64,9 +64,9 @@ fn evaluate_impl(
}
let mut request = func.call_request();
{
let request_params = request.init().init_params(param_values.len());
let request_params = request.init().init_params(param_values.len() as u32);
for ii in range(0, param_values.len()) {
request_params.set(ii, param_values[ii]);
request_params.set(ii as u32, param_values[ii]);
}
}
Ok(try!(request.send().wait()).get_value())
Expand All @@ -76,12 +76,12 @@ fn evaluate_impl(
}

struct FunctionImpl {
param_count : uint,
param_count : u32,
body : MallocMessageBuilder,
}

impl FunctionImpl {
fn new(param_count : uint, body : calculator::expression::Reader) -> FunctionImpl {
fn new(param_count : u32, body : calculator::expression::Reader) -> FunctionImpl {
let mut result = FunctionImpl { param_count : param_count, body : MallocMessageBuilder::new_default() };
result.body.set_root(&body);
result
Expand All @@ -91,7 +91,7 @@ impl FunctionImpl {
impl calculator::function::Server for FunctionImpl {
fn call(&mut self, mut context : calculator::function::CallContext) {
let (params, results) = context.get();
if params.get_params().size() != self.param_count{
if params.get_params().size() != self.param_count {
//"Wrong number of parameters."
return context.fail();
};
Expand Down Expand Up @@ -155,7 +155,7 @@ impl calculator::Server for CalculatorImpl {
results.set_func(
FromServer::new(
None::<LocalClient>,
box FunctionImpl::new(params.get_param_count() as uint, params.get_body())));
box FunctionImpl::new(params.get_param_count() as u32, params.get_body())));
context.done();
}
fn get_operator<'a>(& mut self, mut context : calculator::GetOperatorContext<'a>) {
Expand Down
24 changes: 12 additions & 12 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,11 @@ impl ClientHook for PipelineClient {
let target = call.init_target();
let promised_answer = target.init_promised_answer();
promised_answer.set_question_id(self.question_ref.id);
let transform = promised_answer.init_transform(self.ops.len());
let transform = promised_answer.init_transform(self.ops.len() as u32);
for ii in range(0, self.ops.len()) {
match self.ops.as_slice()[ii] {
pipeline_op::Noop => transform.get(ii).set_noop(()),
pipeline_op::GetPointerField(idx) => transform.get(ii).set_get_pointer_field(idx),
pipeline_op::Noop => transform.get(ii as u32).set_noop(()),
pipeline_op::GetPointerField(idx) => transform.get(ii as u32).set_get_pointer_field(idx),
}
}
}
Expand Down Expand Up @@ -773,29 +773,29 @@ impl ClientHook for PromisedAnswerClient {
fn write_outgoing_cap_table(rpc_chan : &::std::comm::Sender<RpcEvent>, message : &mut MallocMessageBuilder) {
fn write_payload(rpc_chan : &::std::comm::Sender<RpcEvent>, cap_table : & [Box<::std::any::Any>],
payload : payload::Builder) {
let new_cap_table = payload.init_cap_table(cap_table.len());
for ii in range(0, cap_table.len()) {
match cap_table[ii].downcast_ref::<OwnedCapDescriptor>() {
let new_cap_table = payload.init_cap_table(cap_table.len() as u32);
for ii in range::<u32>(0, cap_table.len() as u32) {
match cap_table[ii as uint].downcast_ref::<OwnedCapDescriptor>() {
Some(&NoDescriptor) => {}
Some(&ReceiverHosted(import_id)) => {
new_cap_table.get(ii).set_receiver_hosted(import_id);
}
Some(&ReceiverAnswer(question_id,ref ops)) => {
let promised_answer = new_cap_table.get(ii).init_receiver_answer();
promised_answer.set_question_id(question_id);
let transform = promised_answer.init_transform(ops.len());
for ii in range(0, ops.len()) {
match ops.as_slice()[ii] {
pipeline_op::Noop => transform.get(ii).set_noop(()),
pipeline_op::GetPointerField(idx) => transform.get(ii).set_get_pointer_field(idx),
let transform = promised_answer.init_transform(ops.len() as u32);
for jj in range(0, ops.len()) {
match ops.as_slice()[jj] {
pipeline_op::Noop => transform.get(jj as u32).set_noop(()),
pipeline_op::GetPointerField(idx) => transform.get(jj as u32).set_get_pointer_field(idx),
}
}
}
Some(&SenderHosted(export_id)) => {
new_cap_table.get(ii).set_sender_hosted(export_id);
}
None => {
match cap_table[ii].downcast_ref::<Box<ClientHook+Send>>() {
match cap_table[ii as uint].downcast_ref::<Box<ClientHook+Send>>() {
Some(clienthook) => {
let (chan, port) = ::std::comm::channel::<ExportId>();
rpc_chan.send(NewLocalServer(clienthook.copy(), chan));
Expand Down

0 comments on commit b2e0c95

Please sign in to comment.