summaryrefslogtreecommitdiff
path: root/src/utils/utils.h
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-22 00:45:26 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-22 00:45:26 +0000
commit703a8b505cf698c310497086334408d44397d121 (patch)
treef507e15f3d6abbdb29ff4651a8f4e666dc844edc /src/utils/utils.h
parentca3a7f507ebdcbb4a1ae16fd28ce6a256a0f8861 (diff)
downloadlibcss-703a8b505cf698c310497086334408d44397d121.tar.gz
Move isDigit() and isHex() to utils.h.
Fix #rgb/#rrggbb parsing to ensure that the characters are valid hex digits. svn path=/trunk/libcss/; revision=6167
Diffstat (limited to 'src/utils/utils.h')
-rw-r--r--src/utils/utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 835265b..8100669 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -125,6 +125,16 @@ static inline fixed number_from_css_string(const css_string *string,
return FMULI(((intpart << 10) | fracpart), sign);
}
+static inline bool isDigit(uint8_t c)
+{
+ return '0' <= c && c <= '9';
+}
+
+static inline bool isHex(uint8_t c)
+{
+ return isDigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');
+}
+
static inline uint32_t charToHex(uint8_t c)
{
switch (c) {