mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Fix issue with some GOG XML data files
Some GOG XML data files contain additional nodes/elements that were not handled properly and caused issues. We only care about the "chunk" elements so lets ignore all other xml elements.
This commit is contained in:
parent
116f9d88f2
commit
31ebaee54c
@ -1374,16 +1374,15 @@ int Downloader::repairFile(const std::string& url, const std::string& filepath,
|
|||||||
std::stringstream(fileElem->Attribute("total_size")) >> filesize;
|
std::stringstream(fileElem->Attribute("total_size")) >> filesize;
|
||||||
|
|
||||||
//Iterate through all chunk nodes
|
//Iterate through all chunk nodes
|
||||||
tinyxml2::XMLNode *chunkNode = fileElem->FirstChild();
|
tinyxml2::XMLElement *chunkElem = fileElem->FirstChildElement("chunk");
|
||||||
while (chunkNode)
|
while (chunkElem)
|
||||||
{
|
{
|
||||||
tinyxml2::XMLElement *chunkElem = chunkNode->ToElement();
|
|
||||||
std::stringstream(chunkElem->Attribute("from")) >> from_offset;
|
std::stringstream(chunkElem->Attribute("from")) >> from_offset;
|
||||||
std::stringstream(chunkElem->Attribute("to")) >> to_offset;
|
std::stringstream(chunkElem->Attribute("to")) >> to_offset;
|
||||||
chunk_from.push_back(from_offset);
|
chunk_from.push_back(from_offset);
|
||||||
chunk_to.push_back(to_offset);
|
chunk_to.push_back(to_offset);
|
||||||
chunk_hash.push_back(chunkElem->GetText());
|
chunk_hash.push_back(chunkElem->GetText());
|
||||||
chunkNode = chunkNode->NextSibling();
|
chunkElem = chunkElem->NextSiblingElement("chunk");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "XML: Parsing finished" << std::endl << std::endl
|
std::cout << "XML: Parsing finished" << std::endl << std::endl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user