>From 294f0ec43f6f64765d85d2e85ac9b4dafeb0e045
From: Ori Bernstein <o...@eigenstate.org>
Date: Sun, 22 Mar 2020 18:00:34 -0700
Subject: [PATCH] portability fixes for plan9


Several changes are made here:
- Our compilers don't like double-declared enum tags, so we rename
  them to avoid conflicts.
- We don't handle static initializations of bitfields, so we
  replace 2 16 bit bitfields with 2 int16_ts. This shouldn't
  affect storage or performance.
- uint32_t isn't guaranteed to be compatible with css_unit,
  and in fact it isn't on plan9, so we need to just pass
  a uint32_t.

diff -urN a/include/libcss/errors.h b/include/libcss/errors.h
--- a/include/libcss/errors.h   Mon Feb 24 02:28:58 2020
+++ b/include/libcss/errors.h   Sun Mar 22 18:00:34 2020
@@ -14,8 +14,9 @@
 #endif
 
 #include <stddef.h>
+#include <libcss/errors.h>
 
-typedef enum css_error {
+typedef enum {
        CSS_OK               = 0,
 
        CSS_NOMEM            = 1,
diff -urN a/src/lex/lex.c b/src/lex/lex.c
--- a/src/lex/lex.c     Mon Feb 24 02:28:58 2020
+++ b/src/lex/lex.c     Sun Mar 22 18:00:34 2020
@@ -1375,7 +1375,7 @@
        css_error error;
        parserutils_error perror;
        enum { Initial = 0, LParen = 1, W1 = 2, Quote = 3,
-               URL = 4, W2 = 5, RParen = 6, String = 7 };
+               URL = 4, W2 = 5, RParen = 6, Str = 7 };
 
        /* URI = "url(" w (string | urlchar*) w ')'
         *
@@ -1518,9 +1518,9 @@
 
                APPEND(lexer, cptr, clen);
                break;
-       case String:
+       case Str:
        string:
-               lexer->substate = String;
+               lexer->substate = Str;
 
                error = consumeString(lexer);
                if (error == CSS_INVALID) {
diff -urN a/src/parse/properties/utils.c b/src/parse/properties/utils.c
--- a/src/parse/properties/utils.c      Mon Feb 24 02:28:58 2020
+++ b/src/parse/properties/utils.c      Sun Mar 22 18:00:34 2020
@@ -932,7 +932,7 @@
        if (token->type == CSS_TOKEN_DIMENSION) {
                size_t len = lwc_string_length(token->idata);
                const char *data = lwc_string_data(token->idata);
-               css_unit temp_unit = CSS_UNIT_PX;
+               uint32_t temp_unit = CSS_UNIT_PX;
 
                error = css__parse_unit_keyword(data + consumed, len - consumed,
                                &temp_unit);
@@ -961,7 +961,7 @@
                         * (e.g. "0 px")
                         */
                        int temp_ctx = *ctx;
-                       css_unit temp_unit;
+                       uint32_t temp_unit;
 
                        consumeWhitespace(vector, &temp_ctx);


Reply via email to