diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-09-20 20:32:25 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-09-20 20:32:25 -0700 |
commit | c0a08a6827a294f74b0ee5feaf5542081cff4381 (patch) | |
tree | a54e053d050f648d52369fcf2932fdc7a872703f /upb/bytestream.h | |
parent | 56f7a345d7572e118d4a370bb8e79b328d16bc0e (diff) |
Fixes to get upb to compile inside Google.
Diffstat (limited to 'upb/bytestream.h')
-rw-r--r-- | upb/bytestream.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/upb/bytestream.h b/upb/bytestream.h index 6ec1ba6..cbaef48 100644 --- a/upb/bytestream.h +++ b/upb/bytestream.h @@ -215,9 +215,10 @@ INLINE int upb_bytesink_putc(upb_bytesink *sink, char ch) { } INLINE int upb_bytesink_putrepeated(upb_bytesink *sink, char ch, int len) { - char buf[len]; - memset(buf, ch, len); - return upb_bytesink_write(sink, buf, len); + for (int i = 0; i < len; i++) + if (upb_bytesink_write(sink, &ch, 1) < 0) + return -1; + return len; } INLINE uint64_t upb_bytesink_getoffset(upb_bytesink *sink) { |