Author: jmb
Date: Fri Jan 16 15:41:33 2009
New Revision: 6098

URL: http://source.netsurf-browser.org?rev=6098&view=rev
Log:
Fix counter-increment and counter-reset

Modified:
    trunk/libcss/src/parse/properties.c

Modified: trunk/libcss/src/parse/properties.c
URL: 
http://source.netsurf-browser.org/trunk/libcss/src/parse/properties.c?rev=6098&r1=6097&r2=6098&view=diff
==============================================================================
--- trunk/libcss/src/parse/properties.c (original)
+++ trunk/libcss/src/parse/properties.c Fri Jan 16 15:41:33 2009
@@ -1608,7 +1608,7 @@
        int temp_ctx = *ctx;
        uint8_t *ptr;
 
-       /* [IDENT <integer> ]+ | IDENT(none, inherit) */
+       /* [IDENT <integer>? ]+ | IDENT(none, inherit) */
 
        /* Pass 1: validate input and calculate bytecode size */
        token = parserutils_vector_iterate(vector, &temp_ctx);
@@ -1626,17 +1626,17 @@
 
                while (token != NULL) {
                        const parserutils_hash_entry *name = token->idata;
-                       fixed increment = 1;
+                       fixed increment = INTTOFIX(1);
 
                        consumeWhitespace(vector, &temp_ctx);
 
                        /* Optional integer */
                        token = parserutils_vector_peek(vector, temp_ctx);
-                       if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
-                                       token->type != CSS_TOKEN_NUMBER))
+                       if (token != NULL && token->type != CSS_TOKEN_IDENT &&
+                                       token->type != CSS_TOKEN_NUMBER)
                                return CSS_INVALID;
 
-                       if (token->type == CSS_TOKEN_NUMBER) {
+                       if (token != NULL && token->type == CSS_TOKEN_NUMBER) {
                                const css_string temp = { token->ilower->len,
                                        (uint8_t *) token->ilower->data };
                                size_t consumed = 0;
@@ -1658,7 +1658,7 @@
                        required_size += sizeof(name) + sizeof(increment);
 
                        token = parserutils_vector_peek(vector, temp_ctx);
-                       if (token != NULL && tokenIsChar(token, '!')) {
+                       if (token == NULL || tokenIsChar(token, '!')) {
                                break;
                        }
 
@@ -1702,17 +1702,17 @@
 
                while (token != NULL) {
                        const parserutils_hash_entry *name = token->idata;
-                       fixed increment = 1;
+                       fixed increment = INTTOFIX(1);
 
                        consumeWhitespace(vector, ctx);
 
                        /* Optional integer */
                        token = parserutils_vector_peek(vector, *ctx);
-                       if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
-                                       token->type != CSS_TOKEN_NUMBER))
+                       if (token != NULL && token->type != CSS_TOKEN_IDENT &&
+                                       token->type != CSS_TOKEN_NUMBER)
                                return CSS_INVALID;
 
-                       if (token->type == CSS_TOKEN_NUMBER) {
+                       if (token != NULL && token->type == CSS_TOKEN_NUMBER) {
                                const css_string temp = { token->ilower->len,
                                        (uint8_t *) token->ilower->data };
                                size_t consumed = 0;
@@ -1738,7 +1738,7 @@
                        ptr += sizeof(increment);
 
                        token = parserutils_vector_peek(vector, *ctx);
-                       if (token != NULL && tokenIsChar(token, '!')) {
+                       if (token == NULL || tokenIsChar(token, '!')) {
                                break;
                        }
 
@@ -1773,7 +1773,7 @@
        int temp_ctx = *ctx;
        uint8_t *ptr;
 
-       /* [IDENT <integer> ]+ | IDENT(none, inherit) */
+       /* [IDENT <integer>? ]+ | IDENT(none, inherit) */
 
        /* Pass 1: validate input and calculate bytecode size */
        token = parserutils_vector_iterate(vector, &temp_ctx);
@@ -1791,17 +1791,17 @@
 
                while (token != NULL) {
                        const parserutils_hash_entry *name = token->idata;
-                       fixed increment = 1;
+                       fixed increment = INTTOFIX(1);
 
                        consumeWhitespace(vector, &temp_ctx);
 
                        /* Optional integer */
                        token = parserutils_vector_peek(vector, temp_ctx);
-                       if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
-                                       token->type != CSS_TOKEN_NUMBER))
+                       if (token != NULL && token->type != CSS_TOKEN_IDENT &&
+                                       token->type != CSS_TOKEN_NUMBER)
                                return CSS_INVALID;
 
-                       if (token->type == CSS_TOKEN_NUMBER) {
+                       if (token != NULL && token->type == CSS_TOKEN_NUMBER) {
                                const css_string temp = { token->ilower->len,
                                        (uint8_t *) token->ilower->data };
                                size_t consumed = 0;
@@ -1823,7 +1823,7 @@
                        required_size += sizeof(name) + sizeof(increment);
 
                        token = parserutils_vector_peek(vector, temp_ctx);
-                       if (token != NULL && tokenIsChar(token, '!')) {
+                       if (token == NULL || tokenIsChar(token, '!')) {
                                break;
                        }
 
@@ -1867,17 +1867,17 @@
 
                while (token != NULL) {
                        const parserutils_hash_entry *name = token->idata;
-                       fixed increment = 1;
+                       fixed increment = INTTOFIX(1);
 
                        consumeWhitespace(vector, ctx);
 
                        /* Optional integer */
                        token = parserutils_vector_peek(vector, *ctx);
-                       if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
-                                       token->type != CSS_TOKEN_NUMBER))
+                       if (token != NULL && token->type != CSS_TOKEN_IDENT &&
+                                       token->type != CSS_TOKEN_NUMBER)
                                return CSS_INVALID;
 
-                       if (token->type == CSS_TOKEN_NUMBER) {
+                       if (token != NULL && token->type == CSS_TOKEN_NUMBER) {
                                const css_string temp = { token->ilower->len,
                                        (uint8_t *) token->ilower->data };
                                size_t consumed = 0;
@@ -1903,7 +1903,7 @@
                        ptr += sizeof(increment);
 
                        token = parserutils_vector_peek(vector, *ctx);
-                       if (token != NULL && tokenIsChar(token, '!')) {
+                       if (token == NULL || tokenIsChar(token, '!')) {
                                break;
                        }
 


_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to