Fix more signed vs. unsigned char pointer type conflicts.

This patch contains those cases where a cast was unavoidable.

Patch by J. Alex Aycinena. Detailed explanation follows:

1 - src/register/register-gnome/gnucash-item-edit.c
The variable 'sel' is set with 'gtk_selection_data_get_text' which
returns a 'guchar *'; 'sel' is then used by functions
'gtk_editable_insert_text' and 'strlen' which require 'gchar *', so
there is no alternative but to cast.

2 - src/backend/xml/gnc-budget-xml-v2.c
The functions 'xmlNewNode'and 'xmlSetProp' require arguments that are
of type 'const xmlChar *' but the arguments are string literals (char
*). Can string literals be set up as type 'const xmlChar *'? The
patchfile has them being cast. BAD_CAST is defined for this purpose.

3 - src/backend/xml/gnc-schedxaction-xml-v2.c
Like above, the function 'xmlNewNode' requires arguments that are of
type 'const xmlChar *' but the arguments are string literals (char *).
In the three other changes the type 'const xmlChar *' needs to be
changed to 'char *' to be used by 'strcmp'.

4 - src/backend/xml/gnc-recurrence-xml-v2.c
Like above for the functions 'xmlNewNode'and 'xmlSetProp'.

5 - src/html/gnc-html-graph-gog-webkit.c
The function 'g_base64_encode' requires type 'guchar *' for the
argument and changing the variable to this caused other problems so
used casting instead.

6 - src/libqof/backend/file/qsf-xml-map.c (6 occurances)
The first occurance was solved by changing the type declaration, but
the other 5 required casting.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18226 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2009-07-24 20:07:26 +00:00
parent 0e72f8e066
commit d7a88892f1
6 changed files with 22 additions and 16 deletions

View File

