Switch over to use use blocks from nostrdb

This is still kind of broken until queries are switched over to nostrdb.
Will do this next

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-02-01 17:26:57 -08:00
committed by Daniel D’Aquino
parent 208b3331ca
commit 28a06af534
51 changed files with 1086 additions and 501 deletions

View File

@@ -5,9 +5,9 @@
/* Common FlatBuffers build functionality for C. */
#include "flatcc/flatcc_prologue.h"
#include "flatcc_prologue.h"
#ifndef FLATBUILDER_H
#include "flatcc/flatcc_builder.h"
#include "flatcc_builder.h"
#endif
typedef flatcc_builder_t flatbuffers_builder_t;
typedef flatcc_builder_ref_t flatbuffers_ref_t;
@@ -681,5 +681,5 @@ __flatbuffers_build_scalar(flatbuffers_, flatbuffers_double, double)
__flatbuffers_build_string(flatbuffers_)
__flatbuffers_build_buffer(flatbuffers_)
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* FLATBUFFERS_COMMON_BUILDER_H */

View File

@@ -5,8 +5,8 @@
/* Common FlatBuffers read functionality for C. */
#include "flatcc/flatcc_prologue.h"
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc_prologue.h"
#include "flatcc_flatbuffers.h"
#define __flatbuffers_read_scalar_at_byteoffset(N, p, o) N ## _read_from_pe((uint8_t *)(p) + (o))
@@ -574,5 +574,5 @@ static inline N ## _ ## K ## t N ## _as_typed_root(const void *buffer__tmp)\
#define __flatbuffers_struct_as_root(N) __flatbuffers_buffer_as_root(N, struct_)
#define __flatbuffers_table_as_root(N) __flatbuffers_buffer_as_root(N, table_)
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* FLATBUFFERS_COMMON_H */

View File

@@ -9,7 +9,7 @@
#ifndef FLATBUFFERS_COMMON_BUILDER_H
#include "flatbuffers_common_builder.h"
#endif
#include "flatcc/flatcc_prologue.h"
#include "flatcc_prologue.h"
#ifndef flatbuffers_identifier
#define flatbuffers_identifier 0
#endif
@@ -65,5 +65,5 @@ static NdbEventMeta_ref_t NdbEventMeta_clone(flatbuffers_builder_t *B, NdbEventM
__flatbuffers_memoize_end(B, t, NdbEventMeta_end(B));
}
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* META_BUILDER_H */

View File

