void
avtOriginalDataSpatialExtentsQuery::PerformQuery(QueryAttributes *qA)
{
    queryAtts = *qA;
    Init(); 

    std::string floatFormat = queryAtts.GetFloatFormat();
    std::string format ="";
    UpdateProgress(0, 0);

    avtDataObject_p dob = ApplyFilters(GetInput());

    SetTypedInput(dob);

    avtDataset_p input = GetTypedInput();
    double extents[6] = {0., 0., 0., 0., 0., 0.};
    char msg[1024];

    avtDatasetExaminer::GetSpatialExtents(input, extents);
    UnifyMinMax(extents, 6);
    int dim = input->GetInfo().GetAttributes().GetSpatialDimension();
    if (dim == 1)
    {
        format = "The original extents are (" + floatFormat + ", " 
                                              + floatFormat + ")";
        SNPRINTF(msg, 1024,format.c_str(), 
                extents[0], extents[1]);
    }
    else if (dim == 2)
    {
        format = "The original extents are (" + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ")";
        SNPRINTF(msg, 1024, format.c_str(), 
            extents[0], extents[1], extents[2], extents[3]);
    }
    else if (dim == 3)
    {
        format = "The original extents are (" + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ", " 
                                              + floatFormat + ")";
       SNPRINTF(msg, 1024, format.c_str(),
        extents[0], extents[1], extents[2], extents[3], extents[4], extents[5]);
    }
    doubleVector d;
    for (int i = 0 ; i < 2*dim ; i++)
        d.push_back(extents[i]);
    qA->SetResultsMessage(msg);
    qA->SetResultsValue(d);

    UpdateProgress(1, 0);
}
STDMETHODIMP CMktStructureBaseDlg::OnOption(PP::OptionParams *Params, PP::OptionInfo *Results, VARIANT_BOOL bLast)
{
	USES_CONVERSION;

	HRESULT hr = S_OK;
	DoEvents();
	if(m_bCanceled) return hr;
/*
	if(bLast==VARIANT_FALSE && m_opts.m_enProviderType == enMyTrackPriceProvider)
	{
		if( fEQZero(Results->Last) && fEQZero(Results->Bid) && fEQZero(Results->Ask) )
			return S_OK;
	}
*/
	if(bLast==VARIANT_FALSE && Results->ExpirationDate < int(vt_date::GetCurrentDate()))
		return S_OK;

	stocks_map::iterator it =  m_stocks.find (Params->UnderlyingSymbol);
	if (it != m_stocks.end())
	try
	{
		USES_CONVERSION;

		if (bLast)
		{
			it->second.m_bGotOptions = true;
			UpdateProgress(it);
			return hr;
		}
		
		CDBLayout db;
		db.Connect(); 
		
		db.UpdateOptionData (it->second.m_nID, Params, Results);

		db.Disconnect();
		

		CString strMsg;
		strMsg.Format(IDS_MKTSTRUCTURE_GOTOPTION, OLE2T(Params->UnderlyingSymbol),
			OLE2T(Results->Series) );

		it->second.m_lGotOptions++;		
		StatusMessage (strMsg, false);
		UpdateProgress(it);
	}
	catch (_com_error & e)
	{
		ErrorMessage(e);
		Stop();
	}

	return hr;
}
void TranscodeDialog::timerEvent(QTimerEvent* e) {
  QDialog::timerEvent(e);

  if (e->timerId() == progress_timer_.timerId()) {
    UpdateProgress();
  }
}
void TranscodeDialog::JobComplete(const QString& filename, bool success) {
  (*(success ? &finished_success_ : &finished_failed_))++;
  queued_--;

  UpdateStatusText();
  UpdateProgress();
}
void UOnlineHotfixManager::OnReadFileComplete(bool bWasSuccessful, const FString& FileName)
{
	if (PendingHotfixFiles.Contains(FileName))
	{
		if (bWasSuccessful)
		{
			FCloudFileHeader* Header = GetFileHeaderFromDLName(FileName);
			check(Header != nullptr);
			UE_LOG(LogHotfixManager, Log, TEXT("Hotfix file (%s) downloaded. Size was (%d)"), *GetFriendlyNameFromDLName(FileName), Header->FileSize);
			// Completion updates the file count and progress updates the byte count
			UpdateProgress(1, 0);
			PendingHotfixFiles.Remove(FileName);
			if (PendingHotfixFiles.Num() == 0)
			{
				// All files have been downloaded so now apply the files
				ApplyHotfix();
			}
		}
		else
		{
			UE_LOG(LogHotfixManager, Error, TEXT("Hotfix file (%s) failed to download"), *GetFriendlyNameFromDLName(FileName));
			TriggerHotfixComplete(EHotfixResult::Failed);
		}
	}
}
Exemple #6
0
/* atsh_compute_SMR
 * ================
 * computes the SMR data for a set of frames
 * *sound: pointer to an ATS_SOUND structure
 * from_frame: initial frame
 * to_frame: last frame
 */
