mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 16:08:23 +08:00
Fix duplicates in UEFIExtract
This commit is contained in:
parent
6e481fbb4d
commit
aa0ab13411
@ -19,6 +19,7 @@ USTATUS FfsDumper::dump(const UModelIndex & root, const UString & path, const Du
|
|||||||
{
|
{
|
||||||
dumped = false;
|
dumped = false;
|
||||||
counterHeader = counterBody = counterRaw = counterInfo = 0;
|
counterHeader = counterBody = counterRaw = counterInfo = 0;
|
||||||
|
fileList.clear();
|
||||||
|
|
||||||
if (changeDirectory(path))
|
if (changeDirectory(path))
|
||||||
return U_DIR_ALREADY_EXIST;
|
return U_DIR_ALREADY_EXIST;
|
||||||
@ -57,7 +58,9 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||||||
|
|
||||||
if (dumpMode == DUMP_ALL || model->rowCount(index) == 0) { // Dump if leaf item or dumpAll is true
|
if (dumpMode == DUMP_ALL || model->rowCount(index) == 0) { // Dump if leaf item or dumpAll is true
|
||||||
if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_HEADER) {
|
if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_HEADER) {
|
||||||
if (!model->header(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
if (!model->header(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType) &&
|
||||||
|
fileList.count(index) == 0) {
|
||||||
|
fileList.insert(index);
|
||||||
UString filename;
|
UString filename;
|
||||||
if (counterHeader == 0)
|
if (counterHeader == 0)
|
||||||
filename = usprintf("%s/header.bin", path.toLocal8Bit());
|
filename = usprintf("%s/header.bin", path.toLocal8Bit());
|
||||||
@ -75,7 +78,9 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_BODY) {
|
if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_BODY) {
|
||||||
if (!model->body(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
if (!model->body(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType) &&
|
||||||
|
fileList.count(index) == 0) {
|
||||||
|
fileList.insert(index);
|
||||||
UString filename;
|
UString filename;
|
||||||
if (counterBody == 0)
|
if (counterBody == 0)
|
||||||
filename = usprintf("%s/body.bin", path.toLocal8Bit());
|
filename = usprintf("%s/body.bin", path.toLocal8Bit());
|
||||||
@ -99,6 +104,8 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||||||
if (!fileIndex.isValid())
|
if (!fileIndex.isValid())
|
||||||
fileIndex = index;
|
fileIndex = index;
|
||||||
}
|
}
|
||||||
|
if (fileList.count(fileIndex) == 0) {
|
||||||
|
fileList.insert(fileIndex);
|
||||||
UString filename;
|
UString filename;
|
||||||
if (counterRaw == 0)
|
if (counterRaw == 0)
|
||||||
filename = usprintf("%s/file.ffs", path.toLocal8Bit());
|
filename = usprintf("%s/file.ffs", path.toLocal8Bit());
|
||||||
@ -118,6 +125,7 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||||||
dumped = true;
|
dumped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Always dump info unless explicitly prohibited
|
// Always dump info unless explicitly prohibited
|
||||||
if ((dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_INFO)
|
if ((dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_INFO)
|
||||||
|
@ -14,6 +14,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#ifndef FFSDUMPER_H
|
#ifndef FFSDUMPER_H
|
||||||
#define FFSDUMPER_H
|
#define FFSDUMPER_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "../common/basetypes.h"
|
#include "../common/basetypes.h"
|
||||||
#include "../common/ustring.h"
|
#include "../common/ustring.h"
|
||||||
#include "../common/treemodel.h"
|
#include "../common/treemodel.h"
|
||||||
@ -47,5 +49,6 @@ private:
|
|||||||
UString currentPath;
|
UString currentPath;
|
||||||
bool dumped;
|
bool dumped;
|
||||||
int counterHeader, counterBody, counterRaw, counterInfo;
|
int counterHeader, counterBody, counterRaw, counterInfo;
|
||||||
|
std::set<UModelIndex> fileList;
|
||||||
};
|
};
|
||||||
#endif // FFSDUMPER_H
|
#endif // FFSDUMPER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user