Fix errors and warnings on INTEGRITY compiler It seems to be applying C90 (?) rules: initializers must be compile-time constants. Fixes #71.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 3ef5b33..5fe7b01 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -25,6 +25,7 @@
#include "md4c.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -2508,6 +2509,7 @@ md_asterisk_chain(MD_CTX* ctx, unsigned flags)
case MD_MARK_EMPH_MOD3_2: return &ASTERISK_OPENERS_extraword_mod3_2;
default: MD_UNREACHABLE();
}
+ return NULL;
}
static MD_MARKCHAIN*
@@ -3447,7 +3449,7 @@ md_resolve_links(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
} else {
if(closer->end < ctx->size && CH(closer->end) == _T('(')) {
/* Might be inline link. */
- OFF inline_link_end = -1;
+ OFF inline_link_end = UINT_MAX;
is_link = md_is_inline_link_spec(ctx, lines, n_lines, closer->end, &inline_link_end, &attr);
if(is_link < 0)
@@ -4235,11 +4237,14 @@ static int
md_process_table_row(MD_CTX* ctx, MD_BLOCKTYPE cell_type, OFF beg, OFF end,
const MD_ALIGN* align, int col_count)
{
- MD_LINE line = { beg, end };
+ MD_LINE line;
OFF* pipe_offs = NULL;
int i, j, n;
int ret = 0;
+ line.beg = beg;
+ line.end = end;
+
/* Break the line into table cells by identifying pipe characters who
* form the cell boundary. */
MD_CHECK(md_analyze_inlines(ctx, &line, 1, TRUE));
@@ -4326,10 +4331,13 @@ abort:
static int
md_is_table_row(MD_CTX* ctx, OFF beg, OFF* p_end)
{
- MD_LINE line = { beg, beg };
+ MD_LINE line;
int i;
int ret = FALSE;
+ line.beg = beg;
+ line.end = beg;
+
/* Find end of line. */
while(line.end < ctx->size && !ISNEWLINE(line.end))
line.end++;
@@ -5290,6 +5298,7 @@ md_is_html_block_end_condition(MD_CTX* ctx, OFF beg, OFF* p_end)
default:
MD_UNREACHABLE();
}
+ return FALSE;
}