Merge pull request #70 from lioncash/fifo-unsigned

Kill off some casting in the FifoPlayer.
This commit is contained in:
Matthew Parlane 2014-02-15 20:42:15 +13:00
commit 48798d8d34
5 changed files with 15 additions and 15 deletions

View File

@ -64,8 +64,8 @@ public:
u32 *GetXFRegs() { return m_XFRegs; }
void AddFrame(const FifoFrameInfo &frameInfo);
const FifoFrameInfo &GetFrame(int frame) const { return m_Frames[frame]; }
int GetFrameCount() { return (int)m_Frames.size(); }
const FifoFrameInfo &GetFrame(size_t frame) const { return m_Frames[frame]; }
size_t GetFrameCount() { return m_Frames.size(); }
bool Save(const char *filename);

View File

@ -49,7 +49,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
frameInfo.clear();
frameInfo.resize(file->GetFrameCount());
for (int frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
for (size_t frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
{
const FifoFrameInfo& frame = file->GetFrame(frameIdx);
AnalyzedFrameInfo& analyzed = frameInfo[frameIdx];

View File

@ -260,7 +260,7 @@ void FifoPlayer::WriteAllMemoryUpdates()
{
_assert_(m_File);
for (int frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
for (size_t frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
{
const FifoFrameInfo &frame = m_File->GetFrame(frameNum);
for (auto& update : frame.memoryUpdates)

View File

@ -845,12 +845,12 @@ void FifoPlayerDlg::UpdateAnalyzerGui()
FifoPlayer &player = FifoPlayer::GetInstance();
FifoDataFile* file = player.GetFile();
int num_frames = (file) ? player.GetFile()->GetFrameCount() : 0;
if ((int)m_framesList->GetCount() != num_frames)
size_t num_frames = (file) ? player.GetFile()->GetFrameCount() : 0U;
if (m_framesList->GetCount() != num_frames)
{
m_framesList->Clear();
for (int i = 0; i < num_frames; ++i)
for (size_t i = 0; i < num_frames; ++i)
{
m_framesList->Append(wxString::Format(wxT("Frame %i"), i));
}
@ -897,8 +897,8 @@ wxString FifoPlayerDlg::CreateRecordingFifoSizeLabel() const
if (file)
{
int fifoBytes = 0;
for (int i = 0; i < file->GetFrameCount(); ++i)
size_t fifoBytes = 0;
for (size_t i = 0; i < file->GetFrameCount(); ++i)
fifoBytes += file->GetFrame(i).fifoDataSize;
return CreateIntegerLabel(fifoBytes, _("FIFO Byte"));
@ -913,8 +913,8 @@ wxString FifoPlayerDlg::CreateRecordingMemSizeLabel() const
if (file)
{
int memBytes = 0;
for (int frameNum = 0; frameNum < file->GetFrameCount(); ++frameNum)
size_t memBytes = 0;
for (size_t frameNum = 0; frameNum < file->GetFrameCount(); ++frameNum)
{
const vector<MemoryUpdate>& memUpdates = file->GetFrame(frameNum).memoryUpdates;
for (auto& memUpdate : memUpdates)
@ -933,20 +933,20 @@ wxString FifoPlayerDlg::CreateRecordingFrameCountLabel() const
if (file)
{
int numFrames = file->GetFrameCount();
size_t numFrames = file->GetFrameCount();
return CreateIntegerLabel(numFrames, _("Frame"));
}
return wxEmptyString;
}
wxString FifoPlayerDlg::CreateIntegerLabel(int size, const wxString& label) const
wxString FifoPlayerDlg::CreateIntegerLabel(size_t size, const wxString& label) const
{
wxString postfix;
if (size != 1)
postfix = _("s");
return wxString::Format(wxT("%i"), size) + wxT(" ") + label + postfix;
return wxString::Format(wxT("%u"), size) + wxT(" ") + label + postfix;
}
bool FifoPlayerDlg::GetSaveButtonEnabled() const

View File

@ -56,7 +56,7 @@ private:
wxString CreateRecordingFifoSizeLabel() const;
wxString CreateRecordingMemSizeLabel() const;
wxString CreateRecordingFrameCountLabel() const;
wxString CreateIntegerLabel(int size, const wxString& label) const;
wxString CreateIntegerLabel(size_t size, const wxString& label) const;
bool GetSaveButtonEnabled() const;