summaryrefslogtreecommitdiff
path: root/src/charset/detect.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 15:29:06 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 15:29:06 +0000
commitd138c4ab32e2b4a3c527ad12b4c10a3527472289 (patch)
treef84f74e49a234d5915c0ed97f08867d99c2b1e20 /src/charset/detect.c
parente75a0c7c08cc0a0864185bdf155c934526a212ac (diff)
downloadlibcss-d138c4ab32e2b4a3c527ad12b4c10a3527472289.tar.gz
libcss-d138c4ab32e2b4a3c527ad12b4c10a3527472289.tar.bz2
Ensure that charset detection always returns CSS_OK unless there's a fatal error. Otherwise, it's possible to fail to process any of a short stylesheet (sheet.length < "@charset ").
svn path=/trunk/libcss/; revision=8241
Diffstat (limited to 'src/charset/detect.c')
-rw-r--r--src/charset/detect.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/charset/detect.c b/src/charset/detect.c
index 2612fa8..9f8da69 100644
--- a/src/charset/detect.c
+++ b/src/charset/detect.c
@@ -144,10 +144,8 @@ parserutils_error css_charset_read_bom_or_charset(const uint8_t *data,
}
error = try_ascii_compatible_charset(data, len, &charset);
- if (error != PARSERUTILS_OK)
- return error;
-
- *mibenum = charset;
+ if (error == PARSERUTILS_OK)
+ *mibenum = charset;
return PARSERUTILS_OK;
}