aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-15 21:21:15 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-15 21:21:15 +0100
commit22d0d7056206e3158fe6cdbe82c9508b2f41da29 (patch)
treecb2a425bdf4ede9f198c27e85a47ac8cec2c541c
parentf68785a65aed9ce40d9aec5fbf7f9cec3af1b384 (diff)
make CSS_MAX_STR_LEN a static const integer
-rw-r--r--src/cssparser.cc14
-rw-r--r--src/cssparser.hh6
2 files changed, 9 insertions, 11 deletions
diff --git a/src/cssparser.cc b/src/cssparser.cc
index 349e4ce6..5b41c490 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -426,7 +426,7 @@ void CssParser::nextToken()
// handle negative numbers
if (c == '-') {
- if (i < CSS_MAX_STR_LEN - 1)
+ if (i < maxStrLen - 1)
tval[i++] = c;
c = getc();
}
@@ -434,7 +434,7 @@ void CssParser::nextToken()
if (isdigit(c)) {
ttype = CSS_TK_DECINT;
do {
- if (i < CSS_MAX_STR_LEN - 1) {
+ if (i < maxStrLen - 1) {
tval[i++] = c;
}
/* else silently truncated */
@@ -450,10 +450,10 @@ void CssParser::nextToken()
c = getc();
if (isdigit(c)) {
ttype = CSS_TK_FLOAT;
- if (i < CSS_MAX_STR_LEN - 1)
+ if (i < maxStrLen - 1)
tval[i++] = '.';
do {
- if (i < CSS_MAX_STR_LEN - 1)
+ if (i < maxStrLen - 1)
tval[i++] = c;
/* else silently truncated */
c = getc();
@@ -492,7 +492,7 @@ void CssParser::nextToken()
i = 1;
c = getc();
while (isalnum(c) || c == '_' || c == '-') {
- if (i < CSS_MAX_STR_LEN - 1) {
+ if (i < maxStrLen - 1) {
tval[i] = c;
i++;
} /* else silently truncated */
@@ -534,7 +534,7 @@ void CssParser::nextToken()
}
}
- if (i < CSS_MAX_STR_LEN - 1) {
+ if (i < maxStrLen - 1) {
tval[i] = c;
i++;
} /* else silently truncated */
@@ -556,7 +556,7 @@ void CssParser::nextToken()
i = 1;
c = getc();
while (isxdigit(c)) {
- if (i < CSS_MAX_STR_LEN - 1) {
+ if (i < maxStrLen - 1) {
tval[i] = c;
i++;
} /* else silently truncated */
diff --git a/src/cssparser.hh b/src/cssparser.hh
index 4802510d..8be8c8a5 100644
--- a/src/cssparser.hh
+++ b/src/cssparser.hh
@@ -16,11 +16,9 @@ typedef enum {
CSS_TK_CHAR, CSS_TK_END
} CssTokenType;
-/* Applies to symbol lengths and string literals. */
-#define CSS_MAX_STR_LEN 256
-
class CssParser {
private:
+ static const int maxStrLen = 256;
CssContext *context;
CssOrigin origin;
@@ -28,7 +26,7 @@ class CssParser {
int buflen, bufptr;
CssTokenType ttype;
- char tval[CSS_MAX_STR_LEN];
+ char tval[maxStrLen];
bool within_block;
bool space_separated; /* used when parsing CSS selectors */