summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/README20
-rw-r--r--test/css21.c8
-rw-r--r--test/dump.h116
-rw-r--r--test/dump_computed.h16
-rw-r--r--test/lex-auto.c22
-rw-r--r--test/lex.c30
-rw-r--r--test/number.c8
-rw-r--r--test/parse-auto.c60
-rw-r--r--test/parse.c6
-rw-r--r--test/parse2-auto.c18
-rw-r--r--test/select.c140
11 files changed, 222 insertions, 222 deletions
diff --git a/test/README b/test/README
index f408e72..557adf9 100644
--- a/test/README
+++ b/test/README
@@ -21,14 +21,14 @@ basis.
Testcase output
---------------
-Testcases may output anything at all to stdout. The final line of the
-output must begin with either PASS or FAIL (case sensitive), indicating
+Testcases may output anything at all to stdout. The final line of the
+output must begin with either PASS or FAIL (case sensitive), indicating
the success status of the test.
Test Index
----------
-In the test sources directory, is a file, named INDEX, which provides an
+In the test sources directory, is a file, named INDEX, which provides an
index of all available test binaries. Any new test applications should be
added to this index as they are created.
@@ -49,20 +49,20 @@ The test index file format is as follows:
non-newline = VCHAR / WSP
non-reserved = VCHAR / SP
-Each entry contains a mandatory binary name and description followed by
-an optional data directory specifier. The data directory specifier is
-used to state the name of the directory containing data files for the
-test name. This directory will be searched for within the "data"
-directory in the source tree.
+Each entry contains a mandatory binary name and description followed by
+an optional data directory specifier. The data directory specifier is
+used to state the name of the directory containing data files for the
+test name. This directory will be searched for within the "data"
+directory in the source tree.
If a data directory is specified, the test binary will be invoked for
-each data file listed within the data directory INDEX, passing the
+each data file listed within the data directory INDEX, passing the
filename as the second parameter (<data_file>, above).
Data Index
----------
-Each test data directory contains a file, named INDEX, which provides an
+Each test data directory contains a file, named INDEX, which provides an
index of all available test data files.
The data index file format is as follows:
diff --git a/test/css21.c b/test/css21.c
index cc9acab..a29fae1 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
size_t read = fread(buf, 1, CHUNK_SIZE, fp);
assert(read == CHUNK_SIZE);
- error = css_stylesheet_append_data(sheet, buf,
+ error = css_stylesheet_append_data(sheet, buf,
CHUNK_SIZE);
assert(error == CSS_OK || error == CSS_NEEDDATA);
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
css_stylesheet *import;
char *buf = malloc(lwc_string_length(url) + 1);
- memcpy(buf, lwc_string_data(url),
+ memcpy(buf, lwc_string_data(url),
lwc_string_length(url));
buf[lwc_string_length(url)] = '\0';
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
assert(css_stylesheet_create(&params,
&import) == CSS_OK);
- assert(css_stylesheet_data_done(import) ==
+ assert(css_stylesheet_data_done(import) ==
CSS_OK);
assert(css_stylesheet_register_import(sheet,
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
}
printf("PASS\n");
-
+
return 0;
}
diff --git a/test/dump.h b/test/dump.h
index 872c850..0159b19 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -13,13 +13,13 @@
#include "testutils.h"
static void dump_sheet(css_stylesheet *sheet, char *buf, size_t *len);
-static void dump_rule_selector(css_rule_selector *s, char **buf,
+static void dump_rule_selector(css_rule_selector *s, char **buf,
size_t *buflen, uint32_t depth);
static void dump_rule_charset(css_rule_charset *s, char **buf, size_t *buflen);
static void dump_rule_import(css_rule_import *s, char **buf, size_t *buflen);
static void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen);
static void dump_rule_page(css_rule_page *s, char **buf, size_t *buflen);
-static void dump_rule_font_face(css_rule_font_face *s,
+static void dump_rule_font_face(css_rule_font_face *s,
char **buf, size_t *buflen);
static void dump_selector_list(css_selector *list, char **ptr);
static void dump_selector(css_selector *selector, char **ptr);
@@ -35,15 +35,15 @@ void dump_sheet(css_stylesheet *sheet, char *buf, size_t *buflen)
for (rule = sheet->rule_list; rule != NULL; rule = rule->next) {
switch (rule->type) {
case CSS_RULE_SELECTOR:
- dump_rule_selector((css_rule_selector *) rule,
+ dump_rule_selector((css_rule_selector *) rule,
&buf, buflen, 1);
break;
case CSS_RULE_CHARSET:
- dump_rule_charset((css_rule_charset *) rule,
+ dump_rule_charset((css_rule_charset *) rule,
&buf, buflen);
break;
case CSS_RULE_IMPORT:
- dump_rule_import((css_rule_import *) rule,
+ dump_rule_import((css_rule_import *) rule,
&buf, buflen);
break;
case CSS_RULE_MEDIA:
@@ -71,7 +71,7 @@ void dump_sheet(css_stylesheet *sheet, char *buf, size_t *buflen)
}
}
-void dump_rule_selector(css_rule_selector *s, char **buf, size_t *buflen,
+void dump_rule_selector(css_rule_selector *s, char **buf, size_t *buflen,
uint32_t depth)
{
uint32_t i;
@@ -115,7 +115,7 @@ void dump_rule_import(css_rule_import *s, char **buf, size_t *buflen)
{
char *ptr = *buf;
- ptr += sprintf(ptr, "| @import url(\"%.*s\")",
+ ptr += sprintf(ptr, "| @import url(\"%.*s\")",
(int) lwc_string_length(s->url), lwc_string_data(s->url));
/** \todo media list */
@@ -174,7 +174,7 @@ void dump_rule_font_face(css_rule_font_face *s, char **buf, size_t *buflen)
if (s->font_face != NULL) {
dump_font_face(s->font_face, &ptr);
}
-
+
*ptr++ = '\n';
*buflen -= ptr - *buf;
@@ -233,7 +233,7 @@ void dump_selector_detail(css_selector_detail *detail, char **ptr)
switch (detail->type) {
case CSS_SELECTOR_ELEMENT:
- if (lwc_string_length(detail->qname.name) == 1 &&
+ if (lwc_string_length(detail->qname.name) == 1 &&
lwc_string_data(detail->qname.name)[0] == '*' &&
detail->next == 0) {
dump_string(detail->qname.name, ptr);
@@ -662,7 +662,7 @@ static void dump_counter(lwc_string *name, uint32_t value,
static void dump_counters(lwc_string *name, lwc_string *separator,
uint32_t value, char **ptr)
{
- *ptr += sprintf(*ptr, "counter(%.*s, %.*s",
+ *ptr += sprintf(*ptr, "counter(%.*s, %.*s",
(int) lwc_string_length(name),
lwc_string_data(name),
(int) lwc_string_length(separator),
@@ -748,7 +748,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
if (isInherit(opv)) {
*ptr += sprintf(*ptr, "inherit");
- } else {
+ } else {
value = getValue(opv);
switch (op) {
@@ -836,11 +836,11 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
case BACKGROUND_COLOR_SET:
{
- uint32_t colour =
+ uint32_t colour =
*((uint32_t *) bytecode);
ADVANCE(sizeof(colour));
*ptr += sprintf(*ptr, "#%08x", colour);
- }
+ }
break;
}
break;
@@ -875,12 +875,12 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
{
uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
- css__stylesheet_string_get(style->sheet,
- snum,
+ css__stylesheet_string_get(style->sheet,
+ snum,
&he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "url('%.*s')",
- (int) lwc_string_length(he),
+ *ptr += sprintf(*ptr, "url('%.*s')",
+ (int) lwc_string_length(he),
lwc_string_data(he));
}
break;
@@ -1289,14 +1289,14 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
}
break;
case CSS_PROP_CLIP:
- if ((value & CLIP_SHAPE_MASK) ==
+ if ((value & CLIP_SHAPE_MASK) ==
CLIP_SHAPE_RECT) {
*ptr += sprintf(*ptr, "rect(");
if (value & CLIP_RECT_TOP_AUTO) {
*ptr += sprintf(*ptr, "auto");
} else {
uint32_t unit;
- css_fixed val =
+ css_fixed val =
*((css_fixed *) bytecode);
ADVANCE(sizeof(val));
unit = *((uint32_t *) bytecode);
@@ -1308,7 +1308,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "auto");
} else {
uint32_t unit;
- css_fixed val =
+ css_fixed val =
*((css_fixed *) bytecode);
ADVANCE(sizeof(val));
unit = *((uint32_t *) bytecode);
@@ -1320,7 +1320,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "auto");
} else {
uint32_t unit;
- css_fixed val =
+ css_fixed val =
*((css_fixed *) bytecode);
ADVANCE(sizeof(val));
unit = *((uint32_t *) bytecode);
@@ -1332,7 +1332,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "auto");
} else {
uint32_t unit;
- css_fixed val =
+ css_fixed val =
*((css_fixed *) bytecode);
ADVANCE(sizeof(val));
unit = *((uint32_t *) bytecode);
@@ -1353,11 +1353,11 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
case COLOR_SET:
{
- uint32_t colour =
+ uint32_t colour =
*((uint32_t *) bytecode);
ADVANCE(sizeof(colour));
*ptr += sprintf(*ptr, "#%08x", colour);
- }
+ }
break;
}
break;
@@ -1422,7 +1422,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
}
while (value != CONTENT_NORMAL) {
- uint32_t snum = *((uint32_t *) bytecode);
+ uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
const char *end = "";
@@ -1448,10 +1448,10 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
case CONTENT_URI:
- case CONTENT_ATTR:
+ case CONTENT_ATTR:
case CONTENT_STRING:
css__stylesheet_string_get(style->sheet, snum, &he);
- if (value == CONTENT_URI)
+ if (value == CONTENT_URI)
*ptr += sprintf(*ptr, "url(");
if (value == CONTENT_ATTR)
*ptr += sprintf(*ptr, "attr(");
@@ -1504,11 +1504,11 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
while (value != COUNTER_INCREMENT_NONE) {
css_fixed val;
uint32_t snum = *((uint32_t *) bytecode); lwc_string *he;
- css__stylesheet_string_get(style->sheet,
- snum,
+ css__stylesheet_string_get(style->sheet,
+ snum,
&he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "%.*s ",
+ *ptr += sprintf(*ptr, "%.*s ",
(int)lwc_string_length(he),
lwc_string_data(he));
val = *((css_fixed *) bytecode);
@@ -1518,10 +1518,10 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
value = *((uint32_t *) bytecode);
ADVANCE(sizeof(value));
- if (value !=
+ if (value !=
COUNTER_INCREMENT_NONE)
- *ptr += sprintf(*ptr,
- " ");
+ *ptr += sprintf(*ptr,
+ " ");
}
break;
case COUNTER_INCREMENT_NONE:
@@ -1532,11 +1532,11 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
case CSS_PROP_CURSOR:
while (value == CURSOR_URI) {
uint32_t snum = *((uint32_t *) bytecode); lwc_string *he;
- css__stylesheet_string_get(style->sheet,
- snum,
+ css__stylesheet_string_get(style->sheet,
+ snum,
&he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "url('%.*s'), ",
+ *ptr += sprintf(*ptr, "url('%.*s'), ",
(int) lwc_string_length(he),
lwc_string_data(he));
@@ -1718,12 +1718,12 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
case FONT_FAMILY_STRING:
case FONT_FAMILY_IDENT_LIST:
{
- uint32_t snum = *((uint32_t *) bytecode);
+ uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
css__stylesheet_string_get(style->sheet, snum, &he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "'%.*s'",
- (int) lwc_string_length(he),
+ *ptr += sprintf(*ptr, "'%.*s'",
+ (int) lwc_string_length(he),
lwc_string_data(he));
}
break;
@@ -2078,7 +2078,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
case OUTLINE_COLOR_SET:
{
- uint32_t colour =
+ uint32_t colour =
*((uint32_t *) bytecode);
ADVANCE(sizeof(colour));
*ptr += sprintf(*ptr, "#%08x", colour);
@@ -2185,12 +2185,12 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
switch (value) {
case PLAY_DURING_URI:
{
- uint32_t snum = *((uint32_t *) bytecode);
+ uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
css__stylesheet_string_get(style->sheet, snum, &he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "'%.*s'",
- (int) lwc_string_length(he),
+ *ptr += sprintf(*ptr, "'%.*s'",
+ (int) lwc_string_length(he),
lwc_string_data(he));
}
break;
@@ -2227,18 +2227,18 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
switch (value) {
case QUOTES_STRING:
while (value != QUOTES_NONE) {
- uint32_t snum = *((uint32_t *) bytecode);
+ uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
css__stylesheet_string_get(style->sheet, snum, &he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, " '%.*s' ",
- (int) lwc_string_length(he),
+ *ptr += sprintf(*ptr, " '%.*s' ",
+ (int) lwc_string_length(he),
lwc_string_data(he));
css__stylesheet_string_get(style->sheet, snum, &he);
ADVANCE(sizeof(he));
- *ptr += sprintf(*ptr, " '%.*s' ",
- (int) lwc_string_length(he),
+ *ptr += sprintf(*ptr, " '%.*s' ",
+ (int) lwc_string_length(he),
lwc_string_data(he));
value = *((uint32_t *) bytecode);
@@ -2459,11 +2459,11 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
case VOICE_FAMILY_STRING:
case VOICE_FAMILY_IDENT_LIST:
{
- uint32_t snum = *((uint32_t *) bytecode);
+ uint32_t snum = *((uint32_t *) bytecode);
lwc_string *he;
css__stylesheet_string_get(style->sheet, snum, &he);
ADVANCE(sizeof(snum));
- *ptr += sprintf(*ptr, "'%.*s'",
+ *ptr += sprintf(*ptr, "'%.*s'",
(int) lwc_string_length(he),
lwc_string_data(he));
}
@@ -2589,7 +2589,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
void dump_string(lwc_string *string, char **ptr)
{
- *ptr += sprintf(*ptr, "%.*s",
+ *ptr += sprintf(*ptr, "%.*s",
(int) lwc_string_length(string),
lwc_string_data(string));
}
@@ -2604,7 +2604,7 @@ void dump_font_face(css_font_face *font_face, char **ptr)
(int) lwc_string_length(font_face->font_family),
lwc_string_data(font_face->font_family));
}
-
+
*ptr += sprintf(*ptr, "\n| font-style: ");
style = css_font_face_font_style(font_face);
switch (style) {
@@ -2666,18 +2666,18 @@ void dump_font_face(css_font_face *font_face, char **ptr)
break;
}
-
+
if (font_face->srcs != NULL) {
uint32_t i;
css_font_face_src *srcs = font_face->srcs;
for (i = 0; i < font_face->n_srcs; ++i) {
css_font_face_format format;
*ptr += sprintf(*ptr, "\n| src: ");
-
+
format = css_font_face_src_format(&srcs[i]);
-
+
*ptr += sprintf(*ptr, "\n| format: ");
-
+
switch (format) {
case CSS_FONT_FACE_FORMAT_UNSPECIFIED:
*ptr += sprintf(*ptr, "unspecified");
@@ -2717,10 +2717,10 @@ void dump_font_face(css_font_face *font_face, char **ptr)
*ptr += sprintf(*ptr, "UNKNOWN");
break;
}
-
+
*ptr += sprintf(*ptr, "(%.*s)",
(int) lwc_string_length(
- srcs[i].location),
+ srcs[i].location),
lwc_string_data(srcs[i].location));
}
}
diff --git a/test/dump_computed.h b/test/dump_computed.h
index eb9d522..c9d699d 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -194,7 +194,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
wrote = snprintf(ptr, *len, "background-image: inherit\n");
} else if (val == CSS_BACKGROUND_IMAGE_IMAGE && url != NULL) {
wrote = snprintf(ptr, *len, "background-image: url('%.*s')\n",
- (int) lwc_string_length(url),
+ (int) lwc_string_length(url),
lwc_string_data(url));
} else if (val == CSS_BACKGROUND_IMAGE_NONE) {
wrote = snprintf(ptr, *len, "background-image: none\n");
@@ -1176,7 +1176,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
switch (content->type) {
case CSS_COMPUTED_CONTENT_STRING:
- wrote += snprintf(ptr + wrote,
+ wrote += snprintf(ptr + wrote,
*len - wrote,
"\"%.*s\"",
(int) lwc_string_length(
@@ -1185,7 +1185,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
content->data.string));
break;
case CSS_COMPUTED_CONTENT_URI:
- wrote += snprintf(ptr + wrote,
+ wrote += snprintf(ptr + wrote,
*len - wrote,
"uri(\"%.*s\")",
(int) lwc_string_length(
@@ -1194,7 +1194,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
content->data.uri));
break;
case CSS_COMPUTED_CONTENT_COUNTER:
- wrote += snprintf(ptr + wrote,
+ wrote += snprintf(ptr + wrote,
*len - wrote,
"counter(%.*s)",
(int) lwc_string_length(
@@ -1203,7 +1203,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
content->data.counter.name));
break;
case CSS_COMPUTED_CONTENT_COUNTERS:
- wrote += snprintf(ptr + wrote,
+ wrote += snprintf(ptr + wrote,
*len - wrote,
"counters(%.*s, "
"\"%.*s\")",
@@ -1217,7 +1217,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
content->data.counters.sep));
break;
case CSS_COMPUTED_CONTENT_ATTR:
- wrote += snprintf(ptr + wrote,
+ wrote += snprintf(ptr + wrote,
*len - wrote,
"attr(%.*s)",
(int) lwc_string_length(
@@ -1834,7 +1834,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
wrote = snprintf(ptr, *len, "list-style-image: inherit\n");
} else if (url != NULL) {
wrote = snprintf(ptr, *len, "list-style-image: url('%.*s')\n",
- (int) lwc_string_length(url),
+ (int) lwc_string_length(url),
lwc_string_data(url));
} else if (val == CSS_LIST_STYLE_IMAGE_NONE) {
wrote = snprintf(ptr, *len, "list-style-image: none\n");
@@ -1882,7 +1882,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
wrote = snprintf(ptr, *len, "list-style-type: decimal\n");
break;
case CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO:
- wrote = snprintf(ptr, *len,
+ wrote = snprintf(ptr, *len,
"list-style-type: decimal-leading-zero\n");
break;
case CSS_LIST_STYLE_TYPE_LOWER_ROMAN:
diff --git a/test/lex-auto.c b/test/lex-auto.c
index f2f6007..f4afec3 100644
--- a/test/lex-auto.c
+++ b/test/lex-auto.c
@@ -39,7 +39,7 @@ static bool handle_line(const char *data, size_t datalen, void *pw);
static void css__parse_expected(line_ctx *ctx, const char *data, size_t len);
static const char *string_from_type(css_token_type type);
static css_token_type string_to_type(const char *data, size_t len);
-static void run_test(const uint8_t *data, size_t len,
+static void run_test(const uint8_t *data, size_t len,
exp_entry *exp, size_t explen);
int main(int argc, char **argv)
@@ -92,7 +92,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
if (ctx->inexp) {
/* This marks end of testcase, so run it */
- run_test(ctx->buf, ctx->bufused,
+ run_test(ctx->buf, ctx->bufused,
ctx->exp, ctx->expused);
ctx->buf[0] = '\0';
@@ -141,7 +141,7 @@ void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
if (ctx->expused == ctx->explen) {
size_t num = ctx->explen == 0 ? 4 : ctx->explen;
- exp_entry *temp = realloc(ctx->exp,
+ exp_entry *temp = realloc(ctx->exp,
num * 2 * sizeof(exp_entry));
if (temp == NULL) {
assert(0 && "No memory for expected tokens");
@@ -188,7 +188,7 @@ void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
ctx->exp[ctx->expused].textLen] = c;
ctx->exp[ctx->expused].textLen++;
- assert(ctx->exp[ctx->expused].textLen <
+ assert(ctx->exp[ctx->expused].textLen <
EXP_ENTRY_TEXT_LEN);
}
}
@@ -201,7 +201,7 @@ const char *string_from_type(css_token_type type)
{
"IDENT", "ATKEYWORD", "HASH", "FUNCTION", "STRING", "INVALID",
"URI", "UNICODE-RANGE", "CHAR", "NUMBER", "PERCENTAGE",
- "DIMENSION", "last_intern", "CDO", "CDC", "S", "COMMENT",
+ "DIMENSION", "last_intern", "CDO", "CDC", "S", "COMMENT",
"INCLUDES", "DASHMATCH", "PREFIXMATCH", "SUFFIXMATCH",
"SUBSTRINGMATCH", "EOF"
};
@@ -271,10 +271,10 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
assert(css__lexer_create(input, &lexer) == CSS_OK);
- assert(parserutils_inputstream_append(input, data, len) ==
+ assert(parserutils_inputstream_append(input, data, len) ==
PARSERUTILS_OK);
- assert(parserutils_inputstream_append(input, NULL, 0) ==
+ assert(parserutils_inputstream_append(input, NULL, 0) ==
PARSERUTILS_OK);
e = 0;
@@ -283,7 +283,7 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
while ((error = css__lexer_get_token(lexer, &tok)) == CSS_OK) {
if (tok->type != exp[e].type) {
printf("%d: Got token %s, Expected %s [%d, %d]\n",
- testnum, string_from_type(tok->type),
+ testnum, string_from_type(tok->type),
string_from_type(exp[e].type),
tok->line, tok->col);
assert(0 && "Types differ");
@@ -292,15 +292,15 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
if (exp[e].hasText) {
if (tok->data.len != exp[e].textLen) {
printf("%d: Got length %d, Expected %d\n",
- testnum, (int) tok->data.len,
+ testnum, (int) tok->data.len,
(int) exp[e].textLen);
assert(0 && "Text lengths differ");
}
- if (strncmp((char *) tok->data.data, exp[e].text,
+ if (strncmp((char *) tok->data.data, exp[e].text,
tok->data.len) != 0) {
printf("%d: Got data '%.*s', Expected '%.*s'\n",
- testnum,
+ testnum,
(int) tok->data.len, tok->data.data,
(int) exp[e].textLen, exp[e].text);
assert(0 && "Text differs");
diff --git a/test/lex.c b/test/lex.c
index 24401af..cce8ded 100644
--- a/test/lex.c
+++ b/test/lex.c
@@ -25,42 +25,42 @@ static void printToken(const css_token *token)
switch (token->type) {
case CSS_TOKEN_IDENT:
- printf("IDENT(%.*s)",
+ printf("IDENT(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_ATKEYWORD:
- printf("ATKEYWORD(%.*s)",
+ printf("ATKEYWORD(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_STRING:
- printf("STRING(%.*s)",
+ printf("STRING(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_INVALID_STRING:
- printf("INVALID(%.*s)",
+ printf("INVALID(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_HASH:
- printf("HASH(%.*s)",
+ printf("HASH(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_NUMBER:
- printf("NUMBER(%.*s)",
+ printf("NUMBER(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_PERCENTAGE:
- printf("PERCENTAGE(%.*s)",
+ printf("PERCENTAGE(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_DIMENSION:
- printf("DIMENSION(%.*s)",
+ printf("DIMENSION(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_URI:
printf("URI(%.*s)", (int) token->data.len, token->data.data);
break;
case CSS_TOKEN_UNICODE_RANGE:
- printf("UNICODE-RANGE(%.*s)",
+ printf("UNICODE-RANGE(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_CDO:
@@ -76,7 +76,7 @@ static void printToken(const css_token *token)
printf("COMMENT(%.*s)", (int) token->data.len, token->data.data);
break;
case CSS_TOKEN_FUNCTION:
- printf("FUNCTION(%.*s)",
+ printf("FUNCTION(%.*s)",
(int) token->data.len, token->data.data);
break;
case CSS_TOKEN_INCLUDES:
@@ -128,11 +128,11 @@ int main(int argc, char **argv)
}
for (i = 0; i < ITERATIONS; i++) {
- assert(parserutils_inputstream_create("UTF-8",
- CSS_CHARSET_DICTATED,css__charset_extract,
+ assert(parserutils_inputstream_create("UTF-8",
+ CSS_CHARSET_DICTATED,css__charset_extract,
&stream) == PARSERUTILS_OK);
- assert(css__lexer_create(stream, &lexer) ==
+ assert(css__lexer_create(stream, &lexer) ==
CSS_OK);
fp = fopen(argv[1], "rb");
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
len -= CHUNK_SIZE;
- while ((error = css__lexer_get_token(lexer, &tok)) ==
+ while ((error = css__lexer_get_token(lexer, &tok)) ==
CSS_OK) {
printToken(tok);
@@ -175,7 +175,7 @@ int main(int argc, char **argv)
fclose(fp);
- assert(parserutils_inputstream_append(stream, NULL, 0) ==
+ assert(parserutils_inputstream_append(stream, NULL, 0) ==
PARSERUTILS_OK);
while ((error = css__lexer_get_token(lexer, &tok)) == CSS_OK) {
diff --git a/test/number.c b/test/number.c
index 12728fb..d255f4c 100644
--- a/test/number.c
+++ b/test/number.c
@@ -21,7 +21,7 @@ typedef struct line_ctx {
} line_ctx;
static bool handle_line(const char *data, size_t datalen, void *pw);
-static void run_test(const uint8_t *data, size_t len,
+static void run_test(const uint8_t *data, size_t len,
const char *exp, size_t explen);
static void print_css_fixed(char *buf, size_t len, css_fixed f);
@@ -72,7 +72,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
if (ctx->inexp) {
/* This marks end of testcase, so run it */
- run_test(ctx->buf, ctx->bufused - 1,
+ run_test(ctx->buf, ctx->bufused - 1,
ctx->exp, ctx->explen);
ctx->buf[0] = '\0';
@@ -117,9 +117,9 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
UNUSED(exp);
UNUSED(explen);
-
+
assert(lwc_intern_string((const char *)data, len, &in) == lwc_error_ok);
-
+
result = css__number_from_lwc_string(in, false, &consumed);
print_css_fixed(buf, sizeof(buf), result);
diff --git a/test/parse-auto.c b/test/parse-auto.c
index a332a5b..58ccf9a 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -47,12 +47,12 @@ typedef struct line_ctx {
static bool handle_line(const char *data, size_t datalen, void *pw);
static void css__parse_expected(line_ctx *ctx, const char *data, size_t len);
-static void run_test(const uint8_t *data, size_t len,
+static void run_test(const uint8_t *data, size_t len,
exp_entry *exp, size_t explen);
static bool validate_rule_selector(css_rule_selector *s, exp_entry *e);
-static void validate_rule_charset(css_rule_charset *s, exp_entry *e,
+static void validate_rule_charset(css_rule_charset *s, exp_entry *e,
int testnum);
-static void validate_rule_import(css_rule_import *s, exp_entry *e,
+static void validate_rule_import(css_rule_import *s, exp_entry *e,
int testnum);
static void dump_selector_list(css_selector *list, char **ptr);
@@ -78,7 +78,7 @@ static void
printing_lwc_iterator(lwc_string *str, void *pw)
{
UNUSED(pw);
-
+
printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str));
fail_because_lwc_leaked = true;
}
@@ -140,9 +140,9 @@ int main(int argc, char **argv)
free(ctx.exp);
lwc_iterate_strings(printing_lwc_iterator, NULL);
-
+
assert(fail_because_lwc_leaked == false);
-
+
printf("PASS\n");
return 0;
@@ -156,7 +156,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
if (ctx->inexp) {
/* This marks end of testcase, so run it */
- run_test(ctx->buf, ctx->bufused,
+ run_test(ctx->buf, ctx->bufused,
ctx->exp, ctx->expused);
ctx->buf[0] = '\0';
@@ -169,7 +169,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
ctx->indata = false;
ctx->inerrors = true;
ctx->inexp = false;
- } else if (ctx->inerrors &&
+ } else if (ctx->inerrors &&
strncasecmp(data+1, "expected", 8) == 0) {
ctx->indata = false;
ctx->inerrors = false;
@@ -212,7 +212,7 @@ void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
if (ctx->inrule == false) {
char *name;
int type;
-
+
start_rule:
type = strtol(data + 1, &name, 10);
@@ -223,7 +223,7 @@ start_rule:
if (ctx->expused == ctx->explen) {
size_t num = ctx->explen == 0 ? 4 : ctx->explen;
- exp_entry *temp = realloc(ctx->exp,
+ exp_entry *temp = realloc(ctx->exp,
num * 2 * sizeof(exp_entry));
if (temp == NULL) {
assert(0 && "No memory for expected rules");
@@ -234,9 +234,9 @@ start_rule:
}
ctx->exp[ctx->expused].type = type;
- memcpy(ctx->exp[ctx->expused].name, name,
+ memcpy(ctx->exp[ctx->expused].name, name,
min(len - (name - data), MAX_RULE_NAME_LEN));
- ctx->exp[ctx->expused].name[min(len - (name - data),
+ ctx->exp[ctx->expused].name[min(len - (name - data),
MAX_RULE_NAME_LEN - 1)] = '\0';
ctx->exp[ctx->expused].bclen = 0;
ctx->exp[ctx->expused].bcused = 0;
@@ -246,7 +246,7 @@ start_rule:
ctx->exp[ctx->expused].stringtab = NULL;
ctx->expused++;
-
+
ctx->inrule = true;
} else {
char *next = (char *) data + 1;
@@ -266,7 +266,7 @@ start_rule:
break;
if (rule->bcused >= rule->bclen) {
- size_t num = rule->bcused == 0 ? 4 :
+ size_t num = rule->bcused == 0 ? 4 :
rule->bcused;
uint8_t *temp = realloc(rule->bytecode,
@@ -295,10 +295,10 @@ start_rule:
rule->stused;
struct stentry *temp = realloc(
- rule->stringtab,
+ rule->stringtab,
num * 2 * sizeof(struct stentry));
if (temp == NULL) {
- assert(0 &&
+ assert(0 &&
"No memory for string table");
}
@@ -306,11 +306,11 @@ start_rule:
rule->stlen = num * 2;
}
- rule->stringtab[rule->stused].off =
+ rule->stringtab[rule->stused].off =
rule->bcused;
rule->stringtab[rule->stused].string =
malloc(next - str);
- assert(rule->stringtab[rule->stused].string !=
+ assert(rule->stringtab[rule->stused].string !=
NULL);
memcpy(rule->stringtab[rule->stused].string,
str, next - str - 1);
@@ -324,7 +324,7 @@ start_rule:
uint32_t val = strtoul(next, &next, 16);
/* Append to bytecode */
- memcpy(rule->bytecode + rule->bcused,
+ memcpy(rule->bytecode + rule->bcused,
&val, sizeof(val));
rule->bcused += sizeof(val);
}
@@ -405,7 +405,7 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
css_stylesheet *import;
char *buf = malloc(lwc_string_length(url) + 1);
- memcpy(buf, lwc_string_data(url),
+ memcpy(buf, lwc_string_data(url),
lwc_string_length(url));
buf[lwc_string_length(url)] = '\0';
@@ -437,7 +437,7 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
for (rule = sheet->rule_list; rule != NULL; rule = rule->next, e++) {
if (rule->type != exp[e].type) {
- printf("%d: Got type %d. Expected %d\n",
+ printf("%d: Got type %d. Expected %d\n",
testnum, rule->type, exp[e].type);
assert(0 && "Types differ");
}
@@ -535,28 +535,28 @@ bool validate_rule_selector(css_rule_selector *s, exp_entry *e)
css__stylesheet_string_get(s->style->sheet, (s->style->bytecode[i / sizeof(css_code_t)]), &p);
- if (lwc_string_length(p) !=
+ if (lwc_string_length(p) !=
strlen(e->stringtab[j].string) ||
- memcmp(lwc_string_data(p),
+ memcmp(lwc_string_data(p),
e->stringtab[j].string,
lwc_string_length(p)) != 0) {
printf("FAIL Strings differ\n"
" Got string '%.*s'. "
"Expected '%s'\n",
- (int) lwc_string_length(p),
- lwc_string_data(p),
+ (int) lwc_string_length(p),
+ lwc_string_data(p),
e->stringtab[j].string);
return true;
}
i += sizeof (css_code_t) - 1;
- } else if (((uint8_t *) s->style->bytecode)[i] !=
+ } else if (((uint8_t *) s->style->bytecode)[i] !=
e->bytecode[i]) {
printf("FAIL Bytecode differs\n"
" Bytecode differs at %u\n ",
(int) i);
while (i < e->bcused) {
- printf("%.2x ",
+ printf("%.2x ",
((uint8_t *) s->style->bytecode)[i]);
i++;
}
@@ -588,7 +588,7 @@ void validate_rule_import(css_rule_import *s, exp_entry *e, int testnum)
if (strncmp(lwc_string_data(s->url), e->name,
lwc_string_length(s->url)) != 0) {
printf("%d: Got URL '%.*s'. Expected '%s'\n",
- testnum, (int) lwc_string_length(s->url),
+ testnum, (int) lwc_string_length(s->url),
lwc_string_data(s->url),
e->name);
assert(0 && "Mismatched URLs");
@@ -648,7 +648,7 @@ void dump_selector_detail(css_selector_detail *detail, char **ptr)
switch (detail->type) {
case CSS_SELECTOR_ELEMENT:
- if (lwc_string_length(detail->qname.name) == 1 &&
+ if (lwc_string_length(detail->qname.name) == 1 &&
lwc_string_data(detail->qname.name)[0] == '*' &&
detail->next == 0) {
dump_string(detail->qname.name, ptr);
@@ -778,6 +778,6 @@ void dump_selector_detail(css_selector_detail *detail, char **ptr)
void dump_string(lwc_string *string, char **ptr)
{
- *ptr += sprintf(*ptr, "%.*s", (int) lwc_string_length(string),
+ *ptr += sprintf(*ptr, "%.*s", (int) lwc_string_length(string),
lwc_string_data(string));
}
diff --git a/test/parse.c b/test/parse.c
index dbbf91f..0692fc7 100644
--- a/test/parse.c
+++ b/test/parse.c
@@ -29,7 +29,7 @@ static const char *event_names[] = {
};
#endif
-static css_error event_handler(css_parser_event type,
+static css_error event_handler(css_parser_event type,
const parserutils_vector *tokens, void *pw)
{
#if !DUMP_EVENTS
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
params.event_handler.handler = event_handler;
params.event_handler.pw = NULL;
- assert(css__parser_setopt(parser, CSS_PARSER_EVENT_HANDLER,
+ assert(css__parser_setopt(parser, CSS_PARSER_EVENT_HANDLER,
&params) == CSS_OK);
fp = fopen(argv[1], "rb");
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
}
printf("PASS\n");
-
+
return 0;
}
diff --git a/test/parse2-auto.c b/test/parse2-auto.c
index 1d5ba57..ee717c3 100644
--- a/test/parse2-auto.c
+++ b/test/parse2-auto.c
@@ -31,7 +31,7 @@ typedef struct line_ctx {
static bool handle_line(const char *data, size_t datalen, void *pw);
static void css__parse_expected(line_ctx *ctx, const char *data, size_t len);
-static void run_test(const uint8_t *data, size_t len,
+static void run_test(const uint8_t *data, size_t len,
const char *exp, size_t explen);
static css_error resolve_url(void *pw,
@@ -52,7 +52,7 @@ static void
printing_lwc_iterator(lwc_string *str, void *pw)
{
UNUSED(pw);
-
+
printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str));
fail_because_lwc_leaked = true;
}
@@ -60,7 +60,7 @@ printing_lwc_iterator(lwc_string *str, void *pw)
int main(int argc, char **argv)
{
line_ctx ctx;
-
+
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
return 1;
@@ -96,9 +96,9 @@ int main(int argc, char **argv)
free(ctx.exp);
lwc_iterate_strings(printing_lwc_iterator, NULL);
-
+
assert(fail_because_lwc_leaked == false);
-
+
printf("PASS\n");
return 0;
@@ -112,7 +112,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
if (ctx->inexp) {
/* This marks end of testcase, so run it */
- run_test(ctx->buf, ctx->bufused,
+ run_test(ctx->buf, ctx->bufused,
ctx->exp, ctx->expused);
ctx->buf[0] = '\0';
@@ -125,7 +125,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
ctx->indata = false;
ctx->inerrors = true;
ctx->inexp = false;
- } else if (ctx->inerrors &&
+ } else if (ctx->inerrors &&
strncasecmp(data+1, "expected", 8) == 0) {
ctx->indata = false;
ctx->inerrors = false;
@@ -188,7 +188,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
assert(0 && "No memory for result data");
}
buflen = 2 * explen;
-
+
params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1;
params.level = CSS_LEVEL_21;
params.charset = "UTF-8";
@@ -220,7 +220,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
dump_sheet(sheet, buf, &buflen);
if (2 * explen - buflen != explen || memcmp(buf, exp, explen) != 0) {
- printf("Expected (%u):\n%.*s\n",
+ printf("Expected (%u):\n%.*s\n",
(int) explen, (int) explen, exp);
printf("Result (%u):\n%.*s\n", (int) (2 * explen - buflen),
(int) (2 * explen - buflen), buf);
diff --git a/test/select.c b/test/select.c
index 4146355..d317696 100644
--- a/test/select.c
+++ b/test/select.c
@@ -65,7 +65,7 @@ typedef struct line_ctx {
uint64_t media;
uint32_t pseudo_element;
node *target;
-
+
lwc_string *attr_class;
lwc_string *attr_id;
} line_ctx;
@@ -78,7 +78,7 @@ static void css__parse_tree(line_ctx *ctx, const char *data, size_t len);
static void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len);
static void css__parse_sheet(line_ctx *ctx, const char *data, size_t len);
static void css__parse_media_list(const char **data, size_t *len, uint64_t *media);
-static void css__parse_pseudo_list(const char **data, size_t *len,
+static void css__parse_pseudo_list(const char **data, size_t *len,
uint32_t *element);
static void css__parse_expected(line_ctx *ctx, const char *data, size_t len);
static void run_test(line_ctx *ctx, const char *exp, size_t explen);
@@ -104,8 +104,8 @@ static css_error named_generic_sibling_node(void *pw, void *node,
void **sibling);
static css_error parent_node(void *pw, void *node, void **parent);
static css_error sibling_node(void *pw, void *node, void **sibling);
-static css_error node_has_name(void *pw, void *node,
- const css_qname *qname,
+static css_error node_has_name(void *pw, void *node,
+ const css_qname *qname,
bool *match);
static css_error node_has_class(void *pw, void *node,
lwc_string *name,
@@ -226,7 +226,7 @@ static void
printing_lwc_iterator(lwc_string *str, void *pw)
{
UNUSED(pw);
-
+
printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str));
fail_because_lwc_leaked = true;
}
@@ -234,7 +234,7 @@ printing_lwc_iterator(lwc_string *str, void *pw)
int main(int argc, char **argv)
{
line_ctx ctx;
-
+
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
return 1;
@@ -245,22 +245,22 @@ int main(int argc, char **argv)
lwc_intern_string("class", SLEN("class"), &ctx.attr_class);
lwc_intern_string("id", SLEN("id"), &ctx.attr_id);
-
+
assert(css__parse_testfile(argv[1], handle_line, &ctx) == true);
-
+
/* and run final test */
if (ctx.tree != NULL)
run_test(&ctx, ctx.exp, ctx.expused);
free(ctx.exp);
-
+
lwc_string_unref(ctx.attr_class);
lwc_string_unref(ctx.attr_id);
-
+
lwc_iterate_strings(printing_lwc_iterator, NULL);
-
+
assert(fail_because_lwc_leaked == false);
-
+
printf("PASS\n");
return 0;
}
@@ -289,7 +289,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
} else if (ctx->insheet) {
if (strncasecmp(data+1, "errors", 6) == 0) {
assert(css_stylesheet_data_done(
- ctx->sheets[ctx->n_sheets - 1].sheet)
+ ctx->sheets[ctx->n_sheets - 1].sheet)
== CSS_OK);
ctx->intree = false;
@@ -306,10 +306,10 @@ bool handle_line(const char *data, size_t datalen, void *pw)
css__parse_sheet(ctx, data + 1, datalen - 1);
} else {
error = css_stylesheet_append_data(
- ctx->sheets[ctx->n_sheets - 1].sheet,
- (const uint8_t *) data,
+ ctx->sheets[ctx->n_sheets - 1].sheet,
+ (const uint8_t *) data,
datalen);
- assert(error == CSS_OK ||
+ assert(error == CSS_OK ||
error == CSS_NEEDDATA);
}
} else if (ctx->inerrors) {
@@ -344,7 +344,7 @@ bool handle_line(const char *data, size_t datalen, void *pw)
css__parse_tree_data(ctx, data + 1, datalen - 1);
} else if (ctx->insheet) {
error = css_stylesheet_append_data(
- ctx->sheets[ctx->n_sheets - 1].sheet,
+ ctx->sheets[ctx->n_sheets - 1].sheet,
(const uint8_t *) data, datalen);
assert(error == CSS_OK || error == CSS_NEEDDATA);
} else if (ctx->inexp) {
@@ -397,7 +397,7 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
bool target = false;
/* ' '{depth+1} [ <element> '*'? | <attr> ]
- *
+ *
* <element> ::= [^=*[:space:]]+
* <attr> ::= [^=*[:space:]]+ '=' [^[:space:]]*
*/
@@ -440,7 +440,7 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
assert(n != NULL);
memset(n, 0, sizeof(node));
-
+
lwc_intern_string(name, namelen, &n->name);
/* Insert it into tree */
@@ -488,7 +488,7 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len)
n->attrs = temp;
attr = &n->attrs[n->n_attrs];
-
+
lwc_intern_string(name, namelen, &attr->name);
lwc_intern_string(value, valuelen, &attr->value);
@@ -566,7 +566,7 @@ void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
assert(css_stylesheet_create(&params, &sheet) == CSS_OK);
/* Extend array of sheets and append new sheet to it */
- temp = realloc(ctx->sheets,
+ temp = realloc(ctx->sheets,
(ctx->n_sheets + 1) * sizeof(sheet_ctx));
assert(temp != NULL);
@@ -594,7 +594,7 @@ void css__parse_media_list(const char **data, size_t *len, uint64_t *media)
while (isspace(*p) == false && *p != ',')
p++;
- if (p - start == 10 &&
+ if (p - start == 10 &&
strncasecmp(start, "projection", 10) == 0)
result |= CSS_MEDIA_PROJECTION;
else if (p - start == 8 &&
@@ -765,7 +765,7 @@ static void run_test_select_tree(css_select_ctx *select,
css_select_results *sr;
struct node *n = NULL;
- assert(css_select_style(select, node, ctx->media, NULL,
+ assert(css_select_style(select, node, ctx->media, NULL,
&select_handler, ctx, &sr) == CSS_OK);
if (node->parent != NULL) {
@@ -812,7 +812,7 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen)
assert(css_select_ctx_create(&select) == CSS_OK);
for (i = 0; i < ctx->n_sheets; i++) {
- assert(css_select_ctx_append_sheet(select,
+ assert(css_select_ctx_append_sheet(select,
ctx->sheets[i].sheet, ctx->sheets[i].origin,
ctx->sheets[i].media) == CSS_OK);
}
@@ -826,7 +826,7 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen)
if (8192 - buflen != explen || memcmp(buf, exp, explen) != 0) {
size_t len = 8192 - buflen < explen ? 8192 - buflen : explen;
- printf("Expected (%u):\n%.*s\n",
+ printf("Expected (%u):\n%.*s\n",
(int) explen, (int) explen, exp);
printf("Result (%u):\n%.*s\n", (int) (8192 - buflen),
(int) (8192 - buflen), buf);
@@ -868,7 +868,7 @@ void destroy_tree(node *root)
}
css_select_results_destroy(root->sr);
-
+
for (i = 0; i < root->n_attrs; ++i) {
lwc_string_unref(root->attrs[i].name);
lwc_string_unref(root->attrs[i].value);
@@ -897,9 +897,9 @@ css_error node_name(void *pw, void *n, css_qname *qname)
node *node = n;
UNUSED(pw);
-
+
qname->name = lwc_string_ref(node->name);
-
+
return CSS_OK;
}
@@ -930,7 +930,7 @@ css_error node_id(void *pw, void *n,
for (i = 0; i < node->n_attrs; i++) {
bool amatch = false;
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, lc->attr_id, &amatch) ==
+ node->attrs[i].name, lc->attr_id, &amatch) ==
lwc_error_ok);
if (amatch == true)
break;
@@ -954,7 +954,7 @@ css_error named_ancestor_node(void *pw, void *n,
for (node = node->parent; node != NULL; node = node->parent) {
bool match = false;
assert(lwc_string_caseless_isequal(
- qname->name, node->name,
+ qname->name, node->name,
&match) == lwc_error_ok);
if (match == true)
break;
@@ -976,7 +976,7 @@ css_error named_parent_node(void *pw, void *n,
if (node->parent != NULL) {
bool match = false;
assert(lwc_string_caseless_isequal(
- qname->name, node->parent->name, &match) ==
+ qname->name, node->parent->name, &match) ==
lwc_error_ok);
if (match == true)
*parent = (void *) node->parent;
@@ -996,7 +996,7 @@ css_error named_sibling_node(void *pw, void *n,
if (node->prev != NULL) {
bool match = false;
assert(lwc_string_caseless_isequal(
- qname->name, node->prev->name, &match) ==
+ qname->name, node->prev->name, &match) ==
lwc_error_ok);
if (match == true)
*sibling = (void *) node->prev;
@@ -1015,7 +1015,7 @@ css_error named_generic_sibling_node(void *pw, void *n,
for (node = node->prev; node != NULL; node = node->prev) {
bool match = false;
assert(lwc_string_caseless_isequal(
- qname->name, node->name,
+ qname->name, node->name,
&match) == lwc_error_ok);
if (match == true)
break;
@@ -1059,7 +1059,7 @@ css_error node_has_name(void *pw, void *n,
lwc_string_data(qname->name)[0] == '*')
*match = true;
else
- assert(lwc_string_caseless_isequal(node->name,
+ assert(lwc_string_caseless_isequal(node->name,
qname->name, match) == lwc_error_ok);
return CSS_OK;
@@ -1076,7 +1076,7 @@ css_error node_has_class(void *pw, void *n,
for (i = 0; i < node->n_attrs; i++) {
bool amatch = false;
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, ctx->attr_class,
+ node->attrs[i].name, ctx->attr_class,
&amatch) == lwc_error_ok);
if (amatch == true)
break;
@@ -1102,7 +1102,7 @@ css_error node_has_id(void *pw, void *n,
for (i = 0; i < node->n_attrs; i++) {
bool amatch = false;
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, ctx->attr_id, &amatch) ==
+ node->attrs[i].name, ctx->attr_id, &amatch) ==
lwc_error_ok);
if (amatch == true)
break;
@@ -1124,11 +1124,11 @@ css_error node_has_attribute(void *pw, void *n,
node *node = n;
uint32_t i;
UNUSED(pw);
-
+
*match = false;
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
@@ -1147,21 +1147,21 @@ css_error node_has_attribute_equal(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
}
-
+
if (*match == true) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, value, match) ==
+ node->attrs[i].name, value, match) ==
lwc_error_ok);
}
-
+
return CSS_OK;
}
@@ -1176,10 +1176,10 @@ css_error node_has_attribute_includes(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
@@ -1188,14 +1188,14 @@ css_error node_has_attribute_includes(void *pw, void *n,
if (*match == true) {
const char *p;
const char *start = lwc_string_data(node->attrs[i].value);
- const char *end = start +
+ const char *end = start +
lwc_string_length(node->attrs[i].value);
-
+
*match = false;
-
+
for (p = start; p < end; p++) {
if (*p == ' ') {
- if ((size_t) (p - start) == vlen &&
+ if ((size_t) (p - start) == vlen &&
strncasecmp(start,
lwc_string_data(value),
vlen) == 0) {
@@ -1222,10 +1222,10 @@ css_error node_has_attribute_dashmatch(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
@@ -1234,16 +1234,16 @@ css_error node_has_attribute_dashmatch(void *pw, void *n,
if (*match == true) {
const char *p;
const char *start = lwc_string_data(node->attrs[i].value);
- const char *end = start +
+ const char *end = start +
lwc_string_length(node->attrs[i].value);
-
+
*match = false;
-
+
for (p = start; p < end; p++) {
if (*p == '-') {
- if ((size_t) (p - start) == vlen &&
+ if ((size_t) (p - start) == vlen &&
strncasecmp(start,
- lwc_string_data(value),
+ lwc_string_data(value),
vlen) == 0) {
*match = true;
break;
@@ -1267,15 +1267,15 @@ css_error node_has_attribute_prefix(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
}
-
+
if (*match == true) {
size_t len = lwc_string_length(node->attrs[i].value);
const char *data = lwc_string_data(node->attrs[i].value);
@@ -1288,7 +1288,7 @@ css_error node_has_attribute_prefix(void *pw, void *n,
else
*match = (strncasecmp(data, vdata, vlen) == 0);
}
-
+
return CSS_OK;
}
@@ -1302,15 +1302,15 @@ css_error node_has_attribute_suffix(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
}
-
+
if (*match == true) {
size_t len = lwc_string_length(node->attrs[i].value);
const char *data = lwc_string_data(node->attrs[i].value);
@@ -1323,7 +1323,7 @@ css_error node_has_attribute_suffix(void *pw, void *n,
if (len < vlen)
*match = false;
else {
- *match = (strncasecmp(data + suffix_start,
+ *match = (strncasecmp(data + suffix_start,
vdata, vlen) == 0);
}
}
@@ -1341,15 +1341,15 @@ css_error node_has_attribute_substring(void *pw, void *n,
UNUSED(pw);
*match = false;
-
+
for (i = 0; i < node->n_attrs; i++) {
assert(lwc_string_caseless_isequal(
- node->attrs[i].name, qname->name, match) ==
+ node->attrs[i].name, qname->name, match) ==
lwc_error_ok);
if (*match == true)
break;
}
-
+
if (*match == true) {
size_t len = lwc_string_length(node->attrs[i].value);
const char *data = lwc_string_data(node->attrs[i].value);
@@ -1637,17 +1637,17 @@ css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size)
size->data.length = sizes[size->status - 1];
} else if (size->status == CSS_FONT_SIZE_LARGER) {
/** \todo Step within table, if appropriate */
- size->data.length.value =
+ size->data.length.value =
FMUL(parent_size->value, FLTTOFIX(1.2));
size->data.length.unit = parent_size->unit;
} else if (size->status == CSS_FONT_SIZE_SMALLER) {
/** \todo Step within table, if appropriate */
- size->data.length.value =
+ size->data.length.value =
FMUL(parent_size->value, FLTTOFIX(1.2));
size->data.length.unit = parent_size->unit;
} else if (size->data.length.unit == CSS_UNIT_EM ||
size->data.length.unit == CSS_UNIT_EX) {
- size->data.length.value =
+ size->data.length.value =
FMUL(size->data.length.value, parent_size->value);
if (size->data.length.unit == CSS_UNIT_EX) {