Compare commits
1 Commits
556bb22d26
...
2e74d94641
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e74d94641 |
+3
-2
@@ -1383,7 +1383,6 @@ private:
|
|||||||
pugi::xml_document _doc;
|
pugi::xml_document _doc;
|
||||||
pugi::xml_node _root;
|
pugi::xml_node _root;
|
||||||
std::map<int, std::pair<uint64_t, uint64_t>> _attachmentPos;// pair contain position and size
|
std::map<int, std::pair<uint64_t, uint64_t>> _attachmentPos;// pair contain position and size
|
||||||
std::map<int, std::pair<uint64_t, uint64_t>> _attachmentPosNew;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1446,6 +1445,8 @@ void XISFModifyPrivate::save(std::ostream &io)
|
|||||||
doc.append_child(pugi::node_comment).set_value("\nExtensible Image Serialization Format - XISF version 1.0\nCreated with libXISF - https://nouspiro.space\n");
|
doc.append_child(pugi::node_comment).set_value("\nExtensible Image Serialization Format - XISF version 1.0\nCreated with libXISF - https://nouspiro.space\n");
|
||||||
pugi::xml_node root_copy = doc.append_copy(_root);
|
pugi::xml_node root_copy = doc.append_copy(_root);
|
||||||
|
|
||||||
|
parseAttachmentPos(_root);
|
||||||
|
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
std::string header;
|
std::string header;
|
||||||
while(true)
|
while(true)
|
||||||
@@ -1601,6 +1602,7 @@ void XISFModifyPrivate::readXISFHeader()
|
|||||||
|
|
||||||
void XISFModifyPrivate::parseAttachmentPos(pugi::xml_node &root)
|
void XISFModifyPrivate::parseAttachmentPos(pugi::xml_node &root)
|
||||||
{
|
{
|
||||||
|
_attachmentPos.clear();
|
||||||
pugi::xpath_node_set locationAttributes = root.select_nodes("//@location");
|
pugi::xpath_node_set locationAttributes = root.select_nodes("//@location");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(auto &attr : locationAttributes)
|
for(auto &attr : locationAttributes)
|
||||||
@@ -1625,7 +1627,6 @@ void XISFModifyPrivate::updateAttachmentPos(pugi::xml_node &root, size_t offset)
|
|||||||
pugi::xml_attribute attr = locationAttributes[pos.first].attribute();
|
pugi::xml_attribute attr = locationAttributes[pos.first].attribute();
|
||||||
uint64_t attachmentSize = pos.second.second;
|
uint64_t attachmentSize = pos.second.second;
|
||||||
std::string locationStr = "attachment:" + std::to_string(offset) + ":" + std::to_string(attachmentSize);
|
std::string locationStr = "attachment:" + std::to_string(offset) + ":" + std::to_string(attachmentSize);
|
||||||
_attachmentPosNew[pos.first] = pos.second;
|
|
||||||
offset += attachmentSize;
|
offset += attachmentSize;
|
||||||
attr.set_value(locationStr.c_str());
|
attr.set_value(locationStr.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user