void atsh_compute_SMR(ATS_SOUND *sound, int from_frame, int to_frame)
{
  ATS_PEAK *peaks;
  int i, j, nValue=0;
  int todo  = to_frame - from_frame;

  peaks = (ATS_PEAK *)malloc(sound->partials * sizeof(ATS_PEAK));
  
  StartProgress("Computing SMR...", FALSE);
  for(i = from_frame; i < to_frame; i++)
    {
      //fprintf(stderr," frm=%d", i);

      make_peaks(sound,peaks,i);
      evaluate_smr(peaks, sound->partials);
      for(j = 0 ; j < sound->partials ; j++)
	{
	  sound->smr[j][i] = peaks[j].smr;
	  //fprintf(stderr,"%8.3f ",sound->smr[j][i] );
	}
    //fprintf(stderr,"\n");
     ++nValue;
      UpdateProgress(nValue,todo);
    }
  EndProgress();
  smr_done=TRUE;
  free(peaks);
}
NS_IMETHODIMP
nsIncrementalDownload::OnDataAvailable(nsIRequest *request,
                                       nsISupports *context,
                                       nsIInputStream *input,
                                       uint64_t offset,
                                       uint32_t count)
{
  while (count) {
    uint32_t space = mChunkSize - mChunkLen;
    uint32_t n, len = std::min(space, count);

    nsresult rv = input->Read(&mChunk[mChunkLen], len, &n);
    if (NS_FAILED(rv))
      return rv;
    if (n != len)
      return NS_ERROR_UNEXPECTED;

    count -= n;
    mChunkLen += n;

    if (mChunkLen == mChunkSize) {
      rv = FlushChunk();
      if (NS_FAILED(rv))
        return rv;
    }
  }

  if (PR_Now() > mLastProgressUpdate + UPDATE_PROGRESS_INTERVAL)
    UpdateProgress();

  return NS_OK;
}
void CASW_Map_Builder::ProcessExecution()
{
	DWORD dwCount = 0;
	DWORD dwRead = 0;

	// read from input handle
	PeekNamedPipe(m_hChildStdoutRd, NULL, NULL, NULL, &dwCount, NULL);
	if (dwCount)
	{
		dwCount = MIN (dwCount, 4096 - 1);
		ReadFile(m_hChildStdoutRd, m_szProcessBuffer, dwCount, &dwRead, NULL);
	}
	if(dwRead)
	{
		m_szProcessBuffer[dwRead] = 0;
		UpdateProgress();
		Msg(m_szProcessBuffer);
	}
	// check process termination
	else if ( WaitForSingleObject(m_hProcess, 50) != WAIT_TIMEOUT )
	{
		if(m_bFinishedExecution)
		{
			m_iProcessReturnValue = 0;
			FinishExecution();
		}
		else
		{
			m_bFinishedExecution = true;
		}
	}	
}
Exemple #9
0
void Organise::timerEvent(QTimerEvent* e) {
  QObject::timerEvent(e);

  if (e->timerId() == transcode_progress_timer_.timerId()) {
    UpdateProgress();
  }
}
void FileTransferWidget::GetNextFile()
{
    if (m_filesHashIter->hasNext())
    {
        m_speedBytes = 0;
        m_currentFileSize = 0;
        QHash<QString, quint32>::const_iterator currFile = m_filesHashIter->next();
        m_ui->progressBar->setMaximum(currFile.value());
        m_ui->progressBar->setValue(0);
        m_ui->fileSizeLabel->setText(MRIMCommonUtils::GetFileSize(currFile.value()));
        m_ui->doneLabel->setText(MRIMCommonUtils::GetFileSize(0));
        m_ui->statusLabel->setText(tr("Getting file..."));
        m_ui->fileNameLabel->setText(currFile.key());
        m_ui->speedLabel->clear();
        QString reqCmd("MRA_FT_GET_FILE "+currFile.key());        
        m_currentFile.setFileName(m_location+currFile.key());
        m_currentFile.open(QIODevice::WriteOnly);
        SendCmd(reqCmd);
        m_currentStatus = FT_WAIT_FOR_TRANSFER;
        UpdateProgress();
    }
    else
    {
        m_client->Protocol()->FileTransferCompleted(m_req.UniqueId);
        m_currentStatus = FT_TRANSFER_COMPLETED;
        m_socket->disconnectFromHost();
        m_ui->cancelButton->setText(tr("Close"));
        if (m_ui->closeAfterTransfer->checkState() == Qt::Checked)
        {
            close();
        }
    }
}
void FileTransferWidget::UpdateProgress()
{
    qint64 progress = 0, totalSize = 0;
    if (m_transferMode == TM_RECIEVE_CLIENT)
    {
        progress = m_currentFileSize;
        totalSize = m_filesHashIter->value();
    }
    else if (m_transferMode == TM_SEND_SERVER)
    {
        progress = m_currentFile.pos();
        totalSize = m_currentFile.size();
    }

    m_ui->doneLabel->setText(MRIMCommonUtils::GetFileSize(progress));
    m_ui->progressBar->setValue(progress);
    m_ui->speedLabel->setText(MRIMCommonUtils::GetFileSize(m_speedBytes)+tr("/sec"));
    SetRemainTime();
    m_speedBytes = 0;

    if (progress >= totalSize)
    {
        m_ui->statusLabel->setText(tr("Done!"));
        m_ui->speedLabel->setText("");
        return;
    }

    if ( m_socket->state() == QAbstractSocket::ConnectedState )
        QTimer::singleShot(1000, this, SLOT(UpdateProgress()));
}
Exemple #12
0
void Pipeline::ResizeStage(ImageList images, Task* task)
{
	// Resize images and split it by resolutions
	QHash<QString, ImageList> imagesByRes;
	for(QString res : task->outputRes)
	{
		imagesByRes[res] = resizer.Run(images, task->sourceRes, res, task->potSize);
		UpdateProgress();
	}

	// Pass images to build atals stage
	if(task->atlas) BuildAtlasStage(imagesByRes, task);

	// Save resized images without building atlas
	else
	{
		for(const QString& resolution : imagesByRes.keys())
		{
			for(auto entry : imagesByRes[resolution])
			{
				QString filename = MakeFilename(entry.first, resolution, ExtensionForFormat(task->outputFormat));
				if(!SaveImage(entry.second, task->outputDir, filename, task->outputFormat))
				{
					errors.push_back(ERROR_MASK.arg(task->name).arg(ERROR_SAVE_MASK.arg(filename)));
				}
			}
		}
	}
}
void FileTransferWidget::SendFile(QString aFileName)
{
    if (!m_req.FilesDict.contains(aFileName)) return;

    QFileInfo info = m_req.FilesInfo.at(m_req.FilesDict.keys().indexOf(aFileName,0));
    if (info.exists())
    {
        m_speedBytes = 0;
        if (m_currentFile.isOpen()) m_currentFile.close();
        m_currentFile.setFileName(info.absoluteFilePath());
        m_currentFile.open(QIODevice::ReadOnly);
        m_currentFileChunkSize = m_currentFile.size() < 1360 ? m_currentFile.size() : 1360;

        m_ui->progressBar->setMaximum(m_currentFile.size());
        m_ui->progressBar->setValue(0);
        m_ui->fileSizeLabel->setText(MRIMCommonUtils::GetFileSize(m_currentFile.size()));
        m_ui->doneLabel->setText(MRIMCommonUtils::GetFileSize(0));
        m_ui->speedLabel->clear();
        m_ui->statusLabel->setText(tr("Sending file..."));
        m_ui->fileNameLabel->setText(m_currentFile.fileName());

        UpdateProgress();
        SendFileDataChunk();
    }
}
void CDownloads_Bittorrent_Files::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CColumnTreeCtrl::OnShowWindow(bShow, nStatus);
	
	if (bShow)
		UpdateProgress ();
}
Exemple #15
0
void ParRenamer::CheckFiles(const char* destDir, bool checkPars)
{
	DirBrowser dir(destDir);
	while (const char* filename = dir.Next())
	{
		if (!IsStopped())
		{
			BString<1024> fullFilename("%s%c%s", destDir, PATH_SEPARATOR, filename);

			if (!FileSystem::DirectoryExists(fullFilename))
			{
				m_progressLabel.Format("Checking file %s", filename);
				m_stageProgress = m_fileCount > 0 ? m_curFile * 1000 / m_fileCount / 2 : 1000;
				UpdateProgress();
				m_curFile++;

				if (checkPars)
				{
					CheckParFile(destDir, fullFilename);
				}
				else
				{
					CheckRegularFile(destDir, fullFilename);
				}
			}
		}
	}
}
Exemple #16
0
static void CPROC seek_changed( uintptr_t psvPanel, PSI_CONTROL pc, int val )
{
    struct media_control_panel *panel = ( struct media_control_panel *)psvPanel;
    UpdateProgress( panel, val );
    if( !panel->flags.setting_position )
        ffmpeg_SeekFile( panel->media->file, (int64_t)val * 100000LL );
    // update position text...
}
Exemple #17
0
/*
   Fills file with given data
   Returns SCRUB_ERR in case of error, otherwise returns SCRUB_OK
*/
int Scrubber::FillFile(int fdFile, off64_t nFileSize, char* arrData, unsigned int nSize, bool bRandomize)
{
    //       Add progress update
    off64_t nWritten = 0LL;

    int nBytes = 0;

    lseek(fdFile, 0, SEEK_SET);

    if (bRandomize)
    {
        if (churnrand() != 0)
        {
            snprintf(sLogBuf, MESSAGE_LEN, "ERROR: Occured in churnrand(). Inside function FillFile().\n");
            WriteToLog(ScrubLogger::SCRUB_ERROR, this->nCurrFile, sLogBuf);

            return SCRUB_ERR;
        }
    }

    while (nWritten < nFileSize)
    {
        // Randomise buffer if needed
        if (bRandomize)
        {
            genrand(arrData, nSize);
            //Random::GetInstance()->FillRand(arrData, nSize, 0, 255);
        }

        // Make sure we won't write out of file bounds
        if (nWritten + nSize > nFileSize)
        {
            nSize = nFileSize - nWritten;
        }

        // Write Data
        nBytes = WriteData(fdFile, arrData, nSize);

        if (nBytes < 0)
        {
            snprintf(sLogBuf, MESSAGE_LEN, "ERROR: %s. Occured while writing data to file %s. Inside function FillFile().\n",
                    strerror(errno), this->lstFiles->at(this->nCurrFile).c_str());
            WriteToLog(ScrubLogger::SCRUB_ERROR, this->nCurrFile, sLogBuf);

            this->nTotalWritten += nFileSize - nWritten;

            return SCRUB_ERR;
        }

        nWritten += nBytes;
        this->nTotalWritten += nBytes;

        // Report progress
        UpdateProgress();
    }

    return SCRUB_OK;
}
STDMETHODIMP CMktStructureBaseDlg::OnError(PP::ErrorNumberEnum ErrorNumber, BSTR Description, PP::RequestsTypeEnum ReqType, VARIANT Request)
{
	HRESULT hr = S_OK;
	
	DoEvents();
	if(m_bCanceled) return S_OK;

	CString strError;
	_bstr_t bstrSymbol;
	
	USES_CONVERSION;
	
	switch (ErrorNumber)
	{
	case PP::enSymbolNotSupported:
	case PP::enNoDataAvailableForSymbol:
	case PP::enNoAccessForData:
		{
			if ( (Request.vt & VT_RECORD) == VT_RECORD )
			{
				if (ReqType == PP::enRequestStock )
				{
					PP::StockParams * pParams = (PP::StockParams *) Request.pvRecord;
					bstrSymbol =  pParams->Stock;
				}
				else
				{
					PP::OptionParams * pParams = (PP::OptionParams *) Request.pvRecord;
					bstrSymbol =  pParams->UnderlyingSymbol;
				}
				
				stocks_map::iterator it =  m_stocks.find ( bstrSymbol);
				if (it != m_stocks.end())
				{
					CContractRequestData & data = it->second;
					if (! data.m_bError)
					{
						it->second.m_bGotData = true;
						it->second.m_bGotYield = true;
						it->second.m_bError = true;

						strError.Format (IDS_MKTSTRUCTURE_ERR_GETDATA, (LPCTSTR)bstrSymbol, (LPCTSTR) CString (Description) );
						StatusMessage (strError);

						UpdateProgress(it); 
					}
				}
			}
		}
		return hr;
	default:
		strError.Format (IDS_MKTSTRUCTURE_ERROR, OLE2T(Description) );
		StatusMessage (strError);
		Stop();
	}
	return hr;
}
void QmitkDenoisingView::CreateConnections()
{
  if ( m_Controls )
  {
    connect( (QObject*)(m_Controls->m_ApplyButton), SIGNAL(clicked()), this, SLOT(StartDenoising()));
    connect( (QObject*)(m_Controls->m_SelectFilterComboBox), SIGNAL(activated(int)), this, SLOT(SelectFilter(int)));
    connect( m_DenoisingTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
  }
}
Exemple #20
0
static void CPROC video_position_update( uintptr_t psvPanel, uint64_t tick )
{
    struct media_control_panel *panel = ( struct media_control_panel *)psvPanel;
    panel->flags.setting_position = 1;
    SetSliderValues( panel->seek_slider, 0, tick / (100000), 10000 );  // 100.00%
    panel->flags.setting_position = 0;
    UpdateProgress( panel, tick / 100000 );

}
void FFeedbackContext::StatusForceUpdate( int32 Numerator, int32 Denominator, const FText& StatusText )
{
	ensure(IsInGameThread());

	if (LegacyAPIScopes.Num() != 0)
	{
		UpdateProgress(Numerator, Denominator);
		LegacyAPIScopes.Last()->FrameMessage = StatusText;
		UpdateUI();
	}
}
void UOnlineHotfixManager::OnReadFileProgress(const FString& FileName, uint64 BytesRead)
{
	if (PendingHotfixFiles.Contains(FileName))
	{
		// Since the title file is reporting absolute numbers subtract out the last update so we can add a delta
		uint64 Delta = BytesRead - PendingHotfixFiles[FileName].Progress;
		PendingHotfixFiles[FileName].Progress = BytesRead;
		// Completion updates the file count and progress updates the byte count
		UpdateProgress(0, Delta);
	}
}
void
avtLineScanQuery::Execute(vtkDataSet *ds, const int chunk)
{
    if (ds->GetDataObjectType() != VTK_POLY_DATA)
    {
        EXCEPTION0(ImproperUseException);
    }

    int extraMsg = 100;
    int totalProg = totalNodes * extraMsg;
    UpdateProgress(extraMsg*currentNode, totalProg);

    vtkPolyData *pd = (vtkPolyData *) ds;
    vtkPolyData *cleaned = MergeSegmentPoints(pd, "avtLineID", 1e-7);

    UpdateProgress(extraMsg*currentNode+extraMsg/3, totalProg);

    ExecuteLineScan(cleaned);

    cleaned->Delete();
}
Exemple #24
0
static NTSTATUS
Fat12WriteBootSector(IN HANDLE FileHandle,
                     IN PFAT16_BOOT_SECTOR BootSector,
                     IN OUT PFORMAT_CONTEXT Context)
{
    IO_STATUS_BLOCK IoStatusBlock;
    NTSTATUS Status;
    PFAT16_BOOT_SECTOR NewBootSector;
    LARGE_INTEGER FileOffset;

    /* Allocate buffer for new bootsector */
    NewBootSector = (PFAT16_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap (),
                                            0,
                                            BootSector->BytesPerSector);
    if (NewBootSector == NULL)
        return STATUS_INSUFFICIENT_RESOURCES;

    /* Zero the new bootsector */
    RtlZeroMemory(NewBootSector, BootSector->BytesPerSector);

    /* Copy FAT16 BPB to new bootsector */
    memcpy(&NewBootSector->OEMName[0],
           &BootSector->OEMName[0],
           FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, OEMName));
           /* FAT16 BPB length (up to (not including) Res2) */

    /* Write the boot sector signature */
    NewBootSector->Signature1 = 0xAA550000;

    /* Write sector 0 */
    FileOffset.QuadPart = 0ULL;
    Status = NtWriteFile(FileHandle,
                         NULL,
                         NULL,
                         NULL,
                         &IoStatusBlock,
                         NewBootSector,
                         BootSector->BytesPerSector,
                         &FileOffset,
                         NULL);
    if (!NT_SUCCESS(Status))
    {
        DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
        goto done;
    }

    UpdateProgress(Context, 1);

done:
    /* Free the buffer */
    RtlFreeHeap(RtlGetProcessHeap(), 0, NewBootSector);
    return Status;
}
// ****************************************************************************
//  Method: avtTwoPassDatasetQuery::Execute
//
//  Purpose:
//    Recursive method to traverse an avtDataTree, calling Execute on the leaf
//    nodes. 
//
//  Notes:  Started as a direct copy of Execute() method of
//          avtDatasetQuery, added extensions for two passes
//
//  Programmer: Jeremy Meredith
//  Creation:   April 16, 2003
//
//  Modifications:
//    Kathleen Bonnell, Wed May 17 15:22:06 PDT 2006
//    Remove call to SetSource(NULL) as it now removes information necessary
//    for the dataset.
//
// ****************************************************************************
void
avtTwoPassDatasetQuery::ExecuteNthPass(avtDataTree_p inDT, int pass)
{
    if (*inDT == NULL)
    {
        return;
    }
 
    int nc = inDT->GetNChildren();
 
    if (nc <= 0 && !inDT->HasData())
    {
        return;
    }
 
    if ( nc == 0 )
    {
        //
        // There is only one dataset to process.
        //
        vtkDataSet *in_ds = inDT->GetDataRepresentation().GetDataVTK();
        int dom = inDT->GetDataRepresentation().GetDomain();
 
        //
        // Setting the source to NULL for the input will break the
        // pipeline.
        //
        //in_ds->SetSource(NULL);

        if (pass==1)
            Execute1(in_ds, dom);
        if (pass==2)
            Execute2(in_ds, dom);

        currentNode++;
        UpdateProgress(currentNode, totalNodes);
    }
    else
    {
        //
        // There is more than one input dataset to process.
        // Recurse through the children.
        //
        for (int j = 0; j < nc; j++)
        {
            if (inDT->ChildIsPresent(j))
            {
                ExecuteNthPass(inDT->GetChild(j), pass);
            }
        }
    }
}
Exemple #26
0
static NTSTATUS
Fat32WriteFsInfo(IN HANDLE FileHandle,
                 IN PFAT32_BOOT_SECTOR BootSector,
                 IN OUT PFORMAT_CONTEXT Context)
{
    IO_STATUS_BLOCK IoStatusBlock;
    NTSTATUS Status;
    PFAT32_FSINFO FsInfo;
    LARGE_INTEGER FileOffset;

    /* Allocate buffer for new sector */
    FsInfo = (PFAT32_FSINFO)RtlAllocateHeap(RtlGetProcessHeap(),
                                            0,
                                            BootSector->BytesPerSector);
    if (FsInfo == NULL)
        return STATUS_INSUFFICIENT_RESOURCES;

    /* Zero the new sector */
    memset(FsInfo, 0, BootSector->BytesPerSector);

    FsInfo->LeadSig = 0x41615252;
    FsInfo->StrucSig = 0x61417272;
    FsInfo->FreeCount = 0xffffffff;
    FsInfo->NextFree = 0xffffffff;
    FsInfo->TrailSig = 0xaa550000;

    /* Write sector */
    FileOffset.QuadPart = BootSector->FSInfoSector * BootSector->BytesPerSector;
    Status = NtWriteFile(FileHandle,
                         NULL,
                         NULL,
                         NULL,
                         &IoStatusBlock,
                         FsInfo,
                         BootSector->BytesPerSector,
                         &FileOffset,
                         NULL);
    if (!NT_SUCCESS(Status))
    {
        DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
        RtlFreeHeap(RtlGetProcessHeap(), 0, FsInfo);
        return Status;
    }

    UpdateProgress(Context, 1);

    /* Free the new sector buffer */
    RtlFreeHeap(RtlGetProcessHeap(), 0, FsInfo);

    return Status;
}
Exemple #27
0
void Pipeline::BuildAtlasStage(QHash<QString,ImageList> images, Task* task)
{
	for(const QString& resolution : images.keys())
	{
		int width = task->atlasParams.sizes[resolution].width();
		int height = task->atlasParams.sizes[resolution].height();

		if(!MathUtils::IsPowerOfTwo(width) || !MathUtils::IsPowerOfTwo(height))
		{
			QString error = ERROR_MASK.arg(task->name).arg("Sizes of atlas for resolution \"%1\" must be power of two");
			errors.push_back(error.arg(resolution));
			return;
		}

		QPair<QImage,QJsonObject> atlas = atlasBuilder.Run(images[resolution], width, height,
			task->outputFormat, task->atlasParams);

		// Save atlas image
		QString imageFilename = MakeFilename(task->atlasParams.name, resolution, ExtensionForFormat(task->outputFormat));
		if(!SaveImage(atlas.first, task->outputDir, imageFilename, task->outputFormat))
		{
			errors.push_back(ERROR_MASK.arg(task->name).arg(ERROR_SAVE_MASK.arg(imageFilename)));
			return;
		}

		// Save atlas json description
		QDir outputDir(task->outputDir);
		QString filename = MakeFilename(task->atlasParams.name, resolution, "atlas");
		QFile file(outputDir.absoluteFilePath(filename));
		if(!file.open(QIODevice::WriteOnly))
		{
			errors.push_back(ERROR_MASK.arg(task->name).arg(ERROR_SAVE_MASK.arg(filename)));
			return;
		}

		QJsonDocument doc(atlas.second);
		file.write(doc.toJson());

		auto atlasErrors = atlasBuilder.GetErrors();
		if(!atlasErrors.empty())
		{
			for(auto& error : atlasErrors)
			{
				QString resError = QString("%1 for \"%2\" resolution").arg(error).arg(resolution);
				errors.push_back(ERROR_MASK.arg(task->name).arg(resError));
			}
		}

		UpdateProgress();
	}
}
void
avtLineScanQuery::ExecuteTree(avtDataTree_p inDT)
{
    if (*inDT == NULL)
    {
        return;
    }

    int nc = inDT->GetNChildren();

    if (nc <= 0 && !inDT->HasData())
    {
        return;
    }

    if ( nc == 0 )
    {
        //
        // There is only one dataset to process.
        //
        vtkDataSet *in_ds = inDT->GetDataRepresentation().GetDataVTK();
        int dom = inDT->GetDataRepresentation().GetDomain();

        //
        // Setting the source to NULL for the input will break the
        // pipeline.
        //
        // NO LONGER A GOOD IDEA
        //in_ds->SetSource(NULL);
        Execute(in_ds, dom);
        if (!timeVarying)
        {
            currentNode++;
            UpdateProgress(currentNode, totalNodes);
        }
    }
    else
    {
        //
        // There is more than one input dataset to process.
        // Recurse through the children.
        //
        for (int j = 0; j < nc; j++)
        {
            if (inDT->ChildIsPresent(j))
            {
                Execute(inDT->GetChild(j));
            }
        }
    }
}
ProjectCodeStats CodeStatExecDlg::ParseProject(int index, ParsedFileNamesSet *parsedFileNames)
{
    ProjectCodeStats stat;
    cbProject* project = Manager::Get()->GetProjectManager()->GetProjects()->Item(index - 1);
    stat.numFiles = project->GetFilesCount();

    for (int i = 0 ; i < stat.numFiles; ++i)
    {
        ProjectFile* pf = project->GetFile(i);
        wxFileName filename(pf->file.GetFullPath(), wxPATH_DOS);

        if (parsedFileNames)
        {
            if (parsedFileNames->find(filename.GetFullPath())==parsedFileNames->end())
                parsedFileNames->insert(filename.GetFullPath());
            else
                continue;
        }

        if (!filename.FileExists())
            ++stat.numFilesNotFound;
        else
        {
            // Find the language associated to the file extension
            int language = -1;
            for (int l = 0; l < m_numLanguages; ++l)
            {
                for (int j = 0; j < (int)m_languages[l].ext.Count(); ++j)
                {
                    if (filename.GetExt() == m_languages[l].ext[j])
                    {
                        language = l;
                        break;
                    }
                }
            }

            // If the language is found, analyse the source file
            if (language > -1)
                CountLines(stat, filename, m_languages[language]);
            else
                ++stat.numSkippedFiles;
        }
        if (stat.numFiles > 1)
        {
            ++m_currentFile;
            UpdateProgress();
        }
    }
    return stat;
}
Exemple #30
0
void SaveThread::run()
{
    bool cachesessions=PROFILE.session->cacheSessions();

    while (Session *sess=machine->popSaveList()) {
        int i=(float(machine->savelistCnt)/float(machine->savelistSize)*100.0);
        emit UpdateProgress(i);
        sess->UpdateSummaries();
        sess->Store(path);
        if (!cachesessions)
            sess->TrashEvents();
    }
    machine->savelistSem->release(1);
}