From 98ee28f049415750b2bb5d9f3eb386a83696cddc Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 18 Mar 2014 10:46:32 +0100 Subject: 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. --- src/xml-parser.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/xml-parser.c') 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 -- cgit v1.2.3