summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc5a219)
raw | patch | inline | side by side (parent: bc5a219)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 4 Jul 2009 14:35:39 +0000 (14:35 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 4 Jul 2009 14:35:39 +0000 (14:35 +0000) |
program/src/rrd_restore.c | patch | blob | history |
index 95cdda3fb3ac83bd617e156ef195110923645b2e..ef524b2ed9fc663b296bc49e6346f4ff6da79045 100644 (file)
return (0);
} /* int get_ulong_from_node */
+static int get_long_long_from_node(
+ xmlDoc * doc,
+ xmlNode * node,
+ long long *value)
+{
+ long long temp;
+ char *str_ptr;
+ char *end_ptr;
+
+ str_ptr = (char *) xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ if (str_ptr == NULL) {
+ rrd_set_error("get_ulong_from_node: xmlNodeListGetString failed.");
+ return (-1);
+ }
+
+ end_ptr = NULL;
+ temp = strtoll(str_ptr, &end_ptr, 0);
+ xmlFree(str_ptr);
+
+ if (str_ptr == end_ptr) {
+ rrd_set_error("get_long_long_from_node: Cannot parse buffer as unsigned long long: %s",
+ str_ptr);
+ return (-1);
+ }
+
+ *value = temp;
+
+ return (0);
+} /* int get_ulong_from_node */
+
static int get_double_from_node(
xmlDoc * doc,
xmlNode * node,
status = get_ulong_from_node(doc, child,
&rrd->stat_head->pdp_step);
else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") == 0)
- status = get_long_from_node(doc, child,
- &rrd->live_head->last_up);
+ if (sizeof(time_t) == sizeof(long)) {
+ status = get_long_from_node(doc, child, (long *)&rrd->live_head->last_up);
+ }
+ else if (sizeof(time_t) == sizeof(long long)) {
+ status = get_long_long_from_node(doc, child, (long long *)&rrd->live_head->last_up);
+ }
else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
status = parse_tag_ds(doc, child, rrd);
else if (xmlStrcmp(child->name, (const xmlChar *) "rra") == 0)