[Open-scap] [PATCH 4/4] Small fix and time_t typemap
Josh Adams
jadams at tresys.com
Thu Jun 3 19:26:40 UTC 2010
XCCDF Results should be referred to as "TestResult", not just "Result".
Also added a type map for time_t.
---
src/XCCDF/item.c | 2 +-
swig/openscap.i | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/src/XCCDF/item.c b/src/XCCDF/item.c
index 877b32b..8674def 100644
--- a/src/XCCDF/item.c
+++ b/src/XCCDF/item.c
@@ -390,7 +390,7 @@ xmlNode *xccdf_item_to_dom(struct xccdf_item *item, xmlDoc *doc, xmlNode *parent
xccdf_profile_to_dom(XPROFILE(item), item_node, doc, parent);
break;
case XCCDF_RESULT:
- xmlNodeSetName(item_node,BAD_CAST "Result");
+ xmlNodeSetName(item_node,BAD_CAST "TestResult");
xccdf_result_to_dom(XRESULT(item), item_node, doc, parent);
break;
case XCCDF_GROUP:
diff --git a/swig/openscap.i b/swig/openscap.i
index 9f05261..5b13c55 100644
--- a/swig/openscap.i
+++ b/swig/openscap.i
@@ -34,6 +34,20 @@
#if defined(SWIGPYTHON)
/* Definitions for PYTHON */
+%typemap(in) time_t
+{
+ if (PyLong_Check($input))
+ $1 = (time_t) PyLong_AsLong($input);
+ else if (PyInt_Check($input))
+ $1 = (time_t) PyInt_AsLong($input);
+ else if (PyFloat_Check($input))
+ $1 = (time_t) PyFloat_AsDouble($input);
+ else {
+ PyErr_SetString(PyExc_TypeError,"Expected a large number");
+ return NULL;
+ }
+}
+
%typemap (in) void*
{
if (PyCObject_Check($input))
--
1.7.0.1
More information about the Open-scap-list
mailing list