nostrdb: fix windows build

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-12 12:34:09 -07:00
committed by Daniel D’Aquino
parent de0935582c
commit 3186b0e1d3
10 changed files with 108 additions and 30 deletions

View File

@@ -3,8 +3,13 @@
#include "block.h"
#include "nostrdb.h"
#include "invoice.h"
#ifndef _WIN32
#include "bolt11/bolt11.h"
#endif
#include "bolt11/bech32.h"
#include <stdlib.h>
#include <string.h>
@@ -164,6 +169,11 @@ fail:
static int push_invoice_str(struct ndb_content_parser *p, struct ndb_str_block *str)
{
#ifdef _WIN32
// we shouldn't be pushing invoices on windows until we fix
// bolt11 parser portability
return 0;
#else
unsigned char *start;
struct bolt11 *bolt11;
char *fail;
@@ -186,6 +196,7 @@ static int push_invoice_str(struct ndb_content_parser *p, struct ndb_str_block *
tal_free(bolt11);
return 1;
#endif
}
int push_block(struct ndb_content_parser *p, struct ndb_block *block);
@@ -455,6 +466,11 @@ static int parse_url(struct cursor *cur, struct ndb_block *block) {
static int parse_invoice(struct cursor *cur, struct ndb_block *block) {
unsigned char *start, *end;
#ifdef _WIN32
// bolt11 stuff requires non-portable cc stuff, so ignore for now
return 0;
#else
// optional
parse_str(cur, "lightning:");
@@ -478,6 +494,7 @@ static int parse_invoice(struct cursor *cur, struct ndb_block *block) {
cur->p = end;
return 1;
#endif
}