void modifyOrder(QLinkedList<BidOrAsk> &queue, BidOrAsk &bidOrAsk) { auto r = std::find(queue.begin(), queue.end(), bidOrAsk); if (r != queue.end()) { BidOrAsk original = *r; Q_ASSERT (original.id() == bidOrAsk.id()); if (original.price() != bidOrAsk.price() || original.volume() > bidOrAsk.volume()) { // remove and re-add to loose position queue.erase(r); original.setPrice(bidOrAsk.price()); original.setVolume(bidOrAsk.volume()); // since this simulation happens long past, // we can't use the current time. original.setTime(bidOrAsk.time()); original.setDate(bidOrAsk.date()); queue.insert(std::lower_bound(queue.begin(), queue.end(), bidOrAsk), bidOrAsk); } else { // if only the volume has decreased, it // doesn't loose its position. original.setVolume(bidOrAsk.volume()); } } }
/** Atualiza os pesos as arestas de acordo com a Equação: * \f[ w_{i,j} = w_{i,j} + \alpha\left(\frac{\lambda}{\Delta t} - w_{i,j} \right) \f] */ void ComplexNetworkConstructor::makeCoOccurrences(QLinkedList<FeatureAbstractPtr> &features, QList<int> ®ionsIds) { QLinkedList<FeaturesComplexNetwork::Node> nodes; //Cria nós ou pesquisa existentes for (auto &f: features) { FeaturesComplexNetwork::Node id; if (!index.contains(f)) { FeatureAbstractPtr temp = f; id = cn.addNode(f); index.insert(temp, id); } else { id = index[f]; } nodes.append(id); } unsigned int i = 0, j = 0; for (QLinkedList<FeaturesComplexNetwork::Node>::const_iterator it1 = nodes.begin(); it1 != nodes.end(); it1++) { j = i + 1; for (QLinkedList<FeaturesComplexNetwork::Node>::const_iterator it2 = it1 + 1; it2 != nodes.end(); it2++) { reinforceLink(*it1, *it2, regionsIds[i] == regionsIds[j]); if (*it2 != *it1) reinforceLink(*it2, *it1, regionsIds[i] == regionsIds[j]); this->time++; j++; } i++; } }
void MainWindow::deviceRemoved(QDBusMessage message) { int index; QString devicePath; #ifdef USEHAL devicePath = message.arguments().at(0).toString(); if (devicePath.startsWith("/org/freedesktop/Hal/devices/storage_serial")) #else QDBusObjectPath path = message.arguments().at(0).value<QDBusObjectPath>(); devicePath = path.path(); if (devicePath.startsWith("/org/freedesktop/UDisks/devices/")) #endif { QLinkedList<DeviceItem *> list = pPlatform->getDeviceList(); QLinkedList<DeviceItem *>::iterator i; for (i = list.begin(); i != list.end(); ++i) { if ((*i)->getUDI() == devicePath) { if (removeMenuItem((*i)->getDisplayString()) != -1) { pPlatform->removeDeviceFromList(devicePath); break; } } } } }
void FlickrWindow::slotPopulatePhotoSetComboBox() { kDebug() << "slotPopulatePhotoSetComboBox invoked"; if (m_talker && m_talker->m_photoSetsList) { QLinkedList <FPhotoSet> *list = m_talker->m_photoSetsList; m_albumsListComboBox->clear(); m_albumsListComboBox->insertItem(0, i18n("<Photostream Only>")); m_albumsListComboBox->insertSeparator(1); QLinkedList<FPhotoSet>::iterator it = list->begin(); int index = 2, curr_index = 0; while (it != list->end()) { FPhotoSet photoSet = *it; QString name = photoSet.title; // Store the id as user data, because the title is not unique. QVariant id = QVariant(photoSet.id); if (id == m_talker->m_selectedPhotoSet.id) { curr_index = index; } m_albumsListComboBox->insertItem(index++, name, id); ++it; } m_albumsListComboBox->setCurrentIndex(curr_index); } }
void QgsComposition::sortZList() { if ( mItemZList.size() < 2 ) { return; } QLinkedList<QgsComposerItem*>::const_iterator lIt = mItemZList.constBegin(); QLinkedList<QgsComposerItem*> sortedList; for ( ; lIt != mItemZList.constEnd(); ++lIt ) { QLinkedList<QgsComposerItem*>::iterator insertIt = sortedList.begin(); for ( ; insertIt != sortedList.end(); ++insertIt ) { if (( *lIt )->zValue() < ( *insertIt )->zValue() ) { break; } } sortedList.insert( insertIt, ( *lIt ) ); } mItemZList = sortedList; }
bool QED2KSession::hasActiveTransfers() const { QLinkedList<QED2KHandle> torrents = getActiveTransfers(); QLinkedList<QED2KHandle>::iterator torrentIT; for (torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { const QED2KHandle h(*torrentIT); if (h.is_valid() && !h.is_seed() && !h.is_paused() ) return true; } return false; }
QStringList NfcTarget::getContentListStrings() { QStringList cl; QLinkedList< QPair<QVariant,QString> > ll = this->getContentList(); QLinkedList< QPair<QVariant,QString> >::iterator it; for ( it = ll.begin(); it!= ll.end(); ++it ) { cl << QString::number ( ( *it ).first.toInt() ) + QString ( ": " ) + ( *it ).second + QString ( "\n" ); } return cl; }
int main () { unsigned int i; QLinkedList<unsigned int> myQLinkedList; QLinkedList<unsigned int>::iterator it1,it2; // set some values: for (i=1; i<10; i++) myQLinkedList.push_back(i*10); // 10 20 30 40 50 60 70 80 90 it1 = it2 = myQLinkedList.begin(); // ^^ advance (it2,6); // ^ ^ assert(*it2 != 70); ++it1; // ^ ^ it1 = myQLinkedList.erase (it1); // 10 30 40 50 60 70 80 90 assert(*it1 != 30); assert(myQLinkedList.size() == 8); // ^ ^ it2 = myQLinkedList.erase (it2); // 10 30 40 50 60 80 90 // ^ ^ assert(*it2 != 80); assert(myQLinkedList.size() == 7); ++it1; // ^ ^ --it2; // ^ ^ myQLinkedList.erase (it1,it2); // 10 30 60 80 90 // ^ assert(myQLinkedList.size() == 5); assert(*it2 != 60); cout << "myQLinkedList contains:"; for (it1=myQLinkedList.begin(); it1!=myQLinkedList.end(); ++it1) cout << " " << *it1; cout << endl; return 0; }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QLinkedList<QString> linkList; linkList.append("Bangaluru"); linkList.append("Mumbai"); linkList.append("Delhi"); linkList.append("Gandhinagara"); qDebug() << "1-Number of Items =" << linkList.count(); QLinkedList<QString>::iterator j = qFind(linkList.begin(),linkList.end(),"Varanasi"); linkList.insert(j,"Bhopal"); QLinkedList<QString>::iterator i; for (i = linkList.begin(); i != linkList.end(); ++i) qDebug() << *i << endl; qDebug() << "2-Number of Items =" << linkList.count(); return a.exec(); }
int main () { QLinkedList<int> myints; cout << "0. size: " << (int) myints.size() << endl; assert(myints.size() == 0); for (int i=0; i<10; i++) myints.push_back(i); cout << "1. size: " << (int) myints.size() << endl; assert(myints.size() == 10); myints.insert (myints.begin(),10); cout << "2. size: " << (int) myints.size() << endl; assert(myints.size() == 11); myints.pop_back(); cout << "3. size: " << (int) myints.size() << endl; assert(myints.size() == 10); return 0; }
void PicasawebWindow::slotGetAlbumsListSucceeded() { if (m_talker && m_talker->m_albumsList) { QLinkedList <PicasaWebAlbum> *list = m_talker->m_albumsList; m_albumsListComboBox->clear(); QLinkedList<PicasaWebAlbum>::iterator it = list->begin(); int index = 0; while(it != list->end()) { PicasaWebAlbum pwa=*it; QString name = pwa.title; m_albumsListComboBox->insertItem(index++, name); it++; } } }
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++; } }
int main () { QLinkedList<int> myQLinkedList; // two ints with a value of 100 myQLinkedList.push_back(100); myQLinkedList.push_back(100); assert(myQLinkedList.front() == 100); myQLinkedList.push_front (200); assert(myQLinkedList.front() == 200); myQLinkedList.push_front (300); assert(myQLinkedList.front() == 300); cout << "myQLinkedList contains:"; for (QLinkedList<int>::iterator it=myQLinkedList.begin(); it!=myQLinkedList.end(); ++it) cout << " " << *it; cout << endl; return 0; }
void Odf::saveConditions(const Conditions *conditions, KoGenStyle ¤tCellStyle, ValueConverter *converter) { //todo fix me with kspread old format!!! if (conditions->isEmpty()) return; QLinkedList<Conditional> list = conditions->conditionList(); QLinkedList<Conditional>::const_iterator it; int i = 0; for (it = list.begin(); it != list.end(); ++it, ++i) { Conditional conditional = *it; //<style:map style:condition="cell-content()=45" style:apply-style-name="Default" style:base-cell-address="Sheet1.E10"/> QMap<QString, QString> map; map.insert("style:condition", saveConditionValue(conditional, converter)); map.insert("style:apply-style-name", conditional.styleName); if (!conditional.baseCellAddress.isEmpty()) map.insert("style:base-cell-address", conditional.baseCellAddress); currentCellStyle.addStyleMap(map); } }
void BatteryHistoryDialog::UpdateHistory (const QLinkedList<BatteryHistory>& hist) { QVector<double> xdata (hist.size ()); QVector<double> percents (hist.size ()); QVector<double> energy (hist.size ()); int i = 0; std::for_each (hist.begin (), hist.end (), [&xdata, &percents, &energy, &i] (const BatteryHistory& bh) { percents [i] = bh.Percentage_; energy [i] = bh.EnergyRate_; xdata [i] = i; ++i; }); Percent_->setSamples (xdata, percents); Energy_->setSamples (xdata, energy); Ui_.PercentPlot_->replot (); }
void MainWindow::reloadDeviceList(const char *cmddevice) { int dev = -1; QLinkedList<DeviceItem *> list = pPlatform->getDeviceList(); QLinkedList<DeviceItem *>::iterator i; for (i = list.begin(); i != list.end(); ++i) { if (!(*i)->getPath().isEmpty()) if (deviceComboBox->findText((*i)->getDisplayString()) == -1) addMenuItem((*i)->getDisplayString()); if (cmddevice != NULL) if ((*i)->getPath().compare(cmddevice) == 0) dev = deviceComboBox->findText((*i)->getDisplayString(), 0); } if (dev != -1) deviceComboBox->setCurrentIndex(dev); }
void DeviceVerifyPlanner::doNotVerifyConfigPage(QLinkedList<Device::MemoryRange>& verifyList) { if(!device->hasConfigAsFlash()) { // ABORT: this device does not store config bits in FLASH, so no worries... return; } QLinkedList<Device::MemoryRange>::iterator it = verifyList.begin(); if(it->end <= device->endFLASH - device->eraseBlockSizeFLASH) { // ABORT: user is not planning to verify the config bit page. return; } it->end -= device->eraseBlockSizeFLASH; if(it->end <= it->start) { // after taking out the config page, this transaction has nothing left in it. verifyList.removeFirst(); } }
void boxAvail::convertNodes(QLinkedList<BareNode*> src){ QLinkedList<BareNode*>::Iterator bnIt; itemNode *node; itemLinker *linker; int pos=1; int id; QString info; int link; for (bnIt=src.begin (); bnIt!=src.end (); ++bnIt){ id = (*bnIt)->getId(); info = (*bnIt)->getInfo(); link = (*bnIt)->getLink(); node = new itemNode(&Server,pos,id,info,link, this); source << node; if (link){ linker = new itemLinker(pos, &Server, this); source << linker; } ++pos; } }
/** * When sending a packet to the PIC, we must not overflow the PIC's internal RAM * storage limit. Therefore, each write must be made small enough for the PIC * to buffer it successfully. * * Additionally, the AN1310 protocol only provides a single byte for the * write flash block count. Therefore, write transactions must not exceed 256 * write blocks in a single transaction. */ void DeviceWritePlanner::packetSizeWriteList(QLinkedList<Device::MemoryRange>& writeList) { QLinkedList<Device::MemoryRange>::iterator it = writeList.begin(); Device::MemoryRange firstHalf; int maxWritePacketData = device->maxPacketSize(); int bytesPerWriteBlock = device->writeBlockSizeFLASH; int blocks, bytes; maxWritePacketData -= WriteFlashPacket::headerSize; maxWritePacketData -= WriteFlashPacket::footerSize; if(device->family == Device::PIC16) { // On PIC12/PIC16, writeBlockSizeFLASH only counts the number of instruction words per block. // Each instruction word requires two bytes of data to be transmitted in the command packet, // so we need to double bytesPerWriteBlock here. bytesPerWriteBlock <<= 1; } else if(device->family == Device::PIC24) { // On PIC24, writeBlockSizeFLASH only counts the two least significant bytes of the // instruction word, so we need to add 1/2 more here to count that special third byte. bytesPerWriteBlock = device->writeBlockSizeFLASH + (device->writeBlockSizeFLASH >> 1); }
int main (int argc, char *argv[]) { int c; char *device = NULL; char *file = NULL; bool unsafe = false; bool maximized = false; bool listMode = false; bool kioskMode = false; qDebug() << "Starting up..."; #if defined(Q_OS_UNIX) #if !defined(KIOSKHACK) && !defined(USEUDISKS2) if (getuid() != 0) qFatal("You must run this program as the root user."); #endif #endif while ((c = getopt (argc, argv, "mlkvuhd:f:")) != -1) { switch (c) { case 'h': fprintf(stdout, "Usage:\t%s [-d <device>] [-f <raw file>] [-u] [-l] [-v]\n", argv[0]); fprintf(stdout, "Flashes a raw disk file to a device\n\n"); fprintf(stdout, "-d <device>\t\tSpecify a device, for example: /dev/sdc\n"); fprintf(stdout, "-f <raw file>\t\tSpecify the file to write\n"); fprintf(stdout, "-k\t\t\tOperate in \"kiosk mode\", only listing disks smaller than 200GB\n"); fprintf(stdout, "-l\t\t\tList valid USB devices\n"); fprintf(stdout, "-m\t\t\tMaximize the window\n"); fprintf(stdout, "-u\t\t\tOperate in unsafe mode, listing all disks, not just removable ones\n"); fprintf(stdout, "-v\t\t\tVersion and author information\n"); exit(0); case 'u': unsafe = true; break; case 'd': device = strdup(optarg); break; case 'f': file = strdup(optarg); break; case 'l': listMode = true; break; case 'k': kioskMode = true; break; case 'v': fprintf(stdout, "SUSE Studio Imagewriter %s\nWritten by Matt Barringer <*****@*****.**>\n", APP_VERSION); exit(0); break; case 'm': maximized = true; break; default: break; } } QApplication app(argc, argv); #ifdef USEHAL PlatformHal *platform = new PlatformHal(kioskMode, unsafe); #elif USEUDISKS2 PlatformUdisks2 *platform = new PlatformUdisks2(kioskMode, unsafe); #else PlatformUdisks *platform = new PlatformUdisks(kioskMode, unsafe); #endif platform->findDevices(); if (listMode) { QLinkedList<DeviceItem *> list = platform->getDeviceList(); QLinkedList<DeviceItem *>::iterator i; for (i = list.begin(); i != list.end(); ++i) { if (!(*i)->getPath().isEmpty()) fprintf(stdout, "%s\n", (*i)->getPath().toLatin1().data()); } exit(0); } MainWindow window(platform, device, file, unsafe, maximized); if (maximized) { window.showMaximized(); } else { window.show(); } return app.exec(); }
bool PlotIO::write(const QString& path, const ros::Time& start, const ros::Time& end) { FileFormat* io = 0; if(path.endsWith(".bag")) io = new BagFormat; else if(path.endsWith(".csv")) io = new CSVFormat; if(!io) { fprintf(stderr, "Could not find output format\n"); return false; } if(!io->init(path, start)) return false; QLinkedList<Plot::LinkedBufferIterator> its = m_rootPlot->iterators(io->defaultFlags()); io->writeHeader(its); QVector<Plot::LinkedBufferIterator*> to_write(its.size(), 0); while(1) { ros::Time stamp = ros::Time(0); qFill(to_write, (Plot::LinkedBufferIterator*)0); // Get a list of iterators with the next timestamp int i = 0; for(QLinkedList<Plot::LinkedBufferIterator>::iterator it = its.begin(); it != its.end(); ++it, ++i) { Plot::LinkedBufferIterator& buf_it = *it; if(!buf_it.isValid()) continue; const Plot::DataPoint& point = *buf_it; if(point.time < stamp || stamp == ros::Time(0)) { qFill(to_write, (Plot::LinkedBufferIterator*)0); to_write[i] = &buf_it; stamp = point.time; } else if(point.time == stamp) to_write[i] = &buf_it; } if(stamp == ros::Time(0)) break; if(end != ros::Time(0) && stamp > end) break; if(stamp >= start) io->writeData(stamp, to_write); // Advance all used iterators Q_FOREACH(Plot::LinkedBufferIterator* it, to_write) { if(!it) continue; ++(*it); } } delete io; return true; }
/*! * @desc collects groups of concurrent items in the offset range */ QList< QLinkedList<QxtScheduleInternalItem *> > QxtScheduleViewPrivate::findConcurrentItems(const int from, const int to) const { QList< QLinkedList<QxtScheduleInternalItem *> > allConcurrentItems; QList<QxtScheduleInternalItem *> allItemsSorted = m_Items; if(m_Items.size() == 0) return allConcurrentItems; qSort(allItemsSorted.begin(), allItemsSorted.end(), qxtScheduleItemLessThan); int startItem = 0; int endItem = allItemsSorted.size() - 1; //find the startitem that interferes with our range for (int i = 0; i < allItemsSorted.size(); i++) { if (i > 0) { if (!(allItemsSorted.at(i - 1)->visualEndTableOffset() >= allItemsSorted.at(i)->visualStartTableOffset() && allItemsSorted.at(i - 1)->visualStartTableOffset() <= allItemsSorted.at(i)->visualEndTableOffset())) startItem = i; } if (allItemsSorted.at(i)->visualEndTableOffset() >= from && allItemsSorted.at(i)->visualStartTableOffset() <= to) break; } //find the last item that interferes with our range for (int i = allItemsSorted.size() - 1; i >= 0 ; i--) { if (i < allItemsSorted.size() - 1) { if (!(allItemsSorted.at(i + 1)->visualEndTableOffset() >= allItemsSorted.at(i)->visualStartTableOffset() && allItemsSorted.at(i + 1)->visualStartTableOffset() <= allItemsSorted.at(i)->visualEndTableOffset())) endItem = i; } if (allItemsSorted.at(i)->visualEndTableOffset() >= from && allItemsSorted.at(i)->visualStartTableOffset() <= to) break; } int startOffset = allItemsSorted.at(startItem)->visualStartTableOffset(); int endOffset = allItemsSorted.at(endItem)->visualEndTableOffset(); /*now we have to populate a list with all items that interfere with our range */ QLinkedList<QxtScheduleInternalItem *> concurrentItems; for (int iAllItemLoop = startItem; iAllItemLoop <= endItem; iAllItemLoop++) { int tempStartOffset = allItemsSorted.at(iAllItemLoop)->visualStartTableOffset(); int tempEndOffset = allItemsSorted.at(iAllItemLoop)->visualEndTableOffset(); if (tempEndOffset >= startOffset && tempStartOffset <= endOffset) { if (concurrentItems.size() >= 1) { bool bAppend = false; /*check all items in the list if the current items interfers although the items are ordered by startIndex *we can loose some of them if the endTime of the last Item is before the endTime of the pre last item */ for (QLinkedList<QxtScheduleInternalItem *>::iterator it = concurrentItems.begin(); it != concurrentItems.end(); ++it) { int lastStartOffset = (*it)->visualStartTableOffset(); int lastEndOffset = (*it)->visualEndTableOffset(); if (tempEndOffset >= lastStartOffset && tempStartOffset <= lastEndOffset) { bAppend = true; break; } } if (bAppend) { concurrentItems.append(allItemsSorted.at(iAllItemLoop)); } else { allConcurrentItems.append(concurrentItems); concurrentItems.clear(); concurrentItems.append(allItemsSorted.at(iAllItemLoop)); } } else concurrentItems.append(allItemsSorted.at(iAllItemLoop)); if (tempStartOffset < startOffset) startOffset = tempStartOffset; if (tempEndOffset > endOffset) endOffset = tempEndOffset; } } if (concurrentItems.size() > 0) allConcurrentItems.append(concurrentItems); return allConcurrentItems; }
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; } }
/** * Produces FLASH erase and write plans for optimally programming application code into * a device. * * This routine assumes that pages filled with blank or "NOP" instructions (0xFFFF) do * not need to be erased nor written. For most applications, this will be sufficient, * providing extremely fast programming. * * To guarantee clean memory, perform a Verify After Write CRC check on each Erase * Block. This will find any leftover junk data from older firmware that can be erased. */ void DeviceWritePlanner::planFlashWrite(QLinkedList<Device::MemoryRange>& eraseList, QLinkedList<Device::MemoryRange>& writeList, unsigned int start, unsigned int end, unsigned int* data, unsigned int* existingData) { unsigned int address = start; Device::MemoryRange block; while(address < end) { address = skipEmptyFlashPages(address, data); block.start = address; if(address >= end) { break; } address = findEndFlashWrite(address, data); if(address >= end) { address = end; } block.end = address; if(device->family == Device::PIC16 && !device->hasEraseFlashCommand()) { // Certain PIC16 devices (such as PIC16F882) have a peculiar automatic erase // during write feature. To make that work, writes must be expanded to align // with Erase Block boundaries. block.start -= (block.start % device->eraseBlockSizeFLASH); if(block.end % device->eraseBlockSizeFLASH) { block.end += device->eraseBlockSizeFLASH - (block.end % device->eraseBlockSizeFLASH); address = block.end; } } writeList.append(block); address++; } if(existingData == NULL && device->family == Device::PIC32) { // Because PIC32 has Bulk Erase available for bootloader use, // it's faster to simply erase the entire FLASH memory space // than erasing specific erase blocks using an erase plan. block.start = device->startFLASH; block.end = device->endFLASH; eraseList.append(block); } else { if(existingData != NULL) { QLinkedList<Device::MemoryRange>::iterator it; for(it = writeList.begin(); it != writeList.end(); ++it) { qDebug("unpruned write(%X to %X)", it->start, it->end); } doNotWriteExistingData(writeList, start, end, data, existingData); for(it = writeList.begin(); it != writeList.end(); ++it) { qDebug("pruned write(%X to %X)", it->start, it->end); } } if(!writeList.isEmpty()) { if(device->hasEraseFlashCommand()) { flashEraseList(eraseList, writeList, data, existingData); } EraseAppCheckFirst(eraseList); WriteAppCheckLast(writeList); if(writeConfig) { eraseConfigPageLast(eraseList); writeConfigPageFirst(writeList); doNotEraseBootBlock(eraseList); // needed in case boot block resides on config page } else { doNotEraseConfigPage(eraseList); } doNotEraseInterruptVectorTable(eraseList); } } packetSizeWriteList(writeList); }