index 789d68f42c34ea00bd9f6a65a3a1dc50160a90f8..e0abba83a42463db0e08a839169b63181785d7b4 100644 (file)
--- a/src/libcroco/cr-style.c
+++ b/src/libcroco/cr-style.c
typedef struct _CRPropertyDesc CRPropertyDesc;
struct _CRPropertyDesc {
- const guchar *name;
+ const gchar *name;
enum CRPropertyID prop_id;
};
{"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}
};
/**
{NUM_PROP_MARGIN_BOTTOM, "margin-bottom"},
{NUM_PROP_MARGIN_LEFT, "margin-left"},
{NUM_PROP_WIDTH, "width"},
- {0, NULL}
+ {(enum CRNumProp)0, NULL}
};
struct CRRgbPropEnumDumpInfo {
{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 {
{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
static const gchar *
num_prop_code_to_string (enum CRNumProp a_code)
{
- unsigned const 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 "
static const gchar *
rgb_prop_code_to_string (enum CRRgbProp a_code)
{
- unsigned const 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 "
static const gchar *
border_style_prop_code_to_string (enum CRBorderStyleProp a_code)
{
- unsigned const 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 "
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
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);
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) ;
}
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) ;
}
struct CRPropDisplayValPair {
- const guchar *prop_name;
+ const gchar *prop_name;
enum CRDisplayType type;
};
}
struct CRPropPositionValPair {
- const guchar *name;
+ const gchar *name;
enum CRPositionType type;
};
&& 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) {
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;
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);
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;
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);
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;
&& 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;
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;
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;
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) {
*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 {
}
/*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);
}
/*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);
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);