From 511e92f39fe9bdca51bea3ee0add95a6eca880f5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 24 Oct 2014 19:09:59 -0700 Subject: Use unsigned char, not char, throughout. Closes #43. --- src/blocks.c | 2 +- src/inlines.c | 12 ++++++------ src/references.c | 4 ++-- src/stmd.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/blocks.c b/src/blocks.c index c0c7e23..18fcdc4 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -87,7 +87,7 @@ static void remove_trailing_blank_lines(strbuf *ln) int i; for (i = ln->size - 1; i >= 0; --i) { - char c = ln->ptr[i]; + unsigned char c = ln->ptr[i]; if (c != ' ' && c != '\t' && c != '\r' && c != '\n') break; diff --git a/src/inlines.c b/src/inlines.c index 07a75f9..c95b46b 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -14,7 +14,7 @@ typedef struct InlineStack { struct InlineStack *previous; node_inl *first_inline; int delim_count; - char delim_char; + unsigned char delim_char; } inline_stack; typedef struct Subject { @@ -231,7 +231,7 @@ inline static chunk take_while(subject* subj, int (*f)(int)) static int scan_to_closing_backticks(subject* subj, int openticklength) { // read non backticks - char c; + unsigned char c; while ((c = peek_char(subj)) && c != '`') { advance(subj); } @@ -273,10 +273,10 @@ static node_inl* handle_backticks(subject *subj) // Scan ***, **, or * and return number scanned, or 0. // Advances position. -static int scan_delims(subject* subj, char c, bool * can_open, bool * can_close) +static int scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close) { int numdelims = 0; - char char_before, char_after; + unsigned char char_before, char_after; char_before = subj->pos == 0 ? '\n' : peek_at(subj, subj->pos - 1); while (peek_char(subj) == c) { @@ -305,7 +305,7 @@ static void free_openers(subject* subj, inline_stack* istack) // Parse strong/emph or a fallback. // Assumes the subject has '_' or '*' at the current position. -static node_inl* handle_strong_emph(subject* subj, char c, node_inl **last) +static node_inl* handle_strong_emph(subject* subj, unsigned char c, node_inl **last) { bool can_open, can_close; int numdelims; @@ -575,7 +575,7 @@ static int link_label(subject* subj, chunk *raw_label) } advance(subj); // advance past [ - char c; + unsigned char c; while ((c = peek_char(subj)) && (c != ']' || nestlevel > 0)) { switch (c) { case '`': diff --git a/src/references.c b/src/references.c index 975bf81..31e2a3c 100644 --- a/src/references.c +++ b/src/references.c @@ -92,10 +92,10 @@ reference* reference_lookup(reference_map *map, chunk *label) reference *ref = NULL; unsigned char *norm; unsigned int hash; - + if (map == NULL) return NULL; - + norm = normalize_reference(label); if (norm == NULL) return NULL; diff --git a/src/stmd.h b/src/stmd.h index c6473a6..552e60e 100644 --- a/src/stmd.h +++ b/src/stmd.h @@ -56,7 +56,7 @@ struct ListData { struct FencedCodeData { int fence_length; int fence_offset; - char fence_char; + unsigned char fence_char; strbuf info; }; -- cgit v1.2.3