summaryrefslogtreecommitdiff
path: root/libs/protoutil/src/ProtoOutputStream.cpp
diff options
context:
space:
mode:
authorYi Jin <jinyithu@google.com>2017-10-23 15:42:44 -0700
committerYi Jin <jinyithu@google.com>2017-10-23 16:36:06 -0700
commite08333067a9f4ce9176dff490c4b163f71f56e1e (patch)
tree09d88398f208cf4abde6feb17e82441c4e9f4c45 /libs/protoutil/src/ProtoOutputStream.cpp
parentc35ca6de375a1a17a3e070f85e7cf15272d92181 (diff)
Fix several nits
1. Change the APIs of ProtoOutputStream to be able to write bytes 2. Fix the tests in incidentd, stdout is closed so can't capture the value, use temporaryFile instead. Test: N/A Change-Id: Ibc31f2efd068afc6c06188d92f57ca5a754c3683
Diffstat (limited to 'libs/protoutil/src/ProtoOutputStream.cpp')
-rw-r--r--libs/protoutil/src/ProtoOutputStream.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libs/protoutil/src/ProtoOutputStream.cpp b/libs/protoutil/src/ProtoOutputStream.cpp
index 15144ac2eb28..9dadf1c20510 100644
--- a/libs/protoutil/src/ProtoOutputStream.cpp
+++ b/libs/protoutil/src/ProtoOutputStream.cpp
@@ -225,14 +225,13 @@ ProtoOutputStream::write(uint64_t fieldId, string val)
}
bool
-ProtoOutputStream::write(uint64_t fieldId, const char* val)
+ProtoOutputStream::write(uint64_t fieldId, const char* val, size_t size)
{
if (mCompact) return false;
const uint32_t id = (uint32_t)fieldId;
- int size = 0;
- while (val[size] != '\0') size++;
switch (fieldId & FIELD_TYPE_MASK) {
case TYPE_STRING:
+ case TYPE_BYTES:
writeUtf8StringImpl(id, val, size);
return true;
default: