// workaround for package ID's used by some package managers
// get the package ID and store it for each application
char* package_id = NULL;
+ char* package_version_major = NULL;
+ char* package_version_minor = NULL;
+ char* package_version_release = NULL;
+ char* package_version_build = NULL;
pElem = hRoot.FirstChild ( PND_PXML_ENAME_PACKAGE ).Element();
if ( pElem ) {
package_id = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_PACKAGE_ID );
+ TiXmlHandle pRoot = TiXmlHandle( pElem );
+ if ( (pElem = pRoot.FirstChild(PND_PXML_ENAME_VERSION).Element()) )
+ {
+ package_version_major = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_VERMAJOR);
+ package_version_minor = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_VERMINOR);
+ package_version_release = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_VERREL);
+ package_version_build = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_VERBUILD);
+ }
}
// move to applications element then
// give application the package id, if there is one
if( package_id )
app -> package_id = strdup(package_id);
+ if( package_version_major )
+ app -> package_version_major = strdup(package_version_major);
+ if( package_version_minor )
+ app -> package_version_minor = strdup(package_version_minor);
+ if( package_version_release )
+ app -> package_version_release = strdup(package_version_release);
+ if( package_version_build )
+ app -> package_version_build = strdup(package_version_build);
//Get unique ID first.
if ( appwrappermode ) {
char *filetype = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCFTYPE);
char *paramter = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCARGS);
- if (!(name && filetype && paramter)) continue;
+ if (!(name && filetype && paramter))
+ {
+ if(name) free(name);
+ if(filetype) free(filetype);
+ if(paramter) free(paramter);
+ continue;
+ }
switch(i) //TODO: same problem here: only 3 associations supported
{
app->associationitem3_parameter = paramter;
}
}
+ if(name) free(name);
+ if(filetype) free(filetype);
+ if(paramter) free(paramter);
}
}
if ( ( t = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_MKDIRPATH) ) ) {
// first <dir>, so just replace it wholesale; we use strdup so we can free() easily later, consistently. Mmm, leak seems imminent.
app -> mkdir_sp = strdup ( t );
+ free(t); // free this attribute
}
while ( ( pElem = pElem -> NextSiblingElement ( PND_PXML_ENAME_MKDIR ) ) ) {
app -> mkdir_sp = foo;
} // assuming we got ram, lets cat it all together
+ free(t); // free this attribute
} // got another elem?
} // while
if( package_id )
free(package_id);
+ if( package_version_major )
+ free(package_version_major);
+ if( package_version_minor )
+ free(package_version_minor);
+ if( package_version_release )
+ free(package_version_release);
+ if( package_version_build )
+ free(package_version_build);
return (1);
}