~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/libcroco/cr-declaration.c

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
static void
42
42
dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
43
43
{
44
 
        guchar *str = NULL;
45
 
 
46
44
        g_return_if_fail (a_this);
47
45
 
48
 
        str = cr_declaration_to_string (a_this, a_indent);
 
46
        gchar *str = cr_declaration_to_string (a_this, a_indent);
49
47
        if (str) {
50
48
                fprintf (a_fp, "%s", str);
51
49
                g_free (str);
64
62
cr_declaration_new (CRStatement * a_statement,
65
63
                    CRString * a_property, CRTerm * a_value)
66
64
{
67
 
        CRDeclaration *result = NULL;
68
 
 
69
65
        g_return_val_if_fail (a_property, NULL);
70
66
 
71
67
        if (a_statement)
76
72
                                          || (a_statement->type
77
73
                                              == AT_PAGE_RULE_STMT)), NULL);
78
74
 
79
 
        result = g_try_malloc (sizeof (CRDeclaration));
 
75
        CRDeclaration * result = (CRDeclaration *)g_try_malloc (sizeof (CRDeclaration));
80
76
        if (!result) {
81
77
                cr_utils_trace_info ("Out of memory");
82
78
                return NULL;
111
107
        CRTerm *value = NULL;
112
108
        CRString *property = NULL;
113
109
        CRDeclaration *result = NULL;
114
 
        CRParser *parser = NULL;
115
110
        gboolean important = FALSE;
116
111
 
117
112
        g_return_val_if_fail (a_str, NULL);
119
114
                g_return_val_if_fail (a_statement->type == RULESET_STMT,
120
115
                                      NULL);
121
116
 
122
 
        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
 
117
        CRParser *parser = (CRParser *)
 
118
                        cr_parser_new_from_buf ((guchar*)a_str,
 
119
                                  strlen ((char *)a_str), a_enc, FALSE);
123
120
        g_return_val_if_fail (parser, NULL);
124
121
 
125
122
        status = cr_parser_try_to_skip_spaces_and_comments (parser);
175
172
        CRString *property = NULL;
176
173
        CRDeclaration *result = NULL,
177
174
                *cur_decl = NULL;
178
 
        CRParser *parser = NULL;
179
175
        CRTknzr *tokenizer = NULL;
180
176
        gboolean important = FALSE;
181
177
 
182
178
        g_return_val_if_fail (a_str, NULL);
183
179
 
184
 
        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
 
180
        CRParser *parser = (CRParser *)cr_parser_new_from_buf
 
181
                      ((guchar*)a_str, strlen ((char *)a_str), a_enc, FALSE);
185
182
        g_return_val_if_fail (parser, NULL);
186
183
        status = cr_parser_get_tknzr (parser, &tokenizer);
187
184
        if (status != CR_OK || !tokenizer) {
213
210
                cr_parser_try_to_skip_spaces_and_comments (parser);
214
211
                status = cr_tknzr_peek_char (tokenizer, &c);
215
212
                if (status != CR_OK) {
216
 
                        if (status == CR_END_OF_INPUT_ERROR)
 
213
                        if (status == CR_END_OF_INPUT_ERROR) 
217
214
                                status = CR_OK;
218
215
                        goto cleanup;
219
216
                }
220
217
                if (c == ';') {
221
218
                        status = cr_tknzr_read_char (tokenizer, &c);
222
219
                } else {
223
 
                        break;
 
220
                        cr_tknzr_read_char (tokenizer, &c);
 
221
                        continue; // try to keep reading until we reach the end or a ;
224
222
                }
225
223
                important = FALSE;
226
224
                cr_parser_try_to_skip_spaces_and_comments (parser);
228
226
                                                      &value, &important);
229
227
                if (status != CR_OK || !property) {
230
228
                        if (status == CR_END_OF_INPUT_ERROR) {
231
 
                                status = CR_OK;
232
 
                        }
233
 
                        break;
 
229
                                status = CR_OK; // simply the end of input, do not delete what we got so far, just finish
 
230
                                break; 
 
231
                        } else {
 
232
                                continue; // even if one declaration is broken, it's no reason to discard others (see http://www.w3.org/TR/CSS21/syndata.html#declaration)
 
233
                                                                }
234
234
                }
235
235
                cur_decl = cr_declaration_new (NULL, property, value);
236
236
                if (cur_decl) {
468
468
{
469
469
        GString *stringue = NULL;
470
470
 
471
 
        guchar *str = NULL,
 
471
        gchar *str = NULL,
472
472
                *result = NULL;
473
473
 
474
474
        g_return_val_if_fail (a_this, NULL);
535
535
{
536
536
        CRDeclaration *cur = NULL;
537
537
        GString *stringue = NULL;
538
 
        guchar *str = NULL,
 
538
        gchar *str = NULL,
539
539
                *result = NULL;
540
540
 
541
541
        g_return_val_if_fail (a_this, NULL);
555
555
                g_string_free (stringue, FALSE);
556
556
        }
557
557
 
558
 
        return result;
 
558
        return (guchar *)result;
559
559
}
560
560
 
561
561
/**
570
570
{
571
571
        CRDeclaration *cur = NULL;
572
572
        GString *stringue = NULL;
573
 
        guchar *str = NULL,
 
573
        gchar *str = NULL,
574
574
                *result = NULL;
575
575
 
576
576
        g_return_val_if_fail (a_this, NULL);
604
604
                g_string_free (stringue, FALSE);
605
605
        }
606
606
 
607
 
        return result;
 
607
        return (guchar *)result;
608
608
}
609
609
 
610
610
/**
666
666
                    && cur->property->stryng
667
667
                    && cur->property->stryng->str) {
668
668
                        if (!strcmp (cur->property->stryng->str, 
669
 
                                     a_prop)) {
 
669
                                     (char *)a_prop)) {
670
670
                                return cur;
671
671
                        }
672
672
                }