X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Furl.c;h=90b011d614c19a22ac48ff5f76123027f9219890;hb=354cf2e07ccd0d7900f96bffc279093997cbe203;hp=a7a5c0c7435335901841c6b67d65f44c0de326b0;hpb=4b8ad1b3b464836eca2e876dd418a8e8d87bd721;p=smdp.git diff --git a/src/url.c b/src/url.c index a7a5c0c..90b011d 100644 --- a/src/url.c +++ b/src/url.c @@ -1,6 +1,6 @@ /* * Functions necessary to handle pandoc URLs. - * Copyright (C) 2014 Michael Goehler + * Copyright (C) 2018 Michael Goehler * * This file is part of mdp. * @@ -165,7 +165,7 @@ int url_count_inline(const wchar_t *line) { for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) { @@ -178,14 +178,14 @@ int url_count_inline(const wchar_t *line) { return count; } -int url_len_inline(const wchar_t *text) { +int url_len_inline(const wchar_t *value) { int count = 0; - const wchar_t *i = text; + const wchar_t *i = value; for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) {