diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2013-05-13 11:17:31 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2013-05-13 11:17:31 +0000 |
commit | 8cdb6d6fb056575f58eaf7e1a8fae2f31c321d13 (patch) | |
tree | 03cf143582b475f3a973ee5569501e7d313a5645 /src/htscharset.c | |
parent | 1c496d66c8d39fac3ec5dee010e5ef7f3cba83ba (diff) |
Limit the final destination path lenght to 256 (Windows compatibility)
See http://code.google.com/p/httrack/issues/detail?id=9
Diffstat (limited to 'src/htscharset.c')
-rw-r--r-- | src/htscharset.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/htscharset.c b/src/htscharset.c index f19e47c..351fa8c 100644 --- a/src/htscharset.c +++ b/src/htscharset.c @@ -502,6 +502,18 @@ static int is_space_or_equal_or_quote(char c) { return is_space_or_equal(c) || c == '"' || c == '\''; } +size_t hts_stringLengthUTF8(const char *s) { + const unsigned char *const bytes = (const unsigned char*) s; + size_t i, len; + for(i = 0, len = 0 ; bytes[i] != '\0' ; i++) { + const unsigned char c = bytes[i]; + if (HTS_IS_LEADING_UTF8(c)) { // ASCII or leading byte + len++; + } + } + return len; +} + char* hts_getCharsetFromMeta(const char *html, size_t size) { int i; // <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8" > |