summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/Bytecode5
-rw-r--r--src/bytecode/dump.c13
-rw-r--r--src/parse/properties.c32
3 files changed, 20 insertions, 30 deletions
diff --git a/docs/Bytecode b/docs/Bytecode
index 0b5ec74..552fc30 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -27,9 +27,8 @@ All numeric values are stored in a 32bit wide field. This field contains
a fixed point value with 22 bits assigned to the integer part and 10 bits
assigned to the fractional part.
-Strings are stored as <pointer,length> pairs, as per css_string.
-Pointer's width is the native width of a pointer on the platform.
-Length's width is the native width of a size_t on the platform.
+Strings are stored as a pointer to an interned string.
+The pointer's width is the native width of a pointer on the platform.
CSS dimensions are stored as two 32bit values: <length, units>.
Length is a 32bit numeric value (as described above) and unit is as follows:
diff --git a/src/bytecode/dump.c b/src/bytecode/dump.c
index 05213ee..0cf54c8 100644
--- a/src/bytecode/dump.c
+++ b/src/bytecode/dump.c
@@ -166,14 +166,13 @@ void css_bytecode_dump(void *bytecode, uint32_t length, FILE *fp)
break;
case BACKGROUND_IMAGE_URI:
{
- uint8_t *ptr =
- *((uint8_t **) bytecode);
+ parserutils_hash_entry *ptr =
+ *((parserutils_hash_entry **)
+ bytecode);
ADVANCE(sizeof(ptr));
- size_t len =
- *((size_t *) bytecode);
- ADVANCE(sizeof(len));
- fprintf(fp, "url('%.*s')", (int) len,
- (char *) ptr);
+ fprintf(fp, "url('%.*s')",
+ (int) ptr->len,
+ (char *) ptr->data);
}
break;
}
diff --git a/src/parse/properties.c b/src/parse/properties.c
index e6a285d..94cf4fa 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -658,7 +658,7 @@ css_error parse_background_image(css_language *c,
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI)
- required_size += sizeof(uint8_t *) + sizeof(size_t);
+ required_size += sizeof(parserutils_hash_entry *);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, required_size, result);
@@ -669,10 +669,8 @@ css_error parse_background_image(css_language *c,
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI) {
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->data.data, sizeof(uint8_t *));
- memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) +
- sizeof(uint8_t *),
- &token->data.len, sizeof(size_t));
+ &token->idata,
+ sizeof(parserutils_hash_entry *));
}
return CSS_OK;
@@ -1166,7 +1164,7 @@ css_error parse_cue_after(css_language *c,
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI)
- required_size += sizeof(uint8_t *) + sizeof(size_t);
+ required_size += sizeof(parserutils_hash_entry *);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, required_size, result);
@@ -1177,10 +1175,8 @@ css_error parse_cue_after(css_language *c,
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI) {
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->data.data, sizeof(uint8_t *));
- memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) +
- sizeof(uint8_t *),
- &token->data.len, sizeof(size_t));
+ &token->idata,
+ sizeof(parserutils_hash_entry *));
}
return CSS_OK;
@@ -1222,7 +1218,7 @@ css_error parse_cue_before(css_language *c,
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == CUE_BEFORE_URI)
- required_size += sizeof(uint8_t *) + sizeof(size_t);
+ required_size += sizeof(parserutils_hash_entry *);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, required_size, result);
@@ -1233,10 +1229,8 @@ css_error parse_cue_before(css_language *c,
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == CUE_BEFORE_URI) {
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->data.data, sizeof(uint8_t *));
- memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) +
- sizeof(uint8_t *),
- &token->data.len, sizeof(size_t));
+ &token->idata,
+ sizeof(parserutils_hash_entry *));
}
return CSS_OK;
@@ -2101,7 +2095,7 @@ css_error parse_list_style_image(css_language *c,
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI)
- required_size += sizeof(uint8_t *) + sizeof(size_t);
+ required_size += sizeof(parserutils_hash_entry *);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, required_size, result);
@@ -2112,10 +2106,8 @@ css_error parse_list_style_image(css_language *c,
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI) {
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->data.data, sizeof(uint8_t *));
- memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) +
- sizeof(uint8_t *),
- &token->data.len, sizeof(size_t));
+ &token->idata,
+ sizeof(parserutils_hash_entry *));
}
return CSS_OK;