commit 4ca156fd833622b99adebef1953199d688233107
parent 9f6da8eb7986ca1dd462105ca4ddff43b2a40159
Author: William Casarin <jb55@jb55.com>
Date: Sun, 10 Dec 2023 19:04:40 -0800
nostrdb/build: fix additional compiler errors
When trying to build from rust
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/nostrdb/nostrdb.c b/nostrdb/nostrdb.c
@@ -1671,7 +1671,7 @@ static int ndb_ingester_process_event(secp256k1_context *ctx,
ndb_client_event_from_json(ev->json, ev->len, &fce, buf, bufsize, &cb) :
ndb_ws_event_from_json(ev->json, ev->len, &tce, buf, bufsize, &cb);
- if (note_size == -42) {
+ if ((int)note_size == -42) {
// we already have this!
//ndb_debug("already have id??\n");
goto cleanup;
@@ -2256,6 +2256,7 @@ static int ndb_write_note_fulltext_index(struct ndb_txn *txn,
static int ndb_parse_search_words(void *ctx, const char *word_str, int word_len, int word_index)
{
+ (void)word_index;
struct ndb_search_words *words = ctx;
struct ndb_word *word;
@@ -3066,7 +3067,7 @@ static int ndb_queue_write_version(struct ndb *ndb, uint64_t version)
static int ndb_run_migrations(struct ndb *ndb)
{
- uint64_t version, latest_version, i;
+ int64_t version, latest_version, i;
latest_version = sizeof(MIGRATIONS) / sizeof(MIGRATIONS[0]);
@@ -3259,7 +3260,7 @@ static inline int cursor_push_tag(struct cursor *cur, struct ndb_tag *tag)
}
int ndb_builder_init(struct ndb_builder *builder, unsigned char *buf,
- int bufsize)
+ size_t bufsize)
{
struct ndb_note *note;
int half, size, str_indices_size;
@@ -4240,7 +4241,7 @@ int ndb_stat(struct ndb *ndb, struct ndb_stat *stat)
common_kind = ndb_kind_to_common_kind(note->kind);
// uncommon kind? just count them in bulk
- if (common_kind == -1) {
+ if ((int)common_kind == -1) {
stat->other_kinds.count++;
stat->other_kinds.key_size += k.mv_size;
stat->other_kinds.value_size += v.mv_size;
diff --git a/nostrdb/nostrdb.h b/nostrdb/nostrdb.h
@@ -364,7 +364,7 @@ int ndb_parse_json_note(struct ndb_json_parser *, struct ndb_note **);
int ndb_client_event_from_json(const char *json, int len, struct ndb_fce *fce, unsigned char *buf, int bufsize, struct ndb_id_cb *cb);
int ndb_ws_event_from_json(const char *json, int len, struct ndb_tce *tce, unsigned char *buf, int bufsize, struct ndb_id_cb *);
int ndb_note_from_json(const char *json, int len, struct ndb_note **, unsigned char *buf, int buflen);
-int ndb_builder_init(struct ndb_builder *builder, unsigned char *buf, int bufsize);
+int ndb_builder_init(struct ndb_builder *builder, unsigned char *buf, size_t bufsize);
int ndb_builder_finalize(struct ndb_builder *builder, struct ndb_note **note, struct ndb_keypair *privkey);
int ndb_builder_set_content(struct ndb_builder *builder, const char *content, int len);
void ndb_builder_set_created_at(struct ndb_builder *builder, uint64_t created_at);