@ -61,8 +61,8 @@ gnc_budget_dom_tree_create(GncBudget *bgt)
ENTER ("(budget=%p)", bgt);
ret = xmlNewNode(NULL, gnc_budget_string);
xmlSetProp(ret, "version", budget_version_string);
ret = xmlNewNode(NULL, BAD_CAST gnc_budget_string);
xmlSetProp(ret, BAD_CAST "version", BAD_CAST budget_version_string);
/* field: GUID */
xmlAddChild(ret, guid_to_dom_tree(bgt_id_string,

View File

@ -133,8 +133,8 @@ recurrence_to_dom_tree(const gchar *tag, const Recurrence *r)
GDate d;
WeekendAdjust wadj;
n = xmlNewNode(NULL, tag);
xmlSetProp(n, "version", recurrence_version_string );
n = xmlNewNode(NULL, BAD_CAST tag);
xmlSetProp(n, BAD_CAST "version", BAD_CAST recurrence_version_string );
xmlAddChild(n, guint_to_dom_tree(recurrence_mult,
recurrenceGetMultiplier(r)));
pt = recurrenceGetPeriodType(r);

View File

@ -153,7 +153,8 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
if (allow_2_2_incompat)
{
xmlNodePtr schedule_node = xmlNewNode(NULL, "sx:schedule");
xmlNodePtr schedule_node = xmlNewNode(NULL,
BAD_CAST "sx:schedule");
GList *schedule = gnc_sx_get_schedule(sx);
for (; schedule != NULL; schedule = schedule->next)
{
@ -686,7 +687,7 @@ gnc_schedXaction_end_handler(gpointer data_for_children,
{
xmlChar *attr_value = attr->children->content;
g_debug("sx attribute name[%s] value[%s]", attr->name, attr_value);
if (strcmp(attr->name, "version") != 0)
if (strcmp((const char *)attr->name, "version") != 0)
{
g_warning("unknown sx attribute [%s]", attr->name);
continue;
@ -694,7 +695,8 @@ gnc_schedXaction_end_handler(gpointer data_for_children,
// if version == 1.0.0: ensure freqspec, no recurrence
// if version == 2.0.0: ensure recurrence, no freqspec.
if (strcmp(attr_value, schedxaction_version_string) == 0)
if (strcmp((const char *)attr_value,
schedxaction_version_string) == 0)
{
if (!sx_pdata.saw_freqspec)
g_critical("did not see freqspec in version 1 sx [%s]", sx_name);
@ -702,7 +704,8 @@ gnc_schedXaction_end_handler(gpointer data_for_children,
g_warning("saw recurrence in supposedly version 1 sx [%s]", sx_name);
}
if (strcmp(attr_value, schedxaction_version2_string) == 0)
if (strcmp((const char *)attr_value,
schedxaction_version2_string) == 0)
{
if (sx_pdata.saw_freqspec)
g_warning("saw freqspec in version 2 sx [%s]", sx_name);

View File

@ -202,7 +202,7 @@ convert_pixbuf_to_base64_string( GdkPixbuf* pixbuf )
return NULL;
}
base64_buf = g_base64_encode( pixel_buffer, pixel_buffer_size );
base64_buf = g_base64_encode( (guchar *)pixel_buffer, pixel_buffer_size );
g_free( pixel_buffer );
return base64_buf;
}

View File

@ -337,10 +337,10 @@ qsf_map_default_handler(xmlNodePtr child, xmlNsPtr ns, qsf_param *params )
g_return_if_fail(params->qsf_define_hash != NULL);
iterate = NULL;
if (qsf_is_element(child, ns, MAP_DEFINE_TAG)) {
iterate = xmlGetProp(child, MAP_ITERATE_ATTR);
iterate = (gchar*)xmlGetProp(child, BAD_CAST MAP_ITERATE_ATTR);
if(qof_util_bool_to_int(iterate) == 1)
{
params->qof_foreach = xmlGetProp(child, BAD_CAST MAP_E_TYPE);
params->qof_foreach = (QofIdType)xmlGetProp(child, BAD_CAST MAP_E_TYPE);
}
if(NULL == g_hash_table_lookup(params->qsf_define_hash,
xmlGetProp(child, BAD_CAST MAP_E_TYPE)))
@ -661,7 +661,8 @@ qsf_map_calculate_output(xmlNodePtr param_node, xmlNodePtr child, qsf_param *par
output_content = xmlNodeGetContent(param_node);
/* source refers to the source object that provides the data */
source = g_list_find_custom(params->qsf_object_list,
BAD_CAST xmlGetProp(param_node, MAP_OBJECT_ATTR), identify_source_func);
BAD_CAST xmlGetProp(param_node, BAD_CAST MAP_OBJECT_ATTR),
identify_source_func);
if(!source) return;
params->object_set = source->data;
node = g_hash_table_lookup(params->object_set->parameters, output_content);
@ -744,7 +745,7 @@ iterator_cb(xmlNodePtr child, xmlNsPtr ns, qsf_param *params)
/* count the number of iterators in the QSF file */
if(qsf_is_element(child, ns, QSF_OBJECT_TAG))
{
object_name = xmlGetProp(child, QSF_OBJECT_TYPE);
object_name = (gchar *)xmlGetProp(child, BAD_CAST QSF_OBJECT_TYPE);
if(0 == safe_strcmp(object_name, params->qof_foreach))
{
params->foreach_limit++;
@ -793,8 +794,9 @@ qsf_object_convert(xmlDocPtr mapDoc, xmlNodePtr qsf_root, qsf_param *params)
params->lister = NULL;
/* cur_node describes the target object */
if(!qof_class_is_registered(BAD_CAST
xmlGetProp(cur_node, MAP_TYPE_ATTR))) { continue; }
if(!qof_class_is_registered(
(QofIdTypeConst)xmlGetProp(cur_node,
BAD_CAST MAP_TYPE_ATTR))) { continue; }
qsf_add_object_tag(params, params->count);
params->count++;
iter.ns = params->map_ns;

View File

@ -1541,7 +1541,8 @@ gnc_item_edit_selection_received (GncItemEdit *item_edit,
if (sel)
{
gtk_editable_insert_text(editable,
sel, strlen(sel),
(gchar *)sel,
strlen((char *)sel),
&tmp_pos);
gtk_editable_set_position(editable, tmp_pos);
g_free(sel);