diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blocks.c | 22 | ||||
-rw-r--r-- | src/chunk.h | 7 | ||||
-rw-r--r-- | src/commonmark.c | 2 | ||||
-rw-r--r-- | src/html.c | 8 | ||||
-rw-r--r-- | src/inlines.c | 6 | ||||
-rw-r--r-- | src/xml.c | 4 |
6 files changed, 24 insertions, 25 deletions
diff --git a/src/blocks.c b/src/blocks.c index d6fa552..f6d0ee4 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -735,7 +735,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) // note, we don't adjust offset because the tag is part of the text } else if (!indented && - container->type == NODE_PARAGRAPH && + container->type == NODE_PARAGRAPH && (lev = scan_setext_header_line(&input, first_nonspace)) && // check that there is only one line in the paragraph: (cmark_strbuf_strrchr(&container->string_content, '\n', @@ -747,8 +747,8 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) offset = input.len - 1; } else if (!indented && - !(container->type == NODE_PARAGRAPH && - !all_matched) && + !(container->type == NODE_PARAGRAPH && + !all_matched) && (matched = scan_hrule(&input, first_nonspace))) { // it's only now that we know the line is not part of a setext header: @@ -757,7 +757,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) offset = input.len - 1; } else if ((matched = parse_list_marker(&input, first_nonspace, &data)) && - (!indented || container->type == NODE_LIST)) { + (!indented || container->type == NODE_LIST)) { // Note that we can have new list items starting with >= 4 // spaces indent, as long as the list container is still open. @@ -800,13 +800,13 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) free(data); } else if (indented && !maybe_lazy && !blank) { - offset += CODE_INDENT; - container = add_child(parser, container, NODE_CODE_BLOCK, offset + 1); - container->as.code.fenced = false; - container->as.code.fence_char = 0; - container->as.code.fence_length = 0; - container->as.code.fence_offset = 0; - container->as.code.info = cmark_chunk_literal(""); + offset += CODE_INDENT; + container = add_child(parser, container, NODE_CODE_BLOCK, offset + 1); + container->as.code.fenced = false; + container->as.code.fence_char = 0; + container->as.code.fence_length = 0; + container->as.code.fence_offset = 0; + container->as.code.info = cmark_chunk_literal(""); } else { break; diff --git a/src/chunk.h b/src/chunk.h index 4bb4980..a246a9d 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -66,8 +66,8 @@ static inline const char *cmark_chunk_to_cstr(cmark_chunk *c) } str = (unsigned char *)malloc(c->len + 1); if(str != NULL) { - if(c->len > 0){ - memcpy(str, c->data, c->len); + if(c->len > 0) { + memcpy(str, c->data, c->len); } str[c->len] = 0; } @@ -86,8 +86,7 @@ static inline void cmark_chunk_set_cstr(cmark_chunk *c, const char *str) c->len = 0; c->data = NULL; c->alloc = 0; - } - else { + } else { c->len = strlen(str); c->data = (unsigned char *)malloc(c->len + 1); c->alloc = 1; diff --git a/src/commonmark.c b/src/commonmark.c index 47da191..dba1fcf 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -260,7 +260,7 @@ is_autolink(cmark_node *node) link_text = node->first_child; cmark_consolidate_text_nodes(link_text); return ((int)strlen(url) == link_text->as.literal.len && - strncmp(url, + strncmp(url, (char*)link_text->as.literal.data, link_text->as.literal.len) == 0); } @@ -262,12 +262,12 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, if (entering) { cmark_strbuf_puts(html, "<a href=\""); escape_href(html, node->as.link.url.data, - node->as.link.url.len); + node->as.link.url.len); if (node->as.link.title.len) { cmark_strbuf_puts(html, "\" title=\""); escape_html(html, node->as.link.title.data, - node->as.link.title.len); + node->as.link.title.len); } cmark_strbuf_puts(html, "\">"); @@ -280,7 +280,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, if (entering) { cmark_strbuf_puts(html, "<img src=\""); escape_href(html, node->as.link.url.data, - node->as.link.url.len); + node->as.link.url.len); cmark_strbuf_puts(html, "\" alt=\""); state->plain = node; @@ -288,7 +288,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, if (node->as.link.title.len) { cmark_strbuf_puts(html, "\" title=\""); escape_html(html, node->as.link.title.data, - node->as.link.title.len); + node->as.link.title.len); } cmark_strbuf_puts(html, "\" />"); diff --git a/src/inlines.c b/src/inlines.c index 352ded3..8a1ee44 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -151,7 +151,7 @@ static cmark_chunk chunk_clone(cmark_chunk *src) memcpy(c.data, src->data, len); c.data[len] = '\0'; - return c; + return c; } static void subject_from_buf(subject *e, cmark_strbuf *buffer, @@ -307,9 +307,9 @@ scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close) !utf8proc_is_punctuation(after_char)); if (c == '_') { *can_open = left_flanking && - (!right_flanking || utf8proc_is_punctuation(before_char)); + (!right_flanking || utf8proc_is_punctuation(before_char)); *can_close = right_flanking && - (!left_flanking || utf8proc_is_punctuation(after_char)); + (!left_flanking || utf8proc_is_punctuation(after_char)); } else if (c == '\'' || c == '"') { *can_open = left_flanking && !right_flanking; *can_close = right_flanking; @@ -119,11 +119,11 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_IMAGE: cmark_strbuf_puts(xml, " destination=\""); escape_xml(xml, node->as.link.url.data, - node->as.link.url.len); + node->as.link.url.len); cmark_strbuf_putc(xml, '"'); cmark_strbuf_puts(xml, " title=\""); escape_xml(xml, node->as.link.title.data, - node->as.link.title.len); + node->as.link.title.len); cmark_strbuf_putc(xml, '"'); break; default: |