nostrdb/content_parser: add initial db decoders

We need to pull the data out as well! Let's add some initial decoders.
We still need tests to make sure it's working.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-12-27 14:55:17 -08:00
committed by Daniel D’Aquino
parent c3b06d281e
commit d73422db38
5 changed files with 169 additions and 38 deletions

View File

@@ -360,6 +360,11 @@ static inline int cursor_push_u16(struct cursor *cursor, unsigned short i)
return cursor_push(cursor, (unsigned char*)&i, sizeof(i));
}
static inline int cursor_pull_u16(struct cursor *cursor, uint16_t *i)
{
return cursor_pull(cursor, (unsigned char*)i, sizeof(*i));
}
static inline void *index_cursor(struct cursor *cursor, unsigned int index, int elem_size)
{
unsigned char *p;