@@ -6,11 +6,11 @@
#ifndef FLATBUFFERS_COMMON_READER_H
#include "flatbuffers_common_reader.h"
#endif
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc_flatbuffers.h"
#ifndef __alignas_is_defined
#include <stdalign.h>
#endif
#include "flatcc/flatcc_prologue.h"
#include "flatcc_prologue.h"
#ifndef flatbuffers_identifier
#define flatbuffers_identifier 0
#endif
@@ -54,5 +54,5 @@ __flatbuffers_define_scalar_field(4, NdbEventMeta, zaps, flatbuffers_int32, int3
__flatbuffers_define_scalar_field(5, NdbEventMeta, zap_total, flatbuffers_int64, int64_t, INT64_C(0))
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* META_READER_H */

View File

@@ -9,7 +9,7 @@
#ifndef FLATBUFFERS_COMMON_BUILDER_H
#include "flatbuffers_common_builder.h"
#endif
#include "flatcc/flatcc_prologue.h"
#include "flatcc_prologue.h"
#ifndef flatbuffers_identifier
#define flatbuffers_identifier 0
#endif
@@ -127,5 +127,5 @@ static NdbProfileRecord_ref_t NdbProfileRecord_clone(flatbuffers_builder_t *B, N
__flatbuffers_memoize_end(B, t, NdbProfileRecord_end(B));
}
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* PROFILE_BUILDER_H */

View File

@@ -3,8 +3,8 @@
/* Generated by flatcc 0.6.1 FlatBuffers schema compiler for C by dvide.com */
#include "flatcc/flatcc_json_parser.h"
#include "flatcc/flatcc_prologue.h"
#include "flatcc_json_parser.h"
#include "flatcc_prologue.h"
/*
* Parses the default root table or struct of the schema and constructs a FlatBuffer.
@@ -408,5 +408,5 @@ static int profile_parse_json(flatcc_builder_t *B, flatcc_json_parser_t *ctx,
return 0;
}
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* PROFILE_JSON_PARSER_H */

View File

@@ -6,11 +6,11 @@
#ifndef FLATBUFFERS_COMMON_READER_H
#include "flatbuffers_common_reader.h"
#endif
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc_flatbuffers.h"
#ifndef __alignas_is_defined
#include <stdalign.h>
#endif
#include "flatcc/flatcc_prologue.h"
#include "flatcc_prologue.h"
#ifndef flatbuffers_identifier
#define flatbuffers_identifier 0
#endif
@@ -89,5 +89,5 @@ __flatbuffers_define_scalar_field(2, NdbProfileRecord, note_key, flatbuffers_uin
__flatbuffers_define_string_field(3, NdbProfileRecord, lnurl, 0)
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* PROFILE_READER_H */

View File

@@ -6,8 +6,8 @@
#ifndef PROFILE_READER_H
#include "profile_reader.h"
#endif
#include "flatcc/flatcc_verifier.h"
#include "flatcc/flatcc_prologue.h"
#include "flatcc_verifier.h"
#include "flatcc_prologue.h"
static int NdbProfile_verify_table(flatcc_table_verifier_descriptor_t *td);
static int NdbProfileRecord_verify_table(flatcc_table_verifier_descriptor_t *td);
@@ -80,5 +80,5 @@ static inline int NdbProfileRecord_verify_as_root_with_type_hash(const void *buf
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &NdbProfileRecord_verify_table);
}
#include "flatcc/flatcc_epilogue.h"
#include "flatcc_epilogue.h"
#endif /* PROFILE_VERIFIER_H */

View File

@@ -2,8 +2,6 @@
// swiftlint:disable all
// swiftformat:disable all
import FlatBuffers
public struct NdbEventMeta: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_5_26() }

View File

@@ -2,8 +2,6 @@
// swiftlint:disable all
// swiftformat:disable all
import FlatBuffers
public struct NdbProfile: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_5_26() }

View File

@@ -133,7 +133,8 @@ static struct bolt11 *decode_fail(struct bolt11 *b11, char **fail,
va_list ap;
va_start(ap, fmt);
*fail = tal_vfmt(tal_parent(b11), fmt, ap);
if (fail)
*fail = tal_vfmt(tal_parent(b11), fmt, ap);
va_end(ap);
return tal_free(b11);
}

View File

@@ -5,8 +5,8 @@
// Created by William Casarin on 2023-04-09.
//
#include "nostr_bech32.h"
#include <stdlib.h>
#include "nostr_bech32.h"
#include "cursor.h"
#include "str_block.h"
#include "ccan/endian/endian.h"
@@ -151,12 +151,12 @@ static int parse_nostr_bech32_nevent(struct cursor *cur, struct bech32_nevent *n
static int parse_nostr_bech32_naddr(struct cursor *cur, struct bech32_naddr *naddr) {
struct nostr_tlv tlv;
int i;
int i, has_kind;
has_kind = 0;
naddr->identifier.str = NULL;
naddr->identifier.len = 0;
naddr->pubkey = NULL;
naddr->has_kind = 0;
naddr->relays.num_relays = 0;
for (i = 0; i < MAX_TLVS; i++) {
@@ -183,7 +183,7 @@ static int parse_nostr_bech32_naddr(struct cursor *cur, struct bech32_naddr *nad
}
}
return naddr->identifier.str != NULL;
return naddr->identifier.str != NULL && has_kind;
}
static int parse_nostr_bech32_nprofile(struct cursor *cur, struct bech32_nprofile *nprofile) {

View File

@@ -384,7 +384,6 @@ struct bech32_naddr {
struct ndb_str_block identifier;
const unsigned char *pubkey;
uint32_t kind;
int has_kind;
};
struct bech32_nrelay {