~ubuntu-branches/debian/squeeze/inkscape/squeeze

« back to all changes in this revision

Viewing changes to src/libcroco/cr-term.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:
84
84
CRTerm *
85
85
cr_term_new (void)
86
86
{
87
 
        CRTerm *result = NULL;
88
 
 
89
 
        result = g_try_malloc (sizeof (CRTerm));
 
87
        CRTerm *result = (CRTerm *)g_try_malloc (sizeof (CRTerm));
90
88
        if (!result) {
91
89
                cr_utils_trace_info ("Out of memory");
92
90
                return NULL;
106
104
cr_term_parse_expression_from_buf (const guchar * a_buf,
107
105
                                   enum CREncoding a_encoding)
108
106
{
109
 
        CRParser *parser = NULL;
110
107
        CRTerm *result = NULL;
111
108
        enum CRStatus status = CR_OK;
112
109
 
113
110
        g_return_val_if_fail (a_buf, NULL);
114
111
 
115
 
        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
116
 
                                         a_encoding, FALSE);
 
112
        CRParser *parser = cr_parser_new_from_buf (
 
113
                                                 (guchar*)a_buf,
 
114
                                                                                  strlen ((char *)a_buf),
 
115
                                          a_encoding, FALSE);
117
116
        g_return_val_if_fail (parser, NULL);
118
117
 
119
118
        status = cr_parser_try_to_skip_spaces_and_comments (parser);
280
279
{
281
280
        GString *str_buf = NULL;
282
281
        CRTerm *cur = NULL;
283
 
        guchar *result = NULL,
284
 
                *content = NULL;
 
282
        guchar *result = NULL;
 
283
        gchar *content = NULL;
285
284
 
286
285
        g_return_val_if_fail (a_this, NULL);
287
286
 
330
329
                switch (cur->type) {
331
330
                case TERM_NUMBER:
332
331
                        if (cur->content.num) {
333
 
                                content = cr_num_to_string (cur->content.num);
 
332
                                content = (gchar *)cr_num_to_string (cur->content.num);
334
333
                        }
335
334
 
336
335
                        if (content) {
361
360
 
362
361
                                        if (tmp_str) {
363
362
                                                g_string_append (str_buf, 
364
 
                                                                 tmp_str);
 
363
                                                                                    (gchar *)tmp_str);
365
364
                                                g_free (tmp_str);
366
365
                                                tmp_str = NULL;
367
366
                                        }
406
405
                case TERM_URI:
407
406
                        if (cur->content.str) {
408
407
                                content = g_strndup
409
 
                                        (cur->content.str->stryng->str,
410
 
                                         cur->content.str->stryng->len);
 
408
                                          (cur->content.str->stryng->str,
 
409
                                           cur->content.str->stryng->len);
411
410
                        }
412
411
 
413
412
                        if (content) {
426
425
                                tmp_str = cr_rgb_to_string (cur->content.rgb);
427
426
 
428
427
                                if (tmp_str) {
429
 
                                        g_string_append (str_buf, tmp_str);
 
428
                                        g_string_append (str_buf, (gchar *)tmp_str);
430
429
                                        g_free (tmp_str);
431
430
                                        tmp_str = NULL;
432
431
                                }
464
463
        }
465
464
 
466
465
        if (str_buf) {
467
 
                result = str_buf->str;
 
466
                result = (guchar *)str_buf->str;
468
467
                g_string_free (str_buf, FALSE);
469
468
                str_buf = NULL;
470
469
        }
476
475
cr_term_one_to_string (CRTerm * a_this)
477
476
{
478
477
        GString *str_buf = NULL;
479
 
        guchar *result = NULL,
480
 
                *content = NULL;
 
478
        guchar *result = NULL;
 
479
        gchar *content = NULL;
481
480
 
482
481
        g_return_val_if_fail (a_this, NULL);
483
482
 
525
524
        switch (a_this->type) {
526
525
        case TERM_NUMBER:
527
526
                if (a_this->content.num) {
528
 
                        content = cr_num_to_string (a_this->content.num);
 
527
                        content = (gchar *)cr_num_to_string (a_this->content.num);
529
528
                }
530
529
 
531
530
                if (content) {
616
615
 
617
616
        case TERM_RGB:
618
617
                if (a_this->content.rgb) {
619
 
                        guchar *tmp_str = NULL;
620
618
 
621
619
                        g_string_append_printf (str_buf, "rgb(");
622
 
                        tmp_str = cr_rgb_to_string (a_this->content.rgb);
 
620
                        gchar *tmp_str = (gchar *)cr_rgb_to_string (a_this->content.rgb);
623
621
 
624
622
                        if (tmp_str) {
625
623
                                g_string_append (str_buf, tmp_str);
660
658
        }
661
659
 
662
660
        if (str_buf) {
663
 
                result = str_buf->str;
 
661
                result = (guchar *)str_buf->str;
664
662
                g_string_free (str_buf, FALSE);
665
663
                str_buf = NULL;
666
664
        }