From d0b5c9238acc63ec6def1fd16c47f06f8c682f2e Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 29 Jun 2022 18:37:11 +0200 Subject: update vdf indexing program to accept integer types --- src/vdf/tests/index.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/vdf/tests') diff --git a/src/vdf/tests/index.c b/src/vdf/tests/index.c index c3f96b1..6a07760 100644 --- a/src/vdf/tests/index.c +++ b/src/vdf/tests/index.c @@ -8,6 +8,7 @@ * on a known file */ #include +#include #include "vdf.h" @@ -38,12 +39,27 @@ int main(int argc, char** argv) } } - int retval = k->type != VDF_TYPE_STRING; + int retval = k != NULL && k->type == VDF_TYPE_ARRAY; - if (retval) + if (!k || retval) vdf_print_object(k); else - puts(k->data.data_string.str); + { + switch(k->type) + { + case VDF_TYPE_STRING: + puts(k->data.data_string.str); + break; + + case VDF_TYPE_INT: + printf("%lli\n", k->data.data_int); + break; + + default: + assert(0); + } + + } vdf_free_object(o); -- cgit v1.2.3