Merge recent updates but without broken builder and with minor refactoring and bugfixes

This commit is contained in:
vit9696 2018-10-08 12:58:12 +03:00
parent b064495db8
commit 0a634ebcbd
37 changed files with 712 additions and 8665 deletions

View file

@ -28,29 +28,29 @@ USTATUS FfsOperations::extract(const UModelIndex & index, UString & name, UByteA
if (mode == EXTRACT_MODE_AS_IS) {
// Extract as is, with header body and tail
extracted.clear();
extracted.append(model->header(index));
extracted.append(model->body(index));
extracted.append(model->tail(index));
extracted += model->header(index);
extracted += model->body(index);
extracted += model->tail(index);
}
else if (mode == EXTRACT_MODE_BODY) {
name += QObject::tr("_body");
name += UString("_body");
// Extract without header and tail
extracted.clear();
extracted.append(model->body(index));
extracted += model->body(index);
}
else if (mode == EXTRACT_MODE_BODY_UNCOMPRESSED) {
name += QObject::tr("_body_unc");
name += UString("_body_unc");
// Extract without header and tail, uncompressed
extracted.clear();
// There is no need to redo decompression, we can use child items
for (int i = 0; i < model->rowCount(index); i++) {
UModelIndex childIndex = index.child(i, 0);
// Ensure 4-byte alignment of current section
extracted.append(UByteArray('\x00', ALIGN4((UINT32)extracted.size()) - (UINT32)extracted.size()));
extracted += UByteArray(ALIGN4((UINT32)extracted.size()) - (UINT32)extracted.size(), '\x00');
// Add current section header, body and tail
extracted.append(model->header(childIndex));
extracted.append(model->body(childIndex));
extracted.append(model->tail(childIndex));
extracted += model->header(childIndex);
extracted += model->body(childIndex);
extracted += model->tail(childIndex);
}
}
else
@ -59,7 +59,7 @@ USTATUS FfsOperations::extract(const UModelIndex & index, UString & name, UByteA
return U_SUCCESS;
}
USTATUS FfsOperations::replace(const UModelIndex & index, const UString & data, const UINT8 mode)
USTATUS FfsOperations::replace(const UModelIndex & index, UByteArray & data, const UINT8 mode)
{
U_UNUSED_PARAMETER(data);