summaryrefslogtreecommitdiff
path: root/tests/test_decoder.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-07-15 12:05:43 -0700
committerJoshua Haberman <joshua@reverberate.org>2011-07-15 12:05:43 -0700
commit10265aa56b22ac4f04e7ba08330138e4507534e4 (patch)
treee821c85219a10b4ee3df715ab774465fdf87cf1d /tests/test_decoder.c
parent6a1f3a66939308668ab8dce0d195afec16e02af9 (diff)
Directory restructure.
Includes are now via upb/foo.h. Files specific to the protobuf format are now in upb/pb (the core library is concerned with message definitions, handlers, and byte streams, but knows nothing about any particular serializationf format).
Diffstat (limited to 'tests/test_decoder.c')
-rw-r--r--tests/test_decoder.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test_decoder.c b/tests/test_decoder.c
index 1c3bed0..88b8741 100644
--- a/tests/test_decoder.c
+++ b/tests/test_decoder.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
-#include "upb_decoder.h"
-#include "upb_textprinter.h"
-#include "upb_stdio.h"
-#include "upb_glue.h"
+#include "upb/bytestream.h"
+#include "upb/pb/decoder.h"
+#include "upb/pb/glue.h"
+#include "upb/pb/textprinter.h"
int main(int argc, char *argv[]) {
if (argc < 3) {
@@ -23,14 +23,12 @@ int main(int argc, char *argv[]) {
upb_read_descriptor(symtab, desc, desc_len, &status);
if (!upb_ok(&status)) {
fprintf(stderr, "Error parsing descriptor: ");
- upb_printerr(&status);
+ upb_status_print(&status, stderr);
return 1;
}
free((void*)desc);
- upb_string *name = upb_strdupc(argv[2]);
- upb_def *md = upb_symtab_lookup(symtab, name);
- upb_string_unref(name);
+ upb_def *md = upb_symtab_lookup(symtab, argv[2]);
if (!md) {
fprintf(stderr, "Descriptor did not contain message: %s\n", argv[2]);
return 1;
@@ -57,12 +55,12 @@ int main(int argc, char *argv[]) {
upb_decoder_initforhandlers(&d, handlers);
upb_decoder_reset(&d, upb_stdio_bytesrc(&in), 0, UINT64_MAX, p);
- upb_clearerr(&status);
+ upb_status_clear(&status);
upb_decoder_decode(&d, &status);
if (!upb_ok(&status)) {
fprintf(stderr, "Error parsing input: ");
- upb_printerr(&status);
+ upb_status_print(&status, stderr);
}
upb_status_uninit(&status);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback