summaryrefslogtreecommitdiff
path: root/src/xml-parser.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2014-03-18 10:46:32 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2014-03-18 10:46:32 +0100
commit98ee28f049415750b2bb5d9f3eb386a83696cddc (patch)
tree44bfab0208e7854e3bcd134287498d59634e9e9f /src/xml-parser.c
parentef1d22999ea6de81f0eb0c58a92da5fa750ee393 (diff)
downloadcataract-98ee28f049415750b2bb5d9f3eb386a83696cddc.tar.xz
Add support for specifying custom focal length and aperture
Similar to using supplied timestamps this is useful for fully manual lenses that don't provide any information to the camera.
Diffstat (limited to 'src/xml-parser.c')
-rw-r--r--src/xml-parser.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/xml-parser.c b/src/xml-parser.c
index 84cc204..9f95cf3 100644
--- a/src/xml-parser.c
+++ b/src/xml-parser.c
@@ -225,6 +225,24 @@ xml_file_get_node_attribute_boolean (TXMLFile *file, const gchar *x_path, const
return b;
}
+double
+xml_file_get_node_attribute_double (TXMLFile *file, const gchar *x_path, const gchar *attr, const double _default)
+{
+ gchar *s;
+ double d;
+ char *endptr = NULL;
+
+ s = xml_file_get_node_attribute (file, x_path, attr);
+ if (s == NULL)
+ return _default;
+
+ d = strtod (s, &endptr);
+ if (endptr != NULL && *endptr != '\0')
+ d = _default;
+ g_free (s);
+ return d;
+}
+
/*
* xml_file_get_node_present: existency test of the XPath node