diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2013-11-03 14:03:19 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2013-11-03 14:03:19 +0000 |
| commit | 52045941ced0124fd0b71c31d0ef08ebfb3d295a (patch) | |
| tree | de9620d16fda77bbe8f09f3e5eedf2ecb1dc83b3 | |
| parent | Fix typo in libcroco/cr-rgb.c (diff) | |
| download | inkscape-52045941ced0124fd0b71c31d0ef08ebfb3d295a.tar.gz inkscape-52045941ced0124fd0b71c31d0ef08ebfb3d295a.zip | |
Minimise diff against libcroco-0.6.8 (pass 1)
(bzr r12772)
| -rw-r--r-- | src/libcroco/cr-additional-sel.c | 12 | ||||
| -rw-r--r-- | src/libcroco/cr-attr-sel.c | 14 | ||||
| -rw-r--r-- | src/libcroco/cr-cascade.c | 8 | ||||
| -rw-r--r-- | src/libcroco/cr-cascade.h | 2 | ||||
| -rw-r--r-- | src/libcroco/cr-declaration.c | 31 | ||||
| -rw-r--r-- | src/libcroco/cr-doc-handler.c | 8 | ||||
| -rw-r--r-- | src/libcroco/cr-enc-handler.c | 11 | ||||
| -rw-r--r-- | src/libcroco/cr-enc-handler.h | 2 | ||||
| -rw-r--r-- | src/libcroco/cr-fonts.c | 39 | ||||
| -rw-r--r-- | src/libcroco/cr-input.c | 10 | ||||
| -rw-r--r-- | src/libcroco/cr-num.c | 13 | ||||
| -rw-r--r-- | src/libcroco/cr-om-parser.c | 55 | ||||
| -rw-r--r-- | src/libcroco/cr-om-parser.h | 2 | ||||
| -rw-r--r-- | src/libcroco/cr-parser.c | 37 | ||||
| -rw-r--r-- | src/libcroco/cr-parsing-location.c | 11 | ||||
| -rw-r--r-- | src/libcroco/cr-prop-list.c | 6 | ||||
| -rw-r--r-- | src/libcroco/cr-pseudo.c | 20 | ||||
| -rw-r--r-- | src/libcroco/cr-rgb.c | 26 | ||||
| -rw-r--r-- | src/libcroco/cr-rgb.h | 4 |
19 files changed, 170 insertions, 141 deletions
diff --git a/src/libcroco/cr-additional-sel.c b/src/libcroco/cr-additional-sel.c index c6cb6cb57..5a37eba6c 100644 --- a/src/libcroco/cr-additional-sel.c +++ b/src/libcroco/cr-additional-sel.c @@ -247,7 +247,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) guchar *name = NULL; if (cur->content.class_name) { - name = (guchar *)g_strndup + name = g_strndup (cur->content.class_name->stryng->str, cur->content.class_name->stryng->len); @@ -267,7 +267,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) guchar *name = NULL; if (cur->content.class_name) { - name = (guchar *)g_strndup + name = g_strndup (cur->content.id_name->stryng->str, cur->content.id_name->stryng->len); @@ -323,7 +323,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) } if (str_buf) { - result = (guchar *)str_buf->str; + result = str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -347,7 +347,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) guchar *name = NULL; if (a_this->content.class_name) { - name = (guchar *)g_strndup + name = g_strndup (a_this->content.class_name->stryng->str, a_this->content.class_name->stryng->len); @@ -367,7 +367,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) guchar *name = NULL; if (a_this->content.class_name) { - name = (guchar *)g_strndup + name = g_strndup (a_this->content.id_name->stryng->str, a_this->content.id_name->stryng->len); @@ -422,7 +422,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) } if (str_buf) { - result = (guchar *)str_buf->str; + result = str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } diff --git a/src/libcroco/cr-attr-sel.c b/src/libcroco/cr-attr-sel.c index 7954290ac..7976ff1f8 100644 --- a/src/libcroco/cr-attr-sel.c +++ b/src/libcroco/cr-attr-sel.c @@ -41,7 +41,9 @@ CRAttrSel * cr_attr_sel_new (void) { - CRAttrSel *result = (CRAttrSel *)g_malloc0 (sizeof (CRAttrSel)); + CRAttrSel *result = NULL; + + result = g_malloc0 (sizeof (CRAttrSel)); return result; } @@ -119,7 +121,9 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (cur->name) { - gchar *name = g_strndup (cur->name->stryng->str, + guchar *name = NULL; + + name = g_strndup (cur->name->stryng->str, cur->name->stryng->len); if (name) { g_string_append (str_buf, name); @@ -129,7 +133,9 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (cur->value) { - gchar *value = g_strndup (cur->value->stryng->str, + guchar *value = NULL; + + value = g_strndup (cur->value->stryng->str, cur->value->stryng->len); if (value) { switch (cur->match_way) { @@ -162,7 +168,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (str_buf) { - result = (guchar *)str_buf->str; + result = str_buf->str; g_string_free (str_buf, FALSE); } diff --git a/src/libcroco/cr-cascade.c b/src/libcroco/cr-cascade.c index 9bdca07f3..31e938bb7 100644 --- a/src/libcroco/cr-cascade.c +++ b/src/libcroco/cr-cascade.c @@ -23,7 +23,7 @@ */ /* - *$Id: cr-cascade.c,v 1.6 2004/03/07 13:22:47 dodji Exp $ + *$Id$ */ #include <string.h> @@ -64,14 +64,16 @@ CRCascade * cr_cascade_new (CRStyleSheet * a_author_sheet, CRStyleSheet * a_user_sheet, CRStyleSheet * a_ua_sheet) { - CRCascade *result = (CRCascade *)g_try_malloc (sizeof (CRCascade)); + CRCascade *result = NULL; + + result = g_try_malloc (sizeof (CRCascade)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (result, 0, sizeof (CRCascade)); - PRIVATE (result) = (CRCascadePriv *)g_try_malloc (sizeof (CRCascadePriv)); + PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv)); if (!PRIVATE (result)) { g_free(result); cr_utils_trace_info ("Out of memory"); diff --git a/src/libcroco/cr-cascade.h b/src/libcroco/cr-cascade.h index 5e718427d..3119ae85f 100644 --- a/src/libcroco/cr-cascade.h +++ b/src/libcroco/cr-cascade.h @@ -22,7 +22,7 @@ */ /* - *$Id: cr-cascade.h,v 1.6 2004/01/29 22:05:14 dodji Exp $ + *$Id$ */ #ifndef __CR_CASCADE_H__ diff --git a/src/libcroco/cr-declaration.c b/src/libcroco/cr-declaration.c index 9f280837c..ab150a9e4 100644 --- a/src/libcroco/cr-declaration.c +++ b/src/libcroco/cr-declaration.c @@ -44,9 +44,11 @@ static void dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent) { + guchar *str = NULL; + g_return_if_fail (a_this); - gchar *str = cr_declaration_to_string (a_this, a_indent); + str = cr_declaration_to_string (a_this, a_indent); if (str) { fprintf (a_fp, "%s", str); g_free (str); @@ -72,6 +74,8 @@ CRDeclaration * 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) @@ -82,7 +86,7 @@ cr_declaration_new (CRStatement * a_statement, || (a_statement->type == AT_PAGE_RULE_STMT)), NULL); - CRDeclaration * result = (CRDeclaration *)g_try_malloc (sizeof (CRDeclaration)); + result = g_try_malloc (sizeof (CRDeclaration)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -118,6 +122,7 @@ cr_declaration_parse_from_buf (CRStatement * a_statement, CRTerm *value = NULL; CRString *property = NULL; CRDeclaration *result = NULL; + CRParser *parser = NULL; gboolean important = FALSE; g_return_val_if_fail (a_str, NULL); @@ -125,9 +130,7 @@ cr_declaration_parse_from_buf (CRStatement * a_statement, g_return_val_if_fail (a_statement->type == RULESET_STMT, NULL); - CRParser *parser = (CRParser *) - cr_parser_new_from_buf ((guchar*)a_str, - strlen ((char *)a_str), a_enc, FALSE); + parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE); g_return_val_if_fail (parser, NULL); status = cr_parser_try_to_skip_spaces_and_comments (parser); @@ -185,13 +188,13 @@ cr_declaration_parse_list_from_buf (const guchar * a_str, 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); - CRParser *parser = (CRParser *)cr_parser_new_from_buf - ((guchar*)a_str, strlen ((char *)a_str), a_enc, FALSE); + parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE); g_return_val_if_fail (parser, NULL); status = cr_parser_get_tknzr (parser, &tokenizer); if (status != CR_OK || !tokenizer) { @@ -223,7 +226,7 @@ cr_declaration_parse_list_from_buf (const guchar * a_str, 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; } @@ -501,7 +504,7 @@ cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent) { GString *stringue = NULL; - gchar *str = NULL, + guchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -570,7 +573,7 @@ cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent) { CRDeclaration const *cur = NULL; GString *stringue = NULL; - gchar *str = NULL, + guchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -590,7 +593,7 @@ cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent) g_string_free (stringue, FALSE); } - return (guchar *)result; + return result; } /** @@ -609,7 +612,7 @@ cr_declaration_list_to_string2 (CRDeclaration const * a_this, { CRDeclaration const *cur = NULL; GString *stringue = NULL; - gchar *str = NULL, + guchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -643,7 +646,7 @@ cr_declaration_list_to_string2 (CRDeclaration const * a_this, g_string_free (stringue, FALSE); } - return (guchar *)result; + return result; } /** @@ -711,7 +714,7 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this, && cur->property->stryng && cur->property->stryng->str) { if (!strcmp (cur->property->stryng->str, - (char *)a_prop)) { + a_prop)) { return cur; } } diff --git a/src/libcroco/cr-doc-handler.c b/src/libcroco/cr-doc-handler.c index b76ba5515..bbb158298 100644 --- a/src/libcroco/cr-doc-handler.c +++ b/src/libcroco/cr-doc-handler.c @@ -69,14 +69,16 @@ struct _CRDocHandlerPriv { CRDocHandler * cr_doc_handler_new (void) { - CRDocHandler *result = ( CRDocHandler *)g_try_malloc (sizeof (CRDocHandler)); + CRDocHandler *result = NULL; + + result = g_try_malloc (sizeof (CRDocHandler)); g_return_val_if_fail (result, NULL); memset (result, 0, sizeof (CRDocHandler)); result->ref_count++; - result->priv = (CRDocHandlerPriv *)g_try_malloc (sizeof (CRDocHandlerPriv)); + result->priv = g_try_malloc (sizeof (CRDocHandlerPriv)); if (!result->priv) { cr_utils_trace_info ("Out of memory exception"); g_free (result); @@ -270,5 +272,5 @@ cr_doc_handler_associate_a_parser (CRDocHandler *a_this, g_return_if_fail (a_this && PRIVATE (a_this) && a_parser) ; - PRIVATE (a_this)->parser = (CRParser *)a_parser ; + PRIVATE (a_this)->parser = a_parser ; } diff --git a/src/libcroco/cr-enc-handler.c b/src/libcroco/cr-enc-handler.c index 993254a33..b3e5b7eba 100644 --- a/src/libcroco/cr-enc-handler.c +++ b/src/libcroco/cr-enc-handler.c @@ -21,7 +21,7 @@ */ /* - *$Id: cr-enc-handler.c,v 1.7 2004/03/07 13:22:47 dodji Exp $ + *$Id$ */ /** @@ -57,7 +57,7 @@ static struct CREncAlias gv_default_aliases[] = { {"UCS-4", CR_UCS_4}, {"UCS_4", CR_UCS_4}, {"ASCII", CR_ASCII}, - {(char *)0, (enum CREncoding)0} + {0, 0} }; static CREncHandler gv_default_enc_handlers[] = { @@ -70,7 +70,7 @@ static CREncHandler gv_default_enc_handlers[] = { {CR_ASCII, cr_utils_ucs1_to_utf8, cr_utils_utf8_to_ucs1, cr_utils_ucs1_str_len_as_utf8, cr_utils_utf8_str_len_as_ucs1}, - {(enum CREncoding)0, NULL, NULL, NULL, NULL} + {0, NULL, NULL, NULL, NULL} }; /** @@ -113,11 +113,12 @@ cr_enc_handler_resolve_enc_alias (const guchar * a_alias_name, enum CREncoding *a_enc) { gulong i = 0; + guchar *alias_name_up = NULL; enum CRStatus status = CR_ENCODING_NOT_FOUND_ERROR; g_return_val_if_fail (a_alias_name != NULL, CR_BAD_PARAM_ERROR); - gchar *alias_name_up = g_strdup ((gchar *)a_alias_name); + alias_name_up = g_strdup (a_alias_name); g_ascii_strup (alias_name_up, -1); for (i = 0; gv_default_aliases[i].name; i++) { @@ -170,7 +171,7 @@ cr_enc_handler_convert_input (CREncHandler * a_this, *a_out_len = *a_in_len; } - *a_out = (guchar *)g_malloc0 (*a_out_len); + *a_out = g_malloc0 (*a_out_len); status = a_this->decode_input (a_in, a_in_len, *a_out, a_out_len); diff --git a/src/libcroco/cr-enc-handler.h b/src/libcroco/cr-enc-handler.h index 63e7433ef..0727764c0 100644 --- a/src/libcroco/cr-enc-handler.h +++ b/src/libcroco/cr-enc-handler.h @@ -21,7 +21,7 @@ */ /* - *$Id: cr-enc-handler.h,v 1.5 2004/01/24 19:24:01 dodji Exp $ + *$Id$ */ /** diff --git a/src/libcroco/cr-fonts.c b/src/libcroco/cr-fonts.c index 96a8e1cee..3c6896ffd 100644 --- a/src/libcroco/cr-fonts.c +++ b/src/libcroco/cr-fonts.c @@ -30,7 +30,7 @@ static enum CRStatus cr_font_family_to_string_real (CRFontFamily const * a_this, gboolean a_walk_list, GString ** a_string) { - gchar const *name = NULL; + guchar const *name = NULL; enum CRStatus result = CR_OK; if (!*a_string) { @@ -46,27 +46,27 @@ cr_font_family_to_string_real (CRFontFamily const * a_this, switch (a_this->type) { case FONT_FAMILY_SANS_SERIF: - name = (gchar const *) "sans-serif"; + name = (guchar const *) "sans-serif"; break; case FONT_FAMILY_SERIF: - name = (gchar const *) "sans-serif"; + name = (guchar const *) "sans-serif"; break; case FONT_FAMILY_CURSIVE: - name = (gchar const *) "cursive"; + name = (guchar const *) "cursive"; break; case FONT_FAMILY_FANTASY: - name = (gchar const *) "fantasy"; + name = (guchar const *) "fantasy"; break; case FONT_FAMILY_MONOSPACE: - name = (gchar const *) "monospace"; + name = (guchar const *) "monospace"; break; case FONT_FAMILY_NON_GENERIC: - name = (gchar const *) a_this->name; + name = (guchar const *) a_this->name; break; default: @@ -153,7 +153,9 @@ cr_relative_font_size_to_string (enum CRRelativeFontSize a_code) CRFontFamily * cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name) { - CRFontFamily *result = (CRFontFamily *)g_try_malloc (sizeof (CRFontFamily)); + CRFontFamily *result = NULL; + + result = g_try_malloc (sizeof (CRFontFamily)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -181,13 +183,13 @@ cr_font_family_to_string (CRFontFamily const * a_this, gboolean a_walk_font_family_list) { enum CRStatus status = CR_OK; - gchar *result = NULL; + guchar *result = NULL; GString *stringue = NULL; if (!a_this) { result = g_strdup ("NULL"); g_return_val_if_fail (result, NULL); - return (guchar *)result; + return result; } status = cr_font_family_to_string_real (a_this, a_walk_font_family_list, @@ -205,7 +207,7 @@ cr_font_family_to_string (CRFontFamily const * a_this, } } - return (guchar *)result; + return result; } /** @@ -332,7 +334,9 @@ cr_font_family_destroy (CRFontFamily * a_this) CRFontSize * cr_font_size_new (void) { - CRFontSize *result = (CRFontSize *)g_try_malloc (sizeof (CRFontSize)); + CRFontSize *result = NULL; + + result = g_try_malloc (sizeof (CRFontSize)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -522,7 +526,7 @@ cr_font_size_to_string (CRFontSize const * a_this) (a_this->value.predefined)); break; case ABSOLUTE_FONT_SIZE: - str = (gchar *)cr_num_to_string (&a_this->value.absolute); + str = cr_num_to_string (&a_this->value.absolute); break; case RELATIVE_FONT_SIZE: str = g_strdup (cr_relative_font_size_to_string @@ -679,7 +683,7 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this) break; case FONT_SIZE_ADJUST_NUMBER: if (a_this->num) - str = (gchar *)cr_num_to_string (a_this->num); + str = cr_num_to_string (a_this->num); else str = g_strdup ("unknow font-size-adjust property value"); /* Should raise an error no?*/ break; @@ -768,7 +772,7 @@ cr_font_weight_get_bolder (enum CRFontWeight a_weight) cr_utils_trace_info ("FONT_WEIGHT_BOLDER or FONT_WEIGHT_LIGHTER should not appear here") ; return FONT_WEIGHT_NORMAL ; } else { - return (enum CRFontWeight)(a_weight << 1) ; + return a_weight << 1 ; } } @@ -910,8 +914,9 @@ cr_font_size_destroy (CRFontSize * a_font_size) CRFontSizeAdjust * cr_font_size_adjust_new (void) { - CRFontSizeAdjust *result = - (CRFontSizeAdjust *)g_try_malloc (sizeof (CRFontSizeAdjust)); + CRFontSizeAdjust *result = NULL; + + result = g_try_malloc (sizeof (CRFontSizeAdjust)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; diff --git a/src/libcroco/cr-input.c b/src/libcroco/cr-input.c index 33321d9f7..3cc283e01 100644 --- a/src/libcroco/cr-input.c +++ b/src/libcroco/cr-input.c @@ -88,14 +88,16 @@ static CRInput *cr_input_new_real (void); static CRInput * cr_input_new_real (void) { - CRInput *result = (CRInput *)g_try_malloc (sizeof (CRInput)); + CRInput *result = NULL; + + result = g_try_malloc (sizeof (CRInput)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (result, 0, sizeof (CRInput)); - PRIVATE (result) = (CRInputPriv *)g_try_malloc (sizeof (CRInputPriv)); + PRIVATE (result) = g_try_malloc (sizeof (CRInputPriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("Out of memory"); g_free (result); @@ -238,7 +240,7 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc) if (status == CR_OK) { /*read went well */ - buf = (guchar *)g_realloc (buf, len + CR_INPUT_MEM_CHUNK_SIZE); + buf = g_realloc (buf, len + CR_INPUT_MEM_CHUNK_SIZE); memcpy (buf + len, tmp_buf, nb_read); len += nb_read; buf_size += CR_INPUT_MEM_CHUNK_SIZE; @@ -764,7 +766,7 @@ cr_input_peek_char (CRInput const * a_this, guint32 * a_char) status = cr_utils_read_char_from_utf8_buf (PRIVATE (a_this)->in_buf + PRIVATE (a_this)->next_byte_index, - nb_bytes_left, a_char, (gulong *)&consumed); + nb_bytes_left, a_char, &consumed); return status; } diff --git a/src/libcroco/cr-num.c b/src/libcroco/cr-num.c index d3aab552b..a5c320bf2 100644 --- a/src/libcroco/cr-num.c +++ b/src/libcroco/cr-num.c @@ -43,7 +43,9 @@ CRNum * cr_num_new (void) { - CRNum *result = (CRNum *)g_try_malloc (sizeof (CRNum)); + CRNum *result = NULL; + + result = g_try_malloc (sizeof (CRNum)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); @@ -92,16 +94,18 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) guchar * cr_num_to_string (CRNum const * a_this) { + gdouble test_val = 0.0; + guchar *tmp_char1 = NULL, *tmp_char2 = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); - gdouble test_val = a_this->val - (glong) a_this->val; + test_val = a_this->val - (glong) a_this->val; if (!test_val) { - tmp_char1 = (guchar *)g_strdup_printf ("%ld", (glong) a_this->val); + tmp_char1 = g_strdup_printf ("%ld", (glong) a_this->val); } else { /* We can't use g_ascii_dtostr, because that sometimes uses e notation (which wouldn't be a valid number in CSS). */ @@ -191,8 +195,7 @@ cr_num_to_string (CRNum const * a_this) } if (tmp_char2) { - result = (guchar *)g_strconcat ( - (gchar *)tmp_char1, (gchar *)tmp_char2, NULL); + result = g_strconcat (tmp_char1, tmp_char2, NULL); g_free (tmp_char1); } else { result = tmp_char1; diff --git a/src/libcroco/cr-om-parser.c b/src/libcroco/cr-om-parser.c index 8eb37306b..ea622e35c 100644 --- a/src/libcroco/cr-om-parser.c +++ b/src/libcroco/cr-om-parser.c @@ -25,8 +25,6 @@ #include "cr-utils.h" #include "cr-om-parser.h" -#define UNUSED(_param) ((void)(_param)) - /** *@CROMParser: * @@ -113,8 +111,9 @@ struct _ParsingContext { static ParsingContext * new_parsing_context (void) { - ParsingContext *result = - (ParsingContext *)g_try_malloc (sizeof (ParsingContext)); + ParsingContext *result = NULL; + + result = g_try_malloc (sizeof (ParsingContext)); if (!result) { cr_utils_trace_info ("Out of Memory"); return NULL; @@ -212,10 +211,10 @@ start_font_face (CRDocHandler * a_this, ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; - UNUSED(a_location); g_return_if_fail (a_this); - ctxtptr = &ctxt; + g_return_if_fail (a_this); + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt == NULL); @@ -311,10 +310,8 @@ charset (CRDocHandler * a_this, CRString * a_charset, ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; - UNUSED(a_location); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->stylesheet); @@ -347,10 +344,8 @@ start_page (CRDocHandler * a_this, ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; - UNUSED(a_location); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt == NULL); @@ -391,11 +386,8 @@ end_page (CRDocHandler * a_this, ParsingContext **ctxtptr = NULL; CRStatement *stmt = NULL; - UNUSED(a_page); - UNUSED(a_pseudo_page); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt @@ -415,6 +407,8 @@ end_page (CRDocHandler * a_this, cr_statement_destroy (ctxt->cur_stmt); ctxt->cur_stmt = NULL; } + a_page = NULL; /*keep compiler happy */ + a_pseudo_page = NULL; /*keep compiler happy */ } static void @@ -427,10 +421,8 @@ start_media (CRDocHandler * a_this, ParsingContext **ctxtptr = NULL; GList *media_list = NULL; - UNUSED(a_location); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); @@ -440,10 +432,12 @@ start_media (CRDocHandler * a_this, && ctxt->stylesheet); if (a_media_list) { /*duplicate the media_list */ - media_list = cr_utils_dup_glist_of_cr_string(a_media_list); + media_list = cr_utils_dup_glist_of_cr_string + (a_media_list); } ctxt->cur_media_stmt = - cr_statement_new_at_media_rule(ctxt->stylesheet, NULL, media_list); + cr_statement_new_at_media_rule + (ctxt->stylesheet, NULL, media_list); } @@ -455,10 +449,8 @@ end_media (CRDocHandler * a_this, GList * a_media_list) ParsingContext **ctxtptr = NULL; CRStatement *stmts = NULL; - UNUSED(a_media_list); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt @@ -478,6 +470,7 @@ end_media (CRDocHandler * a_this, GList * a_media_list) ctxt->cur_stmt = NULL ; ctxt->cur_media_stmt = NULL ; + a_media_list = NULL; } static void @@ -495,11 +488,8 @@ import_style (CRDocHandler * a_this, ParsingContext **ctxtptr = NULL; GList *media_list = NULL ; - UNUSED(a_uri_default_ns); - UNUSED(a_location); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->stylesheet); @@ -571,10 +561,8 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; - UNUSED(a_selector_list); g_return_if_fail (a_this); - - ctxtptr = &ctxt; + ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet); @@ -778,9 +766,10 @@ unrecoverable_error (CRDocHandler * a_this) CROMParser * cr_om_parser_new (CRInput * a_input) { + CROMParser *result = NULL; enum CRStatus status = CR_OK; - CROMParser *result = (CROMParser *)g_try_malloc (sizeof (CROMParser)); + result = g_try_malloc (sizeof (CROMParser)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -788,7 +777,7 @@ cr_om_parser_new (CRInput * a_input) } memset (result, 0, sizeof (CROMParser)); - PRIVATE (result) = (CROMParserPriv *)g_try_malloc (sizeof (CROMParserPriv)); + PRIVATE (result) = g_try_malloc (sizeof (CROMParserPriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("Out of memory"); diff --git a/src/libcroco/cr-om-parser.h b/src/libcroco/cr-om-parser.h index 4fc63011a..13d35b1cd 100644 --- a/src/libcroco/cr-om-parser.h +++ b/src/libcroco/cr-om-parser.h @@ -22,7 +22,7 @@ */ /* - *$Id: cr-om-parser.h,v 1.9 2004/01/29 22:05:14 dodji Exp $ + *$Id$ */ #ifndef __CR_OM_PARSER_H__ diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c index 6544a679f..41d3eab5a 100644 --- a/src/libcroco/cr-parser.c +++ b/src/libcroco/cr-parser.c @@ -413,7 +413,9 @@ static enum CRStatus static CRParserError * cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status) { - CRParserError *result = (CRParserError *)g_try_malloc (sizeof (CRParserError)); + CRParserError *result = NULL; + + result = g_try_malloc (sizeof (CRParserError)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); @@ -442,7 +444,7 @@ cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg) g_free (a_this->msg); } - a_this->msg = (guchar *)g_strdup ((gchar *)a_msg); + a_this->msg = g_strdup (a_msg); } /** @@ -731,7 +733,7 @@ cr_parser_parse_stylesheet_core (CRParser * a_this) error: cr_parser_push_error - (a_this, (guchar *)"could not recognize next production", CR_ERROR); + (a_this, "could not recognize next production", CR_ERROR); cr_parser_dump_err_stack (a_this, TRUE); @@ -2428,7 +2430,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) import_string, NULL, &location) ; - if (PRIVATE (a_this)->sac_handler->resolve_import == TRUE) { + if ((PRIVATE (a_this)->sac_handler->resolve_import == TRUE)) { /* *TODO: resolve the *import rule. @@ -2465,7 +2467,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) /*free the medium list */ for (cur = media_list; cur; cur = cur->next) { if (cur->data) { - cr_string_destroy ((CRString *)cur->data); + cr_string_destroy (cur->data); } } @@ -2705,7 +2707,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) } cr_parser_push_error - (a_this, (guchar *)"could not recognize next production", CR_ERROR); + (a_this, "could not recognize next production", CR_ERROR); if (PRIVATE (a_this)->sac_handler && PRIVATE (a_this)->sac_handler->unrecoverable_error) { @@ -2752,11 +2754,12 @@ cr_parser_parse_stylesheet (CRParser * a_this) CRParser * cr_parser_new (CRTknzr * a_tknzr) { + CRParser *result = NULL; enum CRStatus status = CR_OK; - CRParser *result = (CRParser *)g_malloc0 (sizeof (CRParser)); + result = g_malloc0 (sizeof (CRParser)); - PRIVATE (result) = (CRParserPriv *)g_malloc0 (sizeof (CRParserPriv)); + PRIVATE (result) = g_malloc0 (sizeof (CRParserPriv)); if (a_tknzr) { status = cr_parser_set_tknzr (result, a_tknzr); @@ -3190,7 +3193,7 @@ cr_parser_parse_declaration (CRParser * a_this, CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - (guchar *)"while parsing declaration: next property is malformed", + "while parsing declaration: next property is malformed", CR_SYNTAX_ERROR); READ_NEXT_CHAR (a_this, &cur_char); @@ -3199,7 +3202,7 @@ cr_parser_parse_declaration (CRParser * a_this, status = CR_PARSING_ERROR; cr_parser_push_error (a_this, - (guchar *)"while parsing declaration: this char must be ':'", + "while parsing declaration: this char must be ':'", CR_SYNTAX_ERROR); goto error; } @@ -3210,7 +3213,7 @@ cr_parser_parse_declaration (CRParser * a_this, CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - (guchar *)"while parsing declaration: next expression is malformed", + "while parsing declaration: next expression is malformed", CR_SYNTAX_ERROR); cr_parser_try_to_skip_spaces_and_comments (a_this); @@ -3350,7 +3353,7 @@ cr_parser_parse_ruleset (CRParser * a_this) ENSURE_PARSING_COND_ERR (a_this, cur_char == '{', - (guchar *)"while parsing rulset: current char should be '{'", + "while parsing rulset: current char should be '{'", CR_SYNTAX_ERROR); if (PRIVATE (a_this)->sac_handler @@ -3414,7 +3417,7 @@ cr_parser_parse_ruleset (CRParser * a_this) } CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - (guchar *)"while parsing ruleset: next construction should be a declaration", + "while parsing ruleset: next construction should be a declaration", CR_SYNTAX_ERROR); for (;;) { @@ -3456,7 +3459,7 @@ cr_parser_parse_ruleset (CRParser * a_this) READ_NEXT_CHAR (a_this, &cur_char); ENSURE_PARSING_COND_ERR (a_this, cur_char == '}', - (guchar *)"while parsing rulset: current char must be a '}'", + "while parsing rulset: current char must be a '}'", CR_SYNTAX_ERROR); selector->location = end_parsing_location; @@ -3663,7 +3666,7 @@ cr_parser_parse_import (CRParser * a_this, */ for (cur = *a_media_list; cur; cur = cur->next) { if (cur->data) { - cr_string_destroy ((CRString *)cur->data); + cr_string_destroy (cur->data); } } @@ -3817,7 +3820,7 @@ cr_parser_parse_media (CRParser * a_this) GList *cur = NULL; for (cur = media_list; cur; cur = cur->next) { - cr_string_destroy ((CRString *)cur->data); + cr_string_destroy (cur->data); } g_list_free (media_list); @@ -3845,7 +3848,7 @@ cr_parser_parse_media (CRParser * a_this) GList *cur = NULL; for (cur = media_list; cur; cur = cur->next) { - cr_string_destroy ((CRString *)cur->data); + cr_string_destroy (cur->data); } g_list_free (media_list); diff --git a/src/libcroco/cr-parsing-location.c b/src/libcroco/cr-parsing-location.c index a883de933..4fe4acc30 100644 --- a/src/libcroco/cr-parsing-location.c +++ b/src/libcroco/cr-parsing-location.c @@ -41,8 +41,9 @@ CRParsingLocation * cr_parsing_location_new (void) { - CRParsingLocation *result = - (CRParsingLocation *)g_try_malloc (sizeof (CRParsingLocation)) ; + CRParsingLocation * result = NULL ; + + result = g_try_malloc (sizeof (CRParsingLocation)) ; if (!result) { cr_utils_trace_info ("Out of memory error") ; return NULL ; @@ -101,15 +102,15 @@ gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this, enum CRParsingLocationSerialisationMask a_mask) { + GString *result = NULL ; gchar *str = NULL ; g_return_val_if_fail (a_this, NULL) ; if (!a_mask) { - a_mask = (enum CRParsingLocationSerialisationMask) - ((int)DUMP_LINE | (int)DUMP_COLUMN | (int)DUMP_BYTE_OFFSET) ; + a_mask = DUMP_LINE | DUMP_COLUMN | DUMP_BYTE_OFFSET ; } - GString *result = (GString *)g_string_new (NULL) ; + result =g_string_new (NULL) ; if (!result) return NULL ; if (a_mask & DUMP_LINE) { diff --git a/src/libcroco/cr-prop-list.c b/src/libcroco/cr-prop-list.c index c0eaaf494..dc575d6ff 100644 --- a/src/libcroco/cr-prop-list.c +++ b/src/libcroco/cr-prop-list.c @@ -41,13 +41,15 @@ static CRPropList *cr_prop_list_allocate (void); static CRPropList * cr_prop_list_allocate (void) { - CRPropList *result = (CRPropList *)g_try_malloc (sizeof (CRPropList)); + CRPropList *result = NULL; + + result = g_try_malloc (sizeof (CRPropList)); if (!result) { cr_utils_trace_info ("could not allocate CRPropList"); return NULL; } memset (result, 0, sizeof (CRPropList)); - PRIVATE (result) = (CRPropListPriv *)g_try_malloc (sizeof (CRPropListPriv)); + PRIVATE (result) = g_try_malloc (sizeof (CRPropListPriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("could not allocate CRPropListPriv"); g_free (result); diff --git a/src/libcroco/cr-pseudo.c b/src/libcroco/cr-pseudo.c index 7799a8bbb..a46e69ed0 100644 --- a/src/libcroco/cr-pseudo.c +++ b/src/libcroco/cr-pseudo.c @@ -37,7 +37,9 @@ CRPseudo * cr_pseudo_new (void) { - CRPseudo *result = (CRPseudo *)g_malloc0 (sizeof (CRPseudo)); + CRPseudo *result = NULL; + + result = g_malloc0 (sizeof (CRPseudo)); return result; } @@ -53,17 +55,20 @@ guchar * cr_pseudo_to_string (CRPseudo const * a_this) { guchar *result = NULL; + GString *str_buf = NULL; g_return_val_if_fail (a_this, NULL); - GString *str_buf = (GString *)g_string_new (NULL); + str_buf = g_string_new (NULL); if (a_this->type == IDENT_PSEUDO) { + guchar *name = NULL; - if (a_this->name == NULL) + if (a_this->name == NULL) { goto error; + } - gchar *name = g_strndup (a_this->name->stryng->str, + name = g_strndup (a_this->name->stryng->str, a_this->name->stryng->len); if (name) { @@ -72,12 +77,13 @@ cr_pseudo_to_string (CRPseudo const * a_this) name = NULL; } } else if (a_this->type == FUNCTION_PSEUDO) { - gchar *arg = NULL; + guchar *name = NULL, + *arg = NULL; if (a_this->name == NULL) goto error; - gchar *name = g_strndup (a_this->name->stryng->str, + name = g_strndup (a_this->name->stryng->str, a_this->name->stryng->len); if (a_this->extra) { @@ -101,7 +107,7 @@ cr_pseudo_to_string (CRPseudo const * a_this) } if (str_buf) { - result = (guchar *)str_buf->str; + result = str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } diff --git a/src/libcroco/cr-rgb.c b/src/libcroco/cr-rgb.c index a48490f30..06e61ba41 100644 --- a/src/libcroco/cr-rgb.c +++ b/src/libcroco/cr-rgb.c @@ -191,7 +191,9 @@ static const CRRgb gv_standard_colors[] = { CRRgb * cr_rgb_new (void) { - CRRgb *result = (CRRgb *)g_try_malloc (sizeof (CRRgb)); + CRRgb *result = NULL; + + result = g_try_malloc (sizeof (CRRgb)); if (result == NULL) { cr_utils_trace_info ("No more memory"); @@ -245,8 +247,10 @@ cr_rgb_new_with_vals (gulong a_red, gulong a_green, guchar * cr_rgb_to_string (CRRgb const * a_this) { - gchar *result = NULL; - GString *str_buf = (GString *)g_string_new (NULL); + guchar *result = NULL; + GString *str_buf = NULL; + + str_buf = g_string_new (NULL); g_return_val_if_fail (str_buf, NULL); if (a_this->is_percentage == 1) { @@ -274,7 +278,7 @@ cr_rgb_to_string (CRRgb const * a_this) g_string_free (str_buf, FALSE); } - return (guchar *)result; + return result; } /** @@ -502,7 +506,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) g_return_val_if_fail (a_this && a_hex, CR_BAD_PARAM_ERROR); - if (strlen ((char *)a_hex) == 3) { + if (strlen (a_hex) == 3) { for (i = 0; i < 3; i++) { if (a_hex[i] >= '0' && a_hex[i] <= '9') { colors[i] = a_hex[i] - '0'; @@ -517,7 +521,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) status = CR_UNKNOWN_TYPE_ERROR; } } - } else if (strlen ((char *)a_hex) == 6) { + } else if (strlen (a_hex) == 6) { for (i = 0; i < 6; i++) { if (a_hex[i] >= '0' && a_hex[i] <= '9') { colors[i / 2] <<= 4; @@ -559,8 +563,8 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) { - enum CRStatus status = CR_OK ; - g_return_val_if_fail (a_this && a_value, + enum CRStatus status = CR_OK ; + g_return_val_if_fail (a_this && a_value, CR_BAD_PARAM_ERROR) ; switch(a_value->type) { @@ -582,7 +586,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) } else { status = cr_rgb_set_from_name (a_this, - (guchar *)a_value->content.str->stryng->str) ; + a_value->content.str->stryng->str) ; } } else { cr_utils_trace_info @@ -595,7 +599,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) && a_value->content.str->stryng->str) { status = cr_rgb_set_from_hex_str (a_this, - (guchar *)a_value->content.str->stryng->str) ; + a_value->content.str->stryng->str) ; } else { cr_utils_trace_info ("a_value has NULL string value") ; @@ -651,7 +655,7 @@ cr_rgb_parse_from_buf (const guchar *a_str, g_return_val_if_fail (a_str, NULL); - parser = cr_parser_new_from_buf ((guchar *)a_str, strlen ((char *)a_str), + parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE) ; g_return_val_if_fail (parser, NULL); diff --git a/src/libcroco/cr-rgb.h b/src/libcroco/cr-rgb.h index 49d7f7b82..a127a440e 100644 --- a/src/libcroco/cr-rgb.h +++ b/src/libcroco/cr-rgb.h @@ -39,12 +39,12 @@ struct _CRRgb *Either NO_UNIT (integer) or *UNIT_PERCENTAGE (percentage). */ - const gchar *name ; + const guchar *name ; glong red ; glong green ; glong blue ; gboolean is_percentage ; - gboolean inherit ; + gboolean inherit ; gboolean is_transparent ; CRParsingLocation location ; } ; |
