commit 6117380d1d430a1cb365c5da6dc8987ae73521cc
parent b00f9f05fcff3fc7477650e672e62344af3b9bb7
Author: William Casarin <jb55@jb55.com>
Date: Sun, 10 Dec 2023 19:04:40 -0800
build: fix additional compiler errors
When trying to build from rust
Diffstat:
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/nostrdb.c b/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;
@@ -2248,6 +2248,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;
@@ -3058,7 +3059,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]);
@@ -3251,7 +3252,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;
@@ -4221,7 +4222,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.h b/nostrdb.h
@@ -363,7 +363,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);
diff --git a/threadpool.h b/threadpool.h
@@ -87,7 +87,7 @@ static inline void threadpool_destroy(struct threadpool *tp)
{
struct thread *t;
- for (uint64_t i = 0; i < tp->num_threads; i++) {
+ for (int i = 0; i < tp->num_threads; i++) {
t = &tp->pool[i];
if (!prot_queue_push(&t->inbox, tp->quit_msg)) {
pthread_exit(&t->thread_id);