index a1ff0d292335faa86f914fbd9c7eb60ab8af58b4..530085b52cfdd394fe57df1a147adf267aaae8ba 100644 (file)
static void
dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
{
- guchar *str = NULL;
-
g_return_if_fail (a_this);
- str = cr_declaration_to_string (a_this, a_indent);
+ gchar *str = cr_declaration_to_string (a_this, a_indent);
if (str) {
fprintf (a_fp, "%s", str);
g_free (str);
cr_declaration_new (CRStatement * a_statement,
CRString * a_property, CRTerm * a_value)
{
- CRDeclaration *result = NULL;
-
g_return_val_if_fail (a_property, NULL);
if (a_statement)
|| (a_statement->type
== AT_PAGE_RULE_STMT)), NULL);
- result = g_try_malloc (sizeof (CRDeclaration));
+ CRDeclaration * result = (CRDeclaration *)g_try_malloc (sizeof (CRDeclaration));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
CRTerm *value = NULL;
CRString *property = NULL;
CRDeclaration *result = NULL;
- CRParser *parser = NULL;
gboolean important = FALSE;
g_return_val_if_fail (a_str, NULL);
g_return_val_if_fail (a_statement->type == RULESET_STMT,
NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+ CRParser *parser = (CRParser *)
+ cr_parser_new_from_buf ((guchar*)a_str,
+ strlen ((char *)a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_try_to_skip_spaces_and_comments (parser);
CRString *property = NULL;
CRDeclaration *result = NULL,
*cur_decl = NULL;
- CRParser *parser = NULL;
CRTknzr *tokenizer = NULL;
gboolean important = FALSE;
g_return_val_if_fail (a_str, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+ CRParser *parser = (CRParser *)cr_parser_new_from_buf
+ ((guchar*)a_str, strlen ((char *)a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_get_tknzr (parser, &tokenizer);
if (status != CR_OK || !tokenizer) {
cr_parser_try_to_skip_spaces_and_comments (parser);
status = cr_tknzr_peek_char (tokenizer, &c);
if (status != CR_OK) {
- if (status == CR_END_OF_INPUT_ERROR)
+ if (status == CR_END_OF_INPUT_ERROR)
status = CR_OK;
goto cleanup;
}
if (c == ';') {
status = cr_tknzr_read_char (tokenizer, &c);
} else {
- break;
+ cr_tknzr_read_char (tokenizer, &c);
+ continue; // try to keep reading until we reach the end or a ;
}
important = FALSE;
cr_parser_try_to_skip_spaces_and_comments (parser);
&value, &important);
if (status != CR_OK || !property) {
if (status == CR_END_OF_INPUT_ERROR) {
- status = CR_OK;
- }
- break;
+ status = CR_OK; // simply the end of input, do not delete what we got so far, just finish
+ break;
+ } else {
+ continue; // even if one declaration is broken, it's no reason to discard others (see http://www.w3.org/TR/CSS21/syndata.html#declaration)
+ }
}
cur_decl = cr_declaration_new (NULL, property, value);
if (cur_decl) {
{
GString *stringue = NULL;
- guchar *str = NULL,
+ gchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
{
CRDeclaration *cur = NULL;
GString *stringue = NULL;
- guchar *str = NULL,
+ gchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
g_string_free (stringue, FALSE);
}
- return result;
+ return (guchar *)result;
}
/**
{
CRDeclaration *cur = NULL;
GString *stringue = NULL;
- guchar *str = NULL,
+ gchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
g_string_free (stringue, FALSE);
}
- return result;
+ return (guchar *)result;
}
/**
&& cur->property->stryng
&& cur->property->stryng->str) {
if (!strcmp (cur->property->stryng->str,
- a_prop)) {
+ (char *)a_prop)) {
return cur;
}
}