]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Tidy up some compiler warnings in code
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 11 Mar 2017 18:20:17 +0000 (13:20 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 11 Mar 2017 18:20:17 +0000 (13:20 -0500)
Sources/libMultiMarkdown/aho-corasick.c
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/odf.c
Sources/libMultiMarkdown/token_pairs.c

index 7445aa45f667d0a9906dd6085bee283d60571a91..bc1ee9f44527feadaea4b3088d00e8d412012ed5 100644 (file)
@@ -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) {
index de07093f0222c870ac90ef0d31596f7761135bbc..e0cff9a785977f2e677368b25217d1aaa4b2c100 100644 (file)
@@ -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("</a>");
 }
@@ -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("<div class=\"TOC\">\n");
 
@@ -742,64 +740,6 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        print_const("</div>");
                        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("</li>\n");
-                               }
-
-                               if (temp_short == 0) {
-                                       // First item
-                                       print_const("\n<ul>\n");
-                                       temp_short = temp_token->type;
-                                       temp_short2 = temp_short;
-                               }
-
-                               // Indent?
-                               if (temp_token->type == temp_short2) {
-                                       // Same level -- NTD
-                               } else if (temp_token->type == temp_short2 + 1) {
-                                       // Indent
-                                       print_const("\n\n<ul>\n");
-                                       temp_short2++;
-                               } else if (temp_token->type < temp_short2) {
-                                       // Outdent
-                                       print_const("</li>\n");
-                                       while (temp_short2 > temp_token->type) {
-                                               if (temp_short2 > temp_short)
-                                                       print_const("</ul></li>\n");
-                                               else
-                                                       temp_short = temp_short2 - 1;
-
-                                               temp_short2--;
-                                       }
-                               } else {
-                                       // Skipped more than one level -- ignore
-                                       continue;
-                               }
-
-                               temp_char = label_from_header(source, temp_token);
-
-                               printf("<li><a href=\"#%s\">", temp_char);
-                               mmd_export_token_tree_html(out, source, temp_token->child, scratch);
-                               print_const("</a>");
-                               free(temp_char);
-                       }
-
-                       while (temp_short2 > (temp_short)) {
-                               print_const("</ul>\n");
-                               temp_short2--;
-                       }
-                       
-                       if (temp_short)
-                               print_const("</li>\n</ul>\n");
-
-                       print_const("</div>");
-                       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) {
index a3ec7b7fc8c18add619a0016df7ac47445a3837b..617f06497d448740bb77e2351a95c08b51a6a87f 100644 (file)
@@ -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
 
index 96e6d6fc201e0368f9ce9e14dc1a163683426c79..a610d7feaa416ef41538311caa2776ac51d8bc76 100644 (file)
@@ -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("<text:a xlink:type=\"simple\" xlink:href=\"");
                mmd_print_string_odf(out, link->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) {
index fd3fc7c24beda1d32ffcc950b58f01901e6d1538..7b932516eb4c2b78c5fc0cffd60ffe483019663b 100644 (file)
@@ -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;