From 8cdb6d6fb056575f58eaf7e1a8fae2f31c321d13 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Mon, 13 May 2013 11:17:31 +0000 Subject: Limit the final destination path lenght to 256 (Windows compatibility) See http://code.google.com/p/httrack/issues/detail?id=9 --- src/htscharset.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/htscharset.c') 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; // -- cgit v1.2.3