void DeviceVerifyPlanner::doNotVerifyBootBlock(QLinkedList<Device::MemoryRange>& verifyList)
{
    Device::MemoryRange firstHalf;
    QLinkedList<Device::MemoryRange>::iterator it = verifyList.begin();
    while(it != verifyList.end())
    {
        //     S   E
        // S   |   E
        //     S   |  E
        // S   |   |  E
        //
        //     |   S  E
        // S   E   |
        if(!((it->start <= device->startBootloader && it->end <= device->startBootloader) ||
             (it->start >= device->endBootloader && it->end >= device->endBootloader)))
        {
            // This transaction would verify over bootloader memory, which may fail if
            // we haven't (or can't) read the device out.
            if(it->start == device->startBootloader && it->end == device->endBootloader)
            {
                it = verifyList.erase(it);
                continue;
            }
            if(it->start == device->startBootloader)
            {
                it->start = device->endBootloader;
            }
            else if(it->end == device->endBootloader)
            {
                it->end = device->startBootloader;
            }
            else
            {
                firstHalf.start = device->endBootloader;
                firstHalf.end = it->end;
                it->end = device->startBootloader;
                if(firstHalf.start < firstHalf.end)
                {
                    verifyList.insert(it, firstHalf);
                }
            }
        }
        it++;
    }
}
Exemplo n.º 2
0
void ConditionalDialog::init()
{
    QLinkedList<KCConditional> conditionList;
    QLinkedList<KCConditional> otherList;
    bool found;
    int numCondition;

    QLinkedList<KCConditional>::iterator it1;
    QLinkedList<KCConditional>::iterator it2;

    KCSheet* sheet = m_selection->activeSheet();

    conditionList = KCCell(sheet, m_selection->marker()).conditions().conditionList();
    /* this is the list, but only display the conditions common to all selected
       cells*/

    for (int x = m_selection->lastRange().left(); x <= m_selection->lastRange().right(); x++) {
        for (int y = m_selection->lastRange().top(); y <= m_selection->lastRange().bottom(); y++) {
            otherList = KCCell(sheet, x, y).conditions().conditionList();

            it1 = conditionList.begin();
            while (it1 != conditionList.end()) {
                kDebug() << "Here";
                found = false;
                for (it2 = otherList.begin(); !found && it2 != otherList.end(); ++it2) {
                    kDebug() << "Found:" << found;
                    found = ((*it1).value1 == (*it2).value1 &&
                             (*it1).value2 == (*it2).value2 &&
                             (*it1).cond == (*it2).cond);

                    if (!found)
                        continue;

                    if ((*it1).styleName != (*it2).styleName)
                        found = false;
                }

                if (!found) {  /* if it's not here, don't display this condition */
                    it1 = conditionList.erase(it1);
                } else {
                    ++it1;
                }
            }
        }
    }

    kDebug() << "KCConditions:" << conditionList.size();

    m_dlg->m_condition_2->setEnabled(false);
    m_dlg->m_condition_3->setEnabled(false);

    m_dlg->m_style_1->setEnabled(false);
    m_dlg->m_style_2->setEnabled(false);
    m_dlg->m_style_3->setEnabled(false);

    numCondition = 0;
    for (it1 = conditionList.begin(); numCondition < 3 && it1 != conditionList.end(); ++it1) {
        init(*it1, numCondition);

        ++numCondition;
    }
}