@@ -339,22 +339,29 @@ ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, const char *mapname) {
339339 return NULL ;
340340 }
341341
342- if (!is_int (mapname )) {
343- // Find the <Mapping> section matching our request (mapname)
344- for ( node = node -> children -> next ; node != NULL ; node = node -> next ) {
345- if ( xmlStrcmp (node -> name , (xmlChar * ) "Mapping" ) == 0 ) {
346- char * name = dmixml_GetAttrValue (node , "name" );
347- if ( (name != NULL ) && (strcmp (name , mapname ) == 0 ) ) {
348- break ;
349- }
342+ int type_id = is_int (mapname );
343+ if (type_id > -1 ) {
344+ //FIXME
345+ char * python_xml_typemap = strdup (PYTHON_XML_TYPEMAP );
346+ xmlDoc * typemappingxml = xmlReadFile (python_xml_typemap , NULL , 0 );
347+ xmlNode * node = xmlDocGetRootElement (typemappingxml );
348+ xmlNode * wally ;
349+ char type_id_hex [5 ];
350+ snprintf (type_id_hex , 5 , "0x%02x" , type_id );
351+ wally = dmixml_FindNodeByAttr (node , "id" , type_id_hex );
352+ if (wally ) {
353+ mapname = dmixml_GetAttrValue (wally , "value" );
354+ }
355+ }
356+
357+ // Find the <Mapping> section matching our request (mapname)
358+ for ( node = node -> children -> next ; node != NULL ; node = node -> next ) {
359+ if ( xmlStrcmp (node -> name , (xmlChar * ) "Mapping" ) == 0 ) {
360+ char * name = dmixml_GetAttrValue (node , "name" );
361+ if ( (name != NULL ) && (strcmp (name , mapname ) == 0 ) ) {
362+ break ;
350363 }
351364 }
352- } else {
353- //. FIXME
354- char msg [8194 ];
355- snprintf (msg , 8193 , "Not (yet) implemented%c" , 0 );
356- PyErr_SetString (PyExc_SystemError , msg );
357- return NULL ;
358365 }
359366
360367 if ( node == NULL ) {
0 commit comments