summaryrefslogtreecommitdiff
path: root/rsg_generator.c
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2014-07-16 18:20:06 -0700
committerChris Wailes <chriswailes@google.com>2014-07-16 18:20:06 -0700
commitdb896f0918a7d79b9dd44a786e393206a0ac36a6 (patch)
tree612a974b1d2e34f3d24ac9209a369b63e44636cf /rsg_generator.c
parent42e563a3bc08f1785f379166b6519009c8066fdc (diff)
downloadrs-db896f0918a7d79b9dd44a786e393206a0ac36a6.tar.gz
Fix rsg_generator.c to properly propagate NULL values.
This patch modifies rsg_generator.c to properly propagate NULL values in the presence of inlined data pointers. Change-Id: I5f91518807d4ab05148c9382e143581157409be6
Diffstat (limited to 'rsg_generator.c')
-rw-r--r--rsg_generator.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/rsg_generator.c b/rsg_generator.c
index be2daccc..75ea1a38 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);
}