[planner: 2/4] signedness: explicitly cast the xmlChar to/from gchar type
- From: Mart Raudsepp <mraudsepp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [planner: 2/4] signedness: explicitly cast the xmlChar to/from gchar type
- Date: Sun, 27 Jun 2021 18:34:18 +0000 (UTC)
commit 753c453aac376a82c798950d932cf671f8f5db2a
Author: Andrew Miloradovsky <miloradovsky gmail com>
Date: Fri May 12 19:07:10 2017 +0000
signedness: explicitly cast the xmlChar to/from gchar type
https://bugzilla.gnome.org/show_bug.cgi?id=782572
libplanner/mrp-old-xml.c | 103 ++++++++++++++++-----------
libplanner/mrp-parser.c | 182 ++++++++++++++++++++++++++---------------------
libplanner/mrp-xml.c | 2 +-
libplanner/mrp-xsl.c | 12 ++--
src/planner-msp-plugin.c | 4 +-
tests/scheduler-test.c | 20 ++++--
6 files changed, 188 insertions(+), 135 deletions(-)
---
diff --git a/libplanner/mrp-old-xml.c b/libplanner/mrp-old-xml.c
index 8b79bc24..266042d6 100644
--- a/libplanner/mrp-old-xml.c
+++ b/libplanner/mrp-old-xml.c
@@ -76,6 +76,26 @@ typedef struct {
gint id;
} NodeEntry;
+
+/* These are wrapper functions around the xmlChar type,
+ * to prevent signedness conversion wwarnings.
+ */
+xmlChar * xmlGetProp_ (xmlNodePtr, const gchar *);
+int strcmp_ (const xmlChar *, const gchar *);
+
+xmlChar *
+xmlGetProp_ (xmlNodePtr node, const gchar * x)
+{
+ return xmlGetProp (node, (const xmlChar *) x);
+};
+
+int
+strcmp_ (const xmlChar * x, const gchar * y)
+{
+ return strcmp ((const char *) x, (const char *) y);
+};
+
+
static gchar *old_xml_get_string (xmlNodePtr node,
const char *name);
static gint old_xml_get_int (xmlNodePtr node,
@@ -110,7 +130,7 @@ old_xml_read_predecessor (MrpParser *parser,
gchar *str;
MrpRelationType type;
- if (strcmp (tree->name, "predecessor")){
+ if (strcmp_ (tree->name, "predecessor")){
/*g_warning ("Got %s, expected 'predecessor'.", tree->name);*/
return;
}
@@ -192,7 +212,7 @@ old_xml_read_custom_properties (MrpParser *parser,
xmlNodePtr child;
for (child = node->children; child; child = child->next) {
- if (strcmp (child->name, "property")) {
+ if (strcmp_ (child->name, "property")) {
continue;
}
@@ -220,7 +240,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
MrpTaskType type;
MrpTaskSched sched;
- if (strcmp (tree->name, "task")){
+ if (strcmp_ (tree->name, "task")){
/*g_warning ("Got %s, expected 'task'.", tree->name);*/
return;
}
@@ -319,13 +339,13 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
g_hash_table_insert (parser->task_hash, GINT_TO_POINTER (id), task);
for (child = tree->children; child; child = child->next) {
- if (!strcmp (child->name, "properties")) {
+ if (!strcmp_ (child->name, "properties")) {
old_xml_read_custom_properties (parser, child, MRP_OBJECT (task));
}
}
for (tasks = tree->children; tasks; tasks = tasks->next) {
- if (!strcmp (tasks->name, "task")) {
+ if (!strcmp_ (tasks->name, "task")) {
/* Silently correct old milestones with children to
* normal tasks.
*/
@@ -336,12 +356,12 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
old_xml_read_task (parser, tasks, task);
}
- else if (!strcmp (tasks->name, "predecessors")) {
+ else if (!strcmp_ (tasks->name, "predecessors")) {
for (predecessor = tasks->children; predecessor; predecessor = predecessor->next) {
old_xml_read_predecessor (parser, id, predecessor);
}
}
- else if (!strcmp (tasks->name, "constraint")) {
+ else if (!strcmp_ (tasks->name, "constraint")) {
got_constraint = old_xml_read_constraint (tasks, &constraint);
}
}
@@ -369,7 +389,7 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
MrpGroup *group;
MrpCalendar *calendar;
- if (strcmp (tree->name, "resource")){
+ if (strcmp_ (tree->name, "resource")){
/*g_warning ("Got %s, expected 'resource'.", tree->name);*/
return;
}
@@ -422,7 +442,7 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
NULL);
for (child = tree->children; child; child = child->next) {
- if (!strcmp (child->name, "properties")) {
+ if (!strcmp_ (child->name, "properties")) {
old_xml_read_custom_properties (parser, child, MRP_OBJECT (resource));
}
}
@@ -446,7 +466,7 @@ old_xml_read_group (MrpParser *parser, xmlNodePtr tree)
gchar *mgr_name, *mgr_phone, *mgr_email;
MrpGroup *group;
- if (strcmp (tree->name, "group")){
+ if (strcmp_ (tree->name, "group")){
/*g_warning ("Got %s, expected 'group'.", tree->name);*/
return;
}
@@ -483,7 +503,7 @@ old_xml_read_assignment (MrpParser *parser, xmlNodePtr tree)
MrpTask *task;
MrpResource *resource;
- if (strcmp (tree->name, "allocation")){
+ if (strcmp_ (tree->name, "allocation")){
/*g_warning ("Got %s, expected 'allocation'.", tree->name);*/
return;
}
@@ -531,22 +551,23 @@ old_xml_read_day_type (MrpParser *parser, xmlNodePtr tree)
return;
}
- if (strcmp (tree->name, "day-type") != 0){
+ if (strcmp_ (tree->name, "day-type") != 0){
return;
}
- name = xmlGetProp (tree, "name");
+ name = xmlGetProp_ (tree, "name");
if (!name) {
return;
}
- desc = xmlGetProp (tree, "description");
+ desc = xmlGetProp_ (tree, "description");
if (!desc) {
xmlFree (name);
return;
}
- day = mrp_day_add (parser->project, name, desc);
+ day = mrp_day_add (parser->project,
+ (const gchar *) name, (const gchar *) desc);
xmlFree (name);
xmlFree (desc);
@@ -580,7 +601,7 @@ old_xml_read_overridden_day_type (MrpParser *parser,
GList *intervals = NULL;
xmlNodePtr child;
- if (strcmp (day->name, "overridden-day-type") != 0){
+ if (strcmp_ (day->name, "overridden-day-type") != 0){
return;
}
@@ -588,7 +609,7 @@ old_xml_read_overridden_day_type (MrpParser *parser,
mrp_day = g_hash_table_lookup (parser->day_hash, GINT_TO_POINTER (id));
for (child = day->children; child; child = child->next) {
- if (strcmp (child->name, "interval") == 0) {
+ if (strcmp_ (child->name, "interval") == 0) {
MrpInterval *interval;
gchar *str;
gint hour, min;
@@ -630,15 +651,15 @@ old_xml_read_overridden_day (MrpParser *parser,
MrpDay *mrp_day;
gint y, m, d;
- if (strcmp (day->name, "day") != 0){
+ if (strcmp_ (day->name, "day") != 0){
return;
}
- xml_str = xmlGetProp (day, "type");
+ xml_str = xmlGetProp_ (day, "type");
if (!xml_str) {
return;
}
- if (strcmp (xml_str, "day-type") != 0) {
+ if (strcmp_ (xml_str, "day-type") != 0) {
xmlFree (xml_str);
return;
}
@@ -648,12 +669,12 @@ old_xml_read_overridden_day (MrpParser *parser,
mrp_day = g_hash_table_lookup (parser->day_hash, GINT_TO_POINTER (id));
- xml_str = xmlGetProp (day, "date");
+ xml_str = xmlGetProp_ (day, "date");
if (!xml_str) {
return;
}
- if (sscanf (xml_str, "%04d%02d%02d", &y, &m, &d) == 3) {
+ if (sscanf ((gchar *) xml_str, "%04d%02d%02d", &y, &m, &d) == 3) {
date = mrp_time_compose (y, m, d, 0, 0, 0);
mrp_calendar_set_days (calendar, date, mrp_day, (mrptime) -1);
} else {
@@ -671,19 +692,19 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
xmlNodePtr child;
gint id;
- if (strcmp (tree->name, "calendar") != 0){
+ if (strcmp_ (tree->name, "calendar") != 0){
return;
}
- name = xmlGetProp (tree, "name");
+ name = xmlGetProp_ (tree, "name");
if (!name) {
return;
}
if (parent) {
- calendar = mrp_calendar_derive (name, parent);
+ calendar = mrp_calendar_derive ((gchar *) name, parent);
} else {
- calendar = mrp_calendar_new (name, parser->project);
+ calendar = mrp_calendar_new ((gchar *) name, parser->project);
}
xmlFree (name);
@@ -694,10 +715,10 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
calendar);
for (child = tree->children; child; child = child->next) {
- if (strcmp (child->name, "calendar") == 0) {
+ if (strcmp_ (child->name, "calendar") == 0) {
old_xml_read_calendar (parser, calendar, child);
}
- else if (strcmp (child->name, "default-week") == 0) {
+ else if (strcmp_ (child->name, "default-week") == 0) {
old_xml_read_default_day (parser, child, calendar,
MRP_CALENDAR_DAY_MON, "mon");
old_xml_read_default_day (parser, child, calendar,
@@ -713,7 +734,7 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
old_xml_read_default_day (parser, child, calendar,
MRP_CALENDAR_DAY_SUN, "sun");
}
- else if (strcmp (child->name, "overridden-day-types") == 0) {
+ else if (strcmp_ (child->name, "overridden-day-types") == 0) {
xmlNodePtr day;
for (day = child->children; day; day = day->next) {
@@ -722,7 +743,7 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
day);
}
}
- else if (strcmp (child->name, "days") == 0) {
+ else if (strcmp_ (child->name, "days") == 0) {
xmlNodePtr day;
for (day = child->children; day; day = day->next) {
@@ -794,7 +815,7 @@ old_xml_read_string_list (xmlNodePtr node,
for (child = node->children; child; child = child->next) {
- if (!strcmp (child->name, "list-item")) {
+ if (!strcmp_ (child->name, "list-item")) {
str = old_xml_get_string (child, "value");
if (str && str[0]) {
@@ -826,7 +847,7 @@ old_xml_read_crufty_phases (xmlNodePtr node)
}
for (child = node->children; child; child = child->next) {
- if (!strcmp (child->name, "list-item")) {
+ if (!strcmp_ (child->name, "list-item")) {
str = old_xml_get_string (child, "value");
if (str && str[0]) {
@@ -861,7 +882,7 @@ old_xml_read_property_specs (MrpParser *parser)
}
for (child = node->children; child; child = child->next) {
- if (strcmp (child->name, "property")) {
+ if (strcmp_ (child->name, "property")) {
continue;
}
@@ -944,7 +965,7 @@ old_xml_read_phases (MrpParser *parser)
}
for (child = node->children; child; child = child->next) {
- if (strcmp (child->name, "phase")) {
+ if (strcmp_ (child->name, "phase")) {
continue;
}
@@ -975,7 +996,7 @@ old_xml_read_project (MrpParser *parser)
/* Get the first "properties" node, i.e. specs. */
while (child) {
- if (!strcmp (child->name, "properties")) {
+ if (!strcmp_ (child->name, "properties")) {
old_xml_read_property_specs (parser);
child = child->next;
@@ -987,7 +1008,7 @@ old_xml_read_project (MrpParser *parser)
/* Get the second "properties" node, i.e. values. */
while (child) {
- if (!strcmp (child->name, "properties")) {
+ if (!strcmp_ (child->name, "properties")) {
old_xml_read_custom_properties (parser,
child,
MRP_OBJECT (parser->project));
@@ -1025,7 +1046,7 @@ old_xml_read_project (MrpParser *parser)
}
for (child = calendars->children; child; child = child->next) {
- if (strcmp (child->name, "calendar") == 0) {
+ if (strcmp_ (child->name, "calendar") == 0) {
old_xml_read_calendar (parser, NULL, child);
}
}
@@ -1105,7 +1126,7 @@ old_xml_get_value (xmlNodePtr node, const char *name)
gchar *val;
xmlNodePtr child;
- val = (gchar *) xmlGetProp (node, name);
+ val = (gchar *) xmlGetProp_ (node, name);
if (val != NULL) {
return val;
@@ -1114,11 +1135,11 @@ old_xml_get_value (xmlNodePtr node, const char *name)
child = node->children;
while (child != NULL) {
- if (!strcmp (child->name, name)) {
+ if (!strcmp_ (child->name, name)) {
/*
* !!! Inefficient, but ...
*/
- val = xmlNodeGetContent(child);
+ val = (gchar *) xmlNodeGetContent (child);
if (val != NULL) {
return val;
}
@@ -1297,7 +1318,7 @@ old_xml_search_child (xmlNodePtr node, const gchar *name)
child = node->children;
while (child != NULL) {
- if (!strcmp (child->name, name))
+ if (!strcmp_ (child->name, name))
return child;
child = child->next;
}
diff --git a/libplanner/mrp-parser.c b/libplanner/mrp-parser.c
index 68973e12..10db9c0b 100644
--- a/libplanner/mrp-parser.c
+++ b/libplanner/mrp-parser.c
@@ -81,6 +81,26 @@ typedef struct {
} NodeEntry;
+/* These are wrapper functions around the xmlChar type,
+ * to prevent the signedness conversion wwarnings.
+ */
+void xmlSetProp_ (xmlNodePtr, const gchar *, const gchar *);
+xmlNodePtr xmlNewChild_ (xmlNodePtr, void *, const gchar *, void *);
+
+void
+xmlSetProp_ (xmlNodePtr node, const gchar * x, const gchar * y)
+{
+ xmlSetProp (node, (const xmlChar *) x, (const xmlChar *) y);
+};
+
+xmlNodePtr
+xmlNewChild_ (xmlNodePtr node, void * a, const gchar * x, void * b)
+{
+ /* a and b are NULL wherever it's called, just a dummy arg's */
+ return xmlNewChild (node, NULL, (const xmlChar *) x, NULL);
+};
+
+
static void mpp_xml_set_date (xmlNodePtr node,
const gchar *prop,
mrptime time);
@@ -119,10 +139,10 @@ mpp_write_project_properties (MrpParser *parser, xmlNodePtr node)
"phase", &phase,
NULL);
- xmlSetProp (node, "name", name);
- xmlSetProp (node, "company", org);
- xmlSetProp (node, "manager", manager);
- xmlSetProp (node, "phase", phase);
+ xmlSetProp_ (node, "name", name);
+ xmlSetProp_ (node, "company", org);
+ xmlSetProp_ (node, "manager", manager);
+ xmlSetProp_ (node, "phase", phase);
mpp_xml_set_date (node, "project-start", pstart);
mpp_xml_set_int (node, "mrproject-version", 2);
@@ -233,21 +253,21 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
properties = mrp_project_get_properties_from_type (parser->project,
MRP_TYPE_PROJECT);
- node = xmlNewChild (node, NULL, "properties", NULL);
+ node = xmlNewChild_ (node, NULL, "properties", NULL);
for (l = properties; l; l = l->next) {
property = l->data;
- child = xmlNewChild (node, NULL, "property", NULL);
+ child = xmlNewChild_ (node, NULL, "property", NULL);
- xmlSetProp (child, "name", mrp_property_get_name (property));
+ xmlSetProp_ (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
- xmlSetProp (child, "type", mpp_property_type_to_string (type));
+ xmlSetProp_ (child, "type", mpp_property_type_to_string (type));
- xmlSetProp (child, "owner", "project");
- xmlSetProp (child, "label", mrp_property_get_label (property));
- xmlSetProp (child, "description", mrp_property_get_description (property));
+ xmlSetProp_ (child, "owner", "project");
+ xmlSetProp_ (child, "label", mrp_property_get_label (property));
+ xmlSetProp_ (child, "description", mrp_property_get_description (property));
}
g_list_free (properties);
@@ -258,16 +278,16 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
for (l = properties; l; l = l->next) {
property = l->data;
- child = xmlNewChild (node, NULL, "property", NULL);
+ child = xmlNewChild_ (node, NULL, "property", NULL);
- xmlSetProp (child, "name", mrp_property_get_name (property));
+ xmlSetProp_ (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
- xmlSetProp (child, "type", mpp_property_type_to_string (type));
+ xmlSetProp_ (child, "type", mpp_property_type_to_string (type));
- xmlSetProp (child, "owner", "task");
- xmlSetProp (child, "label", mrp_property_get_label (property));
- xmlSetProp (child, "description", mrp_property_get_description (property));
+ xmlSetProp_ (child, "owner", "task");
+ xmlSetProp_ (child, "label", mrp_property_get_label (property));
+ xmlSetProp_ (child, "description", mrp_property_get_description (property));
}
g_list_free (properties);
@@ -278,16 +298,16 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
for (l = properties; l; l = l->next) {
property = l->data;
- child = xmlNewChild (node, NULL, "property", NULL);
+ child = xmlNewChild_ (node, NULL, "property", NULL);
- xmlSetProp (child, "name", mrp_property_get_name (property));
+ xmlSetProp_ (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
- xmlSetProp (child, "type", mpp_property_type_to_string (type));
+ xmlSetProp_ (child, "type", mpp_property_type_to_string (type));
- xmlSetProp (child, "owner", "resource");
- xmlSetProp (child, "label", mrp_property_get_label (property));
- xmlSetProp (child, "description", mrp_property_get_description (property));
+ xmlSetProp_ (child, "owner", "resource");
+ xmlSetProp_ (child, "label", mrp_property_get_label (property));
+ xmlSetProp_ (child, "description", mrp_property_get_description (property));
}
g_list_free (properties);
@@ -301,12 +321,12 @@ mpp_write_phases (MrpParser *parser, xmlNodePtr node)
g_object_get (parser->project, "phases", &phases, NULL);
- node = xmlNewChild (node, NULL, "phases", NULL);
+ node = xmlNewChild_ (node, NULL, "phases", NULL);
for (l = phases; l; l = l->next) {
- child = xmlNewChild (node, NULL, "phase", NULL);
+ child = xmlNewChild_ (node, NULL, "phase", NULL);
- xmlSetProp (child, "name", l->data);
+ xmlSetProp_ (child, "name", l->data);
}
mrp_string_list_free (phases);
@@ -321,9 +341,9 @@ mpp_write_predecessor (MrpParser *parser,
NodeEntry *entry;
gint lag;
- node = xmlNewChild (node, NULL, "predecessor", NULL);
+ node = xmlNewChild_ (node, NULL, "predecessor", NULL);
- xmlSetProp (node, "id", "1"); /* Don't need id here. */
+ xmlSetProp_ (node, "id", "1"); /* Don't need id here. */
entry = g_hash_table_lookup (parser->task_hash,
mrp_relation_get_predecessor (relation));
@@ -346,7 +366,7 @@ mpp_write_predecessor (MrpParser *parser,
str = "FS";
}
- xmlSetProp (node, "type", str);
+ xmlSetProp_ (node, "type", str);
lag = mrp_relation_get_lag (relation);
if (lag) {
@@ -383,7 +403,7 @@ mpp_write_constraint (xmlNodePtr node, MrpConstraint *constraint)
return;
}
- child = xmlNewChild (node, NULL, "constraint", NULL);
+ child = xmlNewChild_ (node, NULL, "constraint", NULL);
switch (constraint->type) {
case MRP_CONSTRAINT_MSO:
@@ -401,7 +421,7 @@ mpp_write_constraint (xmlNodePtr node, MrpConstraint *constraint)
break;
}
- xmlSetProp (child, "type", str);
+ xmlSetProp_ (child, "type", str);
mpp_xml_set_date (child, "time", constraint->time);
}
@@ -423,8 +443,8 @@ mpp_write_string_list (xmlNodePtr node,
for (i = 0; i < array->len; i++) {
value = g_array_index (array, GValue *, i);
- child = xmlNewChild (node, NULL, "list-item", NULL);
- xmlSetProp (child, "value", g_value_get_string (value));
+ child = xmlNewChild_ (node, NULL, "list-item", NULL);
+ xmlSetProp_ (child, "value", g_value_get_string (value));
}
g_array_free (array, TRUE);
@@ -447,21 +467,21 @@ mpp_write_custom_properties (MrpParser *parser,
return;
}
- node = xmlNewChild (node, NULL, "properties", NULL);
+ node = xmlNewChild_ (node, NULL, "properties", NULL);
for (l = properties; l; l = l->next) {
property = l->data;
- child = xmlNewChild (node, NULL, "property", NULL);
+ child = xmlNewChild_ (node, NULL, "property", NULL);
- xmlSetProp (child, "name", mrp_property_get_name (property));
+ xmlSetProp_ (child, "name", mrp_property_get_name (property));
if (mrp_property_get_property_type (property) == MRP_PROPERTY_TYPE_STRING_LIST) {
mpp_write_string_list (child, property, object);
} else {
value = mpp_property_to_string (object, property);
- xmlSetProp (child, "value", value);
+ xmlSetProp_ (child, "value", value);
g_free (value);
}
@@ -498,7 +518,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
entry = g_hash_table_lookup (parser->task_hash, parent);
parent_node = entry->node;
- node = xmlNewChild (parent_node, NULL, "task", NULL);
+ node = xmlNewChild_ (parent_node, NULL, "task", NULL);
entry = g_hash_table_lookup (parser->task_hash, task);
entry->node = node;
@@ -526,8 +546,8 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
}
mpp_xml_set_int (node, "id", entry->id);
- xmlSetProp (node, "name", name);
- xmlSetProp (node, "note", note);
+ xmlSetProp_ (node, "name", name);
+ xmlSetProp_ (node, "note", note);
mpp_xml_set_int (node, "work", work);
mpp_xml_set_int (node, "duration", duration);
@@ -548,7 +568,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
predecessors = mrp_task_get_predecessor_relations (task);
if (predecessors != NULL) {
- node = xmlNewChild (node, NULL, "predecessors", NULL);
+ node = xmlNewChild_ (node, NULL, "predecessors", NULL);
for (l = predecessors; l; l = l->next) {
mpp_write_predecessor (parser, node, l->data);
}
@@ -581,7 +601,7 @@ mpp_write_group (MrpParser *parser, xmlNodePtr parent, MrpGroup *group)
g_return_if_fail (MRP_IS_GROUP (group));
- node = xmlNewChild (parent,
+ node = xmlNewChild_ (parent,
NULL,
"group",
NULL);
@@ -598,10 +618,10 @@ mpp_write_group (MrpParser *parser, xmlNodePtr parent, MrpGroup *group)
"manager-email", &admin_email,
NULL);
- xmlSetProp (node, "name", name);
- xmlSetProp (node, "admin-name", admin_name);
- xmlSetProp (node, "admin-phone", admin_phone);
- xmlSetProp (node, "admin-email", admin_email);
+ xmlSetProp_ (node, "name", name);
+ xmlSetProp_ (node, "admin-name", admin_name);
+ xmlSetProp_ (node, "admin-phone", admin_phone);
+ xmlSetProp_ (node, "admin-email", admin_email);
g_free (name);
g_free (admin_name);
@@ -638,7 +658,7 @@ mpp_write_resource (MrpParser *parser,
g_return_if_fail (MRP_IS_RESOURCE (resource));
- node = xmlNewChild (parent,
+ node = xmlNewChild_ (parent,
NULL,
"resource",
NULL);
@@ -666,15 +686,15 @@ mpp_write_resource (MrpParser *parser,
resource_entry = g_hash_table_lookup (parser->resource_hash, resource);
mpp_xml_set_int (node, "id", resource_entry->id);
- xmlSetProp (node, "name", name);
- xmlSetProp (node, "short-name", short_name);
+ xmlSetProp_ (node, "name", name);
+ xmlSetProp_ (node, "short-name", short_name);
mpp_xml_set_int (node, "type", type);
mpp_xml_set_int (node, "units", units);
- xmlSetProp (node, "email", email);
+ xmlSetProp_ (node, "email", email);
- xmlSetProp (node, "note", note);
+ xmlSetProp_ (node, "note", note);
mpp_xml_set_float (node, "std-rate", std_rate);
/*mpp_xml_set_float (node, "ovt-rate", ovt_rate);*/
@@ -711,7 +731,7 @@ mpp_write_assignment (MrpParser *parser,
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
- node = xmlNewChild (parent,
+ node = xmlNewChild_ (parent,
NULL,
"allocation",
NULL);
@@ -737,16 +757,16 @@ mpp_write_interval (xmlNodePtr parent, MrpInterval *interval)
mrptime start, end;
gchar *str;
- child = xmlNewChild (parent, NULL, "interval", NULL);
+ child = xmlNewChild_ (parent, NULL, "interval", NULL);
mrp_interval_get_absolute (interval, 0, &start, &end);
str = mrp_time_format ("%H%M", start);
- xmlSetProp (child, "start", str);
+ xmlSetProp_ (child, "start", str);
g_free (str);
str = mrp_time_format ("%H%M", end);
- xmlSetProp (child, "end", str);
+ xmlSetProp_ (child, "end", str);
g_free (str);
}
@@ -758,7 +778,7 @@ mpp_write_day (MrpParser *parser, xmlNodePtr parent, MrpDay *day)
g_return_if_fail (day != NULL);
- node = xmlNewChild (parent, NULL, "day-type", NULL);
+ node = xmlNewChild_ (parent, NULL, "day-type", NULL);
day_entry = g_new0 (NodeEntry, 1);
if (day == mrp_day_get_work ()) {
@@ -776,8 +796,8 @@ mpp_write_day (MrpParser *parser, xmlNodePtr parent, MrpDay *day)
g_hash_table_insert (parser->day_hash, day, day_entry);
mpp_xml_set_int (node, "id", day_entry->id);
- xmlSetProp (node, "name", mrp_day_get_name (day));
- xmlSetProp (node, "description", mrp_day_get_description (day));
+ xmlSetProp_ (node, "name", mrp_day_get_name (day));
+ xmlSetProp_ (node, "description", mrp_day_get_description (day));
}
static void
@@ -811,7 +831,7 @@ mpp_write_overridden_day (MrpParser *parser,
entry = g_hash_table_lookup (parser->day_hash, di->day);
if (entry) {
- child = xmlNewChild (parent, NULL, "overridden-day-type", NULL);
+ child = xmlNewChild_ (parent, NULL, "overridden-day-type", NULL);
mpp_xml_set_int (child, "id", entry->id);
for (l = di->intervals; l; l = l->next) {
@@ -833,13 +853,13 @@ mpp_write_overridden_date (MrpParser *parser,
entry = g_hash_table_lookup (parser->day_hash, dd->day);
if (entry) {
- child = xmlNewChild (parent, NULL, "day", NULL);
+ child = xmlNewChild_ (parent, NULL, "day", NULL);
str = mrp_time_format ("%Y%m%d", dd->date);
- xmlSetProp (child, "date", str);
+ xmlSetProp_ (child, "date", str);
g_free (str);
- xmlSetProp (child, "type", "day-type");
+ xmlSetProp_ (child, "type", "day-type");
mpp_xml_set_int (child, "id", entry->id);
}
@@ -857,7 +877,7 @@ mpp_write_calendar (MrpParser *parser,
g_return_if_fail (MRP_IS_CALENDAR (calendar));
- node = xmlNewChild (parent, NULL, "calendar", NULL);
+ node = xmlNewChild_ (parent, NULL, "calendar", NULL);
id = parser->next_calendar_id++;
mpp_xml_set_int (node, "id", id);
@@ -866,10 +886,10 @@ mpp_write_calendar (MrpParser *parser,
calendar,
GINT_TO_POINTER (id));
- xmlSetProp (node, "name", mrp_calendar_get_name (calendar));
+ xmlSetProp_ (node, "name", mrp_calendar_get_name (calendar));
/* Write the default week */
- child = xmlNewChild (node, NULL, "default-week", NULL);
+ child = xmlNewChild_ (node, NULL, "default-week", NULL);
mpp_write_default_day (parser, child, calendar,
"mon", MRP_CALENDAR_DAY_MON);
@@ -887,7 +907,7 @@ mpp_write_calendar (MrpParser *parser,
"sun", MRP_CALENDAR_DAY_SUN);
/* Override days */
- child = xmlNewChild (node, NULL, "overridden-day-types", NULL);
+ child = xmlNewChild_ (node, NULL, "overridden-day-types", NULL);
days = mrp_calendar_get_overridden_days (calendar);
for (l = days; l; l = l->next) {
@@ -898,7 +918,7 @@ mpp_write_calendar (MrpParser *parser,
g_list_free (days);
/* Write the overriden dates */
- child = xmlNewChild (node, NULL, "days", NULL);
+ child = xmlNewChild_ (node, NULL, "days", NULL);
dates = mrp_calendar_get_all_overridden_dates (calendar);
for (l = dates; l; l = l->next) {
MrpDateWithDay *date_day = l->data;
@@ -925,7 +945,7 @@ mpp_write_project (MrpParser *parser)
NodeEntry *entry;
MrpCalendar *root_calendar;
- node = xmlNewDocNode (parser->doc, NULL, "project", NULL);
+ node = xmlNewDocNode (parser->doc, NULL, (const xmlChar *) "project", NULL);
parser->doc->xmlRootNode = node;
mpp_write_property_specs (parser, node);
@@ -934,8 +954,8 @@ mpp_write_project (MrpParser *parser)
mpp_write_phases (parser, node);
/* Write calendars */
- calendars_node = xmlNewChild (node, NULL, "calendars", NULL);
- child = xmlNewChild (calendars_node, NULL, "day-types", NULL);
+ calendars_node = xmlNewChild_ (node, NULL, "calendars", NULL);
+ child = xmlNewChild_ (calendars_node, NULL, "day-types", NULL);
mpp_write_day (parser, child, mrp_day_get_work ());
mpp_write_day (parser, child, mrp_day_get_nonwork ());
@@ -956,7 +976,7 @@ mpp_write_project (MrpParser *parser)
mpp_write_project_properties (parser, node);
/* Write tasks. */
- child = xmlNewChild (node, NULL, "tasks",NULL);
+ child = xmlNewChild_ (node, NULL, "tasks",NULL);
entry = g_new0 (NodeEntry, 1);
entry->id = 0;
@@ -977,7 +997,7 @@ mpp_write_project (MrpParser *parser)
parser);
/* Write resource groups. */
- child = xmlNewChild (node, NULL, "resource-groups",NULL);
+ child = xmlNewChild_ (node, NULL, "resource-groups",NULL);
list = mrp_project_get_groups (parser->project);
/* Generate IDs and hash table. */
@@ -999,7 +1019,7 @@ mpp_write_project (MrpParser *parser)
}
/* Write resources. */
- child = xmlNewChild (node, NULL, "resources",NULL);
+ child = xmlNewChild_ (node, NULL, "resources",NULL);
list = mrp_project_get_resources (parser->project);
/* Generate IDs and hash table. */
@@ -1017,7 +1037,7 @@ mpp_write_project (MrpParser *parser)
}
/* Write assignments. */
- child = xmlNewChild (node, NULL, "allocations", NULL);
+ child = xmlNewChild_ (node, NULL, "allocations", NULL);
for (l = assignments; l; l = l->next) {
mpp_write_assignment (parser, child, l->data);
@@ -1051,7 +1071,7 @@ parser_build_xml_doc (MrpStorageMrproject *module,
parser.next_day_type_id = MRP_DAY_NEXT;
parser.next_calendar_id = 1;
- parser.doc = xmlNewDoc ("1.0");
+ parser.doc = xmlNewDoc ((const xmlChar *) "1.0");
if (!mpp_write_project (&parser)) {
g_set_error (error,
@@ -1145,7 +1165,7 @@ mrp_parser_to_xml (MrpStorageMrproject *module,
xmlDocDumpFormatMemory (doc, &buf, &len, 1);
xmlFreeDoc (doc);
- *str = g_strdup (buf);
+ *str = g_strdup ((const gchar *) buf);
xmlFree (buf);
if (len <= 0) {
@@ -1181,7 +1201,7 @@ mpp_xml_set_date (xmlNodePtr node, const gchar *prop, mrptime time)
gchar *str;
str = mrp_time_to_string (time);
- xmlSetProp (node, prop, str);
+ xmlSetProp_ (node, prop, str);
g_free (str);
}
@@ -1191,7 +1211,7 @@ mpp_xml_set_int (xmlNodePtr node, const gchar *prop, gint value)
gchar *str;
str = g_strdup_printf ("%d", value);
- xmlSetProp (node, prop, str);
+ xmlSetProp_ (node, prop, str);
g_free (str);
}
@@ -1202,7 +1222,7 @@ mpp_xml_set_float (xmlNodePtr node, const gchar *prop, gfloat value)
gchar *str;
str = g_ascii_dtostr (buf, sizeof(buf) - 1, value);
- xmlSetProp (node, prop, str);
+ xmlSetProp_ (node, prop, str);
}
static void
@@ -1221,7 +1241,7 @@ mpp_xml_set_task_type (xmlNodePtr node, const gchar *prop, MrpTaskType type)
break;
}
- xmlSetProp (node, prop, str);
+ xmlSetProp_ (node, prop, str);
}
static void
@@ -1240,5 +1260,5 @@ mpp_xml_set_task_sched (xmlNodePtr node, const gchar *prop, MrpTaskSched sched)
break;
}
- xmlSetProp (node, prop, str);
+ xmlSetProp_ (node, prop, str);
}
diff --git a/libplanner/mrp-xml.c b/libplanner/mrp-xml.c
index 7cdd6440..0e2b9b31 100644
--- a/libplanner/mrp-xml.c
+++ b/libplanner/mrp-xml.c
@@ -152,7 +152,7 @@ xml_validate (xmlDoc *doc, const gchar *dtd_path)
memset (&cvp, 0, sizeof (cvp));
- dtd = xmlParseDTD (NULL, dtd_path);
+ dtd = xmlParseDTD (NULL, (const xmlChar *) dtd_path);
ret_val = xmlValidateDtd (&cvp, doc, dtd);
diff --git a/libplanner/mrp-xsl.c b/libplanner/mrp-xsl.c
index c32a89b7..ee5ed56e 100644
--- a/libplanner/mrp-xsl.c
+++ b/libplanner/mrp-xsl.c
@@ -71,9 +71,11 @@ extern mrptime mrp_time_from_tm (struct tm *tm);
void
xslt_module_gettext (xmlXPathParserContextPtr ctxt, int argc)
{
- xmlXPathObjectPtr name = valuePop(ctxt);
- name = xmlXPathConvertString(name);
- valuePush (ctxt, xmlXPathNewString ((const xmlChar *) gettext (name->stringval)));
+ xmlXPathObjectPtr name = valuePop(ctxt);
+ name = xmlXPathConvertString(name);
+ valuePush (ctxt, xmlXPathNewString
+ ((const xmlChar *) gettext
+ ((const gchar *) (name -> stringval))));
}
void
@@ -140,7 +142,7 @@ html_write (MrpFileWriter *writer,
xslt_module_init, xslt_module_shutdown);
filename = mrp_paths_get_stylesheet_dir ("planner2html.xsl");
- stylesheet = xsltParseStylesheetFile (filename);
+ stylesheet = xsltParseStylesheetFile ((const xmlChar *) filename);
g_free (filename);
doc = xmlParseMemory (xml_project, strlen (xml_project));
@@ -188,7 +190,7 @@ xml_planner_pre012_write (MrpFileWriter *writer,
exsltRegisterAll ();
filename = mrp_paths_get_stylesheet_dir ("planner2plannerv011.xsl");
- stylesheet = xsltParseStylesheetFile (filename);
+ stylesheet = xsltParseStylesheetFile ((const xmlChar *) filename);
g_free (filename);
doc = xmlParseMemory (xml_project, strlen (xml_project));
diff --git a/src/planner-msp-plugin.c b/src/planner-msp-plugin.c
index 42aff998..ae193e86 100644
--- a/src/planner-msp-plugin.c
+++ b/src/planner-msp-plugin.c
@@ -61,7 +61,7 @@ xml_validate (xmlDoc *doc, const gchar *dtd_path)
gboolean ret_val;
memset (&cvp, 0, sizeof (cvp));
- dtd = xmlParseDTD (NULL, dtd_path);
+ dtd = xmlParseDTD (NULL, (const xmlChar *) dtd_path);
ret_val = xmlValidateDtd (&cvp, doc, dtd);
xmlFreeDtd (dtd);
@@ -87,7 +87,7 @@ msp_plugin_transform (PlannerPlugin *plugin,
exsltRegisterAll ();
filename = mrp_paths_get_stylesheet_dir ("msp2planner.xsl");
- stylesheet = xsltParseStylesheetFile (filename);
+ stylesheet = xsltParseStylesheetFile ((const xmlChar *) filename);
g_free (filename);
doc = xmlParseFile (input_filename);
diff --git a/tests/scheduler-test.c b/tests/scheduler-test.c
index 4bdab4b4..658971f4 100644
--- a/tests/scheduler-test.c
+++ b/tests/scheduler-test.c
@@ -19,6 +19,16 @@ typedef struct {
gint work;
} TaskData;
+/* These are wrapper functions around the xmlChar type,
+ * to prevent signedness conversion wwarnings.
+ */
+int strcmp_ (const xmlChar *, const gchar *);
+
+int
+strcmp_ (const xmlChar * x, const gchar * y)
+{
+ return strcmp ((const char *) x, (const char *) y);
+};
/* Get a value for a node either carried as an attibute or as
@@ -32,7 +42,7 @@ old_xml_get_value (xmlNodePtr node, const char *name)
gchar *val;
xmlNodePtr child;
- val = (gchar *) xmlGetProp (node, name);
+ val = (gchar *) xmlGetProp (node, (const xmlChar *) name);
if (val != NULL) {
return val;
@@ -41,11 +51,11 @@ old_xml_get_value (xmlNodePtr node, const char *name)
child = node->children;
while (child != NULL) {
- if (!strcmp (child->name, name)) {
+ if (!strcmp_ (child->name, name)) {
/*
* !!! Inefficient, but ...
*/
- val = xmlNodeGetContent(child);
+ val = (gchar *) xmlNodeGetContent (child);
if (val != NULL) {
return val;
}
@@ -108,7 +118,7 @@ old_xml_search_child (xmlNodePtr node, const gchar *name)
child = node->children;
while (child != NULL) {
- if (!strcmp (child->name, name))
+ if (!strcmp_ (child->name, name))
return child;
child = child->next;
}
@@ -146,7 +156,7 @@ read_tasks (ProjectData *data, xmlNodePtr node)
TaskData *task_data;
for (task = node->children; task; task = task->next) {
- if (strcmp (task->name, "task") == 0){
+ if (strcmp_ (task->name, "task") == 0){
task_data = read_task (task);
if (g_hash_table_lookup (data->task_hash, task_data->name)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]