diff options
author | Abhishek Sharma <sharma.abhishek.it@gmail.com> | 2011-07-03 00:52:21 +0530 |
---|---|---|
committer | Abhishek Sharma <sharma.abhishek.it@gmail.com> | 2011-07-03 00:52:21 +0530 |
commit | ac3e66fa2bb416507b5b5cf114c1edaa3455f105 (patch) | |
tree | e4756168d3a488de228e9a836a3fa769747352ad | |
parent | 903f13254d71f127bd5221779c3441c93f1ca92b (diff) | |
download | libcroco-ac3e66fa2bb416507b5b5cf114c1edaa3455f105.tar.gz |
Sending recent tested changes from inkscape developers to libcroco upstream
49 files changed, 1750 insertions, 2656 deletions
diff --git a/src/cr-additional-sel.c b/src/cr-additional-sel.c index 5a37eba..80a4767 100644 --- a/src/cr-additional-sel.c +++ b/src/cr-additional-sel.c @@ -26,28 +26,15 @@ #include "string.h" /** - * CRAdditionalSel: - * - * #CRAdditionalSel abstracts an additionnal selector. - * An additional selector is the selector part - * that comes after the combination of type selectors. - * It can be either "a class selector (the .class part), - * a pseudo class selector, an attribute selector - * or an id selector. - */ - -/** - * cr_additional_sel_new: - * - * Default constructor of #CRAdditionalSel. - * Returns the newly build instance of #CRAdditionalSel. + *Default constructor of #CRAdditionalSel. + *@return the newly build instance of #CRAdditionalSel. */ CRAdditionalSel * cr_additional_sel_new (void) { CRAdditionalSel *result = NULL; - result = g_try_malloc (sizeof (CRAdditionalSel)); + result = (CRAdditionalSel *)g_try_malloc (sizeof (CRAdditionalSel)); if (result == NULL) { cr_utils_trace_debug ("Out of memory"); @@ -60,12 +47,10 @@ cr_additional_sel_new (void) } /** - * cr_additional_sel_new_with_type: - * @a_sel_type: the type of the newly built instance - * of #CRAdditionalSel. - * - * Constructor of #CRAdditionalSel. - * Returns the newly built instance of #CRAdditionalSel. + *Constructor of #CRAdditionalSel. + *@param a_sel_type the type of the newly built instance + *of #CRAdditionalSel. + *@return the newly built instance of #CRAdditionalSel. */ CRAdditionalSel * cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type) @@ -82,13 +67,12 @@ cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type) } /** - * cr_additional_sel_set_class_name: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_class_name: the new class name to set. + *Sets a new class name to a + *CLASS additional selector. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_class_name the new class name to set. * - * Sets a new class name to a - * CLASS additional selector. */ void cr_additional_sel_set_class_name (CRAdditionalSel * a_this, @@ -104,13 +88,11 @@ cr_additional_sel_set_class_name (CRAdditionalSel * a_this, } /** - * cr_additional_sel_set_id_name: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_id: the new id to set. - * - * Sets a new id name to an - * ID additional selector. + *Sets a new id name to an + *ID additional selector. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_id the new id to set. */ void cr_additional_sel_set_id_name (CRAdditionalSel * a_this, CRString * a_id) @@ -125,13 +107,11 @@ cr_additional_sel_set_id_name (CRAdditionalSel * a_this, CRString * a_id) } /** - * cr_additional_sel_set_pseudo: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_pseudo: the new pseudo to set. - * - * Sets a new pseudo to a - * PSEUDO additional selector. + *Sets a new pseudo to a + *PSEUDO additional selector. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_pseudo the new pseudo to set. */ void cr_additional_sel_set_pseudo (CRAdditionalSel * a_this, CRPseudo * a_pseudo) @@ -147,13 +127,11 @@ cr_additional_sel_set_pseudo (CRAdditionalSel * a_this, CRPseudo * a_pseudo) } /** - * cr_additional_sel_set_attr_sel: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_sel: the new instance of #CRAttrSel to set. - * - * Sets a new instance of #CRAttrSel to - * a ATTRIBUTE additional selector. + *Sets a new instance of #CRAttrSel to + *a ATTRIBUTE additional selector. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_sel the new instance of #CRAttrSel to set. */ void cr_additional_sel_set_attr_sel (CRAdditionalSel * a_this, CRAttrSel * a_sel) @@ -168,15 +146,12 @@ cr_additional_sel_set_attr_sel (CRAdditionalSel * a_this, CRAttrSel * a_sel) } /** - * cr_additional_sel_append: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_sel: the new instance to #CRAdditional to append. - * - * Appends a new instance of #CRAdditional to the - * current list of #CRAdditional. - * - * Returns the new list of CRAdditionalSel or NULL if an error arises. + *Appends a new instance of #CRAdditional to the + *current list of #CRAdditional. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_sel the new instance to #CRAdditional to append. + *@return the new list of CRAdditionalSel or NULL if an error arises. */ CRAdditionalSel * cr_additional_sel_append (CRAdditionalSel * a_this, CRAdditionalSel * a_sel) @@ -204,15 +179,12 @@ cr_additional_sel_append (CRAdditionalSel * a_this, CRAdditionalSel * a_sel) } /** - * cr_additional_sel_prepend: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * @a_sel: the new instance to #CRAdditional to preappend. - * - * Preppends a new instance of #CRAdditional to the - * current list of #CRAdditional. - * - * Returns the new list of CRAdditionalSel or NULL if an error arises. + *Preppends a new instance of #CRAdditional to the + *current list of #CRAdditional. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . + *@param a_sel the new instance to #CRAdditional to preappend. + *@return the new list of CRAdditionalSel or NULL if an error arises. */ CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel * a_this, CRAdditionalSel * a_sel) @@ -230,11 +202,11 @@ cr_additional_sel_prepend (CRAdditionalSel * a_this, CRAdditionalSel * a_sel) } guchar * -cr_additional_sel_to_string (CRAdditionalSel const * a_this) +cr_additional_sel_to_string (CRAdditionalSel * a_this) { guchar *result = NULL; GString *str_buf = NULL; - CRAdditionalSel const *cur = NULL; + CRAdditionalSel *cur = NULL; g_return_val_if_fail (a_this, NULL); @@ -247,7 +219,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) guchar *name = NULL; if (cur->content.class_name) { - name = g_strndup + name = (guchar *)g_strndup (cur->content.class_name->stryng->str, cur->content.class_name->stryng->len); @@ -267,7 +239,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) guchar *name = NULL; if (cur->content.class_name) { - name = g_strndup + name = (guchar *)g_strndup (cur->content.id_name->stryng->str, cur->content.id_name->stryng->len); @@ -323,7 +295,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -332,7 +304,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this) } guchar * -cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) +cr_additional_sel_one_to_string (CRAdditionalSel *a_this) { guchar *result = NULL; GString *str_buf = NULL; @@ -347,7 +319,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) guchar *name = NULL; if (a_this->content.class_name) { - name = g_strndup + name = (guchar *)g_strndup (a_this->content.class_name->stryng->str, a_this->content.class_name->stryng->len); @@ -367,7 +339,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) guchar *name = NULL; if (a_this->content.class_name) { - name = g_strndup + name = (guchar *)g_strndup (a_this->content.id_name->stryng->str, a_this->content.id_name->stryng->len); @@ -422,7 +394,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -431,15 +403,13 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) } /** - * cr_additional_sel_dump: - * @a_this: the "this pointer" of the current instance of - * #CRAdditionalSel. - * @a_fp: the destination file. - * - * Dumps the current instance of #CRAdditionalSel to a file + *Dumps the current instance of #CRAdditionalSel to a file + *@param a_this the "this pointer" of the current instance of + *#CRAdditionalSel. + *@param a_fp the destination file. */ void -cr_additional_sel_dump (CRAdditionalSel const * a_this, FILE * a_fp) +cr_additional_sel_dump (CRAdditionalSel * a_this, FILE * a_fp) { guchar *tmp_str = NULL; @@ -456,11 +426,9 @@ cr_additional_sel_dump (CRAdditionalSel const * a_this, FILE * a_fp) } /** - * cr_additional_sel_destroy: - * @a_this: the "this pointer" of the current instance - * of #CRAdditionalSel . - * - * Destroys an instance of #CRAdditional. + *Destroys an instance of #CRAdditional. + *@param a_this the "this pointer" of the current instance + *of #CRAdditionalSel . */ void cr_additional_sel_destroy (CRAdditionalSel * a_this) diff --git a/src/cr-additional-sel.h b/src/cr-additional-sel.h index 7ca3e07..6f6ee49 100644 --- a/src/cr-additional-sel.h +++ b/src/cr-additional-sel.h @@ -22,6 +22,16 @@ */ +/** + *@file + *This file holds the declaration of the + *#CRAddSel class. + */ +/** + *@file + *This file holds the declaration of the + *#CRAddSel class. + */ #ifndef __CR_ADD_SEL_H__ #define __CR_ADD_SEL_H__ @@ -48,11 +58,29 @@ union CRAdditionalSelectorContent CRString *class_name ; CRString *id_name ; CRPseudo *pseudo ; +/** + *#CRAdditionalSel abstracts + *an additionnal selector. + *An additional selector is the selector part + *that comes after the combination of type selectors. + *It can be either "a class selector (the .class part), + *a pseudo class selector, an attribute selector + *or an id selector. + */ CRAttrSel *attr_sel ; } ; typedef struct _CRAdditionalSel CRAdditionalSel ; +/** + *#CRAdditionalSel abstracts + *an additionnal selector. + *An additional selector is the selector part + *that comes after the combination of type selectors. + *It can be either "a class selector (the .class part), + *a pseudo class selector, an attribute selector + *or an id selector. + */ struct _CRAdditionalSel { enum AddSelectorType type ; @@ -85,11 +113,11 @@ void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this, CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this, CRAdditionalSel *a_sel) ; -guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ; +guchar * cr_additional_sel_to_string (CRAdditionalSel *a_this) ; -guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ; +guchar * cr_additional_sel_one_to_string (CRAdditionalSel *a_this) ; -void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ; +void cr_additional_sel_dump (CRAdditionalSel *a_this, FILE *a_fp) ; void cr_additional_sel_destroy (CRAdditionalSel *a_this) ; diff --git a/src/cr-attr-sel.c b/src/cr-attr-sel.c index 787f0c0..3c4800e 100644 --- a/src/cr-attr-sel.c +++ b/src/cr-attr-sel.c @@ -24,38 +24,34 @@ #include "cr-attr-sel.h" /** - * CRAttrSel: - * - * #CRAdditionalSel abstracts an attribute selector. - * Attributes selectors are described in the css2 spec [5.8]. - * There are more generally used in the css2 selectors described in - * css2 spec [5] . + *@file + *The class that abstracts an attribute selector. + *Attributes selectors are described in the css2 spec [5.8]. + *There are more generally used in the css2 selectors described in + *css2 spec [5] . */ /** - * cr_attr_sel_new: - * The constructor of #CRAttrSel. - * Returns the newly allocated instance - * of #CRAttrSel. + *The constructor of #CRAttrSel. + *@return the newly allocated instance + *of #CRAttrSel. */ CRAttrSel * cr_attr_sel_new (void) { - CRAttrSel *result = NULL; - - result = g_malloc0 (sizeof (CRAttrSel)); + CRAttrSel *result = (CRAttrSel *)g_malloc0 (sizeof (CRAttrSel)); return result; } /** - * cr_attr_sel_append_attr_sel: - * @a_this: the this pointer of the current instance of #CRAttrSel. - * @a_attr_sel: selector to append. + *Appends an attribute selector to the current list of + *attribute selectors represented by a_this. * - * Appends an attribute selector to the current list of - * attribute selectors represented by a_this. - * Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the this pointer of the current instance of + *#CRAttrSel. + *@param a_attr_sel selector to append. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_attr_sel_append_attr_sel (CRAttrSel * a_this, CRAttrSel * a_attr_sel) @@ -76,13 +72,13 @@ cr_attr_sel_append_attr_sel (CRAttrSel * a_this, CRAttrSel * a_attr_sel) } /** - * cr_attr_sel_prepend_attr_sel: - *@a_this: the "this pointer" of the current instance *of #CRAttrSel. - *@a_attr_sel: the attribute selector to append. - * *Prepends an attribute selector to the list of *attributes selector represented by a_this. - *Returns CR_OK upon successfull completion, an error code otherwise. + * + *@param a_this the "this pointer" of the current instance + *of #CRAttrSel. + *@param a_attr_sel the attribute selector to append. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this, @@ -97,17 +93,10 @@ cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this, return CR_OK; } -/** - * cr_attr_sel_to_string: - * @a_this: the current instance of #CRAttrSel. - * - * Serializes an attribute selector into a string - * Returns the serialized attribute selector. - */ guchar * -cr_attr_sel_to_string (CRAttrSel const * a_this) +cr_attr_sel_to_string (CRAttrSel * a_this) { - CRAttrSel const *cur = NULL; + CRAttrSel *cur = NULL; guchar *result = NULL; GString *str_buf = NULL; @@ -121,9 +110,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (cur->name) { - guchar *name = NULL; - - name = g_strndup (cur->name->stryng->str, + gchar *name = g_strndup (cur->name->stryng->str, cur->name->stryng->len); if (name) { g_string_append (str_buf, name); @@ -133,9 +120,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (cur->value) { - guchar *value = NULL; - - value = g_strndup (cur->value->stryng->str, + gchar *value = g_strndup (cur->value->stryng->str, cur->value->stryng->len); if (value) { switch (cur->match_way) { @@ -168,7 +153,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); } @@ -176,15 +161,13 @@ cr_attr_sel_to_string (CRAttrSel const * a_this) } /** - * cr_attr_sel_dump: - * @a_this: the "this pointer" of the current instance of - * #CRAttrSel. - * @a_fp: the destination file. - * - * Dumps the current instance of #CRAttrSel to a file. + *Dumps the current instance of #CRAttrSel to a file. + *@param a_this the "this pointer" of the current instance of + *#CRAttrSel. + *@param a_fp the destination file. */ void -cr_attr_sel_dump (CRAttrSel const * a_this, FILE * a_fp) +cr_attr_sel_dump (CRAttrSel * a_this, FILE * a_fp) { guchar *tmp_str = NULL; @@ -200,12 +183,10 @@ cr_attr_sel_dump (CRAttrSel const * a_this, FILE * a_fp) } /** - *cr_attr_sel_destroy: - *@a_this: the "this pointer" of the current - *instance of #CRAttrSel. - * *Destroys the current instance of #CRAttrSel. *Frees all the fields if they are non null. + *@param a_this the "this pointer" of the current + *instance of #CRAttrSel. */ void cr_attr_sel_destroy (CRAttrSel * a_this) @@ -232,4 +213,3 @@ cr_attr_sel_destroy (CRAttrSel * a_this) a_this = NULL; } } - diff --git a/src/cr-attr-sel.h b/src/cr-attr-sel.h index 82d5a87..9cc03d3 100644 --- a/src/cr-attr-sel.h +++ b/src/cr-attr-sel.h @@ -58,14 +58,14 @@ struct _CRAttrSel CRAttrSel * cr_attr_sel_new (void) ; enum CRStatus cr_attr_sel_append_attr_sel (CRAttrSel * a_this, - CRAttrSel *a_attr_sel) ; + CRAttrSel *a_new) ; enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel *a_this, CRAttrSel *a_attr_sel) ; -guchar * cr_attr_sel_to_string (CRAttrSel const *a_this) ; +guchar * cr_attr_sel_to_string (CRAttrSel *a_this) ; -void cr_attr_sel_dump (CRAttrSel const *a_this, FILE *a_fp) ; +void cr_attr_sel_dump (CRAttrSel *a_this, FILE *a_fp) ; void cr_attr_sel_destroy (CRAttrSel *a_this) ; diff --git a/src/cr-cascade.c b/src/cr-cascade.c index 4fa69bb..7fef86c 100644 --- a/src/cr-cascade.c +++ b/src/cr-cascade.c @@ -23,7 +23,7 @@ */ /* - *$Id$ + *$Id: cr-cascade.c,v 1.6 2004/03/07 13:22:47 dodji Exp $ */ #include <string.h> @@ -44,11 +44,6 @@ struct _CRCascadePriv { }; /** - * cr_cascade_new: - *@a_author_sheet: the author origin style sheet. May be NULL. - *@a_user_sheet: the user origin style sheet. May be NULL. - *@a_ua_sheet: the user agent origin style sheet. May be NULL. - * *Constructor of the #CRCascade class. *Note that all three parameters of this *method are ref counted and their refcount is increased. @@ -56,25 +51,26 @@ struct _CRCascadePriv { *the instance of #CRCascade. *So the caller should not call their destructor. The caller *should call their ref/unref method instead if it wants - * - *Returns the newly built instance of CRCascade or NULL if + *@param a_author_sheet the autor origin style sheet + *@param a_user_sheet the user origin style sheet. + *@param a_ua_sheet the user agent origin style sheet. + *@return the newly built instance of CRCascade or NULL if *an error arose during constrution. */ CRCascade * cr_cascade_new (CRStyleSheet * a_author_sheet, CRStyleSheet * a_user_sheet, CRStyleSheet * a_ua_sheet) { - CRCascade *result = NULL; - - result = g_try_malloc (sizeof (CRCascade)); + CRCascade *result = (CRCascade *)g_try_malloc (sizeof (CRCascade)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (result, 0, sizeof (CRCascade)); - PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv)); + PRIVATE (result) = (CRCascadePriv *)g_try_malloc (sizeof (CRCascadePriv)); if (!PRIVATE (result)) { + g_free(result); cr_utils_trace_info ("Out of memory"); return NULL; } @@ -94,40 +90,33 @@ cr_cascade_new (CRStyleSheet * a_author_sheet, } /** - * cr_cascade_get_sheet: - *@a_this: the current instance of #CRCascade. - *@a_origin: the origin of the style sheet as - *defined in the css2 spec in chapter 6.4. *Gets a given origin sheet. - * - *Gets a sheet, part of the cascade. *Note that the returned stylesheet *is refcounted so if the caller wants - *to manage it's lifecycle, it must use + *to manage its lifecycle, it must use *cr_stylesheet_ref()/cr_stylesheet_unref() instead *of the cr_stylesheet_destroy() method. - *Returns the style sheet, or NULL if it does not + *@param a_this the current instance of #CRCascade. + *@param a_origin the origin of the style sheet as + *defined in the css2 spec in chapter 6.4. + *@return the style sheet, or NULL if it does not *exist. */ CRStyleSheet * cr_cascade_get_sheet (CRCascade * a_this, enum CRStyleOrigin a_origin) { g_return_val_if_fail (a_this - && a_origin >= ORIGIN_UA - && a_origin < NB_ORIGINS, NULL); + && (unsigned)a_origin < NB_ORIGINS, NULL); return PRIVATE (a_this)->sheets[a_origin]; } /** - * cr_cascade_set_sheet: - *@a_this: the current instance of #CRCascade. - *@a_sheet: the stylesheet to set. - *@a_origin: the origin of the stylesheet. - * *Sets a stylesheet in the cascade - * - *Returns CR_OK upon successfull completion, an error + *@param a_this the current instance of #CRCascade. + *@param a_sheet the stylesheet to set. + *@param a_origin the origin of the stylesheet. + *@return CR_OK upon successfull completion, an error *code otherwise. */ enum CRStatus @@ -136,8 +125,7 @@ cr_cascade_set_sheet (CRCascade * a_this, { g_return_val_if_fail (a_this && a_sheet - && a_origin >= ORIGIN_UA - && a_origin < NB_ORIGINS, CR_BAD_PARAM_ERROR); + && (unsigned)a_origin < NB_ORIGINS, CR_BAD_PARAM_ERROR); if (PRIVATE (a_this)->sheets[a_origin]) cr_stylesheet_unref (PRIVATE (a_this)->sheets[a_origin]); @@ -148,11 +136,10 @@ cr_cascade_set_sheet (CRCascade * a_this, } /** - *cr_cascade_ref: - *@a_this: the current instance of #CRCascade - * *Increases the reference counter of the current instance *of #CRCascade. + *@param a_this the current instance of #CRCascade + * */ void cr_cascade_ref (CRCascade * a_this) @@ -163,14 +150,12 @@ cr_cascade_ref (CRCascade * a_this) } /** - * cr_cascade_unref: - *@a_this: the current instance of - *#CRCascade. - * *Decrements the reference counter associated *to this instance of #CRCascade. If the reference *counter reaches zero, the instance is destroyed *using cr_cascade_destroy() + *@param a_this the current instance of + *#CRCascade. */ void cr_cascade_unref (CRCascade * a_this) @@ -185,10 +170,7 @@ cr_cascade_unref (CRCascade * a_this) } /** - * cr_cascade_destroy: - * @a_this: the current instance of #CRCascade - * - * Destructor of #CRCascade. + *Destructor of #CRCascade. */ void cr_cascade_destroy (CRCascade * a_this) diff --git a/src/cr-cascade.h b/src/cr-cascade.h index 3119ae8..5e71842 100644 --- a/src/cr-cascade.h +++ b/src/cr-cascade.h @@ -22,7 +22,7 @@ */ /* - *$Id$ + *$Id: cr-cascade.h,v 1.6 2004/01/29 22:05:14 dodji Exp $ */ #ifndef __CR_CASCADE_H__ diff --git a/src/cr-declaration.c b/src/cr-declaration.c index 8079aa0..530085b 100644 --- a/src/cr-declaration.c +++ b/src/cr-declaration.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -28,27 +28,22 @@ #include "cr-parser.h" /** - *@CRDeclaration: - * + *@file *The definition of the #CRDeclaration class. */ /** - * dump: - *@a_this: the current instance of #CRDeclaration. - *@a_fp: the destination file pointer. - *@a_indent: the number of indentation white char. - * *Dumps (serializes) one css declaration to a file. + *@param a_this the current instance of #CRDeclaration. + *@param a_fp the destination file pointer. + *@param a_indent the number of indentation white char. */ static void -dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent) +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); @@ -57,25 +52,16 @@ dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent) } /** - * cr_declaration_new: - * @a_statement: the statement this declaration belongs to. can be NULL. - *@a_property: the property string of the declaration - *@a_value: the value expression of the declaration. *Constructor of #CRDeclaration. - * - *Returns the newly built instance of #CRDeclaration, or NULL in + *@param a_property the property string of the declaration + *@param a_value the value expression of the declaration. + *@return the newly built instance of #CRDeclaration, or NULL in *case of error. - * - *The returned CRDeclaration takes ownership of @a_property and @a_value. - *(E.g. cr_declaration_destroy on this CRDeclaration will also free - *@a_property and @a_value.) */ 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) @@ -86,7 +72,7 @@ cr_declaration_new (CRStatement * 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; @@ -103,16 +89,15 @@ cr_declaration_new (CRStatement * a_statement, } /** - * cr_declaration_parse_from_buf: - *@a_statement: the parent css2 statement of this - *this declaration. Must be non NULL and of type - *RULESET_STMT (must be a ruleset). - *@a_str: the string that contains the statement. - *@a_enc: the encoding of a_str. - * *Parses a text buffer that contains *a css declaration. - *Returns the parsed declaration, or NULL in case of error. + * + *@param a_statement the parent css2 statement of this + *this declaration. Must be non NULL and of type + *RULESET_STMT (must be a ruleset). + *@param a_str the string that contains the statement. + *@param a_enc the encoding of a_str. + *@return the parsed declaration, or NULL in case of error. */ CRDeclaration * cr_declaration_parse_from_buf (CRStatement * a_statement, @@ -122,7 +107,6 @@ 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); @@ -130,7 +114,9 @@ cr_declaration_parse_from_buf (CRStatement * a_statement, 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); @@ -170,13 +156,11 @@ cr_declaration_parse_from_buf (CRStatement * a_statement, } /** - * cr_declaration_parse_list_from_buf: - *@a_str: the input buffer that contains the list of declaration to - *parse. - *@a_enc: the encoding of a_str - * *Parses a ';' separated list of properties declaration. - *Returns the parsed list of declaration, NULL if parsing failed. + *@param a_str the input buffer that contains the list of declaration to + *parse. + *@param a_enc the encoding of a_str + *@return the parsed list of declaration, NULL if parsing failed. */ CRDeclaration * cr_declaration_parse_list_from_buf (const guchar * a_str, @@ -188,13 +172,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); - 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) { @@ -226,14 +210,15 @@ 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; } 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); @@ -241,9 +226,11 @@ cr_declaration_parse_list_from_buf (const guchar * a_str, &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) { @@ -282,12 +269,10 @@ cr_declaration_parse_list_from_buf (const guchar * a_str, } /** - * cr_declaration_append: - *@a_this: the current declaration list. - *@a_new: the declaration to append. - * *Appends a new declaration to the current declarations list. - *Returns the declaration list with a_new appended to it, or NULL + *@param a_this the current declaration list. + *@param a_new the declaration to append. + *@return the declaration list with a_new appended to it, or NULL *in case of error. */ CRDeclaration * @@ -309,13 +294,10 @@ cr_declaration_append (CRDeclaration * a_this, CRDeclaration * a_new) } /** - * cr_declaration_unlink: - *@a_decls: the declaration to unlink. - * *Unlinks the declaration from the declaration list. + *@param a_decl the declaration to unlink. + *@return a pointer to the unlinked declaration in *case of a successfull completion, NULL otherwise. - * - *Returns a pointer to the unlinked declaration in */ CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) @@ -387,13 +369,10 @@ cr_declaration_unlink (CRDeclaration * a_decl) } /** - * cr_declaration_prepend: - * @a_this: the current declaration list. - * @a_new: the declaration to prepend. - * - * prepends a declaration to the current declaration list. - * - * Returns the list with a_new prepended or NULL in case of error. + *prepends a declaration to the current declaration list. + *@param a_this the current declaration list. + *@param a_new the declaration to prepend. + *@return the list with a_new prepended or NULL in case of error. */ CRDeclaration * cr_declaration_prepend (CRDeclaration * a_this, CRDeclaration * a_new) @@ -414,13 +393,11 @@ cr_declaration_prepend (CRDeclaration * a_this, CRDeclaration * a_new) } /** - * cr_declaration_append2: - *@a_this: the current declaration list. - *@a_prop: the property string of the declaration to append. - *@a_value: the value of the declaration to append. - * *Appends a declaration to the current declaration list. - *Returns the list with the new property appended to it, or NULL in + *@param a_this the current declaration list. + *@param a_prop the property string of the declaration to append. + *@param a_value the value of the declaration to append. + *@return the list with the new property appended to it, or NULL in *case of an error. */ CRDeclaration * @@ -442,20 +419,16 @@ cr_declaration_append2 (CRDeclaration * a_this, } /** - * cr_declaration_dump: - *@a_this: the current instance of #CRDeclaration. - *@a_fp: the destination file. - *@a_indent: the number of indentation white char. - *@a_one_per_line: whether to put one declaration per line of not . - * - * *Dumps a declaration list to a file. + *@param a_this the current instance of #CRDeclaration. + *@param a_fp the destination file. + *@param a_indent the number of indentation white char. */ void -cr_declaration_dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent, +cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent, gboolean a_one_per_line) { - CRDeclaration const *cur = NULL; + CRDeclaration *cur = NULL; g_return_if_fail (a_this); @@ -471,15 +444,13 @@ cr_declaration_dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent, } /** - * cr_declaration_dump_one: - *@a_this: the current instance of #CRDeclaration. - *@a_fp: the destination file. - *@a_indent: the number of indentation white char. - * *Dumps the first declaration of the declaration list to a file. + *@param a_this the current instance of #CRDeclaration. + *@param a_fp the destination file. + *@param a_indent the number of indentation white char. */ void -cr_declaration_dump_one (CRDeclaration const * a_this, FILE * a_fp, glong a_indent) +cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent) { g_return_if_fail (a_this); @@ -487,21 +458,17 @@ cr_declaration_dump_one (CRDeclaration const * a_this, FILE * a_fp, glong a_inde } /** - * cr_declaration_to_string: - *@a_this: the current instance of #CRDeclaration. - *@a_indent: the number of indentation white char - *to put before the actual serialisation. - * *Serializes the declaration into a string - *Returns the serialized form the declaration. The caller must - *free the string using g_free(). + *@param a_this the current instance of #CRDeclaration. + *@param a_indent the number of indentation white char + *to put before the actual serialisation. */ gchar * -cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent) +cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent) { GString *stringue = NULL; - guchar *str = NULL, + gchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -558,19 +525,17 @@ cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent) } /** - * cr_declaration_list_to_string: - *@a_this: the current instance of #CRDeclaration. - *@a_indent: the number of indentation white char - *to put before the actual serialisation. - * *Serializes the declaration list into a string + *@param a_this the current instance of #CRDeclaration. + *@param a_indent the number of indentation white char + *to put before the actual serialisation. */ guchar * -cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent) +cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent) { - CRDeclaration const *cur = NULL; + CRDeclaration *cur = NULL; GString *stringue = NULL; - guchar *str = NULL, + gchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -590,26 +555,22 @@ cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent) g_string_free (stringue, FALSE); } - return result; + return (guchar *)result; } /** - * cr_declaration_list_to_string2: - *@a_this: the current instance of #CRDeclaration. - *@a_indent: the number of indentation white char - *@a_one_decl_per_line: whether to output one doc per line or not. - *to put before the actual serialisation. - * *Serializes the declaration list into a string - *Returns the serialized form the declararation. + *@param a_this the current instance of #CRDeclaration. + *@param a_indent the number of indentation white char + *to put before the actual serialisation. */ guchar * -cr_declaration_list_to_string2 (CRDeclaration const * a_this, +cr_declaration_list_to_string2 (CRDeclaration * a_this, gulong a_indent, gboolean a_one_decl_per_line) { - CRDeclaration const *cur = NULL; + CRDeclaration *cur = NULL; GString *stringue = NULL; - guchar *str = NULL, + gchar *str = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); @@ -643,18 +604,18 @@ cr_declaration_list_to_string2 (CRDeclaration const * a_this, g_string_free (stringue, FALSE); } - return result; + return (guchar *)result; } /** - * cr_declaration_nr_props: - *@a_this: the current instance of #CRDeclaration. - *Return the number of properties in the declaration + *Return the number of properties in the declaration; + *@param a_this the current instance of #CRDeclaration. + *@return number of properties in the declaration list. */ gint -cr_declaration_nr_props (CRDeclaration const * a_this) +cr_declaration_nr_props (CRDeclaration * a_this) { - CRDeclaration const *cur = NULL; + CRDeclaration *cur = NULL; int nr = 0; g_return_val_if_fail (a_this, -1); @@ -665,14 +626,10 @@ cr_declaration_nr_props (CRDeclaration const * a_this) } /** - * cr_declaration_get_from_list: - *@a_this: the current instance of #CRDeclaration. - *@itemnr: the index into the declaration list. - * *Use an index to get a CRDeclaration from the declaration list. - * - *Returns #CRDeclaration at position itemnr, - *if itemnr > number of declarations - 1, + *@param a_this the current instance of #CRDeclaration. + *@param itemnr the index into the declaration list. + *@return CRDeclaration at position itemnr, if itemnr > number of declarations - 1, *it will return NULL. */ CRDeclaration * @@ -690,12 +647,10 @@ cr_declaration_get_from_list (CRDeclaration * a_this, int itemnr) } /** - * cr_declaration_get_by_prop_name: - *@a_this: the current instance of #CRDeclaration. - *@a_prop: the property name to search for. - * *Use property name to get a CRDeclaration from the declaration list. - *Returns #CRDeclaration with property name a_prop, or NULL if not found. + *@param a_this the current instance of #CRDeclaration. + *@param a_prop the property name to search for. + *@return CRDeclaration with property name a_prop, or NULL if not found. */ CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration * a_this, @@ -711,7 +666,7 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this, && cur->property->stryng && cur->property->stryng->str) { if (!strcmp (cur->property->stryng->str, - a_prop)) { + (char *)a_prop)) { return cur; } } @@ -720,10 +675,8 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this, } /** - * cr_declaration_ref: - *@a_this: the current instance of #CRDeclaration. - * *Increases the ref count of the current instance of #CRDeclaration. + *@param a_this the current instance of #CRDeclaration. */ void cr_declaration_ref (CRDeclaration * a_this) @@ -734,14 +687,12 @@ cr_declaration_ref (CRDeclaration * a_this) } /** - * cr_declaration_unref: - *@a_this: the current instance of #CRDeclaration. - * *Decrements the ref count of the current instance of #CRDeclaration. *If the ref count reaches zero, the current instance of #CRDeclaration *if destroyed. - *Returns TRUE if @a_this was destroyed (ref count reached zero), - *FALSE otherwise. + *@param a_this the current instance of #CRDeclaration. + *@return TRUE if the current instance of #CRDeclaration has been destroyed + *(ref count reached zero), FALSE otherwise. */ gboolean cr_declaration_unref (CRDeclaration * a_this) @@ -760,10 +711,8 @@ cr_declaration_unref (CRDeclaration * a_this) } /** - * cr_declaration_destroy: - *@a_this: the current instance of #CRDeclaration. - * *Destructor of the declaration list. + *@param a_this the current instance of #CRDeclaration. */ void cr_declaration_destroy (CRDeclaration * a_this) @@ -773,19 +722,22 @@ cr_declaration_destroy (CRDeclaration * a_this) g_return_if_fail (a_this); /* - * Go to the last element of the list. + *Go get the tail of the list. + *Meanwhile, free each property/value pair contained in the list. */ - for (cur = a_this; cur->next; cur = cur->next) - g_assert (cur->next->prev == cur); + for (cur = a_this; cur && cur->next; cur = cur->next) { + if (cur->property) { + cr_string_destroy (cur->property); + cur->property = NULL; + } - /* - * Walk backward the list and free each "next" element. - * Meanwhile, free each property/value pair contained in the list. - */ - for (; cur; cur = cur->prev) { - g_free (cur->next); - cur->next = NULL; + if (cur->value) { + cr_term_destroy (cur->value); + cur->value = NULL; + } + } + if (cur) { if (cur->property) { cr_string_destroy (cur->property); cur->property = NULL; @@ -797,5 +749,27 @@ cr_declaration_destroy (CRDeclaration * a_this) } } - g_free (a_this); + /*in case the list contains only one element */ + if (cur && !cur->prev) { + g_free (cur); + return; + } + + /*walk backward the list and free each "next" element */ + for (cur = cur->prev; cur && cur->prev; cur = cur->prev) { + if (cur->next) { + g_free (cur->next); + cur->next = NULL; + } + } + + if (!cur) + return; + + if (cur->next) { + g_free (cur->next); + cur->next = NULL; + } + + g_free (cur); } diff --git a/src/cr-declaration.h b/src/cr-declaration.h index eee8be3..0052395 100644 --- a/src/cr-declaration.h +++ b/src/cr-declaration.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -100,14 +100,14 @@ CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this, CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ; void -cr_declaration_dump (CRDeclaration const *a_this, +cr_declaration_dump (CRDeclaration *a_this, FILE *a_fp, glong a_indent, gboolean a_one_per_line) ; -void cr_declaration_dump_one (CRDeclaration const *a_this, +void cr_declaration_dump_one (CRDeclaration *a_this, FILE *a_fp, glong a_indent) ; -gint cr_declaration_nr_props (CRDeclaration const *a_this) ; +gint cr_declaration_nr_props (CRDeclaration *a_this) ; CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this, int itemnr) ; @@ -115,13 +115,13 @@ CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this, CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_str) ; -gchar * cr_declaration_to_string (CRDeclaration const *a_this, +gchar * cr_declaration_to_string (CRDeclaration *a_this, gulong a_indent) ; -guchar * cr_declaration_list_to_string (CRDeclaration const *a_this, +guchar * cr_declaration_list_to_string (CRDeclaration *a_this, gulong a_indent) ; -guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this, +guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this, gulong a_indent, gboolean a_one_decl_per_line) ; diff --git a/src/cr-doc-handler.c b/src/cr-doc-handler.c index bbb1582..00357c0 100644 --- a/src/cr-doc-handler.c +++ b/src/cr-doc-handler.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -25,8 +25,7 @@ #include "cr-parser.h" /** - *@CRDocHandler: - * + *@file *The definition of the CRDocHandler class. *Contains methods to instantiate, destroy, *and initialyze instances of #CRDocHandler @@ -59,26 +58,20 @@ struct _CRDocHandlerPriv { }; /** - * cr_doc_handler_new: *Constructor of #CRDocHandler. - * - *Returns the newly built instance of + *@return the newly built instance of *#CRDocHandler - * */ CRDocHandler * cr_doc_handler_new (void) { - CRDocHandler *result = NULL; - - result = g_try_malloc (sizeof (CRDocHandler)); + CRDocHandler *result = ( CRDocHandler *)g_try_malloc (sizeof (CRDocHandler)); g_return_val_if_fail (result, NULL); memset (result, 0, sizeof (CRDocHandler)); - result->ref_count++; - result->priv = g_try_malloc (sizeof (CRDocHandlerPriv)); + result->priv = (CRDocHandlerPriv *)g_try_malloc (sizeof (CRDocHandlerPriv)); if (!result->priv) { cr_utils_trace_info ("Out of memory exception"); g_free (result); @@ -91,17 +84,15 @@ cr_doc_handler_new (void) } /** - * cr_doc_handler_get_ctxt: - *@a_this: the current instance of #CRDocHandler. - *@a_ctxt: out parameter. The new parsing context. - * - *Gets the private parsing context associated to the document handler + *Returns the private parsing context. *The private parsing context is used by libcroco only. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRDocHandler. + *@param a_ctxt out parameter. The new parsing context. + *@return CR_OK upon successfull completion, an error code otherwise. + *@return the parsing context, or NULL if an error occured. */ enum CRStatus -cr_doc_handler_get_ctxt (CRDocHandler const * a_this, gpointer * a_ctxt) +cr_doc_handler_get_ctxt (CRDocHandler * a_this, gpointer * a_ctxt) { g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR); @@ -111,13 +102,11 @@ cr_doc_handler_get_ctxt (CRDocHandler const * a_this, gpointer * a_ctxt) } /** - * cr_doc_handler_set_ctxt: - *@a_this: the current instance of #CRDocHandler - *@a_ctxt: a pointer to the parsing context. - * *Sets the private parsing context. *This is used by libcroco only. - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRDocHandler + *@param a_ctxt a pointer to the parsing context. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_doc_handler_set_ctxt (CRDocHandler * a_this, gpointer a_ctxt) @@ -128,17 +117,14 @@ cr_doc_handler_set_ctxt (CRDocHandler * a_this, gpointer a_ctxt) } /** - * cr_doc_handler_get_result: - *@a_this: the current instance of #CRDocHandler - *@a_result: out parameter. The returned result. - * - *Gets the private parsing result. + *Returns the private parsing result. *The private parsing result is used by libcroco only. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRDocHandler + *@param a_result out parameter. The returned result. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus -cr_doc_handler_get_result (CRDocHandler const * a_this, gpointer * a_result) +cr_doc_handler_get_result (CRDocHandler * a_this, gpointer * a_result) { g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR); @@ -148,14 +134,11 @@ cr_doc_handler_get_result (CRDocHandler const * a_this, gpointer * a_result) } /** - * cr_doc_handler_set_result: - *@a_this: the current instance of #CRDocHandler - *@a_result: the new result. - * *Sets the private parsing context. *This is used by libcroco only. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRDocHandler + *@param a_result the new result. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_doc_handler_set_result (CRDocHandler * a_this, gpointer a_result) @@ -166,16 +149,14 @@ cr_doc_handler_set_result (CRDocHandler * a_this, gpointer a_result) } /** - *cr_doc_handler_set_default_sac_handler: - *@a_this: a pointer to the current instance of #CRDocHandler. - * *Sets the sac handlers contained in the current *instance of DocHandler to the default handlers. *For the time being the default handlers are *test handlers. This is expected to change in a *near future, when the libcroco gets a bit debugged. * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this a pointer to the current instance of #CRDocHandler. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler * a_this) @@ -203,8 +184,8 @@ cr_doc_handler_set_default_sac_handler (CRDocHandler * a_this) } /** - * cr_doc_handler_ref: - *@a_this: the current instance of #CRDocHandler. + *Increases the reference count of the doc handler + *@param a_this the current instance of #CRDocHandler. */ void cr_doc_handler_ref (CRDocHandler * a_this) @@ -215,13 +196,10 @@ cr_doc_handler_ref (CRDocHandler * a_this) } /** - * cr_doc_handler_unref: - *@a_this: the currrent instance of #CRDocHandler. - * *Decreases the ref count of the current instance of #CRDocHandler. *If the ref count reaches '0' then, destroys the instance. - * - *Returns TRUE if the instance as been destroyed, FALSE otherwise. + *@param a_this the currrent instance of #CRDocHandler. + *@return TRUE if the instance as been destroyed, FALSE otherwise. */ gboolean cr_doc_handler_unref (CRDocHandler * a_this) @@ -240,11 +218,9 @@ cr_doc_handler_unref (CRDocHandler * a_this) } /** - * cr_doc_handler_destroy: - *@a_this: the instance of #CRDocHandler to - *destroy. - * *The destructor of the #CRDocHandler class. + *@param a_this the instance of #CRDocHandler to + *destroy. */ void cr_doc_handler_destroy (CRDocHandler * a_this) @@ -259,11 +235,9 @@ cr_doc_handler_destroy (CRDocHandler * a_this) } /** - * cr_doc_handler_associate_a_parser: *Associates a parser to the current document handler - * - *@a_this: the current instance of document handler. - *@a_parser: the parser to associate. + *@param a_this the current instance of document handler. + *@param a_parser the parser to associate. */ void cr_doc_handler_associate_a_parser (CRDocHandler *a_this, @@ -272,5 +246,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 = a_parser ; + PRIVATE (a_this)->parser = (CRParser *)a_parser ; } diff --git a/src/cr-doc-handler.h b/src/cr-doc-handler.h index d12673f..704f186 100644 --- a/src/cr-doc-handler.h +++ b/src/cr-doc-handler.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -92,7 +92,7 @@ struct _CRDocHandler *destination media for style information. *@param a_uri the uri of the imported style sheet. *@param a_uri_default_ns the default namespace of URI - *@param a_location the parsing location of the '\@import' + *@param a_location the parsing location of the '@import' *keyword. *of the imported style sheet. */ @@ -175,7 +175,7 @@ struct _CRDocHandler * *@param a_this a pointer to the current instance of *#CRDocHandler. - *@param a_location the parsing location of the "\@font-face" + *@param a_location the parsing location of the "@font-face" *keyword. */ void (*start_font_face) (CRDocHandler *a_this, @@ -227,7 +227,7 @@ struct _CRDocHandler *#CRDocHandler. *@param a_name the name of the page (if any, null otherwise). *@param a_pseudo_page the pseudo page (if any, null otherwise). - *@param a_location the parsing location of the "\@page" keyword. + *@param a_location the parsing location of the "@page" keyword. */ void (*start_page) (CRDocHandler *a_this, CRString *a_name, @@ -239,7 +239,7 @@ struct _CRDocHandler *@param a_this a pointer to the current instance of *#CRDocHandler. *@param a_name the name of the page (if any, null otherwise). - *@param a_pseudo_page the pseudo page (if any, null otherwise). + *@parap a_pseudo_page the pseudo page (if any, null otherwise). */ void (*end_page) (CRDocHandler *a_this, CRString *a_name, @@ -276,11 +276,11 @@ CRDocHandler * cr_doc_handler_new (void) ; enum CRStatus cr_doc_handler_set_result (CRDocHandler *a_this, gpointer a_result) ; -enum CRStatus cr_doc_handler_get_result (CRDocHandler const *a_this, gpointer * a_result) ; +enum CRStatus cr_doc_handler_get_result (CRDocHandler *a_this, gpointer * a_result) ; enum CRStatus cr_doc_handler_set_ctxt (CRDocHandler *a_this, gpointer a_ctxt) ; -enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler const *a_this, gpointer * a_ctxt) ; +enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler *a_this, gpointer * a_ctxt) ; enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler *a_this) ; diff --git a/src/cr-enc-handler.c b/src/cr-enc-handler.c index b3e5b7e..973a5f3 100644 --- a/src/cr-enc-handler.c +++ b/src/cr-enc-handler.c @@ -21,7 +21,7 @@ */ /* - *$Id$ + *$Id: cr-enc-handler.c,v 1.7 2004/03/07 13:22:47 dodji Exp $ */ /** @@ -57,7 +57,7 @@ static struct CREncAlias gv_default_aliases[] = { {"UCS-4", CR_UCS_4}, {"UCS_4", CR_UCS_4}, {"ASCII", CR_ASCII}, - {0, 0} + {(char *)0, (enum CREncoding)0} }; static CREncHandler gv_default_enc_handlers[] = { @@ -70,17 +70,14 @@ 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}, - {0, NULL, NULL, NULL, NULL} + {(enum CREncoding)0, NULL, NULL, NULL, NULL} }; /** - * cr_enc_handler_get_instance: - *@a_enc: the encoding of the Handler. - * *Gets the instance of encoding handler. *This function implements a singleton pattern. - * - *Returns the instance of #CREncHandler. + *@param a_enc the encoding of the Handler. + *@return the instance of #CREncHandler. */ CREncHandler * cr_enc_handler_get_instance (enum CREncoding a_enc) @@ -98,27 +95,23 @@ cr_enc_handler_get_instance (enum CREncoding a_enc) } /** - * cr_enc_handler_resolve_enc_alias: - *@a_alias_name: the encoding name. - *@a_enc: output param. The returned encoding type - *or 0 if the alias is not supported. - * *Given an encoding name (called an alias name) *the function returns the matching encoding type. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_alias_name the encoding name + *@param a_enc output param. The returned encoding type + *or 0 if the alias is not supported. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus 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); - alias_name_up = g_strdup (a_alias_name); + gchar *alias_name_up = g_strdup ((gchar *)a_alias_name); g_ascii_strup (alias_name_up, -1); for (i = 0; gv_default_aliases[i].name; i++) { @@ -133,19 +126,16 @@ cr_enc_handler_resolve_enc_alias (const guchar * a_alias_name, } /** - * cr_enc_handler_convert_input: - *@a_this: the current instance of #CREncHandler. - *@a_in: the input buffer to convert. - *@a_in_len: in/out parameter. The len of the input + *Converts a raw input buffer into an utf8 buffer. + *@param a_this the current instance of #CREncHandler. + *@param a_in the input buffer to convert. + *@param a_in_len in/out parameter. The len of the input *buffer to convert. After return, contains the number of *bytes actually consumed. - *@a_out: output parameter. The converted output buffer. + *@param @a_out output parameter. The converted output buffer. *Must be freed by the buffer. - *@a_out_len: output parameter. The length of the output buffer. - * - *Converts a raw input buffer into an utf8 buffer. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_out_len output parameter. The length of the output buffer. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_enc_handler_convert_input (CREncHandler * a_this, @@ -171,7 +161,7 @@ cr_enc_handler_convert_input (CREncHandler * a_this, *a_out_len = *a_in_len; } - *a_out = g_malloc0 (*a_out_len); + *a_out = (guchar *)g_malloc0 (*a_out_len); status = a_this->decode_input (a_in, a_in_len, *a_out, a_out_len); diff --git a/src/cr-enc-handler.h b/src/cr-enc-handler.h index 0727764..2f5da69 100644 --- a/src/cr-enc-handler.h +++ b/src/cr-enc-handler.h @@ -21,7 +21,7 @@ */ /* - *$Id$ + *$Id: cr-enc-handler.h,v 1.5 2004/01/24 19:24:01 dodji Exp $ */ /** @@ -79,8 +79,10 @@ CREncHandler * cr_enc_handler_get_instance (enum CREncoding a_enc) ; enum CRStatus -cr_enc_handler_resolve_enc_alias (const guchar *a_alias_name, +cr_enc_handler_resolve_enc_alias (const guchar *a_en_alias, enum CREncoding *a_enc) ; +void +cr_enc_handler_destroy (CREncHandler * a_enc_hdlr) ; enum CRStatus cr_enc_handler_convert_input (CREncHandler *a_this, diff --git a/src/cr-fonts.c b/src/cr-fonts.c index 6ef347e..14438c3 100644 --- a/src/cr-fonts.c +++ b/src/cr-fonts.c @@ -27,10 +27,10 @@ #include <string.h> static enum CRStatus -cr_font_family_to_string_real (CRFontFamily const * a_this, +cr_font_family_to_string_real (CRFontFamily * a_this, gboolean a_walk_list, GString ** a_string) { - guchar const *name = NULL; + gchar *name = NULL; enum CRStatus result = CR_OK; if (!*a_string) { @@ -46,31 +46,31 @@ cr_font_family_to_string_real (CRFontFamily const * a_this, switch (a_this->type) { case FONT_FAMILY_SANS_SERIF: - name = (guchar const *) "sans-serif"; + name = (gchar *) "sans-serif"; break; case FONT_FAMILY_SERIF: - name = (guchar const *) "sans-serif"; + name = (gchar *) "sans-serif"; break; case FONT_FAMILY_CURSIVE: - name = (guchar const *) "cursive"; + name = (gchar *) "cursive"; break; case FONT_FAMILY_FANTASY: - name = (guchar const *) "fantasy"; + name = (gchar *) "fantasy"; break; case FONT_FAMILY_MONOSPACE: - name = (guchar const *) "monospace"; + name = (gchar *) "monospace"; break; case FONT_FAMILY_NON_GENERIC: - name = (guchar const *) a_this->name; + name = (gchar *) a_this->name; break; default: - name = NULL; + name = (gchar *) NULL; break; } @@ -92,32 +92,32 @@ static const gchar * cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize a_code) { - gchar const *str = NULL; + gchar *str = NULL; switch (a_code) { case FONT_SIZE_XX_SMALL: - str = "xx-small"; + str = (gchar *) "xx-small"; break; case FONT_SIZE_X_SMALL: - str = "x-small"; + str = (gchar *) "x-small"; break; case FONT_SIZE_SMALL: - str = "small"; + str = (gchar *) "small"; break; case FONT_SIZE_MEDIUM: - str = "medium"; + str = (gchar *) "medium"; break; case FONT_SIZE_LARGE: - str = "large"; + str = (gchar *) "large"; break; case FONT_SIZE_X_LARGE: - str = "x-large"; + str = (gchar *) "x-large"; break; case FONT_SIZE_XX_LARGE: - str = "xx-large"; + str = (gchar *) "xx-large"; break; default: - str = "unknown absolute font size value"; + str = (gchar *) "unknown absolute font size value"; } return str; } @@ -125,37 +125,26 @@ cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize static const gchar * cr_relative_font_size_to_string (enum CRRelativeFontSize a_code) { - gchar const *str = NULL; + gchar *str = NULL; switch (a_code) { case FONT_SIZE_LARGER: - str = "larger"; + str = (gchar *) "larger"; break; case FONT_SIZE_SMALLER: - str = "smaller"; + str = (gchar *) "smaller"; break; default: - str = "unknown relative font size value"; + str = (gchar *) "unknown relative font size value"; break; } return str; } -/** - * cr_font_family_new: - * @a_type: the type of font family to create. - * @a_name: the name of the font family. - * - * create a font family. - * - * Returns the newly built font family. - */ CRFontFamily * cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name) { - CRFontFamily *result = NULL; - - result = g_try_malloc (sizeof (CRFontFamily)); + CRFontFamily *result = (CRFontFamily *)g_try_malloc (sizeof (CRFontFamily)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -170,26 +159,18 @@ cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name) return result; } -/** - * cr_font_family_to_string: - * @a_this: the current instance of #CRFontFamily. - * @a_walk_font_family_list: wether the serialize the entire list. - * - * Returns the seriliazed font family. The caller has to free it using - * g_free(). - */ guchar * -cr_font_family_to_string (CRFontFamily const * a_this, +cr_font_family_to_string (CRFontFamily * a_this, gboolean a_walk_font_family_list) { enum CRStatus status = CR_OK; - guchar *result = NULL; + gchar *result = NULL; GString *stringue = NULL; if (!a_this) { result = g_strdup ("NULL"); g_return_val_if_fail (result, NULL); - return result; + return (guchar *)result; } status = cr_font_family_to_string_real (a_this, a_walk_font_family_list, @@ -207,16 +188,8 @@ cr_font_family_to_string (CRFontFamily const * a_this, } } - return result; + return (guchar *)result; } - -/** - * cr_font_family_set_name: - * @a_this: the current instance of #CRFontFamily. - * @a_name: the new name - * - * Returns CR_OK upon sucessful completion, an error code otherwise. - */ enum CRStatus cr_font_family_set_name (CRFontFamily * a_this, guchar * a_name) { @@ -239,13 +212,6 @@ cr_font_family_set_name (CRFontFamily * a_this, guchar * a_name) return CR_OK; } -/** - * cr_font_family_append: - * @a_this: the current instance of #CRFontFamily. - * @a_family_to_append: the font family to append to the list - * - * Returns the new font family list. - */ CRFontFamily * cr_font_family_append (CRFontFamily * a_this, CRFontFamily * a_family_to_append) @@ -266,13 +232,6 @@ cr_font_family_append (CRFontFamily * a_this, } -/** - * cr_font_family_prepend: - * @a_this: the current instance #CRFontFamily. - * @a_family_to_prepend: the font family to prepend to the list. - * - * Returns the font family list. - */ CRFontFamily * cr_font_family_prepend (CRFontFamily * a_this, CRFontFamily * a_family_to_prepend) @@ -288,12 +247,6 @@ cr_font_family_prepend (CRFontFamily * a_this, return a_family_to_prepend; } -/** - * cr_font_family_destroy: - * @a_this: the current instance of #CRFontFamily. - * - * Returns CR_OK upon sucessful completion, an error code otherwise. - */ enum CRStatus cr_font_family_destroy (CRFontFamily * a_this) { @@ -326,17 +279,10 @@ cr_font_family_destroy (CRFontFamily * a_this) *'font-size' manipulation functions definitions ***************************************************/ -/** - * cr_font_size_new: - * - * Returns the newly created font size. - */ CRFontSize * cr_font_size_new (void) { - CRFontSize *result = NULL; - - result = g_try_malloc (sizeof (CRFontSize)); + CRFontSize *result = (CRFontSize *)g_try_malloc (sizeof (CRFontSize)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -346,12 +292,6 @@ cr_font_size_new (void) return result; } -/** - * cr_font_size_clear: - * @a_this: the current instance of #CRFontSize - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus cr_font_size_clear (CRFontSize * a_this) { @@ -375,15 +315,8 @@ cr_font_size_clear (CRFontSize * a_this) return CR_OK; } -/** - * cr_font_size_copy: - * @a_dst: the destination #CRFontSize (where to copy to). - * @a_src: the source #CRFontSize (where to copy from). - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus -cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src) +cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src) { g_return_val_if_fail (a_dst && a_src, CR_BAD_PARAM_ERROR); @@ -408,20 +341,12 @@ cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src) return CR_OK; } -/** - * cr_font_size_set_predefined_absolute_font_size: - * @a_this: the current instance of #CRFontSize. - * @a_predefined: what to set. - * - * Returns CR_OK upon sucessful completion, an error code otherwise. - */ enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, enum CRPredefinedAbsoluteFontSize a_predefined) { g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - g_return_val_if_fail (a_predefined >= PREDEFINED_ABSOLUTE_FONT_SIZE - && a_predefined < NB_FONT_SIZE_TYPE, + g_return_val_if_fail ((unsigned)a_predefined < NB_FONT_SIZE_TYPE, CR_BAD_PARAM_ERROR) ; a_this->type = PREDEFINED_ABSOLUTE_FONT_SIZE ; @@ -430,20 +355,12 @@ cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, return CR_OK ; } -/** - * cr_font_size_set_relative_font_size: - * @a_this: the current instance of #CRFontSize - * @a_relative: the new relative font size - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this, enum CRRelativeFontSize a_relative) { g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - g_return_val_if_fail (a_relative >= FONT_SIZE_LARGER - && a_relative < NB_RELATIVE_FONT_SIZE, + g_return_val_if_fail ((unsigned)a_relative < NB_RELATIVE_FONT_SIZE, CR_BAD_PARAM_ERROR) ; a_this->type = RELATIVE_FONT_SIZE ; @@ -451,22 +368,13 @@ cr_font_size_set_relative_font_size (CRFontSize *a_this, return CR_OK ; } -/** - * cr_font_size_set_absolute_font_size: - * @a_this: the current instance of #CRFontSize - * @a_num_type: the type of number to set. - * @a_value: the actual value to set. - * - * Returns CR_OK upon succesful completion, an error code otherwise. - */ enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this, enum CRNumType a_num_type, gdouble a_value) { g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - g_return_val_if_fail (a_num_type >= NUM_AUTO - && a_num_type < NB_NUM_TYPE, + g_return_val_if_fail ((unsigned)a_num_type < NB_NUM_TYPE, CR_BAD_PARAM_ERROR) ; a_this->type = ABSOLUTE_FONT_SIZE ; @@ -475,12 +383,6 @@ cr_font_size_set_absolute_font_size (CRFontSize *a_this, return CR_OK ; } -/** - * cr_font_size_set_to_inherit: - * @a_this: the current instance of #CRFontSize - * - * Returns CR_OK upon succesful completion, an error code otherwise. - */ enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) { @@ -492,29 +394,16 @@ cr_font_size_set_to_inherit (CRFontSize *a_this) return CR_OK ; } -/** - * cr_font_size_is_set_to_inherit: - * @a_this: the current instance of #CRFontSize. - * - * Returns TRUE if the current instance is set to 'inherit'. - */ gboolean -cr_font_size_is_set_to_inherit (CRFontSize const *a_this) +cr_font_size_is_set_to_inherit (CRFontSize *a_this) { g_return_val_if_fail (a_this, FALSE) ; return a_this->type == INHERITED_FONT_SIZE ; } -/** - * cr_font_size_to_string: - * @a_this: the current instance of #CRFontSize - * - * Returns the serialized form of #CRFontSize. The returned string - * has to bee freed using g_free(). - */ gchar * -cr_font_size_to_string (CRFontSize const * a_this) +cr_font_size_to_string (CRFontSize * a_this) { gchar *str = NULL; @@ -529,7 +418,7 @@ cr_font_size_to_string (CRFontSize const * a_this) (a_this->value.predefined)); break; case ABSOLUTE_FONT_SIZE: - str = cr_num_to_string (&a_this->value.absolute); + str = (gchar *)cr_num_to_string (&a_this->value.absolute); break; case RELATIVE_FONT_SIZE: str = g_strdup (cr_relative_font_size_to_string @@ -544,21 +433,14 @@ cr_font_size_to_string (CRFontSize const * a_this) return str; } -/** - * cr_font_size_get_smaller_predefined: - * @a_font_size: the font size to consider. - * @a_smaller_size: out parameter. The a smaller value than @a_font_size. - */ void -cr_font_size_get_smaller_predefined_font_size - (enum CRPredefinedAbsoluteFontSize a_font_size, - enum CRPredefinedAbsoluteFontSize *a_smaller_size) +cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_smaller_size) { enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ; g_return_if_fail (a_smaller_size) ; - g_return_if_fail (a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES - && a_font_size >= FONT_SIZE_XX_SMALL) ; + g_return_if_fail ((unsigned)a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) ; switch (a_font_size) { case FONT_SIZE_XX_SMALL: @@ -595,23 +477,14 @@ cr_font_size_get_smaller_predefined_font_size } -/** - * cr_font_size_get_larger_predefined_font_size: - * @a_font_size: the font size to consider. - * @a_larger_size: out parameter. the font size considered larger than - * @a_font_size. - * - */ void -cr_font_size_get_larger_predefined_font_size - (enum CRPredefinedAbsoluteFontSize a_font_size, - enum CRPredefinedAbsoluteFontSize *a_larger_size) +cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_larger_size) { enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ; g_return_if_fail (a_larger_size) ; - g_return_if_fail (a_font_size >= FONT_SIZE_XX_SMALL - && a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) ; + g_return_if_fail ((unsigned)a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) ; switch (a_font_size) { case FONT_SIZE_XX_SMALL: @@ -647,33 +520,18 @@ cr_font_size_get_larger_predefined_font_size *a_larger_size = result ; } -/** - * cr_font_size_is_predefined_absolute_font_size: - * @a_font_size: the font size to consider. - * - * Returns TRUE if the instance is an predefined absolute font size, FALSE - * otherwise. - */ gboolean -cr_font_size_is_predefined_absolute_font_size - (enum CRPredefinedAbsoluteFontSize a_font_size) +cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) { - if (a_font_size >= FONT_SIZE_XX_SMALL - && a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) { + if ((unsigned)a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) { return TRUE ; } else { return FALSE ; } } -/** - * cr_font_size_adjust_to_string: - * @a_this: the instance of #CRFontSizeAdjust. - * - * Returns the serialized form of #CRFontSizeAdjust - */ gchar * -cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this) +cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this) { gchar *str = NULL; @@ -689,9 +547,9 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this) break; case FONT_SIZE_ADJUST_NUMBER: if (a_this->num) - str = cr_num_to_string (a_this->num); + str = (gchar *)cr_num_to_string (a_this->num); else - str = g_strdup ("unknow font-size-adjust property value"); /* Should raise an error no?*/ + str = g_strdup ("unknow font-size-adjust property value"); // Should raise an error no? break; case FONT_SIZE_ADJUST_INHERIT: str = g_strdup ("inherit"); @@ -699,13 +557,6 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this) return str; } -/** - * cr_font_style_to_string: - * @a_code: the current instance of #CRFontStyle . - * - * Returns the serialized #CRFontStyle. The caller must free the returned - * string using g_free(). - */ const gchar * cr_font_style_to_string (enum CRFontStyle a_code) { @@ -731,13 +582,6 @@ cr_font_style_to_string (enum CRFontStyle a_code) return str; } -/** - * cr_font_variant_to_string: - * @a_code: the current instance of #CRFontVariant. - * - * Returns the serialized form of #CRFontVariant. The caller has - * to free the returned string using g_free(). - */ const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) { @@ -757,19 +601,10 @@ cr_font_variant_to_string (enum CRFontVariant a_code) return str; } -/** - * cr_font_weight_get_bolder: - * @a_weight: the #CRFontWeight to consider. - * - * Returns a font weight bolder than @a_weight - */ enum CRFontWeight cr_font_weight_get_bolder (enum CRFontWeight a_weight) { - if (a_weight == FONT_WEIGHT_INHERIT) { - cr_utils_trace_info ("can't return a bolder weight for FONT_WEIGHT_INHERIT") ; - return a_weight; - } else if (a_weight >= FONT_WEIGHT_900) { + if (a_weight >= NB_FONT_WEIGHTS) { return FONT_WEIGHT_900 ; } else if (a_weight < FONT_WEIGHT_NORMAL) { return FONT_WEIGHT_NORMAL ; @@ -778,16 +613,10 @@ 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 a_weight << 1 ; + return (enum CRFontWeight)(a_weight << 1) ; } } -/** - * cr_font_weight_to_string: - * @a_code: the font weight to consider. - * - * Returns the serialized form of #CRFontWeight. - */ const gchar * cr_font_weight_to_string (enum CRFontWeight a_code) { @@ -843,12 +672,6 @@ cr_font_weight_to_string (enum CRFontWeight a_code) return str; } -/** - * cr_font_stretch_to_string: - * @a_code: the instance of #CRFontStretch to consider. - * - * Returns the serialized form of #CRFontStretch. - */ const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) { @@ -895,11 +718,6 @@ cr_font_stretch_to_string (enum CRFontStretch a_code) return str; } -/** - * cr_font_size_destroy: - * @a_font_size: the font size to destroy - * - */ void cr_font_size_destroy (CRFontSize * a_font_size) { @@ -912,17 +730,11 @@ cr_font_size_destroy (CRFontSize * a_font_size) *'font-size-adjust' manipulation function definition *******************************************************/ -/** - * cr_font_size_adjust_new: - * - * Returns a newly built instance of #CRFontSizeAdjust - */ CRFontSizeAdjust * cr_font_size_adjust_new (void) { - CRFontSizeAdjust *result = NULL; - - result = g_try_malloc (sizeof (CRFontSizeAdjust)); + CRFontSizeAdjust *result = + (CRFontSizeAdjust *)g_try_malloc (sizeof (CRFontSizeAdjust)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -932,11 +744,6 @@ cr_font_size_adjust_new (void) return result; } -/** - * cr_font_size_adjust_destroy: - * @a_this: the current instance of #CRFontSizeAdjust. - * - */ void cr_font_size_adjust_destroy (CRFontSizeAdjust * a_this) { diff --git a/src/cr-fonts.h b/src/cr-fonts.h index 9eaeeeb..4544618 100644 --- a/src/cr-fonts.h +++ b/src/cr-fonts.h @@ -25,6 +25,7 @@ #ifndef __CR_FONTS_H__ #define __CR_FONTS_H__ +#endif #include "cr-utils.h" #include "cr-num.h" @@ -235,7 +236,7 @@ cr_font_family_append (CRFontFamily *a_this, CRFontFamily *a_family_to_append) ; guchar * -cr_font_family_to_string (CRFontFamily const *a_this, +cr_font_family_to_string (CRFontFamily *a_this, gboolean a_walk_font_family_list) ; CRFontFamily * @@ -258,7 +259,7 @@ CRFontSize * cr_font_size_new (void) ; enum CRStatus cr_font_size_clear (CRFontSize *a_this) ; enum CRStatus cr_font_size_copy (CRFontSize *a_dst, - CRFontSize const *a_src) ; + CRFontSize *a_src) ; enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, enum CRPredefinedAbsoluteFontSize a_predefined) ; enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this, @@ -270,9 +271,9 @@ enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this, enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ; -gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this) ; +gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ; -gchar* cr_font_size_to_string (CRFontSize const *a_this) ; +gchar* cr_font_size_to_string (CRFontSize *a_this) ; void cr_font_size_destroy (CRFontSize *a_font_size) ; @@ -282,7 +283,7 @@ void cr_font_size_destroy (CRFontSize *a_font_size) ; CRFontSizeAdjust * cr_font_size_adjust_new (void) ; -gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ; +gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ; void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ; @@ -311,5 +312,3 @@ const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ; const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ; G_END_DECLS - -#endif diff --git a/src/cr-input.c b/src/cr-input.c index 3cc283e..8613292 100644 --- a/src/cr-input.c +++ b/src/cr-input.c @@ -27,8 +27,7 @@ #include "cr-enc-handler.h" /** - *@CRInput: - * + *@file *The definition of the #CRInput class. */ @@ -88,16 +87,14 @@ static CRInput *cr_input_new_real (void); static CRInput * cr_input_new_real (void) { - CRInput *result = NULL; - - result = g_try_malloc (sizeof (CRInput)); + CRInput *result = (CRInput *)g_try_malloc (sizeof (CRInput)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (result, 0, sizeof (CRInput)); - PRIVATE (result) = g_try_malloc (sizeof (CRInputPriv)); + PRIVATE (result) = (CRInputPriv *)g_try_malloc (sizeof (CRInputPriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("Out of memory"); g_free (result); @@ -113,17 +110,15 @@ cr_input_new_real (void) ***************/ /** - * cr_input_new_from_buf: - *@a_buf: the memory buffer to create the input stream from. + *Creates a new input stream from a memory buffer. + *@param a_buf the memory buffer to create the input stream from. *The #CRInput keeps this pointer so user should not free it !. - *@a_len: the size of the input buffer. - *@a_enc: the buffer's encoding. - *@a_free_buf: if set to TRUE, this a_buf will be freed + *@param a_len the size of the input buffer. + *@param a_enc the buffer's encoding. + *@param a_free_buf if set to TRUE, this a_buf will be freed *at the destruction of this instance. If set to false, it is up *to the caller to free it. - * - *Creates a new input stream from a memory buffer. - *Returns the newly built instance of #CRInput. + *@return the newly built instance of #CRInput. */ CRInput * cr_input_new_from_buf (guchar * a_buf, @@ -180,14 +175,13 @@ cr_input_new_from_buf (guchar * a_buf, } /** - * cr_input_new_from_uri: - *@a_file_uri: the file to create *the input stream from. - *@a_enc: the encoding of the file *to create the input from. - * *Creates a new input stream from *a file. - * - *Returns the newly created input stream if + *@param a_file_uri the file to create + *the input stream from. + *@param a_enc the encoding of the file + *to create the input from + *@return the newly created input stream if *this method could read the file and create it, *NULL otherwise. */ @@ -240,7 +234,7 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc) if (status == CR_OK) { /*read went well */ - buf = g_realloc (buf, len + CR_INPUT_MEM_CHUNK_SIZE); + buf = (guchar *)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; @@ -274,10 +268,8 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc) } /** - * cr_input_destroy: - *@a_this: the current instance of #CRInput. - * *The destructor of the #CRInput class. + *@param a_this the current instance of #CRInput. */ void cr_input_destroy (CRInput * a_this) @@ -299,11 +291,9 @@ cr_input_destroy (CRInput * a_this) } /** - * cr_input_ref: - *@a_this: the current instance of #CRInput. - * *Increments the reference count of the current *instance of #CRInput. + *@param a_this the current instance of #CRInput. */ void cr_input_ref (CRInput * a_this) @@ -314,14 +304,11 @@ cr_input_ref (CRInput * a_this) } /** - * cr_input_unref: - *@a_this: the current instance of #CRInput. - * *Decrements the reference count of this instance *of #CRInput. If the reference count goes down to *zero, this instance is destroyed. + *@param a_this the current instance of #CRInput. * - * Returns TRUE if the instance of #CRInput got destroyed, false otherwise. */ gboolean cr_input_unref (CRInput * a_this) @@ -340,21 +327,18 @@ cr_input_unref (CRInput * a_this) } /** - * cr_input_end_of_input: - *@a_this: the current instance of #CRInput. - *@a_end_of_input: out parameter. Is set to TRUE if - *the current instance has reached the end of its input buffer, - *FALSE otherwise. - * *Tests wether the current instance of *#CRInput has reached its input buffer. - * - * Returns CR_OK upon successful completion, an error code otherwise. - * Note that all the out parameters of this method are valid if - * and only if this method returns CR_OK. + *@param a_this the current instance of #CRInput. + *@param a_end_of_input out parameter. Is set to TRUE if + *the current instance has reached the end of its input buffer, + *FALSE otherwise. + *@param CR_OK upon successful completion, an error code otherwise. + *Note that all the out parameters of this method are valid if + *and only if this method returns CR_OK. */ enum CRStatus -cr_input_end_of_input (CRInput const * a_this, gboolean * a_end_of_input) +cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_end_of_input, CR_BAD_PARAM_ERROR); @@ -366,14 +350,13 @@ cr_input_end_of_input (CRInput const * a_this, gboolean * a_end_of_input) } /** - * cr_input_get_nb_bytes_left: - *@a_this: the current instance of #CRInput. - * *Returns the number of bytes left in the input stream - *before the end, -1 in case of error. + *before the end. + *@param a_this the current instance of #CRInput. + *@return the number of characters left or -1 in case of error. */ glong -cr_input_get_nb_bytes_left (CRInput const * a_this) +cr_input_get_nb_bytes_left (CRInput * a_this) { g_return_val_if_fail (a_this && PRIVATE (a_this), -1); g_return_val_if_fail (PRIVATE (a_this)->nb_bytes @@ -388,16 +371,14 @@ cr_input_get_nb_bytes_left (CRInput const * a_this) } /** - * cr_input_read_byte: - *@a_this: the current instance of #CRInput. - *@a_byte: out parameter the returned byte. - * - *Gets the next byte of the input. - *Updates the state of the input so that + *Returns the next byte of the input. + *Update the state of the input so that *the next invocation of this method returns *the next coming byte. * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRInput. + *@param a_byte out parameter the returned byte. + *@return CR_OK upon successful completion, an error code *otherwise. All the out parameters of this method are valid if *and only if this method returns CR_OK. */ @@ -426,14 +407,11 @@ cr_input_read_byte (CRInput * a_this, guchar * a_byte) } /** - * cr_input_read_char: - *@a_this: the current instance of CRInput. - *@a_char: out parameter. The read character. - * *Reads an unicode character from the current instance of *#CRInput. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of CRInput. + *@param a_char out parameter. The read character. + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus @@ -484,13 +462,11 @@ cr_input_read_char (CRInput * a_this, guint32 * a_char) } /** - * cr_input_set_line_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_line_num: the new line number. - * *Setter of the current line number. - * - *Return CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@param a_line_num the new line number. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_set_line_num (CRInput * a_this, glong a_line_num) @@ -503,16 +479,14 @@ cr_input_set_line_num (CRInput * a_this, glong a_line_num) } /** - * cr_input_get_line_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_line_num: the returned line number. - * *Getter of the current line number. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@param a_line_num the returned line number. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus -cr_input_get_line_num (CRInput const * a_this, glong * a_line_num) +cr_input_get_line_num (CRInput * a_this, glong * a_line_num) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_line_num, CR_BAD_PARAM_ERROR); @@ -523,13 +497,11 @@ cr_input_get_line_num (CRInput const * a_this, glong * a_line_num) } /** - * cr_input_set_column_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_col: the new column number. - * *Setter of the current column number. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@param a_col the new column number. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_set_column_num (CRInput * a_this, glong a_col) @@ -542,16 +514,14 @@ cr_input_set_column_num (CRInput * a_this, glong a_col) } /** - * cr_input_get_column_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_col: out parameter - * *Getter of the current column number. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@param a_col out parameter + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus -cr_input_get_column_num (CRInput const * a_this, glong * a_col) +cr_input_get_column_num (CRInput * a_this, glong * a_col) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_col, CR_BAD_PARAM_ERROR); @@ -562,13 +532,10 @@ cr_input_get_column_num (CRInput const * a_this, glong * a_col) } /** - * cr_input_increment_line_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_increment: the increment to add to the line number. - * *Increments the current line number. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_increment_line_num (CRInput * a_this, glong a_increment) @@ -581,13 +548,10 @@ cr_input_increment_line_num (CRInput * a_this, glong a_increment) } /** - * cr_input_increment_col_num: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_increment: the increment to add to the column number. - * *Increments the current column number. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_increment_col_num (CRInput * a_this, glong a_increment) @@ -600,15 +564,13 @@ cr_input_increment_col_num (CRInput * a_this, glong a_increment) } /** - * cr_input_consume_char: - *@a_this: the this pointer. - *@a_char: the character to consume. If set to zero, - *consumes any character. - * *Consumes the next character of the input stream if *and only if that character equals a_char. * - *Returns CR_OK upon successful completion, CR_PARSING_ERROR if + *@param a_this the this pointer. + *@param a_char the character to consume. If set to zero, + *consumes any character. + *@return CR_OK upon successful completion, CR_PARSING_ERROR if *next char is different from a_char, an other error code otherwise */ enum CRStatus @@ -633,23 +595,21 @@ cr_input_consume_char (CRInput * a_this, guint32 a_char) } /** - * cr_input_consume_chars: - *@a_this: the this pointer of the current instance of #CRInput. - *@a_char: the character to consume. - *@a_nb_char: in/out parameter. The number of characters to consume. - *If set to a negative value, the function will consume all the occurences - *of a_char found. - *After return, if the return value equals CR_OK, this variable contains - *the number of characters actually consumed. - * *Consumes up to a_nb_char occurences of the next contiguous characters *which equal a_char. Note that the next character of the input stream **MUST* equal a_char to trigger the consumption, or else, the error *code CR_PARSING_ERROR is returned. *If the number of contiguous characters that equals a_char is less than *a_nb_char, then this function consumes all the characters it can consume. - * - *Returns CR_OK if at least one character has been consumed, an error code + * + *@param a_this the this pointer of the current instance of #CRInput. + *@param a_char the character to consume. + *@param a_nb_char in/out parameter. The number of characters to consume. + *If set to a negative value, the function will consume all the occurences + *of a_char found. + *After return, if the return value equals CR_OK, this variable contains + *the number of characters actually consumed. + *@return CR_OK if at least one character has been consumed, an error code *otherwise. */ enum CRStatus @@ -683,15 +643,13 @@ cr_input_consume_chars (CRInput * a_this, guint32 a_char, gulong * a_nb_char) } /** - * cr_input_consume_white_spaces: - *@a_this: the "this pointer" of the current instance of #CRInput. - *@a_nb_chars: in/out parameter. The number of white spaces to - *consume. After return, holds the number of white spaces actually consumed. - * *Same as cr_input_consume_chars() but this one consumes white *spaces. * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRInput. + *@param a_nb_chars in/out parameter. The number of white spaces to + *consume. After return, holds the number of white spaces actually consumed. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars) @@ -730,20 +688,17 @@ cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars) } /** - * cr_input_peek_char: - *@a_this: the current instance of #CRInput. - *@a_char: out parameter. The returned character. - * *Same as cr_input_read_char() but does not update the *internal state of the input stream. The next call *to cr_input_peek_char() or cr_input_read_char() will thus *return the same character as the current one. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRInput. + *@param a_char out parameter. The returned character. + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus -cr_input_peek_char (CRInput const * a_this, guint32 * a_char) +cr_input_peek_char (CRInput * a_this, guint32 * a_char) { enum CRStatus status = CR_OK; glong consumed = 0, @@ -766,20 +721,12 @@ 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, &consumed); + nb_bytes_left, a_char, (gulong *)&consumed); return status; } /** - * cr_input_peek_byte: - *@a_this: the current instance of #CRInput. - *@a_origin: the origin to consider in the calculation - *of the position of the byte to peek. - *@a_offset: the offset of the byte to peek, starting from - *the origin specified by a_origin. - *@a_byte: out parameter the peeked byte. - * *Gets a byte from the input stream, *starting from the current position in the input stream. *Unlike cr_input_peek_next_byte() this method @@ -787,12 +734,21 @@ cr_input_peek_char (CRInput const * a_this, guint32 * a_char) *Subsequent calls to cr_input_peek_byte with the same arguments *will return the same byte. * - *Returns CR_OK upon successful completion or, - *CR_BAD_PARAM_ERROR if at least one of the parameters is invalid; - *CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds. + *@param a_this the current instance of #CRInput. + *@param a_origin the origin to consider in the calculation + *of the position of the byte to peek. + *@param a_offset the offset of the byte to peek, starting from + *the origin specified by a_origin. + *@param a_byte out parameter the peeked byte. + *@return CR_OK upon successful completion or, + * + *<ul> + *<li>CR_BAD_PARAM_ERROR if at least one of the parameters is invalid</li> + *<li>CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds</li> + *</ul> */ enum CRStatus -cr_input_peek_byte (CRInput const * a_this, enum CRSeekPos a_origin, +cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin, gulong a_offset, guchar * a_byte) { gulong abs_offset = 0; @@ -830,21 +786,18 @@ cr_input_peek_byte (CRInput const * a_this, enum CRSeekPos a_origin, } /** - * cr_input_peek_byte2: - *@a_this: the current byte input stream. - *@a_offset: the offset of the byte to peek, starting + *Same as cr_input_peek_byte() but with a simplified + *interface. + *@param a_this the current byte input stream. + *@param a_offset the offset of the byte to peek, starting *from the current input position pointer. - *@a_eof: out parameter. Is set to true is we reach end of + *@param a_eof out parameter. Is set to true is we reach end of *stream. If set to NULL by the caller, this parameter is not taken *in account. - * - *Same as cr_input_peek_byte() but with a simplified - *interface. - * - *Returns the read byte or 0 if something bad happened. + *@return the read byte or 0 if something bad happened. */ guchar -cr_input_peek_byte2 (CRInput const * a_this, gulong a_offset, gboolean * a_eof) +cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof) { guchar result = 0; enum CRStatus status = CR_ERROR; @@ -864,15 +817,12 @@ cr_input_peek_byte2 (CRInput const * a_this, gulong a_offset, gboolean * a_eof) } /** - * cr_input_get_byte_addr: - *@a_this: the current instance of #CRInput. - *@a_offset: the offset of the byte in the input stream starting - *from the beginning of the stream. - * - *Gets the memory address of the byte located at a given offset + *Returns the memory address of the byte located at a given offset *in the input stream. - * - *Returns the address, otherwise NULL if an error occured. + *@param a_this the current instance of #CRInput. + *@param a_offset the offset of the byte in the input stream starting + *from the beginning of the stream. + *@return the address, otherwise NULL if an error occured. */ guchar * cr_input_get_byte_addr (CRInput * a_this, gulong a_offset) @@ -887,13 +837,10 @@ cr_input_get_byte_addr (CRInput * a_this, gulong a_offset) } /** - * cr_input_get_cur_byte_addr: - *@a_this: the current input stream - *@a_offset: out parameter. The returned address. - * - *Gets the address of the current character pointer. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *Returns the address of the current character pointer. + *@param a_this the current input stream + *@param a_offset out parameter. The returned address. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_get_cur_byte_addr (CRInput * a_this, guchar ** a_offset) @@ -912,20 +859,23 @@ cr_input_get_cur_byte_addr (CRInput * a_this, guchar ** a_offset) } /** - * cr_input_seek_index: - *@a_this: the current instance of #CRInput. - *@a_origin: the origin to consider during the calculation - *of the absolute position of the new "current byte index". - *@a_pos: the relative offset of the new "current byte index." - *This offset is relative to the origin a_origin. - * *Sets the "current byte index" of the current instance *of #CRInput. Next call to cr_input_get_byte() will return *the byte next after the new "current byte index". * - *Returns CR_OK upon successful completion otherwise returns - *CR_BAD_PARAM_ERROR if at least one of the parameters is not valid - *or CR_OUT_BOUNDS_ERROR in case of error. + *@param a_this the current instance of #CRInput. + * + *@param a_origin the origin to consider during the calculation + *of the absolute position of the new "current byte index". + * + *@param a_pos the relative offset of the new "current byte index." + *This offset is relative to the origin a_origin. + * + *@return CR_OK upon successful completion otherwise returns + *<ul> + *<li>CR_BAD_PARAM_ERROR if at least one of the parameters is not valid</li> + *<li>CR_OUT_BOUNDS_ERROR</li> + *</ul> */ enum CRStatus cr_input_seek_index (CRInput * a_this, enum CRSeekPos a_origin, gint a_pos) @@ -966,24 +916,26 @@ cr_input_seek_index (CRInput * a_this, enum CRSeekPos a_origin, gint a_pos) } /** - * cr_input_get_cur_pos: - *@a_this: the current instance of #CRInput. - *@a_pos: out parameter. The returned position. - * *Gets the position of the "current byte index" which *is basically the position of the last returned byte in the *input stream. * - *Returns CR_OK upon successful completion. Otherwise, - *CR_BAD_PARAMETER_ERROR if at least one of the arguments is invalid. - *CR_START_OF_INPUT if no call to either cr_input_read_byte() + *@param a_this the current instance of #CRInput. + * + *@param a_pos out parameter. The returned position. + * + *@return CR_OK upon successful completion. Otherwise, + *<ul> + *<li>CR_BAD_PARAMETER_ERROR if at least one of the arguments is invalid.</li> + *<li>CR_START_OF_INPUT if no call to either cr_input_read_byte() *or cr_input_seek_index() have been issued before calling - *cr_input_get_cur_pos() + *cr_input_get_cur_pos()</li> + *</ul> *Note that the out parameters of this function are valid if and only if this *function returns CR_OK. */ enum CRStatus -cr_input_get_cur_pos (CRInput const * a_this, CRInputPos * a_pos) +cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos, CR_BAD_PARAM_ERROR); @@ -998,20 +950,17 @@ cr_input_get_cur_pos (CRInput const * a_this, CRInputPos * a_pos) } /** - * cr_input_get_parsing_location: - *@a_this: the current instance of #CRInput - *@a_loc: the set parsing location. - * *Gets the current parsing location. *The Parsing location is a public datastructure that *represents the current line/column/byte offset/ in the input *stream. - * - *Returns CR_OK upon successful completion, an error + *@param a_this the current instance of #CRInput + *@param a_loc the set parsing location. + *@return CR_OK upon successful completion, an error *code otherwise. */ enum CRStatus -cr_input_get_parsing_location (CRInput const *a_this, +cr_input_get_parsing_location (CRInput *a_this, CRParsingLocation *a_loc) { g_return_val_if_fail (a_this @@ -1030,20 +979,17 @@ cr_input_get_parsing_location (CRInput const *a_this, } /** - * cr_input_get_cur_index: - *@a_this: the "this pointer" of the current instance of - *#CRInput - *@a_index: out parameter. The returned index. - * *Getter of the next byte index. *It actually returns the index of the *next byte to be read. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the "this pointer" of the current instance of + *#CRInput + *@param a_index out parameter. The returned index. + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus -cr_input_get_cur_index (CRInput const * a_this, glong * a_index) +cr_input_get_cur_index (CRInput * a_this, glong * a_index) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_index, CR_BAD_PARAM_ERROR); @@ -1054,15 +1000,12 @@ cr_input_get_cur_index (CRInput const * a_this, glong * a_index) } /** - * cr_input_set_cur_index: - *@a_this: the "this pointer" of the current instance - *of #CRInput . - *@a_index: the new index to set. - * *Setter of the next byte index. *It sets the index of the next byte to be read. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance + *of #CRInput . + *@param a_index the new index to set. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_set_cur_index (CRInput * a_this, glong a_index) @@ -1075,13 +1018,10 @@ cr_input_set_cur_index (CRInput * a_this, glong a_index) } /** - * cr_input_set_end_of_file: - *@a_this: the current instance of #CRInput. - *@a_eof: the new end of file flag. - * *Sets the end of file flag. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRInput. + *@param a_eof the new end of file flag. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_set_end_of_file (CRInput * a_this, gboolean a_eof) @@ -1094,17 +1034,14 @@ cr_input_set_end_of_file (CRInput * a_this, gboolean a_eof) } /** - * cr_input_get_end_of_file: - *@a_this: the current instance of #CRInput. - *@a_eof: out parameter the place to put the end of - *file flag. - * *Gets the end of file flag. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRInput. + *@param a_eof out parameter the place to put the end of + *file flag. + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus -cr_input_get_end_of_file (CRInput const * a_this, gboolean * a_eof) +cr_input_get_end_of_file (CRInput * a_this, gboolean * a_eof) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_eof, CR_BAD_PARAM_ERROR); @@ -1115,13 +1052,10 @@ cr_input_get_end_of_file (CRInput const * a_this, gboolean * a_eof) } /** - * cr_input_set_end_of_line: - *@a_this: the current instance of #CRInput. - *@a_eol: the new end of line flag. - * *Sets the end of line flag. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRInput. + *@param a_eol the new end of line flag. + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus @@ -1135,18 +1069,15 @@ cr_input_set_end_of_line (CRInput * a_this, gboolean a_eol) } /** - * cr_input_get_end_of_line: - *@a_this: the current instance of #CRInput - *@a_eol: out parameter. The place to put - *the returned flag - * *Gets the end of line flag of the current input. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRInput + *@param a_eol out parameter. The place to put + *the returned flag + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus -cr_input_get_end_of_line (CRInput const * a_this, gboolean * a_eol) +cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_eol, CR_BAD_PARAM_ERROR); @@ -1157,17 +1088,14 @@ cr_input_get_end_of_line (CRInput const * a_this, gboolean * a_eol) } /** - * cr_input_set_cur_pos: - *@a_this: the "this pointer" of the current instance of - *#CRInput. - *@a_pos: the new position. - * *Sets the current position in the input stream. * - * Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRInput. + *@param a_pos the new position. */ enum CRStatus -cr_input_set_cur_pos (CRInput * a_this, CRInputPos const * a_pos) +cr_input_set_cur_pos (CRInput * a_this, CRInputPos * a_pos) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos, CR_BAD_PARAM_ERROR); diff --git a/src/cr-input.h b/src/cr-input.h index 9eb402a..976b73f 100644 --- a/src/cr-input.h +++ b/src/cr-input.h @@ -93,15 +93,15 @@ enum CRStatus cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ; enum CRStatus -cr_input_peek_byte (CRInput const *a_this, enum CRSeekPos a_origin, +cr_input_peek_byte (CRInput *a_this, enum CRSeekPos a_origin, gulong a_offset, guchar *a_byte) ; guchar -cr_input_peek_byte2 (CRInput const *a_this, gulong a_offset, +cr_input_peek_byte2 (CRInput *a_this, gulong a_offset, gboolean *a_eof) ; enum CRStatus -cr_input_peek_char (CRInput const *a_this, guint32 *a_char) ; +cr_input_peek_char (CRInput *a_this, guint32 *a_char) ; guchar * cr_input_get_byte_addr (CRInput *a_this, @@ -115,29 +115,29 @@ cr_input_seek_index (CRInput *a_this, enum CRSeekPos a_origin, gint a_pos) ; enum CRStatus -cr_input_get_cur_index (CRInput const *a_this, glong *a_index) ; +cr_input_get_cur_index (CRInput *a_this, glong *a_index) ; enum CRStatus cr_input_set_cur_index (CRInput *a_this, glong a_index) ; enum CRStatus -cr_input_get_cur_pos (CRInput const *a_this, CRInputPos * a_pos) ; +cr_input_get_cur_pos (CRInput *a_this, CRInputPos * a_pos) ; enum CRStatus -cr_input_set_cur_pos (CRInput *a_this, CRInputPos const *a_pos) ; +cr_input_set_cur_pos (CRInput *a_this, CRInputPos *a_pos) ; enum CRStatus -cr_input_get_parsing_location (CRInput const *a_this, +cr_input_get_parsing_location (CRInput *a_this, CRParsingLocation *a_loc) ; enum CRStatus -cr_input_get_end_of_line (CRInput const *a_this, gboolean *a_eol) ; +cr_input_get_end_of_line (CRInput *a_this, gboolean *a_eol) ; enum CRStatus cr_input_set_end_of_line (CRInput *a_this, gboolean a_eol) ; enum CRStatus -cr_input_get_end_of_file (CRInput const *a_this, gboolean *a_eof) ; +cr_input_get_end_of_file (CRInput *a_this, gboolean *a_eof) ; enum CRStatus cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ; @@ -146,13 +146,13 @@ enum CRStatus cr_input_set_line_num (CRInput *a_this, glong a_line_num) ; enum CRStatus -cr_input_get_line_num (CRInput const *a_this, glong *a_line_num) ; +cr_input_get_line_num (CRInput *a_this, glong *a_line_num) ; enum CRStatus cr_input_set_column_num (CRInput *a_this, glong a_col) ; enum CRStatus -cr_input_get_column_num (CRInput const *a_this, glong *a_col) ; +cr_input_get_column_num (CRInput *a_this, glong *a_col) ; enum CRStatus cr_input_increment_line_num (CRInput *a_this, @@ -163,10 +163,10 @@ cr_input_increment_col_num (CRInput *a_this, glong a_increment) ; glong -cr_input_get_nb_bytes_left (CRInput const *a_this) ; +cr_input_get_nb_bytes_left (CRInput *a_this) ; enum CRStatus -cr_input_end_of_input (CRInput const *a_this, gboolean *a_end_of_input) ; +cr_input_end_of_input (CRInput *a_this, gboolean *a_end_of_input) ; G_END_DECLS diff --git a/src/cr-num.c b/src/cr-num.c index 28c5df0..fb412a9 100644 --- a/src/cr-num.c +++ b/src/cr-num.c @@ -23,8 +23,7 @@ */ /** - *@CRNum: - * + *@file *The definition *of the #CRNum class. */ @@ -33,19 +32,15 @@ #include "string.h" /** - * cr_num_new: - * + *The default constructor of *#CRNum. - * - *Returns the newly built instance of + *@return the newly built instance of *#CRNum. */ CRNum * cr_num_new (void) { - CRNum *result = NULL; - - result = g_try_malloc (sizeof (CRNum)); + CRNum *result = (CRNum *)g_try_malloc (sizeof (CRNum)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); @@ -58,14 +53,16 @@ cr_num_new (void) } /** - * cr_num_new_with_val: - * @a_val: the numerical value of the number. - * @a_type: the type of number. - * - * A constructor of #CRNum. - * - * Returns the newly built instance of #CRNum or - * NULL if an error arises. + *A constructor of #CRNum. + *@param a_is_natural indicates whether the intance of #CRNum is + *a natural number or not. + *@param a_integer_part the integer part of the instance + *of #CRNum + *@param a_decimal_part in case the instance of #CRNum + *natural number (but a decimal one) this parameter + *is the decimal part of the instance of #CRNum. + *@return the newly built instance of #CRNum or + *NULL if an error arises. */ CRNum * cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) @@ -83,16 +80,16 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) } /** - * cr_num_to_string: - *@a_this: the current instance of #CRNum. - * - *Returns the newly built string representation + *Returns the string representation of the + *current instance of #CRNum. + *@param a_this the current instance of #CRNum. + *@return the newly built string representation *of the current instance of #CRNum. The returned *string is NULL terminated. The caller *must* *free the returned string. */ guchar * -cr_num_to_string (CRNum const * a_this) +cr_num_to_string (CRNum * a_this) { gdouble test_val = 0.0; @@ -105,11 +102,13 @@ cr_num_to_string (CRNum const * a_this) test_val = a_this->val - (glong) a_this->val; if (!test_val) { - tmp_char1 = g_strdup_printf ("%ld", (glong) a_this->val); + tmp_char1 = (guchar *)g_strdup_printf ("%ld", (glong) a_this->val); } else { - tmp_char1 = g_new0 (char, G_ASCII_DTOSTR_BUF_SIZE + 1); - if (tmp_char1 != NULL) - g_ascii_dtostr (tmp_char1, G_ASCII_DTOSTR_BUF_SIZE, a_this->val); + /* We can't use g_ascii_dtostr, because that sometimes uses + e notation (which wouldn't be a valid number in CSS). */ + size_t const buflen = 35; /* fairly arbitrary. */ + tmp_char1 = (guchar *)g_malloc (buflen); + g_ascii_formatd ((gchar *)tmp_char1, buflen, "%.15g", a_this->val); } g_return_val_if_fail (tmp_char1, NULL); @@ -193,7 +192,8 @@ cr_num_to_string (CRNum const * a_this) } if (tmp_char2) { - result = g_strconcat (tmp_char1, tmp_char2, NULL); + result = (guchar *)g_strconcat ( + (gchar *)tmp_char1, (gchar *)tmp_char2, NULL); g_free (tmp_char1); } else { result = tmp_char1; @@ -203,19 +203,16 @@ cr_num_to_string (CRNum const * a_this) } /** - * cr_num_copy: - *@a_src: the instance of #CRNum to copy. + *Copies an instance of #CRNum. + *@param a_src the instance of #CRNum to copy. *Must be non NULL. - *@a_dest: the destination of the copy. + *@param a_dst the destination of the copy. *Must be non NULL - * - *Copies an instance of #CRNum. - * - *Returns CR_OK upon successful completion, an + *@return CR_OK upon successful completion, an *error code otherwise. */ enum CRStatus -cr_num_copy (CRNum * a_dest, CRNum const * a_src) +cr_num_copy (CRNum * a_dest, CRNum * a_src) { g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR); @@ -225,16 +222,13 @@ cr_num_copy (CRNum * a_dest, CRNum const * a_src) } /** - * cr_num_dup: - *@a_this: the instance of #CRNum to duplicate. - * *Duplicates an instance of #CRNum - * - *Returns the newly created (duplicated) instance of #CRNum. + *@param a_this the instance of #CRNum to duplicate. + *@return the newly created (duplicated) instance of #CRNum. *Must be freed by cr_num_destroy(). */ CRNum * -cr_num_dup (CRNum const * a_this) +cr_num_dup (CRNum * a_this) { CRNum *result = NULL; enum CRStatus status = CR_OK; @@ -251,14 +245,11 @@ cr_num_dup (CRNum const * a_this) } /** - * cr_num_set: *Sets an instance of #CRNum. - *@a_this: the current instance of #CRNum to be set. - *@a_val: the new numerical value to be hold by the current + *@param a_this the current instance of #CRNum to be set. + *@param a_val the new numerical value to be hold by the current *instance of #CRNum - *@a_type: the new type of #CRNum. - * - * Returns CR_OK upon succesful completion, an error code otherwise. + *@param a_type the new type of #CRNum. */ enum CRStatus cr_num_set (CRNum * a_this, gdouble a_val, enum CRNumType a_type) @@ -272,19 +263,15 @@ cr_num_set (CRNum * a_this, gdouble a_val, enum CRNumType a_type) } /** - * cr_num_is_fixed_length: - * @a_this: the current instance of #CRNum . - * *Tests if the current instance of #CRNum is a fixed *length value or not. Typically a fixed length value *is anything from NUM_LENGTH_EM to NUM_LENGTH_PC. *See the definition of #CRNumType to see what we mean. - * - *Returns TRUE if the instance of #CRNum is a fixed length number, + *@return TRUE if the instance of #CRNum is a fixed length number, *FALSE otherwise. */ gboolean -cr_num_is_fixed_length (CRNum const * a_this) +cr_num_is_fixed_length (CRNum * a_this) { gboolean result = FALSE; @@ -298,11 +285,9 @@ cr_num_is_fixed_length (CRNum const * a_this) } /** - * cr_num_destroy: - *@a_this: the this pointer of - *the current instance of #CRNum. - * *The destructor of #CRNum. + *@param a_this the this pointer of + *the current instance of #CRNum. */ void cr_num_destroy (CRNum * a_this) diff --git a/src/cr-num.h b/src/cr-num.h index 2b73aaf..83e9dc7 100644 --- a/src/cr-num.h +++ b/src/cr-num.h @@ -102,20 +102,20 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) ; CRNum * -cr_num_dup (CRNum const *a_this) ; +cr_num_dup (CRNum *a_this) ; guchar * -cr_num_to_string (CRNum const *a_this) ; +cr_num_to_string (CRNum *a_this) ; enum CRStatus -cr_num_copy (CRNum *a_dest, CRNum const *a_src) ; +cr_num_copy (CRNum *a_dest, CRNum *a_src) ; enum CRStatus cr_num_set (CRNum *a_this, gdouble a_val, enum CRNumType a_type) ; gboolean -cr_num_is_fixed_length (CRNum const *a_this) ; +cr_num_is_fixed_length (CRNum *a_this) ; void cr_num_destroy (CRNum *a_this) ; diff --git a/src/cr-om-parser.c b/src/cr-om-parser.c index a62e98d..b8d70e3 100644 --- a/src/cr-om-parser.c +++ b/src/cr-om-parser.c @@ -25,9 +25,10 @@ #include "cr-utils.h" #include "cr-om-parser.h" +#define UNUSED(_param) ((void)(_param)) + /** - *@CROMParser: - * + *@file *The definition of the CSS Object Model Parser. *This parser uses (and sits) the SAC api of libcroco defined *in cr-parser.h and cr-doc-handler.h @@ -111,9 +112,8 @@ struct _ParsingContext { static ParsingContext * new_parsing_context (void) { - ParsingContext *result = NULL; - - result = g_try_malloc (sizeof (ParsingContext)); + ParsingContext *result = + (ParsingContext *)g_try_malloc (sizeof (ParsingContext)); if (!result) { cr_utils_trace_info ("Out of Memory"); return NULL; @@ -216,7 +216,7 @@ start_font_face (CRDocHandler * a_this, ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; - g_return_if_fail (a_this); + UNUSED(a_location); g_return_if_fail (a_this); ctxtptr = &ctxt; @@ -315,6 +315,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; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); @@ -349,6 +351,8 @@ start_page (CRDocHandler * a_this, ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; + UNUSED(a_location); + g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); @@ -426,6 +430,8 @@ start_media (CRDocHandler * a_this, ParsingContext **ctxtptr = NULL; GList *media_list = NULL; + UNUSED(a_location); + g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); @@ -493,6 +499,8 @@ import_style (CRDocHandler * a_this, ParsingContext **ctxtptr = NULL; GList *media_list = NULL ; + UNUSED(a_location); + g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); @@ -762,19 +770,16 @@ unrecoverable_error (CRDocHandler * a_this) ********************************************/ /** - * cr_om_parser_new: - *@a_input: the input stream. - * *Constructor of the CROMParser. - *Returns the newly built instance of #CROMParser. + *@param a_input the input stream. + *@return the newly built instance of #CROMParser. */ CROMParser * cr_om_parser_new (CRInput * a_input) { - CROMParser *result = NULL; enum CRStatus status = CR_OK; - result = g_try_malloc (sizeof (CROMParser)); + CROMParser *result = (CROMParser *)g_try_malloc (sizeof (CROMParser)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -782,7 +787,7 @@ cr_om_parser_new (CRInput * a_input) } memset (result, 0, sizeof (CROMParser)); - PRIVATE (result) = g_try_malloc (sizeof (CROMParserPriv)); + PRIVATE (result) = (CROMParserPriv *)g_try_malloc (sizeof (CROMParserPriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("Out of memory"); @@ -816,16 +821,13 @@ cr_om_parser_new (CRInput * a_input) } /** - * cr_om_parser_parse_buf: - *@a_this: the current instance of #CROMParser. - *@a_buf: the in memory buffer to parse. - *@a_len: the length of the in memory buffer in number of bytes. - *@a_enc: the encoding of the in memory buffer. - *@a_result: out parameter the resulting style sheet - * *Parses the content of an in memory buffer. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CROMParser. + *@param a_buf the in memory buffer to parse. + *@param a_len the length of the in memory buffer in number of bytes. + *@param a_enc the encoding of the in memory buffer. + *@param a_result out parameter the resulting style sheet + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_om_parser_parse_buf (CROMParser * a_this, @@ -866,15 +868,12 @@ cr_om_parser_parse_buf (CROMParser * a_this, } /** - * cr_om_parser_simply_parse_buf: - *@a_buf: the css2 in memory buffer. - *@a_len: the length of the in memory buffer. - *@a_enc: the encoding of the in memory buffer. - *@a_result: out parameter. The resulting css2 style sheet. - * *The simpler way to parse an in memory css2 buffer. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_buf the css2 in memory buffer. + *@param a_len the length of the in memory buffer. + *@param a_enc the encoding of the in memory buffer. + *@param a_result out parameter. The resulting css2 style sheet. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_om_parser_simply_parse_buf (const guchar * a_buf, @@ -904,18 +903,16 @@ cr_om_parser_simply_parse_buf (const guchar * a_buf, } /** - * cr_om_parser_parse_file: - *@a_this: the current instance of the cssom parser. - *@a_file_uri: the uri of the file. - *(only local file paths are suppported so far) - *@a_enc: the encoding of the file. - *@a_result: out parameter. A pointer - *the build css object model. - * *Parses a css2 stylesheet contained *in a file. - * - * Returns CR_OK upon succesful completion, an error code otherwise. + *@param a_this the current instance of the cssom parser. + *@param a_file_uri the uri of the file. + *(only local file paths are suppported so far) + *@param a_enc the encoding of the file. + *@param a_result out parameter. A pointer + *the build css object model. + *@param CR_OK upon successfull completion, an error code + *otherwise. */ enum CRStatus cr_om_parser_parse_file (CROMParser * a_this, @@ -955,15 +952,12 @@ cr_om_parser_parse_file (CROMParser * a_this, } /** - * cr_om_parser_simply_parse_file: - *@a_file_path: the css2 local file path. - *@a_enc: the file encoding. - *@a_result: out parameter. The returned css stylesheet. - *Must be freed by the caller using cr_stylesheet_destroy. - * *The simpler method to parse a css2 file. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_file_path the css2 local file path. + *@param a_enc the file encoding. + *@param a_result out parameter. The returned css stylesheet. + *Must be freed by the caller using cr_stylesheet_destroy. + *@return CR_OK upon successfull completion, an error code otherwise. *Note that this method uses cr_om_parser_parse_file() so both methods *have the same return values. */ @@ -993,18 +987,14 @@ cr_om_parser_simply_parse_file (const guchar * a_file_path, } /** - * cr_om_parser_parse_paths_to_cascade: - *@a_this: the current instance of #CROMParser - *@a_author_path: the path to the author stylesheet - *@a_user_path: the path to the user stylesheet - *@a_ua_path: the path to the User Agent stylesheet - *@a_encoding: the encoding of the sheets. - *@a_result: out parameter. The resulting cascade if the parsing - *was okay - * *Parses three sheets located by their paths and build a cascade - * - *Returns CR_OK upon successful completion, an error code otherwise + *@param a_this the current instance of #CROMParser + *@param a_author_path the path to the author stylesheet + *@param a_user_path the path to the user stylesheet + *@param a_ua_path the path to the User Agent stylesheet + *@param a_result out parameter. The resulting cascade if the parsing + *was okay + *@return CR_OK upon successful completion, an error code otherwise */ enum CRStatus cr_om_parser_parse_paths_to_cascade (CROMParser * a_this, @@ -1024,7 +1014,7 @@ cr_om_parser_parse_paths_to_cascade (CROMParser * a_this, g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); - memset (sheets, 0, sizeof (CRStyleSheet*) * 3); + memset (sheets, 0, sizeof (sheets)); paths[0] = (guchar *) a_author_path; paths[1] = (guchar *) a_user_path; paths[2] = (guchar *) a_ua_path; @@ -1053,17 +1043,13 @@ cr_om_parser_parse_paths_to_cascade (CROMParser * a_this, } /** - * cr_om_parser_simply_parse_paths_to_cascade: - *@a_author_path: the path to the author stylesheet - *@a_user_path: the path to the user stylesheet - *@a_ua_path: the path to the User Agent stylesheet - *@a_encoding: the encoding of the sheets. - *@a_result: out parameter. The resulting cascade if the parsing - *was okay - * *Parses three sheets located by their paths and build a cascade - * - *Returns CR_OK upon successful completion, an error code otherwise + *@param a_author_path the path to the author stylesheet + *@param a_user_path the path to the user stylesheet + *@param a_ua_path the path to the User Agent stylesheet + *@param a_result out parameter. The resulting cascade if the parsing + *was okay + *@return CR_OK upon successful completion, an error code otherwise */ enum CRStatus cr_om_parser_simply_parse_paths_to_cascade (const guchar * a_author_path, @@ -1094,10 +1080,8 @@ cr_om_parser_simply_parse_paths_to_cascade (const guchar * a_author_path, } /** - * cr_om_parser_destroy: - *@a_this: the current instance of #CROMParser. - * *Destructor of the #CROMParser. + *@param a_this the current instance of #CROMParser. */ void cr_om_parser_destroy (CROMParser * a_this) diff --git a/src/cr-om-parser.h b/src/cr-om-parser.h index 13d35b1..4fc6301 100644 --- a/src/cr-om-parser.h +++ b/src/cr-om-parser.h @@ -22,7 +22,7 @@ */ /* - *$Id$ + *$Id: cr-om-parser.h,v 1.9 2004/01/29 22:05:14 dodji Exp $ */ #ifndef __CR_OM_PARSER_H__ diff --git a/src/cr-parser.c b/src/cr-parser.c index 0fa1ffa..5b0a56f 100644 --- a/src/cr-parser.c +++ b/src/cr-parser.c @@ -24,8 +24,7 @@ */ /** - *@CRParser: - * + *@file *The definition of the #CRParser class. */ @@ -42,7 +41,7 @@ *===================================== * *One must keep in mind - *that css UA must comply with two syntaxes. + *that css UA must comply with two syntax. * *1/the specific syntax that defines the css language *for a given level of specificatin (e.g css2 syntax @@ -137,9 +136,8 @@ struct _CRParserPriv { #define CHARS_TAB_SIZE 12 /** - * IS_NUM: - *@a_char: the char to test. *return TRUE if the character is a number ([0-9]), FALSE otherwise + *@param a_char the char to test. */ #define IS_NUM(a_char) (((a_char) >= '0' && (a_char) <= '9')?TRUE:FALSE) @@ -163,18 +161,16 @@ if ((status) != CR_OK) \ } /** - * CHECK_PARSING_STATUS_ERR: - *@a_this: the current instance of #CRParser . - *@a_status: the status to check. Is of type enum #CRStatus. - *@a_is_exception: in case of error, if is TRUE, the status + *same as CHECK_PARSING_STATUS() but this one pushes an error + *on the parser error stack when an error arises. + *@param a_this the current instance of #CRParser . + *@param a_status the status to check. Is of type enum #CRStatus. + *@param a_is_exception in case of error, if is TRUE, the status *is set to CR_PARSING_ERROR before goto error. If is false, the *real low level status is kept and will be returned by the *upper level function that called this macro. Usally,this must *be set to FALSE. * - *same as CHECK_PARSING_STATUS() but this one pushes an error - *on the parser error stack when an error arises. - * */ #define CHECK_PARSING_STATUS_ERR(a_this, a_status, a_is_exception,\ a_err_msg, a_err_status) \ @@ -413,9 +409,7 @@ static enum CRStatus static CRParserError * cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status) { - CRParserError *result = NULL; - - result = g_try_malloc (sizeof (CRParserError)); + CRParserError *result = (CRParserError *)g_try_malloc (sizeof (CRParserError)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); @@ -444,7 +438,7 @@ cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg) g_free (a_this->msg); } - a_this->msg = g_strdup (a_msg); + a_this->msg = (guchar *)g_strdup ((gchar *)a_msg); } /** @@ -511,7 +505,7 @@ cr_parser_error_destroy (CRParserError * a_this) *@param a_this the current instance of #CRParser. *@param a_msg the error message. *@param a_status the error status. - *@return CR_OK upon successfull completion, an error code otherwise. + *@return CR_OK upon successful completion, an error code otherwise. */ static enum CRStatus cr_parser_push_error (CRParser * a_this, @@ -553,7 +547,7 @@ cr_parser_push_error (CRParser * a_this, } /** - *Dumps the error stack on stdout. + *Dumps the error stack using g_printerr. *@param a_this the current instance of #CRParser. *@param a_clear_errs whether to clear the error stack *after the dump or not. @@ -609,13 +603,11 @@ cr_parser_clear_errors (CRParser * a_this) } /** - * cr_parser_try_to_skip_spaces_and_comments: - *@a_this: the current instance of #CRParser. - * *Same as cr_parser_try_to_skip_spaces() but this one skips *spaces and comments. * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser * a_this) @@ -733,7 +725,7 @@ cr_parser_parse_stylesheet_core (CRParser * a_this) error: cr_parser_push_error - (a_this, "could not recognize next production", CR_ERROR); + (a_this, (guchar *)"could not recognize next production", CR_ERROR); cr_parser_dump_err_stack (a_this, TRUE); @@ -1329,7 +1321,7 @@ cr_parser_parse_attribute_selector (CRParser * a_this, CRInputPos init_pos; CRToken *token = NULL; CRAttrSel *result = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && a_sel, CR_BAD_PARAM_ERROR); @@ -1491,9 +1483,6 @@ cr_parser_parse_property (CRParser * a_this, } /** - * cr_parser_parse_term: - *@a_term: out parameter. The successfully parsed term. - * *Parses a "term" as defined in the css2 spec, appendix D.1: *term ::= unary_operator? [NUMBER S* | PERCENTAGE S* | LENGTH S* | *EMS S* | EXS S* | ANGLE S* | TIME S* | FREQ S* | function ] | @@ -1501,7 +1490,8 @@ cr_parser_parse_property (CRParser * a_this, * *TODO: handle parsing of 'RGB' * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_term out parameter. The successfully parsed term. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term) @@ -1512,7 +1502,7 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term) CRTerm *param = NULL; CRToken *token = NULL; CRString *func_name = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && a_term, CR_BAD_PARAM_ERROR); @@ -1646,17 +1636,15 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term) } /** - * cr_parser_parse_simple_selector: - *@a_this: the "this pointer" of the current instance of #CRParser. - *@a_sel: out parameter. Is set to the successfully parsed simple - *selector. - * *Parses a "simple_selector" as defined by the css2 spec in appendix D.1 : *element_name? [ HASH | class | attrib | pseudo ]* S* *and where pseudo is: *pseudo ::= ':' [ IDENT | FUNCTION S* IDENT S* ')' ] * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@Param a_this the "this pointer" of the current instance of #CRParser. + *@param a_sel out parameter. Is set to the successfully parsed simple + *selector. + *@return CR_OK upon successfull completion, an error code otherwise. */ static enum CRStatus cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel) @@ -1686,12 +1674,16 @@ cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel) if (token && token->type == DELIM_TK && token->u.unichar == '*') { - sel->type_mask |= UNIVERSAL_SELECTOR; + int comb = (int)sel->type_mask | (int) UNIVERSAL_SELECTOR; + sel->type_mask = (enum SimpleSelectorType)comb; + //sel->type_mask |= UNIVERSAL_SELECTOR; sel->name = cr_string_new_from_string ("*"); found_sel = TRUE; } else if (token && token->type == IDENT_TK) { sel->name = token->u.str; - sel->type_mask |= TYPE_SELECTOR; + int comb = (int)sel->type_mask | (int) TYPE_SELECTOR; + sel->type_mask = (enum SimpleSelectorType)comb; + //sel->type_mask |= TYPE_SELECTOR; token->u.str = NULL; found_sel = TRUE; } else { @@ -1912,18 +1904,16 @@ cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel) } /** - * cr_parser_parse_simple_sels: - *@a_this: the this pointer of the current instance of #CRParser. - *@a_start: a pointer to the - *first chararcter of the successfully parsed - *string. - *@a_end: a pointer to the last character of the successfully parsed - *string. - * *Parses a "selector" as defined by the css2 spec in appendix D.1: *selector ::= simple_selector [ combinator simple_selector ]* * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the this pointer of the current instance of #CRParser. + *@param a_start a pointer to the + *first chararcter of the successfully parsed + *string. + *@param a_end a pointer to the last character of the successfully parsed + *string. + *@return CR_OK upon successfull completion, an error code otherwise. */ static enum CRStatus cr_parser_parse_simple_sels (CRParser * a_this, @@ -1948,7 +1938,7 @@ cr_parser_parse_simple_sels (CRParser * a_this, for (;;) { guint32 next_char = 0; - enum Combinator comb = 0; + int comb = 0; sel = NULL; @@ -1971,7 +1961,7 @@ cr_parser_parse_simple_sels (CRParser * a_this, break; if (comb && sel) { - sel->combinator = comb; + sel->combinator = (enum Combinator)comb; comb = 0; } if (sel) { @@ -1990,14 +1980,11 @@ cr_parser_parse_simple_sels (CRParser * a_this, } /** - * cr_parser_parse_selector: - *@a_this: the current instance of #CRParser. - *@a_selector: the parsed list of comma separated - *selectors. - * *Parses a comma separated list of selectors. - * - *Returns CR_OK upon successful completion, an error + *@param a_this the current instance of #CRParser. + *@param a_selector the parsed list of comma separated + *selectors. + *@return CR_OK upon successful completion, an error *code otherwise. */ static enum CRStatus @@ -2111,17 +2098,16 @@ cr_parser_parse_selector (CRParser * a_this, } /** - * cr_parser_parse_function: - *@a_this: the "this pointer" of the current instance of #CRParser. - * - *@a_func_name: out parameter. The parsed function name - *@a_expr: out parameter. The successfully parsed term. - * *Parses a "function" as defined in css spec at appendix D.1: *function ::= FUNCTION S* expr ')' S* *FUNCTION ::= ident'(' * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of + *#CRParser. + * + *@param a_func_name out parameter. The parsed function name + *@param a_expr out parameter. The successfully parsed term. + *@return CR_OK upon successfull completion, an error code otherwise. */ static enum CRStatus cr_parser_parse_function (CRParser * a_this, @@ -2199,15 +2185,13 @@ cr_parser_parse_function (CRParser * a_this, } /** - * cr_parser_parse_uri: - *@a_this: the current instance of #CRParser. - *@a_str: the successfully parsed url. - * *Parses an uri as defined by the css spec [4.1.1]: * URI ::= url\({w}{string}{w}\) * |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\) * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@param a_str the successfully parsed url. + *@return CR_OK upon successfull completion, an error code otherwise. */ static enum CRStatus cr_parser_parse_uri (CRParser * a_this, CRString ** a_str) @@ -2224,21 +2208,19 @@ cr_parser_parse_uri (CRParser * a_this, CRString ** a_str) } /** - * cr_parser_parse_string: - *@a_this: the current instance of #CRParser. - *@a_start: out parameter. Upon successfull completion, - *points to the beginning of the string, points to an undefined value - *otherwise. - *@a_end: out parameter. Upon successfull completion, points to - *the beginning of the string, points to an undefined value otherwise. - * *Parses a string type as defined in css spec [4.1.1]: * *string ::= {string1}|{string2} *string1 ::= \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" *string2 ::= \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@param a_start out parameter. Upon successfull completion, + *points to the beginning of the string, points to an undefined value + *otherwise. + *@param a_end out parameter. Upon successfull completion, points to + *the beginning of the string, points to an undefined value otherwise. + *@return CR_OK upon successfull completion, an error code otherwise. */ static enum CRStatus cr_parser_parse_string (CRParser * a_this, CRString ** a_str) @@ -2329,7 +2311,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) CHECK_PARSING_STATUS (status, TRUE); if (token && token->type == CHARSET_SYM_TK) { - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token); CHECK_PARSING_STATUS (status, TRUE); @@ -2405,7 +2387,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) if (token && token->type == IMPORT_SYM_TK) { GList *media_list = NULL; CRString *import_string = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token); @@ -2463,7 +2445,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 (cur->data); + cr_string_destroy ((CRString *)cur->data); } } @@ -2703,7 +2685,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) } cr_parser_push_error - (a_this, "could not recognize next production", CR_ERROR); + (a_this, (guchar *)"could not recognize next production", CR_ERROR); if (PRIVATE (a_this)->sac_handler && PRIVATE (a_this)->sac_handler->unrecoverable_error) { @@ -2738,24 +2720,23 @@ cr_parser_parse_stylesheet (CRParser * a_this) ****************************************/ /** - * cr_parser_new: - * @a_tknzr: the tokenizer to use for the parsing. - * *Creates a new parser to parse data *coming the input stream given in parameter. - * - *Returns the newly created instance of #CRParser, + *@param a_input the input stream of the parser. + *Note that the newly created parser will ref + *a_input and unref it when parsing reaches the + *end of the input stream. + *@return the newly created instance of #CRParser, *or NULL if an error occured. */ CRParser * cr_parser_new (CRTknzr * a_tknzr) { - CRParser *result = NULL; enum CRStatus status = CR_OK; - result = g_malloc0 (sizeof (CRParser)); + CRParser *result = (CRParser *)g_malloc0 (sizeof (CRParser)); - PRIVATE (result) = g_malloc0 (sizeof (CRParserPriv)); + PRIVATE (result) = (CRParserPriv *)g_malloc0 (sizeof (CRParserPriv)); if (a_tknzr) { status = cr_parser_set_tknzr (result, a_tknzr); @@ -2767,18 +2748,15 @@ cr_parser_new (CRTknzr * a_tknzr) } /** - * cr_parser_new_from_buf: - *@a_buf: the buffer to parse. - *@a_len: the length of the data in the buffer. - *@a_enc: the encoding of the input buffer a_buf. - *@a_free_buf: if set to TRUE, a_buf will be freed + *Instanciates a new parser from a memory buffer. + *@param a_buf the buffer to parse. + *@param a_len the length of the data in the buffer. + *@param a_enc the encoding of the input buffer a_buf. + *@param a_free_buf if set to TRUE, a_buf will be freed *during the destruction of the newly built instance *of #CRParser. If set to FALSE, it is up to the caller to *eventually free it. - * - *Instanciates a new parser from a memory buffer. - * - *Returns the newly built parser, or NULL if an error arises. + *@return the newly built parser, or NULL if an error arises. */ CRParser * cr_parser_new_from_buf (guchar * a_buf, @@ -2789,7 +2767,7 @@ cr_parser_new_from_buf (guchar * a_buf, CRParser *result = NULL; CRInput *input = NULL; - g_return_val_if_fail (a_buf && a_len, NULL); + g_return_val_if_fail (a_buf, NULL); input = cr_input_new_from_buf (a_buf, a_len, a_enc, a_free_buf); g_return_val_if_fail (input, NULL); @@ -2803,12 +2781,6 @@ cr_parser_new_from_buf (guchar * a_buf, return result; } -/** - * cr_parser_new_from_input: - * @a_input: the parser input stream to use. - * - * Returns a newly built parser input. - */ CRParser * cr_parser_new_from_input (CRInput * a_input) { @@ -2826,13 +2798,6 @@ cr_parser_new_from_input (CRInput * a_input) return result; } -/** - * cr_parser_new_from_file: - * @a_file_uri: the uri of the file to parse. - * @a_enc: the file encoding to use. - * - * Returns the newly built parser. - */ CRParser * cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc) { @@ -2851,13 +2816,10 @@ cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc) } /** - * cr_parser_set_sac_handler: - *@a_this: the "this pointer" of the current instance of #CRParser. - *@a_handler: the handler to set. - * *Sets a SAC document handler to the parser. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@param a_handler the handler to set. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler) @@ -2875,14 +2837,11 @@ cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler) } /** - * cr_parser_get_sac_handler: - *@a_this: the "this pointer" of the current instance of - *#CRParser. - *@a_handler: out parameter. The returned handler. - * *Gets the SAC document handler. - * - *Returns CR_OK upon successfull completion, an error code + *@param a_this the "this pointer" of the current instance of + *#CRParser. + *@param a_handler out parameter. The returned handler. + *@return CR_OK upon successfull completion, an error code *otherwise. */ enum CRStatus @@ -2896,13 +2855,10 @@ cr_parser_get_sac_handler (CRParser * a_this, CRDocHandler ** a_handler) } /** - * cr_parser_set_default_sac_handler: - *@a_this: a pointer to the current instance of #CRParser. - * *Sets the SAC handler associated to the current instance *of #CRParser to the default SAC handler. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this a pointer to the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_set_default_sac_handler (CRParser * a_this) @@ -2926,13 +2882,6 @@ cr_parser_set_default_sac_handler (CRParser * a_this) return status; } -/** - * cr_parser_set_use_core_grammar: - * @a_this: the current instance of #CRParser. - * @a_use_core_grammar: where to parse against the css core grammar. - * - * Returns CR_OK upon succesful completion, an error code otherwise. - */ enum CRStatus cr_parser_set_use_core_grammar (CRParser * a_this, gboolean a_use_core_grammar) @@ -2944,15 +2893,8 @@ cr_parser_set_use_core_grammar (CRParser * a_this, return CR_OK; } -/** - * cr_parser_get_use_core_grammar: - * @a_this: the current instance of #CRParser. - * @a_use_core_grammar: wether to use the core grammar or not. - * - * Returns CR_OK upon succesful completion, an error code otherwise. - */ enum CRStatus -cr_parser_get_use_core_grammar (CRParser const * a_this, +cr_parser_get_use_core_grammar (CRParser * a_this, gboolean * a_use_core_grammar) { g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); @@ -2963,15 +2905,11 @@ cr_parser_get_use_core_grammar (CRParser const * a_this, } /** - * cr_parser_parse_file: - *@a_this: a pointer to the current instance of #CRParser. - *@a_file_uri: the uri to the file to load. For the time being, - *@a_enc: the encoding of the file to parse. - *only local files are supported. - * *Parses a the given in parameter. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this a pointer to the current instance of #CRParser. + *@param a_file_uri the uri to the file to load. For the time being, + *only local files are supported. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_file (CRParser * a_this, @@ -2996,16 +2934,9 @@ cr_parser_parse_file (CRParser * a_this, } /** - * cr_parser_parse_expr: - * @a_this: the current instance of #CRParser. - * @a_expr: out parameter. the parsed expression. - * *Parses an expression as defined by the css2 spec in appendix *D.1: *expr: term [ operator term ]* - * - * - * Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) @@ -3027,7 +2958,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) CHECK_PARSING_STATUS (status, FALSE); for (;;) { - guchar operator = 0; + guchar operatr = 0; status = cr_tknzr_peek_byte (PRIVATE (a_this)->tknzr, 1, &next_byte); @@ -3047,7 +2978,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) } if (next_byte == '/' || next_byte == ',') { - READ_NEXT_BYTE (a_this, &operator); + READ_NEXT_BYTE (a_this, &operatr); } cr_parser_try_to_skip_spaces_and_comments (a_this); @@ -3059,7 +2990,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) break; } - switch (operator) { + switch (operatr) { case '/': expr2->the_operator = DIVIDE; break; @@ -3072,7 +3003,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) expr = cr_term_append_term (expr, expr2); expr2 = NULL; - operator = 0; + operatr = 0; nb_terms++; } @@ -3102,17 +3033,13 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr) } /** - * cr_parser_parse_prio: - *@a_this: the current instance of #CRParser. - *@a_prio: a string representing the priority. - *Today, only "!important" is returned as only this - *priority is defined by css2. - * *Parses a declaration priority as defined by *the css2 grammar in appendix C: *prio: IMPORTANT_SYM S* - * - * Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@param a_prio a string representing the priority. + *Today, only "!important" is returned as only this + *priority is defined by css2. */ enum CRStatus cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio) @@ -3151,19 +3078,17 @@ cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio) } /** - * cr_parser_parse_declaration: - *@a_this: the "this pointer" of the current instance of #CRParser. - *@a_property: the successfully parsed property. The caller - * *must* free the returned pointer. - *@a_expr: the expression that represents the attribute value. - *The caller *must* free the returned pointer. - * *TODO: return the parsed priority, so that *upper layers can take benefit from it. *Parses a "declaration" as defined by the css2 spec in appendix D.1: *declaration ::= [property ':' S* expr prio?]? * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@param a_property the successfully parsed property. The caller + * *must* free the returned pointer. + *@param a_expr the expression that represents the attribute value. + *The caller *must* free the returned pointer. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_declaration (CRParser * a_this, @@ -3189,7 +3114,7 @@ cr_parser_parse_declaration (CRParser * a_this, CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - "while parsing declaration: next property is malformed", + (guchar *)"while parsing declaration: next property is malformed", CR_SYNTAX_ERROR); READ_NEXT_CHAR (a_this, &cur_char); @@ -3198,7 +3123,7 @@ cr_parser_parse_declaration (CRParser * a_this, status = CR_PARSING_ERROR; cr_parser_push_error (a_this, - "while parsing declaration: this char must be ':'", + (guchar *)"while parsing declaration: this char must be ':'", CR_SYNTAX_ERROR); goto error; } @@ -3209,7 +3134,7 @@ cr_parser_parse_declaration (CRParser * a_this, CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - "while parsing declaration: next expression is malformed", + (guchar *)"while parsing declaration: next expression is malformed", CR_SYNTAX_ERROR); cr_parser_try_to_skip_spaces_and_comments (a_this); @@ -3250,14 +3175,11 @@ cr_parser_parse_declaration (CRParser * a_this, } /** - * cr_parser_parse_statement_core: - *@a_this: the current instance of #CRParser. - * *Parses a statement as defined by the css core grammar in *chapter 4.1 of the css2 spec. *statement : ruleset | at-rule; - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_statement_core (CRParser * a_this) @@ -3309,9 +3231,6 @@ cr_parser_parse_statement_core (CRParser * a_this) } /** - * cr_parser_parse_ruleset: - *@a_this: the "this pointer" of the current instance of #CRParser. - * *Parses a "ruleset" as defined in the css2 spec at appendix D.1. *ruleset ::= selector [ ',' S* selector ]* *'{' S* declaration? [ ';' S* declaration? ]* '}' S*; @@ -3320,8 +3239,8 @@ cr_parser_parse_statement_core (CRParser * a_this) *callbacks whenever it encounters some specific constructions. *See the documentation of #CRDocHandler (the SAC handler) to know *when which SAC handler is called. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_ruleset (CRParser * a_this) @@ -3336,7 +3255,6 @@ cr_parser_parse_ruleset (CRParser * a_this) CRSelector *selector = NULL; gboolean start_selector = FALSE, is_important = FALSE; - CRParsingLocation end_parsing_location; g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); @@ -3349,7 +3267,7 @@ cr_parser_parse_ruleset (CRParser * a_this) ENSURE_PARSING_COND_ERR (a_this, cur_char == '{', - "while parsing rulset: current char should be '{'", + (guchar *)"while parsing rulset: current char should be '{'", CR_SYNTAX_ERROR); if (PRIVATE (a_this)->sac_handler @@ -3413,7 +3331,7 @@ cr_parser_parse_ruleset (CRParser * a_this) } CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, - "while parsing ruleset: next construction should be a declaration", + (guchar *)"while parsing ruleset: next construction should be a declaration", CR_SYNTAX_ERROR); for (;;) { @@ -3451,14 +3369,12 @@ cr_parser_parse_ruleset (CRParser * a_this) end_of_ruleset: cr_parser_try_to_skip_spaces_and_comments (a_this); - cr_parser_get_parsing_location (a_this, &end_parsing_location); READ_NEXT_CHAR (a_this, &cur_char); ENSURE_PARSING_COND_ERR (a_this, cur_char == '}', - "while parsing rulset: current char must be a '}'", + (guchar *)"while parsing rulset: current char must be a '}'", CR_SYNTAX_ERROR); - selector->location = end_parsing_location; if (PRIVATE (a_this)->sac_handler && PRIVATE (a_this)->sac_handler->end_selector) { PRIVATE (a_this)->sac_handler->end_selector @@ -3515,29 +3431,29 @@ cr_parser_parse_ruleset (CRParser * a_this) } /** - * cr_parser_parse_import: - *@a_this: the "this pointer" of the current instance + *Parses an 'import' declaration as defined in the css2 spec + *in appendix D.1: + * + *import ::= + *@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* + * + *@param a_this the "this pointer" of the current instance *of #CRParser. - *@a_media_list: out parameter. A linked list of + * + *@param a_medium_list out parameter. A linked list of *#CRString *Each CRString is a string that contains *a 'medium' declaration part of the successfully *parsed 'import' declaration. - *@a_import_string: out parameter. + * + *@param a_import_string out parameter. *A string that contains the 'import *string". The import string can be either an uri (if it starts with *the substring "uri(") or a any other css2 string. Note that * *a_import_string must be initially set to NULL or else, this function *will return CR_BAD_PARAM_ERROR. - *@a_location: the location (line, column) where the import has been parsed * - *Parses an 'import' declaration as defined in the css2 spec - *in appendix D.1: - * - *import ::= - *\@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* - * - *Returns CR_OK upon sucessfull completion, an error code otherwise. + *@return CR_OK upon sucessfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_import (CRParser * a_this, @@ -3662,7 +3578,7 @@ cr_parser_parse_import (CRParser * a_this, */ for (cur = *a_media_list; cur; cur = cur->next) { if (cur->data) { - cr_string_destroy (cur->data); + cr_string_destroy ((CRString *)cur->data); } } @@ -3686,19 +3602,16 @@ cr_parser_parse_import (CRParser * a_this, } /** - * cr_parser_parse_media: - *@a_this: the "this pointer" of the current instance of #CRParser. - * *Parses a 'media' declaration as specified in the css2 spec at *appendix D.1: * - *media ::= \@media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* + *media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* * *Note that this function calls the required sac handlers during the parsing *to notify media productions. See #CRDocHandler to know the callback called - *during \@media parsing. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *during @media parsing. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_media (CRParser * a_this) @@ -3710,7 +3623,7 @@ cr_parser_parse_media (CRParser * a_this) cur_char = 0; CRString *medium = NULL; GList *media_list = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this), @@ -3816,7 +3729,7 @@ cr_parser_parse_media (CRParser * a_this) GList *cur = NULL; for (cur = media_list; cur; cur = cur->next) { - cr_string_destroy (cur->data); + cr_string_destroy ((CRString *)cur->data); } g_list_free (media_list); @@ -3844,7 +3757,7 @@ cr_parser_parse_media (CRParser * a_this) GList *cur = NULL; for (cur = media_list; cur; cur = cur->next) { - cr_string_destroy (cur->data); + cr_string_destroy ((CRString *)cur->data); } g_list_free (media_list); @@ -3857,18 +3770,15 @@ cr_parser_parse_media (CRParser * a_this) } /** - * cr_parser_parse_page: - *@a_this: the "this pointer" of the current instance of #CRParser. - * - *Parses '\@page' rule as specified in the css2 spec in appendix D.1: + *Parses '@page' rule as specified in the css2 spec in appendix D.1: *page ::= PAGE_SYM S* IDENT? pseudo_page? S* *'{' S* declaration [ ';' S* declaration ]* '}' S* * *This function also calls the relevant SAC handlers whenever it *encounters a construction that must *be reported to the calling application. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_page (CRParser * a_this) @@ -3881,7 +3791,7 @@ cr_parser_parse_page (CRParser * a_this) *page_pseudo_class = NULL, *property = NULL; gboolean important = TRUE; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); @@ -4108,18 +4018,16 @@ cr_parser_parse_page (CRParser * a_this) } /** - * cr_parser_parse_charset: - *@a_this: the "this pointer" of the current instance of #CRParser. - *@a_value: out parameter. The actual parsed value of the charset - *declararation. Note that for safety check reasons, *a_value must be - *set to NULL. - *@a_charset_sym_location: the parsing location of the charset rule - * *Parses a charset declaration as defined implictly by the css2 spec in *appendix D.1: *charset ::= CHARSET_SYM S* STRING S* ';' * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the "this pointer" of the current instance of #CRParser. + *@param a_value out parameter. The actual parsed value of the charset + *declararation. Note that for safety check reasons, *a_value must be + *set to NULL. + *@param a_charset_sym_location the parsing location of + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_charset (CRParser * a_this, CRString ** a_value, @@ -4199,18 +4107,14 @@ cr_parser_parse_charset (CRParser * a_this, CRString ** a_value, } /** - * cr_parser_parse_font_face: - *@a_this: the current instance of #CRParser. - * - *Parses the "\@font-face" rule specified in the css1 spec in + *Parses the "@font-face" rule specified in the css1 spec in *appendix D.1: * *font_face ::= FONT_FACE_SYM S* *'{' S* declaration [ ';' S* declaration ]* '}' S* * *This function will call SAC handlers whenever it is necessary. - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_font_face (CRParser * a_this) @@ -4223,7 +4127,7 @@ cr_parser_parse_font_face (CRParser * a_this) gboolean important = FALSE; guint32 next_char = 0, cur_char = 0; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); @@ -4360,14 +4264,11 @@ cr_parser_parse_font_face (CRParser * a_this) } /** - * cr_parser_parse: - *@a_this: the current instance of #CRParser. - * *Parses the data that comes from the *input previously associated to the current instance of *#CRParser. - * - *Returns CR_OK upon succesful completion, an error code otherwise. + *@param a_this the current instance of #CRParser. + *@return CR_OK ; */ enum CRStatus cr_parser_parse (CRParser * a_this) @@ -4386,13 +4287,6 @@ cr_parser_parse (CRParser * a_this) return status; } -/** - * cr_parser_set_tknzr: - * @a_this: the current instance of #CRParser; - * @a_tknzr: the new tokenizer. - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr) { @@ -4411,13 +4305,10 @@ cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr) } /** - * cr_parser_get_tknzr: - *@a_this: the current instance of #CRParser - *@a_tknzr: out parameter. The returned tokenizer - * *Getter of the parser's underlying tokenizer - * - *Returns CR_OK upon succesful completion, an error code + *@param a_this the current instance of #CRParser + *@param a_tknzr out parameter. The returned tokenizer + *@return CR_OK upon succesful completion, an error code *otherwise */ enum CRStatus @@ -4431,17 +4322,14 @@ cr_parser_get_tknzr (CRParser * a_this, CRTknzr ** a_tknzr) } /** - * cr_parser_get_parsing_location: - *@a_this: the current instance of #CRParser - *@a_loc: the parsing location to get. - * *Gets the current parsing location. - * - *Returns CR_OK upon succesful completion, an error code + *@param a_this the current instance of #CRParser + *@param a_loc the parsing location to get. + *@return CR_OK upon succesful completion, an error code *otherwise. */ enum CRStatus -cr_parser_get_parsing_location (CRParser const *a_this, +cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) { g_return_val_if_fail (a_this @@ -4453,15 +4341,12 @@ cr_parser_get_parsing_location (CRParser const *a_this, } /** - * cr_parser_parse_buf: - *@a_this: the current instance of #CRparser - *@a_buf: the input buffer - *@a_len: the length of the input buffer - *@a_enc: the encoding of the buffer - * *Parses a stylesheet from a buffer - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRparser + *@param a_buf the input buffer + *@param a_len the length of the input buffer + *@param a_enc the encoding of the buffer + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_parser_parse_buf (CRParser * a_this, @@ -4487,12 +4372,10 @@ cr_parser_parse_buf (CRParser * a_this, } /** - * cr_parser_destroy: - *@a_this: the current instance of #CRParser to - *destroy. - * *Destroys the current instance *of #CRParser. + *@param a_this the current instance of #CRParser to + *destroy. */ void cr_parser_destroy (CRParser * a_this) diff --git a/src/cr-parser.h b/src/cr-parser.h index 6dce943..1534afb 100644 --- a/src/cr-parser.h +++ b/src/cr-parser.h @@ -68,7 +68,7 @@ enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ; enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ; -enum CRStatus cr_parser_get_parsing_location (CRParser const *a_this, CRParsingLocation *a_loc) ; +enum CRStatus cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) ; enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ; @@ -81,7 +81,7 @@ enum CRStatus cr_parser_get_sac_handler (CRParser *a_this, enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this, gboolean a_use_core_grammar) ; -enum CRStatus cr_parser_get_use_core_grammar (CRParser const *a_this, +enum CRStatus cr_parser_get_use_core_grammar (CRParser *a_this, gboolean *a_use_core_grammar) ; enum CRStatus cr_parser_parse (CRParser *a_this) ; diff --git a/src/cr-parsing-location.c b/src/cr-parsing-location.c index 4fe4acc..38a75a6 100644 --- a/src/cr-parsing-location.c +++ b/src/cr-parsing-location.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -25,25 +25,21 @@ #include "cr-parsing-location.h" /** - *@CRParsingLocation: - * + *@file *Definition of the #CRparsingLocation class. */ /** - * cr_parsing_location_new: *Instanciates a new parsing location. - * - *Returns the newly instanciated #CRParsingLocation. + *@return the newly instanciated #CRParsingLocation. *Must be freed by cr_parsing_location_destroy() */ CRParsingLocation * cr_parsing_location_new (void) { - CRParsingLocation * result = NULL ; - - result = g_try_malloc (sizeof (CRParsingLocation)) ; + CRParsingLocation *result = + (CRParsingLocation *)g_try_malloc (sizeof (CRParsingLocation)) ; if (!result) { cr_utils_trace_info ("Out of memory error") ; return NULL ; @@ -53,12 +49,9 @@ cr_parsing_location_new (void) } /** - * cr_parsing_location_init: - *@a_this: the current instance of #CRParsingLocation. - * *Initializes the an instance of #CRparsingLocation. - * - *Returns CR_OK upon succesful completion, an error code otherwise. + *@param a_this the current instance of #CRParsingLocation. + *@return CR_OK upon */ enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) @@ -70,19 +63,16 @@ cr_parsing_location_init (CRParsingLocation *a_this) } /** - * cr_parsing_location_copy: - *@a_to: the destination of the copy. - *Must be allocated by the caller. - *@a_from: the source of the copy. - * *Copies an instance of CRParsingLocation into another one. - * - *Returns CR_OK upon succesful completion, an error code + *@param a_to the destination of the copy. + *Must be allocated by the caller. + *@param a_from the source of the copy. + *@return CR_OK upon succesful completion, an error code *otherwise. */ enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to, - CRParsingLocation const *a_from) + CRParsingLocation *a_from) { g_return_val_if_fail (a_to && a_from, CR_BAD_PARAM_ERROR) ; @@ -91,26 +81,24 @@ cr_parsing_location_copy (CRParsingLocation *a_to, } /** - * cr_parsing_location_to_string: - *@a_this: the current instance of #CRParsingLocation. - *@a_mask: a bitmap that defines which parts of the + *@param a_this the current instance of #CRParsingLocation. + *@param a_mask a bitmap that defines which parts of the *parsing location are to be serialized (line, column or byte offset) - * - *Returns the serialized string or NULL in case of an error. + *@return the serialized string or NULL in case of an error. */ gchar * -cr_parsing_location_to_string (CRParsingLocation const *a_this, +cr_parsing_location_to_string (CRParsingLocation *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 = DUMP_LINE | DUMP_COLUMN | DUMP_BYTE_OFFSET ; + a_mask = (enum CRParsingLocationSerialisationMask) + ((int)DUMP_LINE | (int)DUMP_COLUMN | (int)DUMP_BYTE_OFFSET) ; } - result =g_string_new (NULL) ; + GString *result = (GString *)g_string_new (NULL) ; if (!result) return NULL ; if (a_mask & DUMP_LINE) { @@ -134,14 +122,8 @@ cr_parsing_location_to_string (CRParsingLocation const *a_this, return str ; } -/** - * cr_parsing_location_dump: - * @a_this: current instance of #CRParsingLocation - * @a_mask: the serialization mask. - * @a_fp: the file pointer to dump the parsing location to. - */ void -cr_parsing_location_dump (CRParsingLocation const *a_this, +cr_parsing_location_dump (CRParsingLocation *a_this, enum CRParsingLocationSerialisationMask a_mask, FILE *a_fp) { @@ -157,11 +139,9 @@ cr_parsing_location_dump (CRParsingLocation const *a_this, } /** - * cr_parsing_location_destroy: - *@a_this: the current instance of #CRParsingLocation. Must - *have been allocated with cr_parsing_location_new(). - * *Destroys the current instance of #CRParsingLocation + *@param a_this the current instance of #CRParsingLocation. Must + *have been allocated with cr_parsing_location_new(). */ void cr_parsing_location_destroy (CRParsingLocation *a_this) diff --git a/src/cr-parsing-location.h b/src/cr-parsing-location.h index b8064a5..877c050 100644 --- a/src/cr-parsing-location.h +++ b/src/cr-parsing-location.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -54,11 +54,11 @@ CRParsingLocation * cr_parsing_location_new (void) ; enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) ; enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to, - CRParsingLocation const *a_from) ; + CRParsingLocation *a_from) ; -gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this, +gchar * cr_parsing_location_to_string (CRParsingLocation *a_this, enum CRParsingLocationSerialisationMask a_mask) ; -void cr_parsing_location_dump (CRParsingLocation const *a_this, +void cr_parsing_location_dump (CRParsingLocation *a_this, enum CRParsingLocationSerialisationMask a_mask, FILE *a_fp) ; diff --git a/src/cr-prop-list.c b/src/cr-prop-list.c index 0ce57fa..0768379 100644 --- a/src/cr-prop-list.c +++ b/src/cr-prop-list.c @@ -41,15 +41,13 @@ static CRPropList *cr_prop_list_allocate (void); static CRPropList * cr_prop_list_allocate (void) { - CRPropList *result = NULL; - - result = g_try_malloc (sizeof (CRPropList)); + CRPropList *result = (CRPropList *)g_try_malloc (sizeof (CRPropList)); if (!result) { cr_utils_trace_info ("could not allocate CRPropList"); return NULL; } memset (result, 0, sizeof (CRPropList)); - PRIVATE (result) = g_try_malloc (sizeof (CRPropListPriv)); + PRIVATE (result) = (CRPropListPriv *)g_try_malloc (sizeof (CRPropListPriv)); if (!result) { cr_utils_trace_info ("could not allocate CRPropListPriv"); g_free (result); @@ -64,13 +62,10 @@ cr_prop_list_allocate (void) ***************/ /** - * cr_prop_list_append: - *@a_this: the current instance of #CRPropList - *@a_to_append: the property list to append - * *Appends a property list to the current one. - * - *Returns the resulting prop list, or NULL if an error + *@param a_this the current instance of #CRPropList + *@param a_to_append the property list to append + *@return the resulting prop list, or NULL if an error *occured */ CRPropList * @@ -94,14 +89,12 @@ cr_prop_list_append (CRPropList * a_this, CRPropList * a_to_append) } /** - * cr_prop_list_append2: *Appends a pair of prop/declaration to *the current prop list. - *@a_this: the current instance of #CRPropList - *@a_prop: the property to consider - *@a_decl: the declaration to consider - * - *Returns the resulting property list, or NULL in case + *@param a_this the current instance of #CRPropList + *@param a_prop the property to consider + *@param a_decl the declaration to consider + *@return the resulting property list, or NULL in case *of an error. */ CRPropList * @@ -125,12 +118,9 @@ cr_prop_list_append2 (CRPropList * a_this, } /** - * cr_prop_list_prepend: - *@a_this: the current instance of #CRPropList - *@a_to_prepend: the new list to prepend. - * *Prepends a list to the current list - *Returns the new properties list. + *@param a_this the current instance of #CRPropList + *@param the new list to prepend. */ CRPropList * cr_prop_list_prepend (CRPropList * a_this, CRPropList * a_to_prepend) @@ -151,39 +141,32 @@ cr_prop_list_prepend (CRPropList * a_this, CRPropList * a_to_prepend) } /** - * cr_prop_list_prepend2: - *@a_this: the current instance of #CRPropList - *@a_prop_name: property name to append - *@a_decl: the property value to append. - * - *Prepends a propertie to a list of properties - * - *Returns the new property list. + *Prepends a list to the current list + *@param a_this the current instance of #CRPropList + *@param the new list to prepend. */ CRPropList * cr_prop_list_prepend2 (CRPropList * a_this, - CRString * a_prop_name, CRDeclaration * a_decl) + CRString * a_prop, CRDeclaration * a_decl) { CRPropList *list = NULL, *result = NULL; g_return_val_if_fail (a_this && PRIVATE (a_this) - && a_prop_name && a_decl, NULL); + && a_prop && a_decl, NULL); list = cr_prop_list_allocate (); g_return_val_if_fail (list, NULL); - PRIVATE (list)->prop = a_prop_name; + PRIVATE (list)->prop = a_prop; PRIVATE (list)->decl = a_decl; result = cr_prop_list_prepend (a_this, list); return result; } /** - * cr_prop_list_set_prop: - *@a_this: the current instance of #CRPropList - *@a_prop: the property to set - * *Sets the property of a CRPropList + *@param a_this the current instance of #CRPropList + *@param a_prop the property to set */ enum CRStatus cr_prop_list_set_prop (CRPropList * a_this, CRString * a_prop) @@ -196,18 +179,15 @@ cr_prop_list_set_prop (CRPropList * a_this, CRString * a_prop) } /** - * cr_prop_list_get_prop: - *@a_this: the current instance of #CRPropList - *@a_prop: out parameter. The returned property - * *Getter of the property associated to the current instance *of #CRPropList - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRPropList + *@param a_prop out parameter. The returned property + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus -cr_prop_list_get_prop (CRPropList const * a_this, CRString ** a_prop) +cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_prop, CR_BAD_PARAM_ERROR); @@ -216,13 +196,6 @@ cr_prop_list_get_prop (CRPropList const * a_this, CRString ** a_prop) return CR_OK; } -/** - * cr_prop_list_set_decl: - * @a_this: the current instance of #CRPropList - * @a_decl: the new property value. - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus cr_prop_list_set_decl (CRPropList * a_this, CRDeclaration * a_decl) { @@ -233,15 +206,8 @@ cr_prop_list_set_decl (CRPropList * a_this, CRDeclaration * a_decl) return CR_OK; } -/** - * cr_prop_list_get_decl: - * @a_this: the current instance of #CRPropList - * @a_decl: out parameter. The property value - * - * Returns CR_OK upon successful completion. - */ enum CRStatus -cr_prop_list_get_decl (CRPropList const * a_this, CRDeclaration ** a_decl) +cr_prop_list_get_decl (CRPropList * a_this, CRDeclaration ** a_decl) { g_return_val_if_fail (a_this && PRIVATE (a_this) && a_decl, CR_BAD_PARAM_ERROR); @@ -251,15 +217,12 @@ cr_prop_list_get_decl (CRPropList const * a_this, CRDeclaration ** a_decl) } /** - * cr_prop_list_lookup_prop: - *@a_this: the current instance of #CRPropList - *@a_prop: the property to lookup - *@a_prop_list: out parameter. The property/declaration - *pair found (if and only if the function returned code if CR_OK) - * *Lookup a given property/declaration pair - * - *Returns CR_OK if a prop/decl pair has been found, + *@param a_this the current instance of #CRPropList + *@param a_prop the property to lookup + *@param a_prop_list out parameter. The property/declaration + *pair found (if and only if the function returned code if CR_OK) + *@return CR_OK if a prop/decl pair has been found, *CR_VALUE_NOT_FOUND_ERROR if not, or an error code if something *bad happens. */ @@ -296,12 +259,11 @@ cr_prop_list_lookup_prop (CRPropList * a_this, } /** - * cr_prop_list_get_next: - *@a_this: the current instance of CRPropList - * *Gets the next prop/decl pair in the list - * - *Returns the next prop/declaration pair of the list, + *@param a_this the current instance of CRPropList + *@param the next prop/decl pair, or NULL if we + *reached the end of the list. + *@return the next prop/declaration pair of the list, *or NULL if we reached end of list (or if an error occurs) */ CRPropList * @@ -313,12 +275,11 @@ cr_prop_list_get_next (CRPropList * a_this) } /** - * cr_prop_list_get_prev: - *@a_this: the current instance of CRPropList - * *Gets the previous prop/decl pair in the list - * - *Returns the previous prop/declaration pair of the list, + *@param a_this the current instance of CRPropList + *@param the previous prop/decl pair, or NULL if we + *reached the end of the list. + *@return the previous prop/declaration pair of the list, *or NULL if we reached end of list (or if an error occurs) */ CRPropList * @@ -330,13 +291,10 @@ cr_prop_list_get_prev (CRPropList * a_this) } /** - * cr_prop_list_unlink: - *@a_this: the current list of prop/decl pairs - *@a_pair: the prop/decl pair to unlink. - * *Unlinks a prop/decl pair from the list - * - *Returns the new list or NULL in case of an error. + *@param a_this the current list of prop/decl pairs + *@param a_pair the prop/decl pair to unlink. + *@return the new list or NULL in case of an error. */ CRPropList * cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair) @@ -372,10 +330,6 @@ cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair) return a_this; } -/** - * cr_prop_list_destroy: - * @a_this: the current instance of #CRPropList - */ void cr_prop_list_destroy (CRPropList * a_this) { diff --git a/src/cr-prop-list.h b/src/cr-prop-list.h index 797ba43..a003be2 100644 --- a/src/cr-prop-list.h +++ b/src/cr-prop-list.h @@ -53,7 +53,7 @@ CRPropList * cr_prop_list_prepend2 (CRPropList *a_this, enum CRStatus cr_prop_list_set_prop (CRPropList *a_this, CRString *a_prop) ; -enum CRStatus cr_prop_list_get_prop (CRPropList const *a_this, +enum CRStatus cr_prop_list_get_prop (CRPropList *a_this, CRString **a_prop) ; enum CRStatus cr_prop_list_lookup_prop (CRPropList *a_this, @@ -67,7 +67,7 @@ CRPropList * cr_prop_list_get_prev (CRPropList *a_this) ; enum CRStatus cr_prop_list_set_decl (CRPropList *a_this, CRDeclaration *a_decl); -enum CRStatus cr_prop_list_get_decl (CRPropList const *a_this, +enum CRStatus cr_prop_list_get_decl (CRPropList *a_this, CRDeclaration **a_decl) ; CRPropList * cr_prop_list_unlink (CRPropList *a_this, diff --git a/src/cr-pseudo.c b/src/cr-pseudo.c index a46e69e..abb4f9b 100644 --- a/src/cr-pseudo.c +++ b/src/cr-pseudo.c @@ -24,51 +24,37 @@ #include "cr-pseudo.h" /** - *@CRPseudo: + *@file *The definition of the #CRPseudo class. */ /** - * cr_pseudo_new: *Constructor of the #CRPseudo class. - * - *Returns the newly build instance. + *@return the newly build instance. */ CRPseudo * cr_pseudo_new (void) { - CRPseudo *result = NULL; - - result = g_malloc0 (sizeof (CRPseudo)); + CRPseudo *result = (CRPseudo *)g_malloc0 (sizeof (CRPseudo)); return result; } -/** - * cr_pseudo_to_string: - * @a_this: the current instance of #CRPseud. - * - * Returns the serialized pseudo. Caller must free the returned - * string using g_free(). - */ guchar * -cr_pseudo_to_string (CRPseudo const * a_this) +cr_pseudo_to_string (CRPseudo * a_this) { guchar *result = NULL; - GString *str_buf = NULL; g_return_val_if_fail (a_this, NULL); - str_buf = g_string_new (NULL); + GString *str_buf = (GString *)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; - } - name = g_strndup (a_this->name->stryng->str, + gchar *name = g_strndup (a_this->name->stryng->str, a_this->name->stryng->len); if (name) { @@ -77,13 +63,12 @@ cr_pseudo_to_string (CRPseudo const * a_this) name = NULL; } } else if (a_this->type == FUNCTION_PSEUDO) { - guchar *name = NULL, - *arg = NULL; + gchar *arg = NULL; if (a_this->name == NULL) goto error; - name = g_strndup (a_this->name->stryng->str, + gchar *name = g_strndup (a_this->name->stryng->str, a_this->name->stryng->len); if (a_this->extra) { @@ -107,7 +92,7 @@ cr_pseudo_to_string (CRPseudo const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -120,15 +105,12 @@ cr_pseudo_to_string (CRPseudo const * a_this) } /** - * cr_pseudo_dump: - *@a_this: the current instance of pseudo - *@a_fp: the destination file pointer. - * *Dumps the pseudo to a file. - * + *@param a_this the current instance of pseudo + *@param a_fp the destination file pointer. */ void -cr_pseudo_dump (CRPseudo const * a_this, FILE * a_fp) +cr_pseudo_dump (CRPseudo * a_this, FILE * a_fp) { guchar *tmp_str = NULL; @@ -143,10 +125,8 @@ cr_pseudo_dump (CRPseudo const * a_this, FILE * a_fp) } /** - * cr_pseudo_destroy: - *@a_this: the current instance to destroy. - * *destructor of the #CRPseudo class. + *@param a_this the current instance to destroy. */ void cr_pseudo_destroy (CRPseudo * a_this) diff --git a/src/cr-pseudo.h b/src/cr-pseudo.h index 8917da4..6de6c9e 100644 --- a/src/cr-pseudo.h +++ b/src/cr-pseudo.h @@ -53,9 +53,9 @@ struct _CRPseudo CRPseudo * cr_pseudo_new (void) ; -guchar * cr_pseudo_to_string (CRPseudo const *a_this) ; +guchar * cr_pseudo_to_string (CRPseudo *a_this) ; -void cr_pseudo_dump (CRPseudo const *a_this, FILE *a_fp) ; +void cr_pseudo_dump (CRPseudo *a_this, FILE *a_fp) ; void cr_pseudo_destroy (CRPseudo *a_this) ; diff --git a/src/cr-rgb.c b/src/cr-rgb.c index 6313a58..893c208 100644 --- a/src/cr-rgb.c +++ b/src/cr-rgb.c @@ -29,169 +29,164 @@ #include "cr-parser.h" static CRRgb gv_standard_colors[] = { - {"aliceblue", 240, 248, 255, 0,}, - {"antiquewhite", 250, 235, 215, 0}, - {"aqua", 0, 255, 255, 0}, - {"aquamarine", 127, 255, 212, 0}, - {"azure", 240, 255, 255, 0}, - {"beige", 245, 245, 220, 0}, - {"bisque", 255, 228, 196, 0}, - {"black", 0, 0, 0, 0}, - {"blanchedalmond", 255, 235, 205, 0}, - {"blue", 0, 0, 255, 0}, - {"blueviolet", 138, 43, 226, 0}, - {"brown", 165, 42, 42, 0}, - {"burlywood", 222, 184, 135, 0}, - {"cadetblue", 95, 158, 160, 0}, - {"chartreuse", 127, 255, 0, 0}, - {"chocolate", 210, 105, 30, 0}, - {"coral", 255, 127, 80, 0}, - {"cornflowerblue", 100, 149, 237, 0}, - {"cornsilk", 255, 248, 220, 0}, - {"crimson", 220, 20, 60, 0}, - {"cyan", 0, 255, 255, 0}, - {"darkblue", 0, 0, 139, 0}, - {"darkcyan", 0, 139, 139, 0}, - {"darkgoldenrod", 184, 134, 11, 0}, - {"darkgray", 169, 169, 169, 0}, - {"darkgreen", 0, 100, 0, 0}, - {"darkgrey", 169, 169, 169, 0}, - {"darkkhaki", 189, 183, 107, 0}, - {"darkmagenta", 139, 0, 139, 0}, - {"darkolivegreen", 85, 107, 47, 0}, - {"darkorange", 255, 140, 0, 0}, - {"darkorchid", 153, 50, 204, 0}, - {"darkred", 139, 0, 0, 0}, - {"darksalmon", 233, 150, 122, 0}, - {"darkseagreen", 143, 188, 143, 0}, - {"darkslateblue", 72, 61, 139, 0}, - {"darkslategray", 47, 79, 79, 0}, - {"darkslategrey", 47, 79, 79, 0}, - {"darkturquoise", 0, 206, 209, 0}, - {"darkviolet", 148, 0, 211, 0}, - {"deeppink", 255, 20, 147, 0}, - {"deepskyblue", 0, 191, 255, 0}, - {"dimgray", 105, 105, 105, 0}, - {"dimgrey", 105, 105, 105, 0}, - {"dodgerblue", 30, 144, 255, 0}, - {"firebrick", 178, 34, 34, 0}, - {"floralwhite", 255, 250, 240, 0}, - {"forestgreen", 34, 139, 34, 0}, - {"fuchsia", 255, 0, 255, 0}, - {"gainsboro", 220, 220, 220, 0}, - {"ghostwhite", 248, 248, 255, 0}, - {"gold", 255, 215, 0, 0}, - {"goldenrod", 218, 165, 32, 0}, - {"gray", 128, 128, 128, 0}, - {"grey", 128, 128, 128, 0}, - {"green", 0, 128, 0, 0}, - {"greenyellow", 173, 255, 47, 0}, - {"honeydew", 240, 255, 240, 0}, - {"hotpink", 255, 105, 180, 0}, - {"indianred", 205, 92, 92, 0}, - {"indigo", 75, 0, 130, 0}, - {"ivory", 255, 255, 240, 0}, - {"khaki", 240, 230, 140, 0}, - {"lavender", 230, 230, 250, 0}, - {"lavenderblush", 255, 240, 245, 0}, - {"lawngreen", 124, 252, 0, 0}, - {"lemonchiffon", 255, 250, 205, 0}, - {"lightblue", 173, 216, 230, 0}, - {"lightcoral", 240, 128, 128, 0}, - {"lightcyan", 224, 255, 255, 0}, - {"lightgoldenrodyellow", 250, 250, 210, 0}, - {"lightgray", 211, 211, 211, 0}, - {"lightgreen", 144, 238, 144, 0}, - {"lightgrey", 211, 211, 211, 0}, - {"lightpink", 255, 182, 193, 0}, - {"lightsalmon", 255, 160, 122, 0}, - {"lightseagreen", 32, 178, 170, 0}, - {"lightskyblue", 135, 206, 250, 0}, - {"lightslategray", 119, 136, 153, 0}, - {"lightslategrey", 119, 136, 153, 0}, - {"lightsteelblue", 176, 196, 222, 0}, - {"lightyellow", 255, 255, 224, 0}, - {"lime", 0, 255, 0, 0}, - {"limegreen", 50, 205, 50, 0}, - {"linen", 250, 240, 230, 0}, - {"magenta", 255, 0, 255, 0}, - {"maroon", 128, 0, 0, 0}, - {"mediumaquamarine", 102, 205, 170, 0}, - {"mediumblue", 0, 0, 205, 0}, - {"mediumorchid", 186, 85, 211, 0}, - {"mediumpurple", 147, 112, 219, 0}, - {"mediumseagreen", 60, 179, 113, 0}, - {"mediumslateblue", 123, 104, 238, 0}, - {"mediumspringgreen", 0, 250, 154, 0}, - {"mediumturquoise", 72, 209, 204, 0}, - {"mediumvioletred", 199, 21, 133, 0}, - {"midnightblue", 25, 25, 112, 0}, - {"mintcream", 245, 255, 250, 0}, - {"mistyrose", 255, 228, 225, 0}, - {"moccasin", 255, 228, 181, 0}, - {"navajowhite", 255, 222, 173, 0}, - {"navy", 0, 0, 128, 0}, - {"oldlace", 253, 245, 230, 0}, - {"olive", 128, 128, 0, 0}, - {"olivedrab", 107, 142, 35, 0}, - {"orange", 255, 165, 0, 0}, - {"orangered", 255, 69, 0, 0}, - {"orchid", 218, 112, 214, 0}, - {"palegoldenrod", 238, 232, 170, 0}, - {"palegreen", 152, 251, 152, 0}, - {"paleturquoise", 175, 238, 238, 0}, - {"palevioletred", 219, 112, 147, 0}, - {"papayawhip", 255, 239, 213, 0}, - {"peachpuff", 255, 218, 185, 0}, - {"peru", 205, 133, 63, 0}, - {"pink", 255, 192, 203, 0}, - {"plum", 221, 160, 221, 0}, - {"powderblue", 176, 224, 230, 0}, - {"purple", 128, 0, 128, 0}, - {"red", 255, 0, 0, 0}, - {"rosybrown", 188, 143, 143, 0}, - {"royalblue", 65, 105, 225, 0}, - {"saddlebrown", 139, 69, 19, 0}, - {"salmon", 250, 128, 114, 0}, - {"sandybrown", 244, 164, 96, 0}, - {"seagreen", 46, 139, 87, 0}, - {"seashell", 255, 245, 238, 0}, - {"sienna", 160, 82, 45, 0}, - {"silver", 192, 192, 192, 0}, - {"skyblue", 135, 206, 235, 0}, - {"slateblue", 106, 90, 205, 0}, - {"slategray", 112, 128, 144, 0}, - {"slategrey", 112, 128, 144, 0}, - {"snow", 255, 250, 250, 0}, - {"springgreen", 0, 255, 127, 0}, - {"steelblue", 70, 130, 180, 0}, - {"tan", 210, 180, 140, 0}, - {"teal", 0, 128, 128, 0}, - {"thistle", 216, 191, 216, 0}, - {"tomato", 255, 99, 71, 0}, - {"turquoise", 64, 224, 208, 0}, - {"violet", 238, 130, 238, 0}, - {"wheat", 245, 222, 179, 0}, - {"white", 255, 255, 255, 0}, - {"whitesmoke", 245, 245, 245, 0,}, - {"yellow", 255, 255, 0, 0,}, - {"yellowgreen", 154, 205, 50, 0,}, - {"transparent", 255, 255, 255, 0, 0, 1} + {"aliceblue", 240, 248, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"antiquewhite", 250, 235, 215, FALSE, FALSE, FALSE, {0,0,0}}, + {"aqua", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"aquamarine", 127, 255, 212, FALSE, FALSE, FALSE, {0,0,0}}, + {"azure", 240, 255, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"beige", 245, 245, 220, FALSE, FALSE, FALSE, {0,0,0}}, + {"bisque", 255, 228, 196, FALSE, FALSE, FALSE, {0,0,0}}, + {"black", 0, 0, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"blanchedalmond", 255, 235, 205, FALSE, FALSE, FALSE, {0,0,0}}, + {"blue", 0, 0, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"blueviolet", 138, 43, 226, FALSE, FALSE, FALSE, {0,0,0}}, + {"brown", 165, 42, 42, FALSE, FALSE, FALSE, {0,0,0}}, + {"burlywood", 222, 184, 135, FALSE, FALSE, FALSE, {0,0,0}}, + {"cadetblue", 95, 158, 160, FALSE, FALSE, FALSE, {0,0,0}}, + {"chartreuse", 127, 255, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"chocolate", 210, 105, 30, FALSE, FALSE, FALSE, {0,0,0}}, + {"coral", 255, 127, 80, FALSE, FALSE, FALSE, {0,0,0}}, + {"cornflowerblue", 100, 149, 237, FALSE, FALSE, FALSE, {0,0,0}}, + {"cornsilk", 255, 248, 220, FALSE, FALSE, FALSE, {0,0,0}}, + {"crimson", 220, 20, 60, FALSE, FALSE, FALSE, {0,0,0}}, + {"cyan", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkblue", 0, 0, 139, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkcyan", 0, 139, 139, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkgoldenrod", 184, 134, 11, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkgray", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkgreen", 0, 100, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkgrey", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkkhaki", 189, 183, 107, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkmagenta", 139, 0, 139, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkolivegreen", 85, 107, 47, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkorange", 255, 140, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkorchid", 153, 50, 204, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkred", 139, 0, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"darksalmon", 233, 150, 122, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkseagreen", 143, 188, 143, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkslateblue", 72, 61, 139, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkslategray", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkslategrey", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkturquoise", 0, 206, 209, FALSE, FALSE, FALSE, {0,0,0}}, + {"darkviolet", 148, 0, 211, FALSE, FALSE, FALSE, {0,0,0}}, + {"deeppink", 255, 20, 147, FALSE, FALSE, FALSE, {0,0,0}}, + {"deepskyblue", 0, 191, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"dimgray", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}}, + {"dimgrey", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}}, + {"dodgerblue", 30, 144, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"firebrick", 178, 34, 34, FALSE, FALSE, FALSE, {0,0,0}}, + {"floralwhite", 255, 250, 240, FALSE, FALSE, FALSE, {0,0,0}}, + {"forestgreen", 34, 139, 34, FALSE, FALSE, FALSE, {0,0,0}}, + {"fuchsia", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"gainsboro", 220, 220, 220, FALSE, FALSE, FALSE, {0,0,0}}, + {"ghostwhite", 248, 248, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"gold", 255, 215, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"goldenrod", 218, 165, 32, FALSE, FALSE, FALSE, {0,0,0}}, + {"gray", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"grey", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"green", 0, 128, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"greenyellow", 173, 255, 47, FALSE, FALSE, FALSE, {0,0,0}}, + {"honeydew", 240, 255, 240, FALSE, FALSE, FALSE, {0,0,0}}, + {"hotpink", 255, 105, 180, FALSE, FALSE, FALSE, {0,0,0}}, + {"indianred", 205, 92, 92, FALSE, FALSE, FALSE, {0,0,0}}, + {"indigo", 75, 0, 130, FALSE, FALSE, FALSE, {0,0,0}}, + {"ivory", 255, 255, 240, FALSE, FALSE, FALSE, {0,0,0}}, + {"khaki", 240, 230, 140, FALSE, FALSE, FALSE, {0,0,0}}, + {"lavender", 230, 230, 250, FALSE, FALSE, FALSE, {0,0,0}}, + {"lavenderblush", 255, 240, 245, FALSE, FALSE, FALSE, {0,0,0}}, + {"lawngreen", 124, 252, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"lemonchiffon", 255, 250, 205, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightblue", 173, 216, 230, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightcoral", 240, 128, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightcyan", 224, 255, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightgoldenrodyellow", 250, 250, 210, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightgray", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightgreen", 144, 238, 144, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightgrey", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightpink", 255, 182, 193, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightsalmon", 255, 160, 122, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightseagreen", 32, 178, 170, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightskyblue", 135, 206, 250, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightslategray", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightslategrey", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightsteelblue", 176, 196, 222, FALSE, FALSE, FALSE, {0,0,0}}, + {"lightyellow", 255, 255, 224, FALSE, FALSE, FALSE, {0,0,0}}, + {"lime", 0, 255, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"limegreen", 50, 205, 50, FALSE, FALSE, FALSE, {0,0,0}}, + {"linen", 250, 240, 230, FALSE, FALSE, FALSE, {0,0,0}}, + {"magenta", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"maroon", 128, 0, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumaquamarine", 102, 205, 170, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumblue", 0, 0, 205, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumorchid", 186, 85, 211, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumpurple", 147, 112, 219, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumseagreen", 60, 179, 113, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumslateblue", 123, 104, 238, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumspringgreen", 0, 250, 154, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumturquoise", 72, 209, 204, FALSE, FALSE, FALSE, {0,0,0}}, + {"mediumvioletred", 199, 21, 133, FALSE, FALSE, FALSE, {0,0,0}}, + {"midnightblue", 25, 25, 112, FALSE, FALSE, FALSE, {0,0,0}}, + {"mintcream", 245, 255, 250, FALSE, FALSE, FALSE, {0,0,0}}, + {"mistyrose", 255, 228, 225, FALSE, FALSE, FALSE, {0,0,0}}, + {"moccasin", 255, 228, 181, FALSE, FALSE, FALSE, {0,0,0}}, + {"navajowhite", 255, 222, 173, FALSE, FALSE, FALSE, {0,0,0}}, + {"navy", 0, 0, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"oldlace", 253, 245, 230, FALSE, FALSE, FALSE, {0,0,0}}, + {"olive", 128, 128, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"olivedrab", 107, 142, 35, FALSE, FALSE, FALSE, {0,0,0}}, + {"orange", 255, 165, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"orangered", 255, 69, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"orchid", 218, 112, 214, FALSE, FALSE, FALSE, {0,0,0}}, + {"palegoldenrod", 238, 232, 170, FALSE, FALSE, FALSE, {0,0,0}}, + {"palegreen", 152, 251, 152, FALSE, FALSE, FALSE, {0,0,0}}, + {"paleturquoise", 175, 238, 238, FALSE, FALSE, FALSE, {0,0,0}}, + {"palevioletred", 219, 112, 147, FALSE, FALSE, FALSE, {0,0,0}}, + {"papayawhip", 255, 239, 213, FALSE, FALSE, FALSE, {0,0,0}}, + {"peachpuff", 255, 218, 185, FALSE, FALSE, FALSE, {0,0,0}}, + {"peru", 205, 133, 63, FALSE, FALSE, FALSE, {0,0,0}}, + {"pink", 255, 192, 203, FALSE, FALSE, FALSE, {0,0,0}}, + {"plum", 221, 160, 221, FALSE, FALSE, FALSE, {0,0,0}}, + {"powderblue", 176, 224, 230, FALSE, FALSE, FALSE, {0,0,0}}, + {"purple", 128, 0, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"red", 255, 0, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"rosybrown", 188, 143, 143, FALSE, FALSE, FALSE, {0,0,0}}, + {"royalblue", 65, 105, 225, FALSE, FALSE, FALSE, {0,0,0}}, + {"saddlebrown", 139, 69, 19, FALSE, FALSE, FALSE, {0,0,0}}, + {"salmon", 250, 128, 114, FALSE, FALSE, FALSE, {0,0,0}}, + {"sandybrown", 244, 164, 96, FALSE, FALSE, FALSE, {0,0,0}}, + {"seagreen", 46, 139, 87, FALSE, FALSE, FALSE, {0,0,0}}, + {"seashell", 255, 245, 238, FALSE, FALSE, FALSE, {0,0,0}}, + {"sienna", 160, 82, 45, FALSE, FALSE, FALSE, {0,0,0}}, + {"silver", 192, 192, 192, FALSE, FALSE, FALSE, {0,0,0}}, + {"skyblue", 135, 206, 235, FALSE, FALSE, FALSE, {0,0,0}}, + {"slateblue", 106, 90, 205, FALSE, FALSE, FALSE, {0,0,0}}, + {"slategray", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}}, + {"slategrey", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}}, + {"snow", 255, 250, 250, FALSE, FALSE, FALSE, {0,0,0}}, + {"springgreen", 0, 255, 127, FALSE, FALSE, FALSE, {0,0,0}}, + {"steelblue", 70, 130, 180, FALSE, FALSE, FALSE, {0,0,0}}, + {"tan", 210, 180, 140, FALSE, FALSE, FALSE, {0,0,0}}, + {"teal", 0, 128, 128, FALSE, FALSE, FALSE, {0,0,0}}, + {"thistle", 216, 191, 216, FALSE, FALSE, FALSE, {0,0,0}}, + {"tomato", 255, 99, 71, FALSE, FALSE, FALSE, {0,0,0}}, + {"turquoise", 64, 224, 208, FALSE, FALSE, FALSE, {0,0,0}}, + {"violet", 238, 130, 238, FALSE, FALSE, FALSE, {0,0,0}}, + {"wheat", 245, 222, 179, FALSE, FALSE, FALSE, {0,0,0}}, + {"white", 255, 255, 255, FALSE, FALSE, FALSE, {0,0,0}}, + {"whitesmoke", 245, 245, 245, FALSE, FALSE, FALSE, {0,0,0}}, + {"yellow", 255, 255, 0, FALSE, FALSE, FALSE, {0,0,0}}, + {"yellowgreen", 154, 205, 50, FALSE, FALSE, FALSE, {0,0,0}}, + {"transparent", 255, 255, 255, FALSE, FALSE, TRUE, {0,0,0}} }; /** - * cr_rgb_new: - * *The default constructor of #CRRgb. - * - *Returns the newly built instance of #CRRgb + *@return the newly built instance of #CRRgb */ CRRgb * cr_rgb_new (void) { - CRRgb *result = NULL; - - result = g_try_malloc (sizeof (CRRgb)); + CRRgb *result = (CRRgb *)g_try_malloc (sizeof (CRRgb)); if (result == NULL) { cr_utils_trace_info ("No more memory"); @@ -204,16 +199,13 @@ cr_rgb_new (void) } /** - * cr_rgb_new_with_vals: - *@a_red: the red component of the color. - *@a_green: the green component of the color. - *@a_blue: the blue component of the color. - *@a_unit: the unit of the rgb values. - *(either percentage or integer values) - * *A constructor of #CRRgb. - * - *Returns the newly built instance of #CRRgb. + *@param a_red the red component of the color. + *@param a_green the green component of the color. + *@param a_blue the blue component of the color. + *@param a_unit the unit of the rgb values. + *(either percentage or integer values) + *@return the newly built instance of #CRRgb. */ CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green, @@ -234,21 +226,16 @@ cr_rgb_new_with_vals (gulong a_red, gulong a_green, } /** - * cr_rgb_to_string: - *@a_this: the instance of #CRRgb to serialize. - * *Serializes the rgb into a zero terminated string. - * - *Returns the zero terminated string containing the serialized + *@param a_this the instance of #CRRgb to serialize. + *@return the zero terminated string containing the serialized *rgb. MUST BE FREED by the caller using g_free(). */ guchar * -cr_rgb_to_string (CRRgb const * a_this) +cr_rgb_to_string (CRRgb * a_this) { - guchar *result = NULL; - GString *str_buf = NULL; - - str_buf = g_string_new (NULL); + gchar *result = NULL; + GString *str_buf = (GString *)g_string_new (NULL); g_return_val_if_fail (str_buf, NULL); if (a_this->is_percentage == 1) { @@ -276,20 +263,18 @@ cr_rgb_to_string (CRRgb const * a_this) g_string_free (str_buf, FALSE); } - return result; + return (guchar *)result; } /** - * cr_rgb_dump: - *@a_this: the "this pointer" of - *the current instance of #CRRgb. - *@a_fp: the destination file pointer. - * *Dumps the current instance of #CRRgb *to a file. + *@param a_this the "this pointer" of + *the current instance of #CRRgb. + *@param a_fp the destination file pointer. */ void -cr_rgb_dump (CRRgb const * a_this, FILE * a_fp) +cr_rgb_dump (CRRgb * a_this, FILE * a_fp) { guchar *str = NULL; @@ -305,13 +290,10 @@ cr_rgb_dump (CRRgb const * a_this, FILE * a_fp) } /** - * cr_rgb_compute_from_percentage: - *@a_this: the current instance of #CRRgb - * *If the rgb values are expressed in percentage, *compute their real value. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRRgb + *@return */ enum CRStatus cr_rgb_compute_from_percentage (CRRgb * a_this) @@ -328,15 +310,12 @@ cr_rgb_compute_from_percentage (CRRgb * a_this) } /** - * cr_rgb_set: - *@a_this: the current instance of #CRRgb. - *@a_red: the red value. - *@a_green: the green value. - *@a_blue: the blue value. - * *Sets rgb values to the RGB. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current instance of #CRRgb. + *@param a_red the red value. + *@param a_green the green value. + *@param a_blue the blue value. + *@return CR_OK upon successful completion, an error code *otherwise. */ enum CRStatus @@ -361,14 +340,11 @@ cr_rgb_set (CRRgb * a_this, gulong a_red, } /** - * cr_rgb_set_to_inherit: - *@a_this: the current instance of #CRRgb - * *sets the value of the rgb to inherit. *Look at the css spec from chapter 6.1 to 6.2 to understand *the meaning of "inherit". + *@param a_this the current instance of #CRRgb * - * Returns CR_OK upon succesful completion, an error code otherwise. */ enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) @@ -380,15 +356,8 @@ cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) return CR_OK ; } -/** - * cr_rgb_is_set_to_inherit: - * - * @a_this: the current instance of #CRRgb. - * - * Returns TRUE if the rgb is set to the value "inherit", FALSE otherwise. - */ gboolean -cr_rgb_is_set_to_inherit (CRRgb const *a_this) +cr_rgb_is_set_to_inherit (CRRgb *a_this) { g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; @@ -396,18 +365,15 @@ cr_rgb_is_set_to_inherit (CRRgb const *a_this) } /** - * cr_rgb_is_set_to_transparent: - *@a_this: the current instance of - *#CRRgb - * *Tests if the the rgb is set to the *value "transparent" or not. - * - *Returns TRUE if the rgb has been set to + *@param a_this the current instance of + *#CRRgb + *@return TRUE if the rgb has been set to *transparent, FALSE otherwise. */ gboolean -cr_rgb_is_set_to_transparent (CRRgb const *a_this) +cr_rgb_is_set_to_transparent (CRRgb *a_this) { g_return_val_if_fail (a_this, FALSE) ; return a_this->is_transparent ; @@ -415,12 +381,9 @@ cr_rgb_is_set_to_transparent (CRRgb const *a_this) /** - * cr_rgb_set_to_transparent: - *@a_this: the current instance of #CRRgb - *@a_is_transparent: set to transparent or not. - * *Sets the rgb to the "transparent" value (or not) - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRRgb + *@param a_is_transparent set to transparent or not. */ enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, @@ -432,16 +395,13 @@ cr_rgb_set_to_transparent (CRRgb *a_this, } /** - * cr_rgb_set_from_rgb: - *@a_this: the current instance of #CRRgb. - *@a_rgb: the rgb to "copy" - * *Sets the rgb from an other one. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRRgb. + *@param a_rgb the rgb to "copy" + *@return CR_OK upon successful completion, an error code otherwise. */ enum CRStatus -cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb const * a_rgb) +cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb) { g_return_val_if_fail (a_this && a_rgb, CR_BAD_PARAM_ERROR); @@ -450,13 +410,6 @@ cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb const * a_rgb) return CR_OK; } -/** - * cr_rgb_set_from_name: - * @a_this: the current instance of #CRRgb - * @a_color_name: the color name - * - * Returns CR_OK upon successful completion, an error code otherwise. - */ enum CRStatus cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name) { @@ -465,14 +418,14 @@ cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name) g_return_val_if_fail (a_this && a_color_name, CR_BAD_PARAM_ERROR); - for (i = 0; i < G_N_ELEMENTS (gv_standard_colors); i++) { - if (!strcmp (a_color_name, gv_standard_colors[i].name)) { + for (i = 0; i < sizeof (gv_standard_colors); i++) { + if (!strcmp ((char *)a_color_name, gv_standard_colors[i].name)) { cr_rgb_set_from_rgb (a_this, &gv_standard_colors[i]); break; } } - if (i < G_N_ELEMENTS (gv_standard_colors)) + if (i < sizeof (gv_standard_colors)) status = CR_OK; else status = CR_UNKNOWN_TYPE_ERROR; @@ -480,13 +433,6 @@ cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name) return status; } -/** - * cr_rgb_set_from_hex_str: - * @a_this: the current instance of #CRRgb - * @a_hex: the hexadecimal value to set. - * - * Returns CR_OK upon successful completion. - */ enum CRStatus cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) { @@ -496,7 +442,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 (a_hex) == 3) { + if (strlen ((char *)a_hex) == 3) { for (i = 0; i < 3; i++) { if (a_hex[i] >= '0' && a_hex[i] <= '9') { colors[i] = a_hex[i] - '0'; @@ -511,7 +457,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) status = CR_UNKNOWN_TYPE_ERROR; } } - } else if (strlen (a_hex) == 6) { + } else if (strlen ((char *)a_hex) == 6) { for (i = 0; i < 6; i++) { if (a_hex[i] >= '0' && a_hex[i] <= '9') { colors[i / 2] <<= 4; @@ -542,19 +488,15 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) } /** - * cr_rgb_set_from_term: - *@a_this: the instance of #CRRgb to set - *@a_value: the terminal from which to set - * *Set the rgb from a terminal symbol - * - * Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the instance of #CRRgb to set + *@param a_value the terminal from which to set */ 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) { @@ -576,7 +518,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) } else { status = cr_rgb_set_from_name (a_this, - a_value->content.str->stryng->str) ; + (guchar *)a_value->content.str->stryng->str) ; } } else { cr_utils_trace_info @@ -589,7 +531,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, - a_value->content.str->stryng->str) ; + (guchar *)a_value->content.str->stryng->str) ; } else { cr_utils_trace_info ("a_value has NULL string value") ; @@ -602,7 +544,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) } enum CRStatus -cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) +cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) { g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR) ; @@ -612,11 +554,9 @@ cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) } /** - * cr_rgb_destroy: - *@a_this: the "this pointer" of the - *current instance of #CRRgb. - * *Destructor of #CRRgb. + *@param a_this the "this pointer" of the + *current instance of #CRRgb. */ void cr_rgb_destroy (CRRgb * a_this) @@ -626,16 +566,13 @@ cr_rgb_destroy (CRRgb * a_this) } /** - * cr_rgb_parse_from_buf: - *@a_str: a string that contains a color description - *@a_enc: the encoding of a_str - * *Parses a text buffer that contains a rgb color * - *Returns the parsed color, or NULL in case of error + *@param a_str a string that contains a color description + *@param a_enc the encoding of a_str + *@return the parsed color, or NULL in case of error */ -CRRgb * -cr_rgb_parse_from_buf (const guchar *a_str, +CRRgb *cr_rgb_parse_from_buf (const guchar *a_str, enum CREncoding a_enc) { enum CRStatus status = CR_OK ; @@ -645,7 +582,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 (a_str), + parser = cr_parser_new_from_buf ((guchar *)a_str, strlen ((char *)a_str), a_enc, FALSE) ; g_return_val_if_fail (parser, NULL); @@ -675,4 +612,6 @@ cleanup: } return result ; } + + diff --git a/src/cr-rgb.h b/src/cr-rgb.h index a127a44..50cec94 100644 --- a/src/cr-rgb.h +++ b/src/cr-rgb.h @@ -39,12 +39,12 @@ struct _CRRgb *Either NO_UNIT (integer) or *UNIT_PERCENTAGE (percentage). */ - const guchar *name ; + const gchar *name ; glong red ; glong green ; glong blue ; gboolean is_percentage ; - gboolean inherit ; + gboolean inherit ; gboolean is_transparent ; CRParsingLocation location ; } ; @@ -63,17 +63,17 @@ enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage) ; -enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ; +enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ; enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ; -gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ; +gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ; -gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ; +gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ; enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, gboolean a_is_transparent) ; -enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ; +enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ; enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ; @@ -83,9 +83,9 @@ struct _CRTerm; enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value); -guchar * cr_rgb_to_string (CRRgb const *a_this) ; +guchar * cr_rgb_to_string (CRRgb *a_this) ; -void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ; +void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ; void cr_rgb_destroy (CRRgb *a_this) ; diff --git a/src/cr-sel-eng.h b/src/cr-sel-eng.h index e64d133..1b025d8 100644 --- a/src/cr-sel-eng.h +++ b/src/cr-sel-eng.h @@ -30,9 +30,9 @@ #include "cr-style.h" #include "cr-prop-list.h" -#ifdef CROCO_HAVE_LIBXML2 +//#ifdef CROCO_HAVE_LIBXML2 #include <libxml/tree.h> -#endif +//#endif diff --git a/src/cr-selector.c b/src/cr-selector.c index a3603e3..d85b3ef 100644 --- a/src/cr-selector.c +++ b/src/cr-selector.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -25,22 +25,16 @@ #include "cr-parser.h" /** - * cr_selector_new: - * - *@a_simple_sel: the initial simple selector list - *of the current instance of #CRSelector. - * *Creates a new instance of #CRSelector. - * - *Returns the newly built instance of #CRSelector, or + *@param a_simple_sel the initial simple selector list + *of the current instance of #CRSelector. + *@return the newly built instance of #CRSelector, or *NULL in case of failure. */ CRSelector * cr_selector_new (CRSimpleSel * a_simple_sel) { - CRSelector *result = NULL; - - result = g_try_malloc (sizeof (CRSelector)); + CRSelector *result = (CRSelector *)g_try_malloc (sizeof (CRSelector)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -57,7 +51,8 @@ cr_selector_parse_from_buf (const guchar * a_char_buf, enum CREncoding a_enc) g_return_val_if_fail (a_char_buf, NULL); - parser = cr_parser_new_from_buf ((guchar*)a_char_buf, strlen (a_char_buf), + parser = cr_parser_new_from_buf ((guchar*)a_char_buf, + strlen ((char *)a_char_buf), a_enc, FALSE); g_return_val_if_fail (parser, NULL); @@ -65,14 +60,10 @@ cr_selector_parse_from_buf (const guchar * a_char_buf, enum CREncoding a_enc) } /** - * cr_selector_append: - * - *@a_this: the current instance of #CRSelector. - *@a_new: the instance of #CRSelector to be appended. - * *Appends a new instance of #CRSelector to the current selector list. - * - *Returns the new list. + *@param a_this the current instance of #CRSelector. + *@param a_new the instance of #CRSelector to be appended. + *@return the new list. */ CRSelector * cr_selector_append (CRSelector * a_this, CRSelector * a_new) @@ -93,14 +84,10 @@ cr_selector_append (CRSelector * a_this, CRSelector * a_new) } /** - * cr_selector_prepend: - * - *@a_this: the current instance of #CRSelector list. - *@a_new: the instance of #CRSelector. - * *Prepends an element to the #CRSelector list. - * - *Returns the new list. + *@param a_this the current instance of #CRSelector list. + *@param a_new the instance of #CRSelector. + *@return the new list. */ CRSelector * cr_selector_prepend (CRSelector * a_this, CRSelector * a_new) @@ -116,14 +103,10 @@ cr_selector_prepend (CRSelector * a_this, CRSelector * a_new) } /** - * cr_selector_append_simple_sel: - * - *@a_this: the current instance of #CRSelector. - *@a_simple_sel: the simple selector to append. - * *append a simple selector to the current #CRSelector list. - * - *Returns the new list or NULL in case of failure. + *@param a_this the current instance of #CRSelector. + *@param a_simple_sel the simple selector to append. + *@return the new list or NULL in case of failure. */ CRSelector * cr_selector_append_simple_sel (CRSelector * a_this, @@ -138,16 +121,15 @@ cr_selector_append_simple_sel (CRSelector * a_this, } guchar * -cr_selector_to_string (CRSelector const * a_this) +cr_selector_to_string (CRSelector * a_this) { guchar *result = NULL; - GString *str_buf = NULL; - str_buf = g_string_new (NULL); + GString *str_buf = (GString *)g_string_new (NULL); g_return_val_if_fail (str_buf, NULL); if (a_this) { - CRSelector const *cur = NULL; + CRSelector *cur = NULL; for (cur = a_this; cur; cur = cur->next) { if (cur->simple_sel) { @@ -161,7 +143,7 @@ cr_selector_to_string (CRSelector const * a_this) g_string_append (str_buf, ", "); - g_string_append (str_buf, tmp_str); + g_string_append (str_buf, (gchar *)tmp_str); g_free (tmp_str); tmp_str = NULL; @@ -171,7 +153,7 @@ cr_selector_to_string (CRSelector const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -180,15 +162,12 @@ cr_selector_to_string (CRSelector const * a_this) } /** - * cr_selector_dump: - * - *@a_this: the current instance of #CRSelector. - *@a_fp: the destination file. - * *Serializes the current instance of #CRSelector to a file. + *@param a_this the current instance of #CRSelector. + *@param a_fp the destination file. */ void -cr_selector_dump (CRSelector const * a_this, FILE * a_fp) +cr_selector_dump (CRSelector * a_this, FILE * a_fp) { guchar *tmp_buf = NULL; @@ -203,12 +182,9 @@ cr_selector_dump (CRSelector const * a_this, FILE * a_fp) } /** - * cr_selector_ref: - * - *@a_this: the current instance of #CRSelector. - * *Increments the ref count of the current instance *of #CRSelector. + *@param a_this the current instance of #CRSelector. */ void cr_selector_ref (CRSelector * a_this) @@ -219,16 +195,12 @@ cr_selector_ref (CRSelector * a_this) } /** - * cr_selector_unref: - * - *@a_this: the current instance of #CRSelector. - * *Decrements the ref count of the current instance of *#CRSelector. *If the ref count reaches zero, the current instance of *#CRSelector is destroyed. - * - *Returns TRUE if this function destroyed the current instance + *@param a_this the current instance of #CRSelector. + *@return TRUE if this function destroyed the current instance *of #CRSelector, FALSE otherwise. */ gboolean @@ -249,11 +221,8 @@ cr_selector_unref (CRSelector * a_this) } /** - * cr_selector_destroy: - * - *@a_this: the current instance of #CRSelector. - * *Destroys the selector list. + *@param a_this the current instance of #CRSelector. */ void cr_selector_destroy (CRSelector * a_this) diff --git a/src/cr-selector.h b/src/cr-selector.h index dd6a7f7..6bf7697 100644 --- a/src/cr-selector.h +++ b/src/cr-selector.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -80,9 +80,9 @@ CRSelector* cr_selector_append_simple_sel (CRSelector *a_this, CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ; -guchar * cr_selector_to_string (CRSelector const *a_this) ; +guchar * cr_selector_to_string (CRSelector *a_this) ; -void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ; +void cr_selector_dump (CRSelector *a_this, FILE *a_fp) ; void cr_selector_ref (CRSelector *a_this) ; diff --git a/src/cr-simple-sel.c b/src/cr-simple-sel.c index e8d57af..18dd340 100644 --- a/src/cr-simple-sel.c +++ b/src/cr-simple-sel.c @@ -26,18 +26,14 @@ #include "cr-simple-sel.h" /** - * cr_simple_sel_new: - * *The constructor of #CRSimpleSel. * - *Returns the new instance of #CRSimpleSel. + *@return the new instance of #CRSimpleSel. */ CRSimpleSel * cr_simple_sel_new (void) { - CRSimpleSel *result = NULL; - - result = g_try_malloc (sizeof (CRSimpleSel)); + CRSimpleSel *result = (CRSimpleSel *)g_try_malloc (sizeof (CRSimpleSel)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -48,14 +44,11 @@ cr_simple_sel_new (void) } /** - * cr_simple_sel_append_simple_sel: - * *Appends a simpe selector to the current list of simple selector. * - *@a_this: the this pointer of the current instance of #CRSimpleSel. - *@a_sel: the simple selector to append. - * - *Returns: the new list upon successfull completion, an error code otherwise. + *@param a_this the this pointer of the current instance of #CRSimpleSel. + *@param a_sel the simple selector to append. + *@return the new list upon successfull completion, an error code otherwise. */ CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel) @@ -76,14 +69,10 @@ cr_simple_sel_append_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel) } /** - * cr_simple_sel_prepend_simple_sel: - * - *@a_this: the this pointer of the current instance of #CRSimpleSel. - *@a_sel: the simple selector to prepend. - * *Prepends a simple selector to the current list of simple selectors. - * - *Returns the new list upon successfull completion, an error code otherwise. + *@param a_this the this pointer of the current instance of #CRSimpleSel. + *@param a_sel the simple selector to prepend. + *@return the new list upon successfull completion, an error code otherwise. */ CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel) @@ -100,19 +89,19 @@ cr_simple_sel_prepend_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel) } guchar * -cr_simple_sel_to_string (CRSimpleSel const * a_this) +cr_simple_sel_to_string (CRSimpleSel * a_this) { GString *str_buf = NULL; guchar *result = NULL; - CRSimpleSel const *cur = NULL; + CRSimpleSel *cur = NULL; g_return_val_if_fail (a_this, NULL); str_buf = g_string_new (NULL); for (cur = a_this; cur; cur = cur->next) { if (cur->name) { - guchar *str = g_strndup (cur->name->stryng->str, + gchar *str = g_strndup (cur->name->stryng->str, cur->name->stryng->len); if (str) { @@ -140,9 +129,8 @@ cr_simple_sel_to_string (CRSimpleSel const * a_this) } if (cur->add_sel) { - guchar *tmp_str = NULL; - tmp_str = cr_additional_sel_to_string (cur->add_sel); + gchar *tmp_str = (gchar *)cr_additional_sel_to_string (cur->add_sel); if (tmp_str) { g_string_append (str_buf, tmp_str); g_free (tmp_str); @@ -152,7 +140,7 @@ cr_simple_sel_to_string (CRSimpleSel const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -162,7 +150,7 @@ cr_simple_sel_to_string (CRSimpleSel const * a_this) guchar * -cr_simple_sel_one_to_string (CRSimpleSel const * a_this) +cr_simple_sel_one_to_string (CRSimpleSel * a_this) { GString *str_buf = NULL; guchar *result = NULL; @@ -171,7 +159,7 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this) str_buf = g_string_new (NULL); if (a_this->name) { - guchar *str = g_strndup (a_this->name->stryng->str, + gchar *str = g_strndup (a_this->name->stryng->str, a_this->name->stryng->len); if (str) { @@ -182,9 +170,8 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this) } if (a_this->add_sel) { - guchar *tmp_str = NULL; - tmp_str = cr_additional_sel_to_string (a_this->add_sel); + gchar *tmp_str = (gchar *)cr_additional_sel_to_string (a_this->add_sel); if (tmp_str) { g_string_append_printf (str_buf, "%s", tmp_str); @@ -194,7 +181,7 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -203,18 +190,16 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this) } /** - * cr_simple_sel_dump: - *@a_this: the current instance of #CRSimpleSel. - *@a_fp: the destination file pointer. - * *Dumps the selector to a file. *TODO: add the support of unicode in the dump. * - *Returns CR_OK upon successfull completion, an error code + *@param a_this the current instance of #CRSimpleSel. + *@param a_fp the destination file pointer. + *@return CR_OK upon successfull completion, an error code *otherwise. */ enum CRStatus -cr_simple_sel_dump (CRSimpleSel const * a_this, FILE * a_fp) +cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp) { guchar *tmp_str = NULL; @@ -233,20 +218,16 @@ cr_simple_sel_dump (CRSimpleSel const * a_this, FILE * a_fp) } /** - * cr_simple_sel_compute_specificity: - * - *@a_this: the current instance of #CRSimpleSel - * *Computes the selector (combinator separated list of simple selectors) *as defined in the css2 spec in chapter 6.4.3 - * - *Returns CR_OK upon successfull completion, an error code otherwise. + *@param a_this the current instance of #CRSimpleSel + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel * a_this) { - CRAdditionalSel const *cur_add_sel = NULL; - CRSimpleSel const *cur_sel = NULL; + CRAdditionalSel *cur_add_sel = NULL; + CRSimpleSel *cur_sel = NULL; gulong a = 0, b = 0, c = 0; @@ -293,12 +274,10 @@ cr_simple_sel_compute_specificity (CRSimpleSel * a_this) } /** - * cr_simple_sel_destroy: - * - *@a_this: the this pointer of the current instance of #CRSimpleSel. - * *The destructor of the current instance of *#CRSimpleSel. + *@param a_this the this pointer of the current instance of #CRSimpleSel. + * */ void cr_simple_sel_destroy (CRSimpleSel * a_this) diff --git a/src/cr-simple-sel.h b/src/cr-simple-sel.h index d8edc00..29033af 100644 --- a/src/cr-simple-sel.h +++ b/src/cr-simple-sel.h @@ -40,9 +40,9 @@ G_BEGIN_DECLS enum Combinator { NO_COMBINATOR, - COMB_WS,/*whitespace: descendent*/ - COMB_PLUS,/*'+': preceded by*/ - COMB_GT/*greater than ('>'): child*/ + COMB_WS,/*whitesape*/ + COMB_PLUS, + COMB_GT/*greater than*/ } ; enum SimpleSelectorType @@ -112,13 +112,13 @@ CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this, CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this, CRSimpleSel *a_sel) ; -guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ; +guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ; -guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ; +guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ; -enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ; +enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ; -enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel const *a_this) ; +enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ; enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ; diff --git a/src/cr-statement.c b/src/cr-statement.c index a1b8259..40df498 100644 --- a/src/cr-statement.c +++ b/src/cr-statement.c @@ -25,6 +25,8 @@ #include "cr-statement.h" #include "cr-parser.h" +#define UNUSED(_param) ((void)(_param)) + /** *@file *Definition of the #CRStatement class. @@ -36,11 +38,13 @@ static void cr_statement_clear (CRStatement * a_this); static void parse_font_face_start_font_face_cb (CRDocHandler * a_this, - CRParsingLocation *a_location) + CRParsingLocation * a_location) { CRStatement *stmt = NULL; enum CRStatus status = CR_OK; + UNUSED(a_location); + stmt = cr_statement_new_at_font_face_rule (NULL, NULL); g_return_if_fail (stmt); @@ -82,6 +86,8 @@ parse_font_face_property_cb (CRDocHandler * a_this, CRStatement *stmt = NULL; CRStatement **stmtptr = NULL; + UNUSED(a_important); + g_return_if_fail (a_this && a_name); stmtptr = &stmt; @@ -138,12 +144,14 @@ static void parse_page_start_page_cb (CRDocHandler * a_this, CRString * a_name, CRString * a_pseudo_page, - CRParsingLocation *a_location) + CRParsingLocation * a_location) { CRStatement *stmt = NULL; enum CRStatus status = CR_OK; CRString *page_name = NULL, *pseudo_name = NULL ; + UNUSED(a_location); + if (a_name) page_name = cr_string_dup (a_name) ; if (a_pseudo_page) @@ -217,6 +225,9 @@ parse_page_end_page_cb (CRDocHandler * a_this, CRStatement *stmt = NULL; CRStatement **stmtptr = NULL; + UNUSED(a_name); + UNUSED(a_pseudo_page); + stmtptr = &stmt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) stmtptr); g_return_if_fail (status == CR_OK && stmt); @@ -229,12 +240,14 @@ parse_page_end_page_cb (CRDocHandler * a_this, static void parse_at_media_start_media_cb (CRDocHandler * a_this, GList * a_media_list, - CRParsingLocation *a_location) + CRParsingLocation * a_location) { enum CRStatus status = CR_OK; CRStatement *at_media = NULL; GList *media_list = NULL; + UNUSED(a_location); + g_return_if_fail (a_this && a_this->priv); if (a_media_list) { @@ -367,6 +380,8 @@ parse_at_media_end_media_cb (CRDocHandler * a_this, CRStatement *at_media = NULL; CRStatement **at_media_ptr = NULL; + UNUSED(a_media_list); + g_return_if_fail (a_this && a_this->priv); at_media_ptr = &at_media; @@ -575,32 +590,27 @@ cr_statement_clear (CRStatement * a_this) } /** - * cr_statement_ruleset_to_string: - * - *@a_this: the current instance of #CRStatement - *@a_indent: the number of whitespace to use for indentation - * *Serializes the ruleset statement into a string - * - *Returns the newly allocated serialised string. Must be freed + *@param a_this the current instance of #CRStatement + *@param a_indent the number of whitespace to use for indentation + *@return the newly allocated serialised string. Must be freed *by the caller, using g_free(). */ static gchar * -cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent) +cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent) { - GString *stringue = NULL; gchar *tmp_str = NULL, *result = NULL; g_return_val_if_fail (a_this && a_this->type == RULESET_STMT, NULL); - stringue = g_string_new (NULL); + GString *stringue = (GString *)g_string_new (NULL); if (a_this->kind.ruleset->sel_list) { if (a_indent) cr_utils_dump_n_chars2 (' ', stringue, a_indent); - tmp_str = + tmp_str = (gchar *) cr_selector_to_string (a_this->kind.ruleset-> sel_list); if (tmp_str) { @@ -611,7 +621,7 @@ cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent) } g_string_append (stringue, " {\n"); if (a_this->kind.ruleset->decl_list) { - tmp_str = cr_declaration_list_to_string2 + tmp_str = (gchar *)cr_declaration_list_to_string2 (a_this->kind.ruleset->decl_list, a_indent + DECLARATION_INDENT_NB, TRUE); if (tmp_str) { @@ -638,19 +648,15 @@ cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent) /** - * cr_statement_font_face_rule_to_string: - * - *@a_this: the current instance of #CRStatement to consider - *It must be a font face rule statement. - *@a_indent: the number of white spaces of indentation. - * *Serializes a font face rule statement into a string. - * - *Returns the serialized string. Must be deallocated by the caller + *@param a_this the current instance of #CRStatement to consider + *It must be a font face rule statement. + *@param a_indent the number of white spaces of indentation. + *@return the serialized string. Must be deallocated by the caller *using g_free(). */ static gchar * -cr_statement_font_face_rule_to_string (CRStatement const * a_this, +cr_statement_font_face_rule_to_string (CRStatement * a_this, glong a_indent) { gchar *result = NULL, *tmp_str = NULL ; @@ -661,13 +667,13 @@ cr_statement_font_face_rule_to_string (CRStatement const * a_this, NULL); if (a_this->kind.font_face_rule->decl_list) { - stringue = g_string_new (NULL) ; + stringue = (GString *)g_string_new (NULL) ; g_return_val_if_fail (stringue, NULL) ; if (a_indent) cr_utils_dump_n_chars2 (' ', stringue, a_indent); g_string_append (stringue, "@font-face {\n"); - tmp_str = cr_declaration_list_to_string2 + tmp_str = (gchar *)cr_declaration_list_to_string2 (a_this->kind.font_face_rule->decl_list, a_indent + DECLARATION_INDENT_NB, TRUE) ; if (tmp_str) { @@ -688,17 +694,13 @@ cr_statement_font_face_rule_to_string (CRStatement const * a_this, /** - * cr_statement_charset_to_string: - * - *Serialises an \@charset statement into a string. - *@a_this: the statement to serialize. - *@a_indent: the number of indentation spaces - * - *Returns the serialized charset statement. Must be + *Serialises an @charset statement into a string. + *@param a_this the statement to serialize. + *@return the serialized charset statement. Must be *freed by the caller using g_free(). */ static gchar * -cr_statement_charset_to_string (CRStatement const *a_this, +cr_statement_charset_to_string (CRStatement *a_this, gulong a_indent) { gchar *str = NULL ; @@ -734,22 +736,18 @@ cr_statement_charset_to_string (CRStatement const *a_this, /** - * cr_statement_at_page_rule_to_string: - * *Serialises the at page rule statement into a string - *@a_this: the current instance of #CRStatement. Must - *be an "\@page" rule statement. - * - *Returns the serialized string. Must be freed by the caller + *@param a_this the current instance of #CRStatement. Must + *be an "@page" rule statement. + *@return the serialized string. Must be freed by the caller */ static gchar * -cr_statement_at_page_rule_to_string (CRStatement const *a_this, +cr_statement_at_page_rule_to_string (CRStatement *a_this, gulong a_indent) { - GString *stringue = NULL; gchar *result = NULL ; - stringue = g_string_new (NULL) ; + GString *stringue = (GString *)g_string_new (NULL) ; cr_utils_dump_n_chars2 (' ', stringue, a_indent) ; g_string_append (stringue, "@page"); @@ -770,7 +768,7 @@ cr_statement_at_page_rule_to_string (CRStatement const *a_this, if (a_this->kind.page_rule->decl_list) { gchar *str = NULL ; g_string_append (stringue, " {\n"); - str = cr_declaration_list_to_string2 + str = (gchar *)cr_declaration_list_to_string2 (a_this->kind.page_rule->decl_list, a_indent + DECLARATION_INDENT_NB, TRUE) ; if (str) { @@ -788,33 +786,33 @@ cr_statement_at_page_rule_to_string (CRStatement const *a_this, /** - *Serializes an \@media statement. + *Serializes an @media statement. *@param a_this the current instance of #CRStatement *@param a_indent the number of spaces of indentation. - *@return the serialized \@media statement. Must be freed + *@return the serialized @media statement. Must be freed *by the caller using g_free(). */ static gchar * -cr_statement_media_rule_to_string (CRStatement const *a_this, +cr_statement_media_rule_to_string (CRStatement *a_this, gulong a_indent) { gchar *str = NULL ; GString *stringue = NULL ; - GList const *cur = NULL; + GList *cur = NULL; g_return_val_if_fail (a_this->type == AT_MEDIA_RULE_STMT, NULL); if (a_this->kind.media_rule) { - stringue = g_string_new (NULL) ; + stringue = (GString *)g_string_new (NULL) ; cr_utils_dump_n_chars2 (' ', stringue, a_indent); g_string_append (stringue, "@media"); for (cur = a_this->kind.media_rule->media_list; cur; cur = cur->next) { if (cur->data) { - guchar *str = cr_string_dup2 - ((CRString const *) cur->data); + gchar *str = cr_string_dup2 + ((CRString *) cur->data); if (str) { if (cur->prev) { @@ -850,11 +848,11 @@ cr_statement_media_rule_to_string (CRStatement const *a_this, static gchar * -cr_statement_import_rule_to_string (CRStatement const *a_this, +cr_statement_import_rule_to_string (CRStatement *a_this, gulong a_indent) { GString *stringue = NULL ; - guchar *str = NULL; + gchar *str = NULL; g_return_val_if_fail (a_this && a_this->type == AT_IMPORT_RULE_STMT @@ -863,7 +861,7 @@ cr_statement_import_rule_to_string (CRStatement const *a_this, if (a_this->kind.import_rule->url && a_this->kind.import_rule->url->stryng) { - stringue = g_string_new (NULL) ; + stringue = (GString *)g_string_new (NULL) ; g_return_val_if_fail (stringue, NULL) ; str = g_strndup (a_this->kind.import_rule->url->stryng->str, a_this->kind.import_rule->url->stryng->len); @@ -878,12 +876,12 @@ cr_statement_import_rule_to_string (CRStatement const *a_this, return NULL; if (a_this->kind.import_rule->media_list) { - GList const *cur = NULL; + GList *cur = NULL; for (cur = a_this->kind.import_rule->media_list; cur; cur = cur->next) { if (cur->data) { - CRString const *crstr = cur->data; + CRString *crstr = (CRString *)cur->data; if (cur->prev) { g_string_append @@ -916,16 +914,12 @@ cr_statement_import_rule_to_string (CRStatement const *a_this, ******************/ /** - * cr_statement_does_buf_parses_against_core: - * - *@a_buf: the buffer to parse. - *@a_encoding: the character encoding of a_buf. - * *Tries to parse a buffer and says whether if the content of the buffer *is a css statement as defined by the "Core CSS Grammar" (chapter 4 of the *css spec) or not. - * - *Returns TRUE if the buffer parses against the core grammar, false otherwise. + *@param a_buf the buffer to parse. + *@param a_encoding the character encoding of a_buf. + *@return TRUE if the buffer parses against the core grammar, false otherwise. */ gboolean cr_statement_does_buf_parses_against_core (const guchar * a_buf, @@ -935,7 +929,8 @@ cr_statement_does_buf_parses_against_core (const guchar * a_buf, enum CRStatus status = CR_OK; gboolean result = FALSE; - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_encoding, FALSE); g_return_val_if_fail (parser, FALSE); @@ -958,17 +953,13 @@ cr_statement_does_buf_parses_against_core (const guchar * a_buf, } /** - * cr_statement_parse_from_buf: - * - *@a_buf: the buffer to parse. - *@a_encoding: the character encoding of a_buf. - * *Parses a buffer that contains a css statement and returns - *an instance of #CRStatement in case of successful parsing. - *TODO: at support of "\@import" rules. - * - *Returns the newly built instance of #CRStatement in case - *of successful parsing, NULL otherwise. + *an instance of #CRStatement in case of successfull parsing. + *TODO: at support of "@import" rules. + *@param a_buf the buffer to parse. + *@param a_encoding the character encoding of a_buf. + *@return the newly built instance of #CRStatement in case + *of successfull parsing, NULL otherwise. */ CRStatement * cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) @@ -977,7 +968,7 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) /* *The strategy of this function is "brute force". - *It tries to parse all the types of CRStatement it knows about. + *It tries to parse all the types of #CRStatement it knows about. *I could do this a smarter way but I don't have the time now. *I think I will revisit this when time of performances and *pull based incremental parsing comes. @@ -1032,15 +1023,11 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) } /** - * cr_statement_ruleset_parse_from_buf: - * - *@a_buf: the buffer to parse. - *@a_enc: the character encoding of a_buf. - * - *Parses a buffer that contains a ruleset statement an instanciates + *Parses a buffer that contains a ruleset statement and instanciates *a #CRStatement of type RULESET_STMT. - * - *Returns the newly built instance of #CRStatement in case of successful parsing, + *@param a_buf the buffer to parse. + *@param a_enc the character encoding of a_buf. + *@param the newly built instance of #CRStatement in case of successful parsing, *NULL otherwise. */ CRStatement * @@ -1055,13 +1042,14 @@ cr_statement_ruleset_parse_from_buf (const guchar * a_buf, g_return_val_if_fail (a_buf, NULL); - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_enc, FALSE); g_return_val_if_fail (parser, NULL); sac_handler = cr_doc_handler_new (); - g_return_val_if_fail (parser, NULL); + g_return_val_if_fail (sac_handler, NULL); sac_handler->start_selector = parse_ruleset_start_selector_cb; sac_handler->end_selector = parse_ruleset_end_selector_cb; @@ -1100,19 +1088,15 @@ cr_statement_ruleset_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_new_ruleset: - * - *@a_sel_list: the list of #CRSimpleSel (selectors) + *Creates a new instance of #CRStatement of type + *#CRRulSet. + *@param a_sel_list the list of #CRSimpleSel (selectors) *the rule applies to. - *@a_decl_list: the list of instances of #CRDeclaration + *@param a_decl_list the list of instances of #CRDeclaration *that composes the ruleset. - *@a_media_types: a list of instances of GString that + *@param a_media_types a list of instances of GString that *describe the media list this ruleset applies to. - * - *Creates a new instance of #CRStatement of type - *#CRRulSet. - * - *Returns the new instance of #CRStatement or NULL if something + *@return the new instance of #CRStatement or NULL if something *went wrong. */ CRStatement * @@ -1121,8 +1105,6 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet, CRDeclaration * a_decl_list, CRStatement * a_parent_media_rule) { - CRStatement *result = NULL; - g_return_val_if_fail (a_sel_list, NULL); if (a_parent_media_rule) { @@ -1133,7 +1115,7 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet, NULL); } - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1142,7 +1124,7 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet, memset (result, 0, sizeof (CRStatement)); result->type = RULESET_STMT; - result->kind.ruleset = g_try_malloc (sizeof (CRRuleSet)); + result->kind.ruleset = (CRRuleSet *)g_try_malloc (sizeof (CRRuleSet)); if (!result->kind.ruleset) { cr_utils_trace_info ("Out of memory"); @@ -1171,15 +1153,11 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet, } /** - * cr_statement_at_media_rule_parse_from_buf: - * - *@a_buf: the input to parse. - *@a_enc: the encoding of the buffer. - * - *Parses a buffer that contains an "\@media" declaration - *and builds an \@media css statement. - * - *Returns the \@media statement, or NULL if the buffer could not + *Parses a buffer that contains an "@media" declaration + *and builds an @media css statement. + *@param a_buf the input to parse. + *@param a_enc the encoding of the buffer. + *@return the @media statement, or NULL if the buffer could not *be successfully parsed. */ CRStatement * @@ -1192,7 +1170,8 @@ cr_statement_at_media_rule_parse_from_buf (const guchar * a_buf, CRDocHandler *sac_handler = NULL; enum CRStatus status = CR_OK; - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_enc, FALSE); if (!parser) { cr_utils_trace_info ("Instanciation of the parser failed"); @@ -1248,27 +1227,22 @@ cr_statement_at_media_rule_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_new_at_media_rule: - * - *@a_ruleset: the ruleset statements contained - *in the \@media rule. - *@a_media: the media string list. A list of GString pointers. - * *Instanciates an instance of #CRStatement of type - *AT_MEDIA_RULE_STMT (\@media ruleset). - * + *AT_MEDIA_RULE_STMT (@media ruleset). + *@param a_ruleset the ruleset statements contained + *in the @media rule. + *@param a_media, the media string list. A list of GString pointers. */ CRStatement * cr_statement_new_at_media_rule (CRStyleSheet * a_sheet, CRStatement * a_rulesets, GList * a_media) { - CRStatement *result = NULL, - *cur = NULL; + CRStatement *cur = NULL; if (a_rulesets) g_return_val_if_fail (a_rulesets->type == RULESET_STMT, NULL); - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1278,7 +1252,7 @@ cr_statement_new_at_media_rule (CRStyleSheet * a_sheet, memset (result, 0, sizeof (CRStatement)); result->type = AT_MEDIA_RULE_STMT; - result->kind.media_rule = g_try_malloc (sizeof (CRAtMediaRule)); + result->kind.media_rule = (CRAtMediaRule *)g_try_malloc (sizeof (CRAtMediaRule)); if (!result->kind.media_rule) { cr_utils_trace_info ("Out of memory"); g_free (result); @@ -1308,16 +1282,12 @@ cr_statement_new_at_media_rule (CRStyleSheet * a_sheet, } /** - * cr_statement_new_at_import_rule: - * - *@a_url: the url to connect to the get the file - *to be imported. - *@a_sheet: the imported parsed stylesheet. - * *Creates a new instance of #CRStatment of type *#CRAtImportRule. - * - *Returns the newly built instance of #CRStatement. + *@param a_url the url to connect to the get the file + *to be imported. + *@param a_sheet the imported parsed stylesheet. + *@return the newly built instance of #CRStatement. */ CRStatement * cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet, @@ -1325,9 +1295,7 @@ cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet, GList * a_media_list, CRStyleSheet * a_imported_sheet) { - CRStatement *result = NULL; - - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1337,7 +1305,7 @@ cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet, memset (result, 0, sizeof (CRStatement)); result->type = AT_IMPORT_RULE_STMT; - result->kind.import_rule = g_try_malloc (sizeof (CRAtImportRule)); + result->kind.import_rule = (CRAtImportRule *)g_try_malloc (sizeof (CRAtImportRule)); if (!result->kind.import_rule) { cr_utils_trace_info ("Out of memory"); @@ -1356,16 +1324,12 @@ cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet, } /** - * cr_statement_at_import_rule_parse_from_buf: - * - *@a_buf: the buffer to parse. - *@a_encoding: the encoding of a_buf. - * - *Parses a buffer that contains an "\@import" rule and + *Parses a buffer that contains an "@import" rule and *instanciate a #CRStatement of type AT_IMPORT_RULE_STMT - * - *Returns the newly built instance of #CRStatement in case of - *a successful parsing, NULL otherwise. + *@param a_buf the buffer to parse. + *@param a_encoding the encoding of a_buf. + *@return the newly built instance of #CRStatement in case of + *a successfull parsing, NULL otherwise. */ CRStatement * cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf, @@ -1376,9 +1340,10 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf, CRStatement *result = NULL; GList *media_list = NULL; CRString *import_string = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_encoding, FALSE); if (!parser) { cr_utils_trace_info ("Instanciation of parser failed."); @@ -1432,17 +1397,13 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_new_at_page_rule: - * - *@a_decl_list: a list of instances of #CRDeclarations - *which is actually the list of declarations that applies to - *this page rule. - *@a_selector: the page rule selector. - * *Creates a new instance of #CRStatement of type *#CRAtPageRule. - * - *Returns the newly built instance of #CRStatement or NULL + *@param a_decl_list a list of instances of #CRDeclarations + *which is actually the list of declarations that applies to + *this page rule. + *@param a_selector the page rule selector. + *@return the newly built instance of #CRStatement or NULL *in case of error. */ CRStatement * @@ -1450,9 +1411,7 @@ cr_statement_new_at_page_rule (CRStyleSheet * a_sheet, CRDeclaration * a_decl_list, CRString * a_name, CRString * a_pseudo) { - CRStatement *result = NULL; - - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1462,7 +1421,7 @@ cr_statement_new_at_page_rule (CRStyleSheet * a_sheet, memset (result, 0, sizeof (CRStatement)); result->type = AT_PAGE_RULE_STMT; - result->kind.page_rule = g_try_malloc (sizeof (CRAtPageRule)); + result->kind.page_rule = (CRAtPageRule *)g_try_malloc (sizeof (CRAtPageRule)); if (!result->kind.page_rule) { cr_utils_trace_info ("Out of memory"); @@ -1484,15 +1443,11 @@ cr_statement_new_at_page_rule (CRStyleSheet * a_sheet, } /** - * cr_statement_at_page_rule_parse_from_buf: - * - *@a_buf: the character buffer to parse. - *@a_encoding: the character encoding of a_buf. - * - *Parses a buffer that contains an "\@page" production and, + *Parses a buffer that contains an "@page" production and, *if the parsing succeeds, builds the page statement. - * - *Returns the newly built at page statement in case of successful parsing, + *@param a_buf the character buffer to parse. + *@param a_encoding the character encoding of a_buf. + *@return the newly built at page statement in case of successfull parsing, *NULL otherwise. */ CRStatement * @@ -1500,14 +1455,14 @@ cr_statement_at_page_rule_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) { enum CRStatus status = CR_OK; - CRParser *parser = NULL; CRDocHandler *sac_handler = NULL; CRStatement *result = NULL; CRStatement **resultptr = NULL; g_return_val_if_fail (a_buf, NULL); - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + CRParser *parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_encoding, FALSE); if (!parser) { cr_utils_trace_info ("Instanciation of the parser failed."); @@ -1557,27 +1512,21 @@ cr_statement_at_page_rule_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_new_at_charset_rule: - * - *@a_charset: the string representing the charset. - *Note that the newly built instance of #CRStatement becomes - *the owner of a_charset. The caller must not free a_charset !!!. - * *Creates a new instance of #CRStatement of type *#CRAtCharsetRule. - * - *Returns the newly built instance of #CRStatement or NULL + *@param a_charset the string representing the charset. + *Note that the newly built instance of #CRStatement becomes + *the owner of a_charset. The caller must not free a_charset !!!. + *@return the newly built instance of #CRStatement or NULL *if an error arises. */ CRStatement * cr_statement_new_at_charset_rule (CRStyleSheet * a_sheet, CRString * a_charset) { - CRStatement *result = NULL; - g_return_val_if_fail (a_charset, NULL); - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1587,7 +1536,7 @@ cr_statement_new_at_charset_rule (CRStyleSheet * a_sheet, memset (result, 0, sizeof (CRStatement)); result->type = AT_CHARSET_RULE_STMT; - result->kind.charset_rule = g_try_malloc (sizeof (CRAtCharsetRule)); + result->kind.charset_rule = (CRAtCharsetRule *)g_try_malloc (sizeof (CRAtCharsetRule)); if (!result->kind.charset_rule) { cr_utils_trace_info ("Out of memory"); @@ -1602,28 +1551,24 @@ cr_statement_new_at_charset_rule (CRStyleSheet * a_sheet, } /** - * cr_statement_at_charset_rule_parse_from_buf: - * - *@a_buf: the buffer to parse. - *@a_encoding: the character encoding of the buffer. - * - *Parses a buffer that contains an '\@charset' rule and + *Parses a buffer that contains an '@charset' rule and *creates an instance of #CRStatement of type AT_CHARSET_RULE_STMT. - * - *Returns the newly built instance of #CRStatement. + *@param a_buf the buffer to parse. + *@param the character encoding of the buffer. + *@return the newly built instance of #CRStatement. */ CRStatement * cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) { enum CRStatus status = CR_OK; - CRParser *parser = NULL; CRStatement *result = NULL; CRString *charset = NULL; g_return_val_if_fail (a_buf, NULL); - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + CRParser *parser = cr_parser_new_from_buf ((guchar*)a_buf, + strlen ((char *)a_buf), a_encoding, FALSE); if (!parser) { cr_utils_trace_info ("Instanciation of the parser failed."); @@ -1656,22 +1601,16 @@ cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_new_at_font_face_rule: - * - *@a_font_decls: a list of instances of #CRDeclaration. Each declaration - *is actually a font declaration. - * *Creates an instance of #CRStatement of type #CRAtFontFaceRule. - * - *Returns the newly built instance of #CRStatement. + *@param a_font_decls a list of instances of #CRDeclaration. Each declaration + *is actually a font declaration. + *@return the newly built instance of #CRStatement. */ CRStatement * cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, CRDeclaration * a_font_decls) { - CRStatement *result = NULL; - - result = g_try_malloc (sizeof (CRStatement)); + CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { cr_utils_trace_info ("Out of memory"); @@ -1680,7 +1619,7 @@ cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, memset (result, 0, sizeof (CRStatement)); result->type = AT_FONT_FACE_RULE_STMT; - result->kind.font_face_rule = g_try_malloc + result->kind.font_face_rule = (CRAtFontFaceRule *)g_try_malloc (sizeof (CRAtFontFaceRule)); if (!result->kind.font_face_rule) { @@ -1698,16 +1637,11 @@ cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, } /** - * cr_statement_font_face_rule_parse_from_buf: - * - * - *@a_buf: the buffer to parse. - *@a_encoding: the character encoding of a_buf. - * - *Parses a buffer that contains an "\@font-face" rule and builds + *Parses a buffer that contains an "@font-face" rule and builds *an instance of #CRStatement of type AT_FONT_FACE_RULE_STMT out of it. - * - *Returns the newly built instance of #CRStatement in case of successufull + *@param a_buf the buffer to parse. + *@param a_encoding the character encoding of a_buf. + *@return the newly built instance of #CRStatement in case of successufull *parsing, NULL otherwise. */ CRStatement * @@ -1716,11 +1650,12 @@ cr_statement_font_face_rule_parse_from_buf (const guchar * a_buf, { CRStatement *result = NULL; CRStatement **resultptr = NULL; - CRParser *parser = NULL; CRDocHandler *sac_handler = NULL; enum CRStatus status = CR_OK; - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), + CRParser *parser = (CRParser *)cr_parser_new_from_buf ( + (guchar*)a_buf, + strlen ((char *)a_buf), a_encoding, FALSE); if (!parser) goto cleanup; @@ -1774,14 +1709,10 @@ cr_statement_font_face_rule_parse_from_buf (const guchar * a_buf, } /** - * cr_statement_set_parent_sheet: - * - *@a_this: the current instance of #CRStatement. - *@a_sheet: the sheet that contains the current statement. - * *Sets the container stylesheet. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current instance of #CRStatement. + *@param a_sheet the sheet that contains the current statement. + *@return CR_OK upon successfull completion, an errror code otherwise. */ enum CRStatus cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet) @@ -1792,14 +1723,10 @@ cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet) } /** - * cr_statement_get_parent_sheet: - * - *@a_this: the current #CRStatement. - *@a_sheet: out parameter. A pointer to the sheets that - * *Gets the sheets that contains the current statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current #CRStatement. + *@param a_sheet out parameter. A pointer to the sheets that + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet) @@ -1810,14 +1737,10 @@ cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet) } /** - * cr_statement_append: - * - *@a_this: the current instance of the statement list. - *@a_new: a_new the new instance of #CRStatement to append. - * *Appends a new statement to the statement list. - * - *Returns the new list statement list, or NULL in cas of failure. + *@param a_this the current instance of the statement list. + *@param a_this a_new the new instance of #CRStatement to append. + *@return the new list statement list, or NULL in cas of failure. */ CRStatement * cr_statement_append (CRStatement * a_this, CRStatement * a_new) @@ -1840,15 +1763,11 @@ cr_statement_append (CRStatement * a_this, CRStatement * a_new) } /** - * cr_statement_prepend: - * - *@a_this: the current instance of #CRStatement. - *@a_new: the new statement to prepend. - * *Prepends the an instance of #CRStatement to *the current statement list. - * - *Returns the new list with the new statement prepended, + *@param a_this the current instance of #CRStatement. + *@param a_new the new statement to prepend. + *@return the new list with the new statement prepended, *or NULL in case of an error. */ CRStatement * @@ -1871,14 +1790,10 @@ cr_statement_prepend (CRStatement * a_this, CRStatement * a_new) } /** - * cr_statement_unlink: - * - *@a_this: the current statements list. - *@a_to_unlink: the statement to unlink from the list. - * *Unlinks a statement from the statements list. - * - *Returns the new list where a_to_unlink has been unlinked + *@param a_this the current statements list. + *@param a_to_unlink the statement to unlink from the list. + *@return the new list where a_to_unlink has been unlinked *from, or NULL in case of error. */ CRStatement * @@ -1922,18 +1837,14 @@ cr_statement_unlink (CRStatement * a_stmt) } /** - * cr_statement_nr_rules: - * - *@a_this: the current instance of #CRStatement. - * - *Gets the number of rules in the statement list; - * - *Returns number of rules in the statement list. + *Return the number of rules in the statement list; + *@param a_this the current instance of #CRStatement. + *@return number of rules in the statement list. */ gint -cr_statement_nr_rules (CRStatement const * a_this) +cr_statement_nr_rules (CRStatement * a_this) { - CRStatement const *cur = NULL; + CRStatement *cur = NULL; int nr = 0; g_return_val_if_fail (a_this, -1); @@ -1944,14 +1855,10 @@ cr_statement_nr_rules (CRStatement const * a_this) } /** - * cr_statement_get_from_list: - * - *@a_this: the current instance of #CRStatement. - *@itemnr: the index into the statement list. - * *Use an index to get a CRStatement from the statement list. - * - *Returns CRStatement at position itemnr, if itemnr > number of statements - 1, + *@param a_this the current instance of #CRStatement. + *@param itemnr the index into the statement list. + *@return CRStatement at position itemnr, if itemnr > number of statements - 1, *it will return NULL. */ CRStatement * @@ -1969,17 +1876,13 @@ cr_statement_get_from_list (CRStatement * a_this, int itemnr) } /** - * cr_statement_ruleset_set_sel_list: - * - *@a_this: the current ruleset statement. - *@a_sel_list: the selector list to set. Note + *Sets a selector list to a ruleset statement. + *@param a_this the current ruleset statement. + *@param a_sel_list the selector list to set. Note *that this function increments the ref count of a_sel_list. *The sel list will be destroyed at the destruction of the *current instance of #CRStatement. - * - *Sets a selector list to a ruleset statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_ruleset_set_sel_list (CRStatement * a_this, @@ -2000,16 +1903,12 @@ cr_statement_ruleset_set_sel_list (CRStatement * a_this, } /** - * cr_statement_ruleset_get_declarations: - * - *@a_this: the current instance of #CRStatement. - *@a_decl_list: out parameter. A pointer to the the returned - *list of declaration. Must not be NULL. - * *Gets a pointer to the list of declaration contained *in the ruleset statement. - * - *Returns CR_OK upon successful completion, an error code if something + *@param a_this the current instance of #CRStatement. + *@a_decl_list out parameter. A pointer to the the returned + *list of declaration. Must not be NULL. + *@return CR_OK upon successfull completion, an error code if something *bad happened. */ enum CRStatus @@ -2027,19 +1926,15 @@ cr_statement_ruleset_get_declarations (CRStatement * a_this, } /** - * cr_statement_ruleset_get_sel_list: - * - *@a_this: the current ruleset statement. - *@a_list: out parameter. The returned selector list, - *if and only if the function returned CR_OK. - * *Gets a pointer to the selector list contained in *the current ruleset statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current ruleset statement. + *@param a_list out parameter. The returned selector list, + *if and only if the function returned CR_OK. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus -cr_statement_ruleset_get_sel_list (CRStatement const * a_this, CRSelector ** a_list) +cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list) { g_return_val_if_fail (a_this && a_this->type == RULESET_STMT && a_this->kind.ruleset, CR_BAD_PARAM_ERROR); @@ -2050,15 +1945,11 @@ cr_statement_ruleset_get_sel_list (CRStatement const * a_this, CRSelector ** a_l } /** - * cr_statement_ruleset_set_decl_list: - * - *@a_this: the current ruleset statement. - *@a_list: the declaration list to be added to the current - *ruleset statement. - * *Sets a declaration list to the current ruleset statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current ruleset statement. + *@param a_list the declaration list to be added to the current + *ruleset statement. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_ruleset_set_decl_list (CRStatement * a_this, @@ -2080,15 +1971,11 @@ cr_statement_ruleset_set_decl_list (CRStatement * a_this, } /** - * cr_statement_ruleset_append_decl2: - * - *@a_this: the current statement. - *@a_prop: the property of the declaration. - *@a_value: the value of the declaration. - * *Appends a declaration to the current ruleset statement. - * - *Returns CR_OK upon successful completion, an error code + *@param a_this the current statement. + *@param a_prop the property of the declaration. + *@param a_value the value of the declaration. + *@return CR_OK uppon successfull completion, an error code *otherwise. */ enum CRStatus @@ -2111,14 +1998,10 @@ cr_statement_ruleset_append_decl2 (CRStatement * a_this, } /** - * cr_statement_ruleset_append_decl: - * *Appends a declaration to the current statement. - * - *@a_this: the current statement. - *@a_declaration: the declaration to append. - * - *Returns CR_OK upon sucessful completion, an error code + *@param a_this the current statement. + *@param a_declaration the declaration to append. + *@return CR_OK upon sucessfull completion, an error code *otherwise. */ enum CRStatus @@ -2139,16 +2022,13 @@ cr_statement_ruleset_append_decl (CRStatement * a_this, } /** - * cr_statement_at_import_rule_set_imported_sheet: - * - *Sets a stylesheet to the current \@import rule. - *@a_this: the current \@import rule. - *@a_sheet: the stylesheet. The stylesheet is owned + *Sets a stylesheet to the current @import rule. + *@param a_this the current @import rule. + *@param a_sheet the stylesheet. The stylesheet is owned *by the current instance of #CRStatement, that is, the *stylesheet will be destroyed when the current instance - *of #CRStatement is destroyed. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *of #CRStatement will be destroyed. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this, @@ -2165,14 +2045,11 @@ cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this, } /** - * cr_statement_at_import_rule_get_imported_sheet: - * - *@a_this: the current \@import rule statement. - *@a_sheet: out parameter. The returned stylesheet if and + *Gets the stylesheet contained by the @import rule statement. + *@param a_this the current @import rule statement. + *@param a_sheet out parameter. The returned stylesheet if and *only if the function returns CR_OK. - * - *Gets the stylesheet contained by the \@import rule statement. - *Returns CR_OK upon sucessful completion, an error code otherwise. + *@return CR_OK upon sucessfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this, @@ -2188,14 +2065,10 @@ cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this, } /** - * cr_statement_at_import_rule_set_url: - * - *@a_this: the current \@import rule statement. - *@a_url: the url to set. - * - *Sets an url to the current \@import rule statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *Sets an url to the current @import rule statement. + *@param a_this the current @import rule statement. + *@param a_url the url to set. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_import_rule_set_url (CRStatement * a_this, @@ -2216,17 +2089,13 @@ cr_statement_at_import_rule_set_url (CRStatement * a_this, } /** - * cr_statement_at_import_rule_get_url: - * - *@a_this: the current \@import rule statement. - *@a_url: out parameter. The returned url if + *Gets the url of the @import rule statement. + *@param the current @import rule statement. + *@param a_url out parameter. The returned url if *and only if the function returned CR_OK. - * - *Gets the url of the \@import rule statement. - *Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus -cr_statement_at_import_rule_get_url (CRStatement const * a_this, +cr_statement_at_import_rule_get_url (CRStatement * a_this, CRString ** a_url) { g_return_val_if_fail (a_this @@ -2240,14 +2109,12 @@ cr_statement_at_import_rule_get_url (CRStatement const * a_this, } /** - * cr_statement_at_media_nr_rules: - * - *@a_this: the current instance of #CRStatement. - * - *Returns the number of rules in the media rule; + *Return the number of rules in the media rule; + *@param a_this the current instance of #CRStatement. + *@return number of rules in the media rule. */ int -cr_statement_at_media_nr_rules (CRStatement const * a_this) +cr_statement_at_media_nr_rules (CRStatement * a_this) { g_return_val_if_fail (a_this && a_this->type == AT_MEDIA_RULE_STMT @@ -2257,14 +2124,10 @@ cr_statement_at_media_nr_rules (CRStatement const * a_this) } /** - * cr_statement_at_media_get_from_list: - * - *@a_this: the current instance of #CRStatement. - *@itemnr: the index into the media rule list of rules. - * *Use an index to get a CRStatement from the media rule list of rules. - * - *Returns CRStatement at position itemnr, if itemnr > number of rules - 1, + *@param a_this the current instance of #CRStatement. + *@param itemnr the index into the media rule list of rules. + *@return CRStatement at position itemnr, if itemnr > number of rules - 1, *it will return NULL. */ CRStatement * @@ -2279,15 +2142,11 @@ cr_statement_at_media_get_from_list (CRStatement * a_this, int itemnr) } /** - * cr_statement_at_page_rule_set_declarations: - * - *@a_this: the current \@page rule statement. - *@a_decl_list: the declaration list to add. Will be freed + *Sets a declaration list to the current @page rule statement. + *@param a_this the current @page rule statement. + *@param a_decl_list the declaration list to add. Will be freed *by the current instance of #CRStatement when it is destroyed. - * - *Sets a declaration list to the current \@page rule statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_page_rule_set_declarations (CRStatement * a_this, @@ -2311,15 +2170,11 @@ cr_statement_at_page_rule_set_declarations (CRStatement * a_this, } /** - * cr_statement_at_page_rule_get_declarations: - * - *@a_this: the current \@page rule statement. - *@a_decl_list: out parameter. The returned declaration list. - * - *Gets the declaration list associated to the current \@page rule + *Gets the declaration list associated to the current @page rule *statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current @page rule statement. + *@param a_decl_list out parameter. The returned declaration list. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_page_rule_get_declarations (CRStatement * a_this, @@ -2335,15 +2190,10 @@ cr_statement_at_page_rule_get_declarations (CRStatement * a_this, } /** - * cr_statement_at_charset_rule_set_charset: - * - * - *@a_this: the current \@charset rule statement. - *@a_charset: the charset to set. - * - *Sets the charset of the current \@charset rule statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *Sets the charset of the current @charset rule statement. + *@param a_this the current @charset rule statement. + *@param a_charset the charset to set. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_charset_rule_set_charset (CRStatement * a_this, @@ -2362,18 +2212,14 @@ cr_statement_at_charset_rule_set_charset (CRStatement * a_this, } /** - * cr_statement_at_charset_rule_get_charset: - *@a_this: the current \@charset rule statement. - *@a_charset: out parameter. The returned charset string if - *and only if the function returned CR_OK. - * *Gets the charset string associated to the current - *\@charset rule statement. - * - * Returns CR_OK upon successful completion, an error code otherwise. + *@charset rule statement. + *@param a_this the current @charset rule statement. + *@param a_charset out parameter. The returned charset string if + *and only if the function returned CR_OK. */ enum CRStatus -cr_statement_at_charset_rule_get_charset (CRStatement const * a_this, +cr_statement_at_charset_rule_get_charset (CRStatement * a_this, CRString ** a_charset) { g_return_val_if_fail (a_this @@ -2387,14 +2233,10 @@ cr_statement_at_charset_rule_get_charset (CRStatement const * a_this, } /** - * cr_statement_at_font_face_rule_set_decls: - * - *@a_this: the current \@font-face rule statement. - *@a_decls: the declarations list to set. - * - *Sets a declaration list to the current \@font-face rule statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *Sets a declaration list to the current @font-face rule statement. + *@param a_this the current @font-face rule statement. + *@param a_decls the declarations list to set. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_font_face_rule_set_decls (CRStatement * a_this, @@ -2416,16 +2258,12 @@ cr_statement_at_font_face_rule_set_decls (CRStatement * a_this, } /** - * cr_statement_at_font_face_rule_get_decls: - * - *@a_this: the current \@font-face rule statement. - *@a_decls: out parameter. The returned declaration list if - *and only if this function returns CR_OK. - * *Gets the declaration list associated to the current instance - *of \@font-face rule statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *of @font-face rule statement. + *@param a_this the current @font-face rule statement. + *@param a_decls out parameter. The returned declaration list if + *and only if this function returns CR_OK. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_font_face_rule_get_decls (CRStatement * a_this, @@ -2442,16 +2280,12 @@ cr_statement_at_font_face_rule_get_decls (CRStatement * a_this, } /** - * cr_statement_at_font_face_rule_add_decl: - * - *@a_this: the current \@font-face rule statement. - *@a_prop: the property of the declaration. - *@a_value: the value of the declaration. - * - *Adds a declaration to the current \@font-face rule + *Adds a declaration to the current @font-face rule *statement. - * - *Returns CR_OK upon successful completion, an error code otherwise. + *@param a_this the current @font-face rule statement. + *@param a_prop the property of the declaration. + *@param a_value the value of the declaration. + *@return CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_font_face_rule_add_decl (CRStatement * a_this, @@ -2478,20 +2312,15 @@ cr_statement_at_font_face_rule_add_decl (CRStatement * a_this, return CR_OK; } - /** - * cr_statement_to_string: - * - *@a_this: the current statement to serialize - *@a_indent: the number of white space of indentation. - * *Serializes a css statement into a string - * - *Returns the serialized statement. Must be freed by the caller + *@param a_this the current statement to serialize + *@param a_indent the number of white space of indentation. + *@return the serialized statement. Must be freed by the caller *using g_free(). */ gchar * -cr_statement_to_string (CRStatement const * a_this, gulong a_indent) +cr_statement_to_string (CRStatement * a_this, gulong a_indent) { gchar *str = NULL ; @@ -2537,9 +2366,9 @@ cr_statement_to_string (CRStatement const * a_this, gulong a_indent) } gchar* -cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) +cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) { - CRStatement const *cur_stmt = NULL ; + CRStatement *cur_stmt = NULL ; GString *stringue = NULL ; gchar *str = NULL ; @@ -2570,16 +2399,13 @@ cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) } /** - * cr_statement_dump: - * - *@a_this: the current css2 statement. - *@a_fp: the destination file pointer. - *@a_indent: the number of white space indentation characters. - * *Dumps the css2 statement to a file. + *@param a_this the current css2 statement. + *@param a_fp the destination file pointer. + *@param a_indent the number of white space indentation characters. */ void -cr_statement_dump (CRStatement const * a_this, FILE * a_fp, gulong a_indent) +cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent) { gchar *str = NULL ; @@ -2595,39 +2421,31 @@ cr_statement_dump (CRStatement const * a_this, FILE * a_fp, gulong a_indent) } /** - * cr_statement_dump_ruleset: - * - *@a_this: the current instance of #CRStatement. - *@a_fp: the destination file pointer. - *@a_indent: the number of indentation white spaces to add. - * *Dumps a ruleset statement to a file. + *@param a_this the current instance of #CRStatement. + *@param a_fp the destination file pointer. + *@param a_indent the number of indentation white spaces to add. */ void -cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, glong a_indent) +cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent) { - guchar *str = NULL; - g_return_if_fail (a_fp && a_this); - str = cr_statement_ruleset_to_string (a_this, a_indent); + gchar *str = cr_statement_ruleset_to_string (a_this, a_indent); if (str) { - fprintf (a_fp, str); + fprintf (a_fp, "%s", str); g_free (str); str = NULL; } } /** - * cr_statement_dump_font_face_rule: - * - *@a_this: the current instance of font face rule statement. - *@a_fp: the destination file pointer. - *@a_indent: the number of white space indentation. - * *Dumps a font face rule statement to a file. + *@param a_this the current instance of font face rule statement. + *@param a_fp the destination file pointer. + *@param a_indent the number of white space indentation. */ void -cr_statement_dump_font_face_rule (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp, glong a_indent) { gchar *str = NULL ; @@ -2644,25 +2462,20 @@ cr_statement_dump_font_face_rule (CRStatement const * a_this, FILE * a_fp, } /** - * cr_statement_dump_charset: - * - *@a_this: the current instance of the \@charset rule statement. - *@a_fp: the destination file pointer. - *@a_indent: the number of indentation white spaces. - * - *Dumps an \@charset rule statement to a file. + *Dumps an @charset rule statement to a file. + *@param a_this the current instance of the @charset rule statement. + *@param a_fp the destination file pointer. + *@param a_indent the number of indentation white spaces. */ void -cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_indent) +cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent) { - guchar *str = NULL; - g_return_if_fail (a_this && a_this->type == AT_CHARSET_RULE_STMT); - str = cr_statement_charset_to_string (a_this, + gchar *str = cr_statement_charset_to_string (a_this, a_indent) ; if (str) { - fprintf (a_fp, str) ; + fprintf (a_fp, "%s", str) ; g_free (str) ; str = NULL ; } @@ -2670,26 +2483,21 @@ cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_ind /** - * cr_statement_dump_page: - * - *@a_this: the statement to dump on stdout. - *@a_fp: the destination file pointer. - *@a_indent: the number of indentation white spaces. - * - *Dumps an \@page rule statement on stdout. + *Dumps an @page rule statement on stdout. + *@param a_this the statement to dump on stdout. + *@param a_fp the destination file pointer. + *@param a_indent the number of indentation white spaces. */ void -cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent) +cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent) { - guchar *str = NULL; - g_return_if_fail (a_this && a_this->type == AT_PAGE_RULE_STMT && a_this->kind.page_rule); - str = cr_statement_at_page_rule_to_string (a_this, a_indent) ; + gchar *str = cr_statement_at_page_rule_to_string (a_this, a_indent) ; if (str) { - fprintf (a_fp, str); + fprintf (a_fp, "%s", str); g_free (str) ; str = NULL ; } @@ -2697,16 +2505,13 @@ cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent /** - * cr_statement_dump_media_rule: - * - *@a_this: the statement to dump. - *@a_fp: the destination file pointer - *@a_indent: the number of white spaces indentation. - * - *Dumps an \@media rule statement to a file. + *Dumps an @media rule statement to a file. + *@param a_this the statement to dump. + *@param a_fp the destination file pointer + *@param a_indent the number of white spaces indentation. */ void -cr_statement_dump_media_rule (CRStatement const * a_this, +cr_statement_dump_media_rule (CRStatement * a_this, FILE * a_fp, gulong a_indent) { @@ -2715,22 +2520,19 @@ cr_statement_dump_media_rule (CRStatement const * a_this, str = cr_statement_media_rule_to_string (a_this, a_indent) ; if (str) { - fprintf (a_fp, str) ; + fprintf (a_fp, "%s", str) ; g_free (str) ; str = NULL ; } } /** - * cr_statement_dump_import_rule: - * - *@a_fp: the destination file pointer. - *@a_indent: the number of white space indentations. - * - *Dumps an \@import rule statement to a file. + *Dumps an @import rule statement to a file. + *@param a_fp the destination file pointer. + *@param a_indent the number of white space indentations. */ void -cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp, gulong a_indent) { gchar *str = NULL ; @@ -2741,17 +2543,13 @@ cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp, str = cr_statement_import_rule_to_string (a_this, a_indent) ; if (str) { - fprintf (a_fp, str) ; + fprintf (a_fp, "%s", str) ; g_free (str) ; str = NULL ; } } /** - * cr_statement_destroy: - * - * @a_this: the current instance of #CRStatement. - * *Destructor of #CRStatement. */ void diff --git a/src/cr-statement.h b/src/cr-statement.h index 74a2330..5639ab7 100644 --- a/src/cr-statement.h +++ b/src/cr-statement.h @@ -84,7 +84,7 @@ struct _CRStyleSheet ; typedef struct _CRStyleSheet CRStyleSheet; -/**The \@import rule abstraction.*/ +/**The @import rule abstraction.*/ typedef struct _CRAtImportRule CRAtImportRule ; struct _CRAtImportRule { @@ -102,7 +102,7 @@ struct _CRAtImportRule }; -/**abstraction of an \@media rule*/ +/**abstraction of an @media rule*/ struct _CRAtMediaRule { GList *media_list ; @@ -111,7 +111,7 @@ struct _CRAtMediaRule typedef struct _CRAtPageRule CRAtPageRule ; -/**The \@page rule abstraction*/ +/**The @page rule abstraction*/ struct _CRAtPageRule { /**a list of instances of #CRDeclaration*/ @@ -122,14 +122,14 @@ struct _CRAtPageRule CRString *pseudo ; } ; -/**The \@charset rule abstraction*/ +/**The @charset rule abstraction*/ typedef struct _CRAtCharsetRule CRAtCharsetRule ; struct _CRAtCharsetRule { CRString * charset ; }; -/**The abstaction of the \@font-face rule.*/ +/**The abstaction of the @font-face rule.*/ typedef struct _CRAtFontFaceRule CRAtFontFaceRule ; struct _CRAtFontFaceRule { @@ -176,8 +176,8 @@ enum CRStatementType *The abstraction of css statement as defined *in the chapter 4 and appendix D.1 of the css2 spec. *A statement is actually a double chained list of - *statements.A statement can be a ruleset, an \@import - *rule, an \@page rule etc ... + *statements.A statement can be a ruleset, an @import + *rule, an @page rule etc ... */ struct _CRStatement { @@ -314,7 +314,7 @@ cr_statement_ruleset_set_sel_list (CRStatement *a_this, CRSelector *a_sel_list) ; enum CRStatus -cr_statement_ruleset_get_sel_list (CRStatement const *a_this, +cr_statement_ruleset_get_sel_list (CRStatement *a_this, CRSelector **a_list) ; enum CRStatus @@ -346,11 +346,11 @@ cr_statement_at_import_rule_set_url (CRStatement *a_this, CRString *a_url) ; enum CRStatus -cr_statement_at_import_rule_get_url (CRStatement const *a_this, +cr_statement_at_import_rule_get_url (CRStatement *a_this, CRString **a_url) ; gint -cr_statement_at_media_nr_rules (CRStatement const *a_this) ; +cr_statement_at_media_nr_rules (CRStatement *a_this) ; CRStatement * cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ; @@ -360,7 +360,7 @@ cr_statement_at_page_rule_set_sel (CRStatement *a_this, CRSelector *a_sel) ; enum CRStatus -cr_statement_at_page_rule_get_sel (CRStatement const *a_this, +cr_statement_at_page_rule_get_sel (CRStatement *a_this, CRSelector **a_sel) ; enum CRStatus @@ -376,7 +376,7 @@ cr_statement_at_charset_rule_set_charset (CRStatement *a_this, CRString *a_charset) ; enum CRStatus -cr_statement_at_charset_rule_get_charset (CRStatement const *a_this, +cr_statement_at_charset_rule_get_charset (CRStatement *a_this, CRString **a_charset) ; enum CRStatus @@ -393,41 +393,41 @@ cr_statement_at_font_face_rule_add_decl (CRStatement *a_this, CRTerm *a_value) ; gchar * -cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ; +cr_statement_to_string (CRStatement * a_this, gulong a_indent) ; gchar* -cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ; +cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) ; void -cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ; +cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ; void -cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent) ; void -cr_statement_dump_font_face_rule (CRStatement const * a_this, +cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp, glong a_indent) ; void -cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent) ; void -cr_statement_dump_media_rule (CRStatement const * a_this, +cr_statement_dump_media_rule (CRStatement * a_this, FILE * a_fp, gulong a_indent) ; void -cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp, gulong a_indent) ; void -cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, +cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent) ; gint -cr_statement_nr_rules (CRStatement const *a_this) ; +cr_statement_nr_rules (CRStatement *a_this) ; CRStatement * cr_statement_get_from_list (CRStatement *a_this, int itemnr) ; diff --git a/src/cr-string.c b/src/cr-string.c index 633fcab..7c656f5 100644 --- a/src/cr-string.c +++ b/src/cr-string.c @@ -32,9 +32,7 @@ CRString * cr_string_new (void) { - CRString *result = NULL ; - - result = g_try_malloc (sizeof (CRString)) ; + CRString *result = (CRString *)g_try_malloc (sizeof (CRString)) ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; @@ -53,9 +51,7 @@ cr_string_new (void) CRString * cr_string_new_from_string (const gchar * a_string) { - CRString *result = NULL ; - - result = cr_string_new () ; + CRString *result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; @@ -72,11 +68,9 @@ cr_string_new_from_string (const gchar * a_string) *@return the newly instanciated #CRString. */ CRString * -cr_string_new_from_gstring (GString const *a_string) +cr_string_new_from_gstring (GString *a_string) { - CRString *result = NULL ; - - result = cr_string_new () ; + CRString *result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; @@ -91,12 +85,11 @@ cr_string_new_from_gstring (GString const *a_string) } CRString * -cr_string_dup (CRString const *a_this) +cr_string_dup (CRString *a_this) { - CRString *result = NULL ; g_return_val_if_fail (a_this, NULL) ; - result = cr_string_new_from_gstring (a_this->stryng) ; + CRString *result = cr_string_new_from_gstring (a_this->stryng) ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; @@ -107,7 +100,7 @@ cr_string_dup (CRString const *a_this) } gchar * -cr_string_dup2 (CRString const *a_this) +cr_string_dup2 (CRString *a_this) { gchar *result = NULL ; @@ -128,7 +121,7 @@ cr_string_dup2 (CRString const *a_this) *@param a_this the current instance of #CRString */ const gchar * -cr_string_peek_raw_str (CRString const *a_this) +cr_string_peek_raw_str (CRString *a_this) { g_return_val_if_fail (a_this, NULL) ; @@ -145,7 +138,7 @@ cr_string_peek_raw_str (CRString const *a_this) *of -1 if no length can be returned. */ gint -cr_string_peek_raw_str_len (CRString const *a_this) +cr_string_peek_raw_str_len (CRString *a_this) { g_return_val_if_fail (a_this && a_this->stryng, -1) ; diff --git a/src/cr-string.h b/src/cr-string.h index 2700f0e..2564534 100644 --- a/src/cr-string.h +++ b/src/cr-string.h @@ -64,11 +64,11 @@ struct _CRString { CRString * cr_string_new (void) ; CRString *cr_string_new_from_string (const gchar * a_string) ; -CRString * cr_string_new_from_gstring (GString const *a_string) ; -CRString *cr_string_dup (CRString const *a_this) ; -gchar *cr_string_dup2 (CRString const *a_this) ; -const gchar *cr_string_peek_raw_str (CRString const *a_this) ; -gint cr_string_peek_raw_str_len (CRString const *a_this) ; +CRString * cr_string_new_from_gstring (GString *a_string) ; +CRString *cr_string_dup (CRString *a_this) ; +gchar *cr_string_dup2 (CRString *a_this) ; +const gchar *cr_string_peek_raw_str (CRString *a_this) ; +gint cr_string_peek_raw_str_len (CRString *a_this) ; void cr_string_destroy (CRString *a_this) ; G_END_DECLS diff --git a/src/cr-style.c b/src/cr-style.c index fa3306a..e0abba8 100644 --- a/src/cr-style.c +++ b/src/cr-style.c @@ -92,7 +92,7 @@ enum CRPropertyID { typedef struct _CRPropertyDesc CRPropertyDesc; struct _CRPropertyDesc { - const guchar *name; + const gchar *name; enum CRPropertyID prop_id; }; @@ -140,9 +140,9 @@ static CRPropertyDesc gv_prop_table[] = { {"font-size", PROP_ID_FONT_SIZE}, {"font-style", PROP_ID_FONT_STYLE}, {"font-weight", PROP_ID_FONT_WEIGHT}, - {"white-space", PROP_ID_WHITE_SPACE}, + {"white-space", PROP_ID_WHITE_SPACE}, /*must be the last one */ - {NULL, 0} + {NULL, (enum CRPropertyID)0} }; /** @@ -185,7 +185,7 @@ static struct CRNumPropEnumDumpInfo gv_num_props_dump_infos[] = { {NUM_PROP_MARGIN_BOTTOM, "margin-bottom"}, {NUM_PROP_MARGIN_LEFT, "margin-left"}, {NUM_PROP_WIDTH, "width"}, - {0, NULL} + {(enum CRNumProp)0, NULL} }; struct CRRgbPropEnumDumpInfo { @@ -200,7 +200,7 @@ static struct CRRgbPropEnumDumpInfo gv_rgb_props_dump_infos[] = { {RGB_PROP_BORDER_LEFT_COLOR, "left-color"}, {RGB_PROP_COLOR, "color"}, {RGB_PROP_BACKGROUND_COLOR, "background-color"}, - {0, NULL} + {(enum CRRgbProp)0, NULL} }; struct CRBorderStylePropEnumDumpInfo { @@ -215,7 +215,7 @@ static struct CRBorderStylePropEnumDumpInfo gv_border_style_props_dump_infos[] {BORDER_STYLE_PROP_RIGHT, "border-style-right"}, {BORDER_STYLE_PROP_BOTTOM, "boder-style-bottom"}, {BORDER_STYLE_PROP_LEFT, "border-style-left"}, - {0, NULL} + {(enum CRBorderStyleProp)0, NULL} }; static enum CRStatus @@ -319,9 +319,9 @@ set_prop_font_weight_from_value (CRStyle * a_style, CRTerm * a_value); static const gchar * num_prop_code_to_string (enum CRNumProp a_code) { - gint len = sizeof (gv_num_props_dump_infos) / + int len = sizeof (gv_num_props_dump_infos) / sizeof (struct CRNumPropEnumDumpInfo); - if (a_code >= len) { + if ((int)a_code >= len) { cr_utils_trace_info ("A field has been added " "to 'enum CRNumProp' and no matching" " entry has been " @@ -342,10 +342,10 @@ num_prop_code_to_string (enum CRNumProp a_code) static const gchar * rgb_prop_code_to_string (enum CRRgbProp a_code) { - gint len = sizeof (gv_rgb_props_dump_infos) / + int len = sizeof (gv_rgb_props_dump_infos) / sizeof (struct CRRgbPropEnumDumpInfo); - if (a_code >= len) { + if ((int)a_code >= len) { cr_utils_trace_info ("A field has been added " "to 'enum CRRgbProp' and no matching" " entry has been " @@ -366,10 +366,10 @@ rgb_prop_code_to_string (enum CRRgbProp a_code) static const gchar * border_style_prop_code_to_string (enum CRBorderStyleProp a_code) { - gint len = sizeof (gv_border_style_props_dump_infos) / + int len = sizeof (gv_border_style_props_dump_infos) / sizeof (struct CRBorderStylePropEnumDumpInfo); - if (a_code >= len) { + if ((int)a_code >= len) { cr_utils_trace_info ("A field has been added " "to 'enum CRBorderStyleProp' and no matching" " entry has been " @@ -421,11 +421,11 @@ cr_style_get_prop_id (const guchar * a_prop) cr_style_init_properties (); } - raw_id = g_hash_table_lookup (gv_prop_hash, a_prop); + raw_id = (gpointer *)g_hash_table_lookup (gv_prop_hash, a_prop); if (!raw_id) { return PROP_ID_NOT_KNOWN; } - return GPOINTER_TO_INT (raw_id); + return (enum CRPropertyID)GPOINTER_TO_INT (raw_id); } static enum CRStatus @@ -465,7 +465,7 @@ set_prop_padding_x_from_value (CRStyle * a_style, if (a_value->content.str && a_value->content.str->stryng && a_value->content.str->stryng->str - && !strncmp ((guchar *) "inherit", + && !strncmp ("inherit", a_value->content.str->stryng->str, sizeof ("inherit")-1)) { status = cr_num_set (num_val, 0.0, NUM_INHERIT); @@ -569,19 +569,17 @@ static enum CRStatus set_prop_border_width_from_value (CRStyle *a_style, CRTerm *a_value) { - CRTerm *cur_term = NULL ; - enum CRDirection direction = DIR_TOP ; - g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR) ; - cur_term = a_value ; + CRTerm *cur_term = a_value ; if (!cur_term) return CR_ERROR ; - for (direction = DIR_TOP ; - direction < NB_DIRS ; direction ++) { - set_prop_border_x_width_from_value (a_style, + int dir; + for (dir = (int) DIR_TOP ; dir < (int)NB_DIRS ; dir++) { + enum CRDirection direction = (enum CRDirection)dir; + set_prop_border_x_width_from_value (a_style, cur_term, direction) ; } @@ -698,20 +696,17 @@ static enum CRStatus set_prop_border_style_from_value (CRStyle *a_style, CRTerm *a_value) { - CRTerm *cur_term = NULL ; - enum CRDirection direction = DIR_TOP ; - g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR) ; - cur_term = a_value ; + CRTerm *cur_term = a_value ; if (!cur_term || cur_term->type != TERM_IDENT) { return CR_ERROR ; } - for (direction = DIR_TOP ; - direction < NB_DIRS ; - direction ++) { + int dir; + for (dir = (int)DIR_TOP ; dir < (int)NB_DIRS ; dir++) { + enum CRDirection direction = (enum CRDirection)dir; set_prop_border_x_style_from_value (a_style, cur_term, direction) ; @@ -804,7 +799,7 @@ set_prop_margin_x_from_value (CRStyle * a_style, CRTerm * a_value, } struct CRPropDisplayValPair { - const guchar *prop_name; + const gchar *prop_name; enum CRDisplayType type; }; @@ -865,7 +860,7 @@ set_prop_display_from_value (CRStyle * a_style, CRTerm * a_value) } struct CRPropPositionValPair { - const guchar *name; + const gchar *name; enum CRPositionType type; }; @@ -1120,11 +1115,11 @@ set_prop_border_x_color_from_value (CRStyle * a_style, CRTerm * a_value, && a_value->content.str->stryng->str) { status = cr_rgb_set_from_name (rgb_color, - a_value->content.str->stryng->str); + (guchar *)a_value->content.str->stryng->str); } if (status != CR_OK) { - cr_rgb_set_from_name (rgb_color, "black"); + cr_rgb_set_from_name (rgb_color, (guchar *)"black"); } } else if (a_value->type == TERM_RGB) { if (a_value->content.rgb) { @@ -1166,14 +1161,13 @@ set_prop_border_x_from_value (CRStyle * a_style, CRTerm * a_value, static enum CRStatus set_prop_border_from_value (CRStyle * a_style, CRTerm * a_value) { - enum CRDirection direction = 0; - g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR); - for (direction = 0; direction < NB_DIRS; direction++) { + int dir; + for (dir = 0; dir < (int)NB_DIRS; dir++) { set_prop_border_x_from_value (a_style, a_value, - direction); + (enum CRDirection)dir); } return CR_OK; @@ -1183,7 +1177,6 @@ static enum CRStatus set_prop_padding_from_value (CRStyle * a_style, CRTerm * a_value) { CRTerm *cur_term = NULL; - enum CRDirection direction = 0; enum CRStatus status = CR_OK; g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR); @@ -1197,8 +1190,10 @@ set_prop_padding_from_value (CRStyle * a_style, CRTerm * a_value) if (!cur_term) return CR_ERROR ; - for (direction = 0; direction < NB_DIRS; direction++) { - set_prop_padding_x_from_value (a_style, cur_term, direction); + int dir; + for (dir = 0; dir < (int)NB_DIRS; dir++) { + set_prop_padding_x_from_value (a_style, + cur_term, (enum CRDirection)dir); } cur_term = cur_term->next; @@ -1234,7 +1229,6 @@ static enum CRStatus set_prop_margin_from_value (CRStyle * a_style, CRTerm * a_value) { CRTerm *cur_term = NULL; - enum CRDirection direction = 0; enum CRStatus status = CR_OK; g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR); @@ -1248,8 +1242,10 @@ set_prop_margin_from_value (CRStyle * a_style, CRTerm * a_value) if (!cur_term) return CR_OK; - for (direction = 0; direction < NB_DIRS; direction++) { - set_prop_margin_x_from_value (a_style, cur_term, direction); + int dir; + for (dir = 0; dir < (int)NB_DIRS; dir++) { + set_prop_margin_x_from_value(a_style, + cur_term, (enum CRDirection)dir); } cur_term = cur_term->next; @@ -1358,7 +1354,7 @@ set_prop_font_family_from_value (CRStyle * a_style, CRTerm * a_value) && cur_term->content.str->stryng->str) { cur_ff = cr_font_family_new (FONT_FAMILY_NON_GENERIC, - cur_term->content.str->stryng->str); + (guchar *)cur_term->content.str->stryng->str); } } break; @@ -1676,7 +1672,7 @@ set_prop_white_space_from_value (CRStyle * a_style, CRTerm * a_value) a_style->white_space = WHITE_SPACE_NORMAL; } else if (!strcmp (a_value->content.str->stryng->str, "pre")) { - a_style->font_weight = WHITE_SPACE_PRE; + a_style->white_space = WHITE_SPACE_PRE; } else if (!strcmp (a_value->content.str->stryng->str, "nowrap")) { a_style->white_space = WHITE_SPACE_NOWRAP; @@ -1711,9 +1707,7 @@ set_prop_white_space_from_value (CRStyle * a_style, CRTerm * a_value) CRStyle * cr_style_new (gboolean a_set_props_to_initial_values) { - CRStyle *result = NULL; - - result = g_try_malloc (sizeof (CRStyle)); + CRStyle *result = (CRStyle *)g_try_malloc (sizeof (CRStyle)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -2024,7 +2018,7 @@ cr_style_set_style_from_decl (CRStyle * a_this, CRDeclaration * a_decl) CR_BAD_PARAM_ERROR); prop_id = cr_style_get_prop_id - (a_decl->property->stryng->str); + ((guchar *)a_decl->property->stryng->str); value = a_decl->value; switch (prop_id) { @@ -2682,7 +2676,7 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) *before outputing it value */ cr_utils_dump_n_chars2 (' ', str, indent); - tmp_str = (gchar *) num_prop_code_to_string (i); + tmp_str = (gchar *) num_prop_code_to_string ((enum CRNumProp)i); if (tmp_str) { g_string_append_printf (str, "%s: ", tmp_str); } else { @@ -2696,7 +2690,7 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) } /*loop over the rgb_props and to_string() them all */ for (i = RGB_PROP_BORDER_TOP_COLOR; i < NB_RGB_PROPS; i++) { - tmp_str = (gchar *) rgb_prop_code_to_string (i); + tmp_str = (gchar *) rgb_prop_code_to_string ((enum CRRgbProp)i); cr_utils_dump_n_chars2 (' ', str, indent); if (tmp_str) { g_string_append_printf (str, "%s: ", tmp_str); @@ -2711,7 +2705,8 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) } /*loop over the border_style_props and to_string() them */ for (i = BORDER_STYLE_PROP_TOP; i < NB_BORDER_STYLE_PROPS; i++) { - tmp_str = (gchar *) border_style_prop_code_to_string (i); + tmp_str = (gchar *) + border_style_prop_code_to_string ((enum CRBorderStyleProp)i); cr_utils_dump_n_chars2 (' ', str, indent); if (tmp_str) { g_string_append_printf (str, "%s: ", tmp_str); @@ -2746,7 +2741,7 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) cr_utils_dump_n_chars2 (' ', str, indent); g_string_append (str, "font-family: "); - tmp_str = cr_font_family_to_string (a_this->font_family, TRUE); + tmp_str = (gchar *)cr_font_family_to_string (a_this->font_family, TRUE); if (tmp_str) { g_string_append (str, tmp_str); g_free (tmp_str); diff --git a/src/cr-style.h b/src/cr-style.h index 18aeaad..9abdef6 100644 --- a/src/cr-style.h +++ b/src/cr-style.h @@ -80,7 +80,7 @@ enum CRPositionType POSITION_RELATIVE, POSITION_ABSOLUTE, POSITION_FIXED, - POSITION_INHERIT + POSITION_INHERIT, } ; enum CRFloatType diff --git a/src/cr-stylesheet.c b/src/cr-stylesheet.c index 69909da..06b27fc 100644 --- a/src/cr-stylesheet.c +++ b/src/cr-stylesheet.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ /* * This file is part of The Croco Library @@ -36,9 +36,7 @@ CRStyleSheet * cr_stylesheet_new (CRStatement * a_stmts) { - CRStyleSheet *result; - - result = g_try_malloc (sizeof (CRStyleSheet)); + CRStyleSheet *result = (CRStyleSheet *)g_try_malloc (sizeof (CRStyleSheet)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -57,11 +55,11 @@ cr_stylesheet_new (CRStatement * a_stmts) *@return the serialized stylesheet. */ gchar * -cr_stylesheet_to_string (CRStyleSheet const *a_this) +cr_stylesheet_to_string (CRStyleSheet *a_this) { gchar *str = NULL; GString *stringue = NULL; - CRStatement const *cur_stmt = NULL; + CRStatement *cur_stmt = NULL; g_return_val_if_fail (a_this, NULL); @@ -95,7 +93,7 @@ cr_stylesheet_to_string (CRStyleSheet const *a_this) *@param a_fp the destination file */ void -cr_stylesheet_dump (CRStyleSheet const * a_this, FILE * a_fp) +cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp) { gchar *str = NULL ; @@ -115,7 +113,7 @@ cr_stylesheet_dump (CRStyleSheet const * a_this, FILE * a_fp) *@return number of rules in the stylesheet. */ gint -cr_stylesheet_nr_rules (CRStyleSheet const * a_this) +cr_stylesheet_nr_rules (CRStyleSheet * a_this) { g_return_val_if_fail (a_this, -1); diff --git a/src/cr-stylesheet.h b/src/cr-stylesheet.h index f35c94e..3766a28 100644 --- a/src/cr-stylesheet.h +++ b/src/cr-stylesheet.h @@ -84,10 +84,10 @@ struct _CRStyleSheet CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ; -gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ; -void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ; +gchar * cr_stylesheet_to_string (CRStyleSheet *a_this) ; +void cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) ; -gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ; +gint cr_stylesheet_nr_rules (CRStyleSheet *a_this) ; CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ; diff --git a/src/cr-term.c b/src/cr-term.c index d6db51a..63b3927 100644 --- a/src/cr-term.c +++ b/src/cr-term.c @@ -84,9 +84,7 @@ cr_term_clear (CRTerm * a_this) CRTerm * cr_term_new (void) { - CRTerm *result = NULL; - - result = g_try_malloc (sizeof (CRTerm)); + CRTerm *result = (CRTerm *)g_try_malloc (sizeof (CRTerm)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; @@ -106,14 +104,15 @@ CRTerm * cr_term_parse_expression_from_buf (const guchar * a_buf, enum CREncoding a_encoding) { - CRParser *parser = NULL; CRTerm *result = NULL; enum CRStatus status = CR_OK; g_return_val_if_fail (a_buf, NULL); - parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), - a_encoding, FALSE); + CRParser *parser = cr_parser_new_from_buf ( + (guchar*)a_buf, + strlen ((char *)a_buf), + a_encoding, FALSE); g_return_val_if_fail (parser, NULL); status = cr_parser_try_to_skip_spaces_and_comments (parser); @@ -276,12 +275,12 @@ cr_term_prepend_term (CRTerm * a_this, CRTerm * a_new_term) *form of #CRTerm. MUST BE FREED BY THE CALLER using g_free(). */ guchar * -cr_term_to_string (CRTerm const * a_this) +cr_term_to_string (CRTerm * a_this) { GString *str_buf = NULL; - CRTerm const *cur = NULL; - guchar *result = NULL, - *content = NULL; + CRTerm *cur = NULL; + guchar *result = NULL; + gchar *content = NULL; g_return_val_if_fail (a_this, NULL); @@ -330,7 +329,7 @@ cr_term_to_string (CRTerm const * a_this) switch (cur->type) { case TERM_NUMBER: if (cur->content.num) { - content = cr_num_to_string (cur->content.num); + content = (gchar *)cr_num_to_string (cur->content.num); } if (content) { @@ -361,7 +360,7 @@ cr_term_to_string (CRTerm const * a_this) if (tmp_str) { g_string_append (str_buf, - tmp_str); + (gchar *)tmp_str); g_free (tmp_str); tmp_str = NULL; } @@ -406,8 +405,8 @@ cr_term_to_string (CRTerm const * a_this) case TERM_URI: if (cur->content.str) { content = g_strndup - (cur->content.str->stryng->str, - cur->content.str->stryng->len); + (cur->content.str->stryng->str, + cur->content.str->stryng->len); } if (content) { @@ -426,7 +425,7 @@ cr_term_to_string (CRTerm const * a_this) tmp_str = cr_rgb_to_string (cur->content.rgb); if (tmp_str) { - g_string_append (str_buf, tmp_str); + g_string_append (str_buf, (gchar *)tmp_str); g_free (tmp_str); tmp_str = NULL; } @@ -464,7 +463,7 @@ cr_term_to_string (CRTerm const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -473,11 +472,11 @@ cr_term_to_string (CRTerm const * a_this) } guchar * -cr_term_one_to_string (CRTerm const * a_this) +cr_term_one_to_string (CRTerm * a_this) { GString *str_buf = NULL; - guchar *result = NULL, - *content = NULL; + guchar *result = NULL; + gchar *content = NULL; g_return_val_if_fail (a_this, NULL); @@ -525,7 +524,7 @@ cr_term_one_to_string (CRTerm const * a_this) switch (a_this->type) { case TERM_NUMBER: if (a_this->content.num) { - content = cr_num_to_string (a_this->content.num); + content = (gchar *)cr_num_to_string (a_this->content.num); } if (content) { @@ -616,10 +615,9 @@ cr_term_one_to_string (CRTerm const * a_this) case TERM_RGB: if (a_this->content.rgb) { - guchar *tmp_str = NULL; g_string_append_printf (str_buf, "rgb("); - tmp_str = cr_rgb_to_string (a_this->content.rgb); + gchar *tmp_str = (gchar *)cr_rgb_to_string (a_this->content.rgb); if (tmp_str) { g_string_append (str_buf, tmp_str); @@ -660,7 +658,7 @@ cr_term_one_to_string (CRTerm const * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *)str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -677,7 +675,7 @@ cr_term_one_to_string (CRTerm const * a_this) *@param a_fp the destination file pointer. */ void -cr_term_dump (CRTerm const * a_this, FILE * a_fp) +cr_term_dump (CRTerm * a_this, FILE * a_fp) { guchar *content = NULL; @@ -697,9 +695,9 @@ cr_term_dump (CRTerm const * a_this, FILE * a_fp) *@return number of terms in the expression. */ int -cr_term_nr_values (CRTerm const *a_this) +cr_term_nr_values (CRTerm *a_this) { - CRTerm const *cur = NULL ; + CRTerm *cur = NULL ; int nr = 0; g_return_val_if_fail (a_this, -1) ; diff --git a/src/cr-term.h b/src/cr-term.h index 0f22dda..ae8b234 100644 --- a/src/cr-term.h +++ b/src/cr-term.h @@ -35,7 +35,7 @@ G_BEGIN_DECLS /** *@file - *Declaration of the #CRTem class. + *Declaration of the #CRTerm class. */ enum CRTermType @@ -169,13 +169,13 @@ CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ; CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ; -guchar * cr_term_to_string (CRTerm const *a_this) ; +guchar * cr_term_to_string (CRTerm *a_this) ; -guchar * cr_term_one_to_string (CRTerm const * a_this) ; +guchar * cr_term_one_to_string (CRTerm * a_this) ; -void cr_term_dump (CRTerm const *a_this, FILE *a_fp) ; +void cr_term_dump (CRTerm *a_this, FILE *a_fp) ; -int cr_term_nr_values (CRTerm const *a_this) ; +int cr_term_nr_values (CRTerm *a_this) ; CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ; diff --git a/src/cr-tknzr.c b/src/cr-tknzr.c index 64924ed..859b6c5 100644 --- a/src/cr-tknzr.c +++ b/src/cr-tknzr.c @@ -195,7 +195,7 @@ CHECK_PARSING_STATUS (status, TRUE) ; */ #define SKIP_CHARS(a_tknzr, a_nb_chars) \ { \ -glong nb_chars = a_nb_chars ; \ +gulong nb_chars = a_nb_chars ; \ status = cr_input_consume_chars \ (PRIVATE (a_tknzr)->input,0, &nb_chars) ; \ CHECK_PARSING_STATUS (status, TRUE) ; \ @@ -408,7 +408,7 @@ cr_tknzr_try_to_skip_spaces (CRTknzr * a_this) } if (cr_utils_is_white_space (cur_char) == TRUE) { - glong nb_chars = -1; /*consume all spaces */ + gulong nb_chars = -1; /*consume all spaces */ status = cr_input_consume_white_spaces (PRIVATE (a_this)->input, &nb_chars); @@ -434,7 +434,7 @@ cr_tknzr_parse_comment (CRTknzr * a_this, CRInputPos init_pos; guint32 cur_char = 0, next_char= 0; CRString *comment = NULL; - CRParsingLocation loc = {0} ; + CRParsingLocation loc = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) && PRIVATE (a_this)->input, @@ -448,49 +448,38 @@ cr_tknzr_parse_comment (CRTknzr * a_this, READ_NEXT_CHAR (a_this, &cur_char); ENSURE_PARSING_COND (cur_char == '*'); comment = cr_string_new (); - for (;;) { /* [^*]* */ - PEEK_NEXT_CHAR (a_this, &next_char); - if (next_char == '*') - break; + for (;;) { READ_NEXT_CHAR (a_this, &cur_char); - g_string_append_unichar (comment->stryng, cur_char); - } - /* Stop condition: next_char == '*' */ - for (;;) { /* \*+ */ - READ_NEXT_CHAR(a_this, &cur_char); - ENSURE_PARSING_COND (cur_char == '*'); - g_string_append_unichar (comment->stryng, cur_char); - PEEK_NEXT_CHAR (a_this, &next_char); - if (next_char != '*') - break; - } - /* Stop condition: next_char != '*' */ - for (;;) { /* ([^/][^*]*\*+)* */ - if (next_char == '/') - break; - READ_NEXT_CHAR(a_this, &cur_char); - g_string_append_unichar (comment->stryng, cur_char); - for (;;) { /* [^*]* */ - PEEK_NEXT_CHAR (a_this, &next_char); - if (next_char == '*') - break; + + /*make sure there are no nested comments */ + if (cur_char == '/') { READ_NEXT_CHAR (a_this, &cur_char); - g_string_append_unichar (comment->stryng, cur_char); + ENSURE_PARSING_COND (cur_char != '*'); + g_string_append_c (comment->stryng, '/'); + g_string_append_unichar (comment->stryng, + cur_char); + continue; } - /* Stop condition: next_char = '*', no need to verify, because peek and read exit to error anyway */ - for (;;) { /* \*+ */ - READ_NEXT_CHAR(a_this, &cur_char); - ENSURE_PARSING_COND (cur_char == '*'); - g_string_append_unichar (comment->stryng, cur_char); + + /*Detect the end of the comments region */ + if (cur_char == '*') { PEEK_NEXT_CHAR (a_this, &next_char); - if (next_char != '*') + + if (next_char == '/') { + /* + *end of comments region + *Now, call the right SAC callback. + */ + SKIP_CHARS (a_this, 1) ; + status = CR_OK; break; + } else { + g_string_append_c (comment->stryng, + '*'); + } } - /* Continue condition: next_char != '*' */ + g_string_append_unichar (comment->stryng, cur_char); } - /* Stop condition: next_char == '\/' */ - READ_NEXT_CHAR(a_this, &cur_char); - g_string_append_unichar (comment->stryng, cur_char); if (status == CR_OK) { cr_parsing_location_copy (&comment->location, @@ -573,16 +562,39 @@ cr_tknzr_parse_unicode_escape (CRTknzr * a_this, cur_char_val = 10 + (cur_char - 'A'); } - unicode = unicode * 16 + cur_char_val; + unicode = unicode * 10 + cur_char_val; PEEK_NEXT_CHAR (a_this, &cur_char); } - /* Eat a whitespace if possible. */ - cr_tknzr_parse_w (a_this, &tmp_char_ptr1, - &tmp_char_ptr2, NULL); - *a_unicode = unicode; - return CR_OK; + if (occur == 5) { + /* + *the unicode escape is 6 digit length + */ + + /* + *parse one space that may + *appear just after the unicode + *escape. + */ + cr_tknzr_parse_w (a_this, &tmp_char_ptr1, + &tmp_char_ptr2, NULL); + status = CR_OK; + } else { + /* + *The unicode escape is less than + *6 digit length. The character + *that comes right after the escape + *must be a white space. + */ + status = cr_tknzr_parse_w (a_this, &tmp_char_ptr1, + &tmp_char_ptr2, NULL); + } + + if (status == CR_OK) { + *a_unicode = unicode; + return CR_OK; + } error: /* @@ -699,13 +711,14 @@ cr_tknzr_parse_string (CRTknzr * a_this, CRString ** a_str) guchar next_chars[2] = { 0 }; PEEK_BYTE (a_this, 1, &next_chars[0]); - PEEK_BYTE (a_this, 2, &next_chars[1]); if (next_chars[0] == '\\') { guchar *tmp_char_ptr1 = NULL, *tmp_char_ptr2 = NULL; guint32 esc_code = 0; + PEEK_BYTE (a_this, 2, &next_chars[1]); + if (next_chars[1] == '\'' || next_chars[1] == '"') { g_string_append_unichar (str->stryng, next_chars[1]); @@ -1023,7 +1036,7 @@ cr_tknzr_parse_name (CRTknzr * a_this, gboolean str_needs_free = FALSE, is_first_nmchar=TRUE ; glong i = 0; - CRParsingLocation loc = {0} ; + CRParsingLocation loc = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) && PRIVATE (a_this)->input @@ -1075,7 +1088,7 @@ cr_tknzr_parse_hash (CRTknzr * a_this, CRString ** a_str) CRInputPos init_pos; enum CRStatus status = CR_OK; gboolean str_needs_free = FALSE; - CRParsingLocation loc = {0} ; + CRParsingLocation loc = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) && PRIVATE (a_this)->input, @@ -1128,7 +1141,7 @@ cr_tknzr_parse_uri (CRTknzr * a_this, enum CRStatus status = CR_PARSING_ERROR; guchar tab[4] = { 0 }, *tmp_ptr1 = NULL, *tmp_ptr2 = NULL; CRString *str = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) @@ -1253,7 +1266,7 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb) blue = 0, i = 0; gboolean is_percentage = FALSE; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); @@ -1280,7 +1293,7 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb) status = cr_tknzr_parse_num (a_this, &num); ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL)); - red = num->val; + red = (glong)num->val; cr_num_destroy (num); num = NULL; @@ -1306,9 +1319,9 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb) } if (i == 0) { - green = num->val; + green = (glong)num->val; } else if (i == 1) { - blue = num->val; + blue = (glong)num->val; } if (num) { @@ -1479,7 +1492,7 @@ cr_tknzr_parse_num (CRTknzr * a_this, next_char = 0; gdouble numerator, denominator = 1; CRInputPos init_pos; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) && PRIVATE (a_this)->input, @@ -1570,9 +1583,7 @@ cr_tknzr_parse_num (CRTknzr * a_this, CRTknzr * cr_tknzr_new (CRInput * a_input) { - CRTknzr *result = NULL; - - result = g_try_malloc (sizeof (CRTknzr)); + CRTknzr *result = (CRTknzr *)g_try_malloc (sizeof (CRTknzr)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); @@ -1581,7 +1592,7 @@ cr_tknzr_new (CRInput * a_input) memset (result, 0, sizeof (CRTknzr)); - result->priv = g_try_malloc (sizeof (CRTknzrPriv)); + result->priv = (CRTknzrPriv *)g_try_malloc (sizeof (CRTknzrPriv)); if (result->priv == NULL) { cr_utils_trace_info ("Out of memory"); @@ -1622,9 +1633,7 @@ cr_tknzr_new_from_uri (const guchar * a_file_uri, enum CREncoding a_enc) { CRTknzr *result = NULL; - CRInput *input = NULL; - - input = cr_input_new_from_uri (a_file_uri, a_enc); + CRInput *input = cr_input_new_from_uri ((gchar *)a_file_uri, a_enc); g_return_val_if_fail (input != NULL, NULL); result = cr_tknzr_new (input); @@ -1897,7 +1906,7 @@ cr_tknzr_consume_chars (CRTknzr * a_this, guint32 a_char, glong * a_nb_char) } return cr_input_consume_chars (PRIVATE (a_this)->input, - a_char, a_nb_char); + a_char, (gulong *)a_nb_char); } enum CRStatus @@ -1949,7 +1958,7 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) CRInput *input = NULL; CRString *str = NULL; CRRgb *rgb = NULL; - CRParsingLocation location = {0} ; + CRParsingLocation location = {0,0,0} ; g_return_val_if_fail (a_this && PRIVATE (a_this) && a_tk && *a_tk == NULL @@ -2097,8 +2106,18 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) } goto done; } - } - goto fallback; + } else { + status = cr_tknzr_parse_ident (a_this, &str); + if (status == CR_OK && str) { + status = cr_token_set_ident (token, str); + CHECK_PARSING_STATUS (status, TRUE); + if (str) { + cr_parsing_location_copy (&token->location, + &str->location) ; + } + goto done; + } + } break; case 'r': @@ -2117,18 +2136,28 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) goto done; } + } else { + status = cr_tknzr_parse_ident (a_this, &str); + if (status == CR_OK) { + status = cr_token_set_ident (token, str); + CHECK_PARSING_STATUS (status, TRUE); + if (str) { + cr_parsing_location_copy (&token->location, + &str->location) ; + } + str = NULL; + goto done; + } } - goto fallback; break; case '<': - if (BYTE (input, 2, NULL) == '!' - && BYTE (input, 3, NULL) == '-' - && BYTE (input, 4, NULL) == '-') { + if (BYTE (input, 2, NULL) == '-' + && BYTE (input, 3, NULL) == '-') { SKIP_CHARS (a_this, 1); cr_tknzr_get_parsing_location (a_this, &location) ; - SKIP_CHARS (a_this, 3); + SKIP_CHARS (a_this, 2); status = cr_token_set_cdo (token); CHECK_PARSING_STATUS (status, TRUE); cr_parsing_location_copy (&token->location, @@ -2361,7 +2390,7 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) next_bytes[0] = BYTE (input, 1, NULL); next_bytes[1] = BYTE (input, 2, NULL); next_bytes[2] = BYTE (input, 3, NULL); - next_bytes[3] = BYTE (input, 3, NULL); + next_bytes[3] = BYTE (input, 4, NULL); if (next_bytes[0] == 'e' && next_bytes[1] == 'm') { @@ -2509,7 +2538,6 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) break; default: - fallback: /*process the fallback cases here */ if (next_char == '\\' diff --git a/src/cr-token.c b/src/cr-token.c index e240ab8..af95751 100644 --- a/src/cr-token.c +++ b/src/cr-token.c @@ -46,7 +46,6 @@ cr_token_clear (CRToken * a_this) switch (a_this->type) { case S_TK: case CDO_TK: - case CDC_TK: case INCLUDES_TK: case DASHMATCH_TK: case PAGE_SYM_TK: @@ -133,9 +132,7 @@ cr_token_clear (CRToken * a_this) CRToken * cr_token_new (void) { - CRToken *result = NULL; - - result = g_try_malloc (sizeof (CRToken)); + CRToken *result = (CRToken *)g_try_malloc (sizeof (CRToken)); if (result == NULL) { cr_utils_trace_info ("Out of memory"); diff --git a/src/cr-utils.c b/src/cr-utils.c index ed4be3e..487cf4b 100644 --- a/src/cr-utils.c +++ b/src/cr-utils.c @@ -725,7 +725,7 @@ cr_utils_utf8_str_to_ucs4 (const guchar * a_in, g_return_val_if_fail (status == CR_OK, status); - *a_out = g_malloc0 (*a_out_len * sizeof (guint32)); + *a_out = (guint32 *) g_malloc0 (*a_out_len * sizeof (guint32)); status = cr_utils_utf8_to_ucs4 (a_in, a_in_len, *a_out, a_out_len); @@ -971,7 +971,7 @@ cr_utils_ucs1_str_to_utf8 (const guchar * a_in, in_len = *a_in_len; - *a_out = g_malloc0 (out_len); + *a_out = (guchar *) g_malloc0 (out_len); status = cr_utils_ucs1_to_utf8 (a_in, a_in_len, *a_out, &out_len); @@ -1172,7 +1172,7 @@ cr_utils_utf8_str_to_ucs1 (const guchar * a_in, g_return_val_if_fail (status == CR_OK, status); - *a_out = g_malloc0 (*a_out_len * sizeof (guint32)); + *a_out = (guchar *) g_malloc0 (*a_out_len * sizeof (guint32)); status = cr_utils_utf8_to_ucs1 (a_in, a_in_len, *a_out, a_out_len); return status; @@ -1299,10 +1299,10 @@ cr_utils_dump_n_chars2 (guchar a_char, GString * a_string, glong a_nb) *@param a_list_of_strings the list of strings to be duplicated. */ GList * -cr_utils_dup_glist_of_string (GList const * a_list_of_strings) +cr_utils_dup_glist_of_string (GList * a_list_of_strings) { - GList const *cur = NULL; - GList *result = NULL; + GList *cur = NULL, + *result = NULL; g_return_val_if_fail (a_list_of_strings, NULL); @@ -1325,17 +1325,16 @@ cr_utils_dup_glist_of_string (GList const * a_list_of_strings) *happened. */ GList * -cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) +cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings) { - GList const *cur = NULL; - GList *result = NULL; + GList *cur = NULL, *result = NULL; g_return_val_if_fail (a_list_of_strings, NULL); for (cur = a_list_of_strings; cur; cur = cur->next) { CRString *str = NULL; - str = cr_string_dup ((CRString const *) cur->data) ; + str = cr_string_dup ((CRString *) cur->data) ; if (str) result = g_list_append (result, str); } diff --git a/src/cr-utils.h b/src/cr-utils.h index 54aa249..060842a 100644 --- a/src/cr-utils.h +++ b/src/cr-utils.h @@ -26,7 +26,10 @@ #include <stdio.h> #include <glib.h> -#include "libcroco-config.h" +/* + * We're disabling this #include for Inkscape: see comment in libcroco.h. +//#include "libcroco-config.h" + */ G_BEGIN_DECLS @@ -236,10 +239,10 @@ cr_utils_dump_n_chars2 (guchar a_char, GString *a_string, glong a_nb) ; GList * -cr_utils_dup_glist_of_string (GList const *a_list) ; +cr_utils_dup_glist_of_string (GList *a_list) ; GList * -cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ; +cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings) ; G_END_DECLS |