libarchive: Avoid using isblank

It is not available on VS 2012 and below.  Use our own impl instead.
This commit is contained in:
Brad King
2017-02-23 06:57:26 -05:00
parent ce8f117fe2
commit d49176e91e

View File

@@ -531,6 +531,10 @@ time_from_tm(struct tm *t)
#endif #endif
} }
static int la_isblank(int c) {
return c == ' ' || c == '\t';
}
static time_t static time_t
xstrpisotime(const char *s, char **endptr) xstrpisotime(const char *s, char **endptr)
{ {
@@ -543,7 +547,7 @@ xstrpisotime(const char *s, char **endptr)
/* as a courtesy to our callers, and since this is a non-standard /* as a courtesy to our callers, and since this is a non-standard
* routine, we skip leading whitespace */ * routine, we skip leading whitespace */
while (isblank((unsigned char)*s)) while (la_isblank((unsigned char)*s))
++s; ++s;
/* read year */ /* read year */
@@ -619,7 +623,7 @@ _warc_rdver(const char *buf, size_t bsz)
if (memcmp(buf + 3U + end, "\r\n", 2U) != 0) if (memcmp(buf + 3U + end, "\r\n", 2U) != 0)
ver = 0U; ver = 0U;
} else if (ver < 1200U) { } else if (ver < 1200U) {
if (!isblank(*(buf + 3U + end))) if (!la_isblank(*(buf + 3U + end)))
ver = 0U; ver = 0U;
} }
} }
@@ -643,7 +647,7 @@ _warc_rdtyp(const char *buf, size_t bsz)
} }
/* overread whitespace */ /* overread whitespace */
while (val < eol && isblank((unsigned char)*val)) while (val < eol && la_isblank((unsigned char)*val))
++val; ++val;
if (val + 8U == eol) { if (val + 8U == eol) {
@@ -673,7 +677,7 @@ _warc_rduri(const char *buf, size_t bsz)
return res; return res;
} }
while (val < eol && isblank((unsigned char)*val)) while (val < eol && la_isblank((unsigned char)*val))
++val; ++val;
/* overread URL designators */ /* overread URL designators */
@@ -731,7 +735,7 @@ _warc_rdlen(const char *buf, size_t bsz)
} }
/* skip leading whitespace */ /* skip leading whitespace */
while (val < eol && isblank(*val)) while (val < eol && la_isblank(*val))
val++; val++;
/* there must be at least one digit */ /* there must be at least one digit */
if (!isdigit(*val)) if (!isdigit(*val))