cmark

My personal build of CMark ✏️

Commit
511e92f39fe9bdca51bea3ee0add95a6eca880f5
Parent
e8639baa2d91b653859fd8a3643c9c3127f0cece
Author
John MacFarlane <jgm@berkeley.edu>
Date

Use unsigned char, not char, throughout.

Closes #43.

Diffstat

4 files changed, 10 insertions, 10 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 2 1 1
Modified src/inlines.c 12 6 6
Modified src/references.c 4 2 2
Modified src/stmd.h 2 1 1
diff --git 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
@@ -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
@@ -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
@@ -56,7 +56,7 @@ struct ListData {
 struct FencedCodeData {
 	int               fence_length;
 	int               fence_offset;
-	char              fence_char;
+	unsigned char     fence_char;
 	strbuf            info;
 };