MCPcopy Create free account
hub / github.com/LongSoft/UEFITool / reconstructPadding

Method reconstructPadding

ffsengine.cpp:3296–3337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3294}
3295
3296UINT8 FfsEngine::reconstructPadding(const QModelIndex& index, QByteArray& reconstructed)
3297{
3298 if (!index.isValid())
3299 return ERR_SUCCESS;
3300
3301 // No action
3302 if (model->action(index) == Actions::NoAction || model->action(index) == Actions::DoNotRebuild) {
3303 reconstructed = model->body(index);
3304 return ERR_SUCCESS;
3305 }
3306 else if (model->action(index) == Actions::Remove) {
3307 reconstructed.clear();
3308 return ERR_SUCCESS;
3309 }
3310 else if (model->action(index) == Actions::Rebuild ||
3311 model->action(index) == Actions::Replace) {
3312 // Use stored item body
3313 reconstructed = model->body(index);
3314
3315 // Check size of reconstructed region, it must be same
3316 if (reconstructed.size() > model->body(index).size()) {
3317 msg(tr("reconstructPadding: reconstructed padding size %1h (%2) is bigger then original %3h (%4)")
3318 .hexarg(reconstructed.size()).arg(reconstructed.size())
3319 .hexarg(model->body(index).size()).arg(model->body(index).size()),
3320 index);
3321 return ERR_INVALID_PARAMETER;
3322 }
3323 else if (reconstructed.size() < model->body(index).size()) {
3324 msg(tr("reconstructPadding: reconstructed padding size %1h (%2) is smaller then original %3h (%4)")
3325 .hexarg(reconstructed.size()).arg(reconstructed.size())
3326 .hexarg(model->body(index).size()).arg(model->body(index).size()),
3327 index);
3328 return ERR_INVALID_PARAMETER;
3329 }
3330
3331 // Reconstruction successful
3332 return ERR_SUCCESS;
3333 }
3334
3335 // All other actions are not supported
3336 return ERR_NOT_IMPLEMENTED;
3337}
3338
3339UINT8 FfsEngine::reconstructVolume(const QModelIndex & index, QByteArray & reconstructed)
3340{

Callers

nothing calls this directly

Calls 2

actionMethod · 0.45
bodyMethod · 0.45

Tested by

no test coverage detected