1
0
Fork 0
forked from len0rd/rockbox
Change-Id: Ib64eb3539e33d4336c298612b4508c4611b80c9e
This commit is contained in:
Amaury Pouly 2014-02-12 13:13:07 +01:00
parent 0f72c73b5b
commit c35e4a4b7d
4 changed files with 12 additions and 9 deletions

View file

@ -647,13 +647,13 @@ bool my_lua_import_soc(const soc_t& soc)
return true;
}
bool my_lua_import_soc(const std::list< soc_t >& socs)
bool my_lua_import_soc(const std::vector< soc_t >& socs)
{
for(std::list< soc_t >::const_iterator it = socs.begin(); it != socs.end(); ++it)
for(size_t i = 0; i < socs.size(); i++)
{
if(!g_quiet)
printf("importing %s...\n", it->name.c_str());
if(!my_lua_import_soc(*it))
printf("importing %s...\n", socs[i].name.c_str());
if(!my_lua_import_soc(socs[i]))
return false;
}
return true;
@ -711,7 +711,7 @@ int main(int argc, char **argv)
}
// load register descriptions
std::list< soc_t > socs;
std::vector< soc_t > socs;
for(int i = optind; i < argc; i++)
if(!soc_desc_parse_xml(argv[i], socs))
{

View file

@ -252,7 +252,7 @@ bool parse_soc_elem(xmlNode *node, soc_t& soc)
return true;
}
bool parse_root_elem(xmlNode *node, std::list< soc_t >& soc)
bool parse_root_elem(xmlNode *node, std::vector< soc_t >& soc)
{
BEGIN_NODE_MATCH(node)
MATCH_ELEM_NODE("soc", soc, parse_soc_elem)
@ -260,7 +260,7 @@ bool parse_root_elem(xmlNode *node, std::list< soc_t >& soc)
return true;
}
bool soc_desc_parse_xml(const std::string& filename, std::list< soc_t >& socs)
bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& socs)
{
LIBXML_TEST_VERSION

View file

@ -143,6 +143,6 @@ struct soc_t
/** Parse a SoC description from a XML file, append it to <soc>. A file
* can contain multiple SoC descriptions */
bool soc_desc_parse_xml(const std::string& filename, std::list< soc_t >& soc);
bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& soc);
#endif /* __SOC_DESC__ */

View file

@ -33,7 +33,10 @@ bool Backend::GetSocByName(const QString& name, SocRef& s)
bool Backend::LoadSocDesc(const QString& filename)
{
bool ret = soc_desc_parse_xml(filename.toStdString(), m_socs);
std::vector< soc_t > new_socs;
bool ret = soc_desc_parse_xml(filename.toStdString(), new_socs);
for(size_t i = 0; i < new_socs.size(); i++)
m_socs.push_back(new_socs[i]);
emit OnSocListChanged();
return ret;
}