mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-22 06:07:36 +02:00
pofParser: getData/getLength: check if section exists: return data/length or null/-1
This commit is contained in:
+8
-2
@@ -32,14 +32,20 @@ uint8_t *POFParser::getData(const std::string §ion_name)
|
||||
{
|
||||
if (section_name == "")
|
||||
return (uint8_t*)_bit_data.data();
|
||||
return mem_section[section_name].data;
|
||||
auto section = mem_section.find(section_name);
|
||||
if (section == mem_section.end())
|
||||
return NULL;
|
||||
return (*section).second.data;
|
||||
}
|
||||
|
||||
int POFParser::getLength(const std::string §ion_name)
|
||||
{
|
||||
if (section_name == "")
|
||||
return _bit_length;
|
||||
return mem_section[section_name].len;
|
||||
auto section = mem_section.find(section_name);
|
||||
if (section == mem_section.end())
|
||||
return -1;
|
||||
return (*section).second.len;
|
||||
}
|
||||
|
||||
void POFParser::displayHeader()
|
||||
|
||||
Reference in New Issue
Block a user