diff options
author | Stephen Hines <srhines@google.com> | 2014-07-25 12:41:15 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-07-25 12:41:15 +0000 |
commit | f151f3b16a681d9f6c3edf85ad221c3c048985dd (patch) | |
tree | a348408499d1ecc041e8f6cf3fd76c88f44912e6 /rsg_generator.c | |
parent | da9dabcf6027ec09472db2b3a26ad888b3d311c9 (diff) | |
parent | 1f88f088359ced06a2b53320b95c09fadc427c16 (diff) | |
download | rs-f151f3b16a681d9f6c3edf85ad221c3c048985dd.tar.gz |
am 1f88f088: Merge "Fix rsg_generator.c to properly propagate NULL values."
* commit '1f88f088359ced06a2b53320b95c09fadc427c16':
Fix rsg_generator.c to properly propagate NULL values.
Diffstat (limited to 'rsg_generator.c')
-rw-r--r-- | rsg_generator.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rsg_generator.c b/rsg_generator.c index d0f0b7cc..2558f675 100644 --- a/rsg_generator.c +++ b/rsg_generator.c @@ -294,7 +294,9 @@ void printApiCpp(FILE *f) { const VarType *vt = &api->params[ct2]; needFlush += vt->ptrLevel; if (vt->ptrLevel && hasInlineDataPointers(api)) { - fprintf(f, " if (dataSize < io->getMaxInlineSize()) {\n"); + fprintf(f, " if (%s_length == 0) {\n", vt->name); + fprintf(f, " cmd->%s = NULL;\n", vt->name); + fprintf(f, " } else if (dataSize < io->getMaxInlineSize()) {\n"); fprintf(f, " memcpy(payload, %s, %s_length);\n", vt->name, vt->name); fprintf(f, " cmd->%s = (", vt->name); printVarType(f, vt); @@ -489,7 +491,8 @@ void printPlaybackCpp(FILE *f) { needFlush += vt->ptrLevel; if (hasInlineDataPointers(api) && vt->ptrLevel) { - fprintf(f, ",\n (const %s *)&baseData[(intptr_t)cmd->%s]", vt->typeName, vt->name); + fprintf(f, ",\n cmd->%s_length == 0 ? NULL : (const %s *)&baseData[(intptr_t)cmd->%s]", + vt->name, vt->typeName, vt->name); } else { fprintf(f, ",\n cmd->%s", vt->name); } |