summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-06-09 17:14:29 +0200
committerDavid Sommerseth <davids@redhat.com>2009-06-09 17:14:29 +0200
commitf9589f45af460c82fac3712b0560de0e1dc6171d (patch)
tree1bd413720324cf87aa1055b913c96b56c4fec9fc
parentbfbac44bd8c0fcddcdcfade6a15313560c9cc6eb (diff)
downloadpython-dmidecode-f9589f45af460c82fac3712b0560de0e1dc6171d.tar.gz
python-dmidecode-f9589f45af460c82fac3712b0560de0e1dc6171d.tar.xz
python-dmidecode-f9589f45af460c82fac3712b0560de0e1dc6171d.zip
Pass typeid as int internally to the dmiMAP_ParseMappingXML_TypeID(...)
This function will then convert the value to proper hex value for further processing.
-rw-r--r--src/xmlpythonizer.c10
-rw-r--r--src/xmlpythonizer.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index 6c4d4c0..f7fdb3c 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -474,18 +474,22 @@ ptzMAP *_dmimap_parse_mapping_node_typeid(xmlNode *mapnode, const char *typeid)
* @param const char* The Type ID to create the map for
* @return ptzMAP* The parsed XML containing as a ptzMAP
*/
-ptzMAP *dmiMAP_ParseMappingXML_TypeID(xmlDoc *xmlmap, const char *mapname) {
+ptzMAP *dmiMAP_ParseMappingXML_TypeID(xmlDoc *xmlmap, int typeid) {
xmlNode *node = NULL;
+ char typeid_s[16];
node = dmiMAP_GetRootElement(xmlmap);
if( node == NULL ) {
return NULL;
}
+ memset(&typeid_s, 0, 16);
+ snprintf(typeid_s, 14, "0x%02x", typeid);
+
// Find the <TypeMapping> section
node = dmixml_FindNode(node, "TypeMapping");
assert( node != NULL );
- return _dmimap_parse_mapping_node_typeid(node, mapname);
+ return _dmimap_parse_mapping_node_typeid(node, typeid_s);
}
@@ -1103,7 +1107,7 @@ int main(int argc, char **argv) {
assert( doc != NULL );
map = dmiMAP_ParseMappingXML_GroupName(doc, argv[1]);
- // map = dmiMAP_ParseMappingXML_TypeID(doc, argv[1]);
+ // map = dmiMAP_ParseMappingXML_TypeID(doc, atoi(rgv[1]));
ptzmap_Dump(map);
printf("----------------------\n");
assert(map != NULL);
diff --git a/src/xmlpythonizer.h b/src/xmlpythonizer.h
index f37bfa5..df60140 100644
--- a/src/xmlpythonizer.h
+++ b/src/xmlpythonizer.h
@@ -49,7 +49,7 @@ typedef struct ptzMAP_s {
} ptzMAP;
xmlNode *dmiMAP_GetRootElement(xmlDoc *mapdoc);
-ptzMAP *dmiMAP_ParseMappingXML_TypeID(xmlDoc *xmlmap, const char *mapname);
+ptzMAP *dmiMAP_ParseMappingXML_TypeID(xmlDoc *xmlmap, int typeid);
ptzMAP *dmiMAP_ParseMappingXML_GroupName(xmlDoc *xmlmap, const char *mapname);
#define ptzmap_Free(ptr) { ptzmap_Free_func(ptr); ptr = NULL; }
void ptzmap_Free_func(ptzMAP *ptr);