summaryrefslogtreecommitdiff
path: root/stream
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-08-02 10:25:24 -0700
committerJoshua Haberman <joshua@reverberate.org>2010-08-02 10:25:24 -0700
commita9e998159c5ac8c4f2644b5ed0eda2e8ff1f8706 (patch)
treefc9324a56042e65d96ac04a4b39412783062007e /stream
parent4e7dc9d8b6baa598ec63a9991e8b11aede576ac1 (diff)
Fleshed out upb_msg: test_vs_proto2 compiles but fails.
Diffstat (limited to 'stream')
-rw-r--r--stream/upb_decoder.c8
-rw-r--r--stream/upb_strstream.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/stream/upb_decoder.c b/stream/upb_decoder.c
index 7591f78..c35212e 100644
--- a/stream/upb_decoder.c
+++ b/stream/upb_decoder.c
@@ -14,8 +14,10 @@
// Returns true if the give wire type and field type combination is valid,
// taking into account both packed and non-packed encodings.
-static bool upb_check_type(upb_wire_type_t wt, upb_field_type_t ft) {
- return (1 << wt) & upb_types[ft].allowed_wire_types;
+static bool upb_check_type(upb_wire_type_t wt, upb_fielddef *f) {
+ // TODO: need to take into account the label; only repeated fields are
+ // allowed to use packed encoding.
+ return (1 << wt) & upb_types[f->type].allowed_wire_types;
}
// Performs zig-zag decoding, which is used by sint32 and sint64.
@@ -358,7 +360,7 @@ again:
// unknown fields we will implement that here.
upb_decoder_skipval(d);
goto again;
- } else if (!upb_check_type(wire_type, f->type)) {
+ } else if (!upb_check_type(wire_type, f)) {
// This is a recoverable error condition. We skip the value but also
// return NULL and report the error.
upb_decoder_skipval(d);
diff --git a/stream/upb_strstream.h b/stream/upb_strstream.h
index fa9bace..d01d21f 100644
--- a/stream/upb_strstream.h
+++ b/stream/upb_strstream.h
@@ -31,7 +31,7 @@ void upb_stringsrc_free(upb_stringsrc *s);
void upb_stringsrc_reset(upb_stringsrc *s, upb_string *str);
// Returns the upb_bytesrc* for this stringsrc. Invalidated by reset above.
-upb_bytesrc *upb_stringsrc_bytesrc();
+upb_bytesrc *upb_stringsrc_bytesrc(upb_stringsrc *s);
/* upb_stringsink *************************************************************/
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback