diff options
author | Joe Onorato <joeo@google.com> | 2011-12-04 21:13:23 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2012-02-10 14:44:05 -0800 |
commit | c3a7bb6563288373b4b6531ab5c8abfc3d048a77 (patch) | |
tree | 622e53fef5c0dafa0588e3312fd574147ac4f9bd /tools | |
parent | 0a7eaecf6457f9a186b2f2d5c0dbadc8b87e03b9 (diff) | |
download | frameworks_base-c3a7bb6563288373b4b6531ab5c8abfc3d048a77.zip frameworks_base-c3a7bb6563288373b4b6531ab5c8abfc3d048a77.tar.gz frameworks_base-c3a7bb6563288373b4b6531ab5c8abfc3d048a77.tar.bz2 |
Use the new get/putFlattenable methods on RpcData.
They handle null correctly.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/aidl/Type.cpp | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/tools/aidl/Type.cpp b/tools/aidl/Type.cpp index 024062a..42e1226 100755 --- a/tools/aidl/Type.cpp +++ b/tools/aidl/Type.cpp @@ -1016,48 +1016,17 @@ void UserDataType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data, int flags) { - // if (v != null) { - // RpcData _obj = new RpcData(); - // v.writeToRpcData(_obj); - // data.putRpcData(k, obj); - // } - IfStatement* ifpart = new IfStatement; - ifpart->expression = new Comparison(v, "!=", NULL_VALUE); - Variable* _obj = new Variable(RPC_DATA_TYPE, "_obj"); - ifpart->statements->Add(new VariableDeclaration(_obj, new NewExpression(RPC_DATA_TYPE))); - ifpart->statements->Add(new MethodCall(v, "writeToRpcData", 1, _obj)); - ifpart->statements->Add(new MethodCall(data, "putRpcData", 2, k, _obj)); - - addTo->Add(ifpart); + // data.putFlattenable(k, v); + addTo->Add(new MethodCall(data, "putFlattenable", 2, k, v)); } void UserDataType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data, Variable** cl) { - // RpcData _obj = data.getRpcData(k); - // if (_data_XX != null) - // v = CLASS.RPC_CREATOR.createFromParcel(_obj) - // } else { - // v = null; - // } - - StatementBlock* block = new StatementBlock; - addTo->Add(block); - - Variable* _obj = new Variable(RPC_DATA_TYPE, "_obj"); - block->Add(new VariableDeclaration(_obj, new MethodCall(data, "getRpcData", 1, k))); - - IfStatement* ifpart = new IfStatement(); - ifpart->expression = new Comparison(_obj, "!=", NULL_VALUE); - ifpart->statements->Add(new Assignment(v, - new MethodCall(v->type, "RPC_CREATOR.createFromRpcData", 1, _obj))); - - IfStatement* elsepart = new IfStatement(); - ifpart->elseif = elsepart; - elsepart->statements->Add(new Assignment(v, NULL_VALUE)); - - block->Add(ifpart); + // data.getFlattenable(k, CLASS.RPC_CREATOR); + addTo->Add(new Assignment(v, new MethodCall(data, "getFlattenable", 2, k, + new FieldVariable(v->type, "RPC_CREATOR")))); } // ================================================================ |