From: Fletcher T. Penney Date: Sat, 11 Mar 2017 18:20:17 +0000 (-0500) Subject: FIXED: Tidy up some compiler warnings in code X-Git-Tag: 6.0.0-b2~1^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73d6446a76f390be07d3815b293095c32f01164f;p=multimarkdown FIXED: Tidy up some compiler warnings in code --- diff --git a/Sources/libMultiMarkdown/aho-corasick.c b/Sources/libMultiMarkdown/aho-corasick.c index 7445aa4..bc1ee9f 100644 --- a/Sources/libMultiMarkdown/aho-corasick.c +++ b/Sources/libMultiMarkdown/aho-corasick.c @@ -195,13 +195,13 @@ size_t trie_node_search(trie * a, size_t s, const char * query) { return s; } - if (a->node[s].child[query[0]] == 0) { + if (a->node[s].child[(int)query[0]] == 0) { // Failed to match return -1; } // Partial match, keep going - return trie_node_search(a, a->node[s].child[query[0]], query + 1); + return trie_node_search(a, a->node[s].child[(int)query[0]], query + 1); } @@ -259,13 +259,6 @@ void ac_trie_node_prepare(trie * a, size_t s, char * buffer, unsigned short dept char * suffix = buffer; - // No suffix for first level matches - unsigned short last_match_depth = a->node[last_match_state].len; - - if (depth == 1) { - last_match_depth = 1; - } - // Longest match seen so far?? suffix += 1; @@ -380,12 +373,12 @@ match * ac_trie_search(trie * a, const char * source, size_t len) { size_t temp_state; // Character being compared - char test_value; + int test_value; size_t counter = 0; while ((counter < len) && (source[counter] != '\0')) { // Read next character - test_value = source[counter++]; + test_value = (int)source[counter++]; // Check for path that allows us to match next character while (state != 0 && a->node[state].child[test_value] == 0) { diff --git a/Sources/libMultiMarkdown/html.c b/Sources/libMultiMarkdown/html.c index de07093..e0cff9a 100644 --- a/Sources/libMultiMarkdown/html.c +++ b/Sources/libMultiMarkdown/html.c @@ -229,8 +229,9 @@ void mmd_export_link_html(DString * out, const char * source, token * text, link text->child->next->start--; text->child->next->len++; } - - mmd_export_token_tree_html(out, source, text->child, scratch); + + if (text->child) + mmd_export_token_tree_html(out, source, text->child, scratch); print_const(""); } @@ -341,7 +342,6 @@ void mmd_export_toc_entry_html(DString * out, const char * source, scratch_pad * void mmd_export_toc_html(DString * out, const char * source, scratch_pad * scratch) { - token * entry; size_t counter = 0; mmd_export_toc_entry_html(out, source, scratch, &counter, 0); @@ -733,8 +733,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc scratch->padded = 2; break; case BLOCK_TOC: - temp_short = 0; - temp_short2 = 0; pad(out, 2, scratch); print_const("
\n"); @@ -742,64 +740,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc print_const("
"); scratch->padded = 0; break; - for (int i = 0; i < scratch->header_stack->size; ++i) - { - temp_token = stack_peek_index(scratch->header_stack, i); - - if (temp_token->type == temp_short2) { - // Same level -- close list item - print_const("\n"); - } - - if (temp_short == 0) { - // First item - print_const("\n\n"); - temp_short2--; - } - - if (temp_short) - print_const("\n\n"); - - print_const(""); - scratch->padded = 0; - break; case BRACE_DOUBLE_LEFT: print_const("{{"); break; @@ -1189,7 +1129,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc // Classify this use temp_short2 = scratch->used_citations->size; - temp_short3 = scratch->inline_citations_to_free->size; citation_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1202,9 +1141,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc break; } - // Get instance of the note used - temp_note = stack_peek_index(scratch->used_citations, temp_short - 1); - if (temp_bool) { // This is a regular citation @@ -1255,7 +1191,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc // Classify this use temp_short2 = scratch->used_footnotes->size; - temp_short3 = scratch->inline_footnotes_to_free->size; footnote_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1289,7 +1224,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc // Classify this use temp_short2 = scratch->used_glossaries->size; - temp_short3 = scratch->inline_glossaries_to_free->size; glossary_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index a3ec7b7..617f064 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -417,7 +417,6 @@ void mmd_export_toc_entry_latex(DString * out, const char * source, scratch_pad void mmd_export_toc_latex(DString * out, const char * source, scratch_pad * scratch) { - token * entry; size_t counter = 0; mmd_export_toc_entry_latex(out, source, scratch, &counter, 0); @@ -749,8 +748,6 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat scratch->padded = 0; break; case BLOCK_TOC: - temp_short = 0; - temp_short2 = 0; pad(out, 2, scratch); print_const("\\tableofcontents"); scratch->padded = 0; @@ -1018,7 +1015,6 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat // Note-based syntax enabled // Classify this use - temp_short2 = scratch->used_abbreviations->size; temp_short3 = scratch->inline_abbreviations_to_free->size; abbreviation_from_bracket(source, scratch, t, &temp_short); @@ -1083,8 +1079,6 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat } // Classify this use - temp_short2 = scratch->used_citations->size; - temp_short3 = scratch->inline_citations_to_free->size; citation_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1161,7 +1155,6 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat // Classify this use temp_short2 = scratch->used_footnotes->size; - temp_short3 = scratch->inline_footnotes_to_free->size; footnote_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1172,9 +1165,6 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat break; } - // Get instance of the note used - temp_note = stack_peek_index(scratch->used_footnotes, temp_short - 1); - if (temp_short2 == scratch->used_footnotes->size) { // This is a re-use of a previously used note diff --git a/Sources/libMultiMarkdown/odf.c b/Sources/libMultiMarkdown/odf.c index 96e6d6f..a610d7f 100644 --- a/Sources/libMultiMarkdown/odf.c +++ b/Sources/libMultiMarkdown/odf.c @@ -193,8 +193,6 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa void mmd_export_link_odf(DString * out, const char * source, token * text, link * link, scratch_pad * scratch) { - attr * a = link->attributes; - if (link->url) { print_const("url); @@ -339,7 +337,6 @@ void mmd_export_toc_entry_odf(DString * out, const char * source, scratch_pad * } void mmd_export_toc_odf(DString * out, const char * source, scratch_pad * scratch) { - token * entry; size_t counter = 0; // TODO: Could use LC to internationalize this @@ -691,8 +688,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch scratch->padded = 0; break; case BLOCK_TOC: - temp_short = 0; - temp_short2 = 0; pad(out, 2, scratch); mmd_export_toc_odf(out, source, scratch); @@ -1022,7 +1017,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch // Classify this use temp_short2 = scratch->used_citations->size; - temp_short3 = scratch->inline_citations_to_free->size; citation_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1035,8 +1029,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch break; } - // Get instance of the note used - temp_note = stack_peek_index(scratch->used_citations, temp_short - 1); temp_short3 = scratch->odf_para_type; scratch->odf_para_type = PAIR_BRACKET_FOOTNOTE; @@ -1108,7 +1100,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch // Classify this use temp_short2 = scratch->used_footnotes->size; - temp_short3 = scratch->inline_footnotes_to_free->size; footnote_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { @@ -1119,9 +1110,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch break; } - // Get instance of the note used - temp_note = stack_peek_index(scratch->used_footnotes, temp_short - 1); - temp_short3 = scratch->odf_para_type; scratch->odf_para_type = PAIR_BRACKET_FOOTNOTE; @@ -1221,7 +1209,6 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch // Classify this use temp_short2 = scratch->used_glossaries->size; - temp_short3 = scratch->inline_glossaries_to_free->size; glossary_from_bracket(source, scratch, t, &temp_short); if (temp_short == -1) { diff --git a/Sources/libMultiMarkdown/token_pairs.c b/Sources/libMultiMarkdown/token_pairs.c index fd3fc7c..7b93251 100644 --- a/Sources/libMultiMarkdown/token_pairs.c +++ b/Sources/libMultiMarkdown/token_pairs.c @@ -139,7 +139,7 @@ void token_pairs_match_pairs_inside_token(token * parent, token_pair_engine * e, // Counter size_t start_counter = s->size; - size_t i = start_counter; // We're sharing one stack, so any opener earlier than this belongs to a parent + size_t i; // We're sharing one stack, so any opener earlier than this belongs to a parent token * peek; unsigned short pair_type;