diff options
author | jonasno <jonasno@users.sourceforge.net> | 2011-05-04 04:23:05 +0400 |
---|---|---|
committer | jonasno <jonasno@users.sourceforge.net> | 2011-05-04 04:23:05 +0400 |
commit | f5509ca50a48d9293d57b0f06b9fc285a10d88c6 (patch) | |
tree | 582a7b3966f49237ec0457b320b68fff4c6c502e /src/filters/parser/AviSplitter | |
parent | e4afd17d2325f872c6b99d9b720e792a21c32057 (diff) |
Tiny code quality improvement
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@3072 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/AviSplitter')
-rw-r--r-- | src/filters/parser/AviSplitter/AviFile.cpp | 52 | ||||
-rw-r--r-- | src/filters/parser/AviSplitter/AviReportWnd.cpp | 14 | ||||
-rw-r--r-- | src/filters/parser/AviSplitter/AviSplitter.cpp | 16 |
3 files changed, 41 insertions, 41 deletions
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp index 9b51d9fb0..dee5ffc40 100644 --- a/src/filters/parser/AviSplitter/AviFile.cpp +++ b/src/filters/parser/AviSplitter/AviFile.cpp @@ -39,7 +39,7 @@ HRESULT CAviFile::Init() return E_FAIL;
}
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
if(s->strh.fccType != FCC('auds')) {
continue;
@@ -299,7 +299,7 @@ REFERENCE_TIME CAviFile::GetTotalTime() {
REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
t = max(t, t2);
@@ -318,7 +318,7 @@ HRESULT CAviFile::BuildIndex() DWORD nSuperIndexes = 0;
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
if(s->indx && s->indx->nEntriesInUse > 0) {
nSuperIndexes++;
@@ -326,14 +326,14 @@ HRESULT CAviFile::BuildIndex() }
if(nSuperIndexes == m_avih.dwStreams) {
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
DWORD nEntriesInUse = 0;
- for(int j = 0; j < (int)idx->nEntriesInUse; j++) {
+ for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
AVISTDINDEX stdidx;
@@ -350,7 +350,7 @@ HRESULT CAviFile::BuildIndex() DWORD frame = 0;
UINT64 size = 0;
- for(int j = 0; j < (int)idx->nEntriesInUse; j++) {
+ for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
@@ -359,7 +359,7 @@ HRESULT CAviFile::BuildIndex() return E_FAIL;
}
- for(int k = 0; k < (int)p->nEntriesInUse; k++) {
+ for(DWORD k = 0; k < p->nEntriesInUse; ++k) {
s->cs[frame].size = size;
s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
@@ -372,7 +372,7 @@ HRESULT CAviFile::BuildIndex() s->cs[frame].fChunkHdr = true;
}
- frame++;
+ ++frame;
size += s->GetChunkSize(p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK);
}
}
@@ -380,18 +380,18 @@ HRESULT CAviFile::BuildIndex() s->totalsize = size;
}
} else if(AVIOLDINDEX* idx = m_idx1) {
- int len = idx->cb/sizeof(idx->aIndex[0]);
+ DWORD len = idx->cb / sizeof(idx->aIndex[0]);
UINT64 offset = m_movis.GetHead() + 8;
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
- int nFrames = 0;
+ DWORD nFrames = 0;
- for(int j = 0; j < len; j++) {
+ for(DWORD j = 0; j < len; ++j) {
if(TRACKNUM(idx->aIndex[j].dwChunkId) == i) {
- nFrames++;
+ ++nFrames;
}
}
@@ -400,7 +400,7 @@ HRESULT CAviFile::BuildIndex() DWORD frame = 0;
UINT64 size = 0;
- for(int j = 0; j < len; j++) {
+ for(DWORD j = 0; j < len; ++j) {
DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
if(TrackNumber == i) {
@@ -422,7 +422,7 @@ HRESULT CAviFile::BuildIndex() s->cs[frame].fChunkHdr = j == len-1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
s->cs[frame].orgsize = idx->aIndex[j].dwSize;
- frame++;
+ ++frame;
size += s->GetChunkSize(idx->aIndex[j].dwSize);
}
}
@@ -432,7 +432,7 @@ HRESULT CAviFile::BuildIndex() }
m_idx1.Free();
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->indx.Free();
}
@@ -441,7 +441,7 @@ HRESULT CAviFile::BuildIndex() void CAviFile::EmptyIndex()
{
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
s->cs.RemoveAll();
s->totalsize = 0;
@@ -457,7 +457,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
return(true);
*/
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
}
@@ -473,8 +473,8 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) UINT64 fpmin = _I64_MAX;
DWORD n = (DWORD)-1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
- int curchunk = curchunks[i];
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ DWORD curchunk = curchunks[i];
CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
if(curchunk >= cs.GetCount()) {
continue;
@@ -501,7 +501,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) }
cursize = s->cs[curchunk].size;
- curchunk++;
+ ++curchunk;
}
memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
@@ -513,9 +513,9 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) while(fInterleaved) {
strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
- int n = -1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
- int curchunk = curchunks[i];
+ DWORD n = (DWORD)-1;
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ DWORD curchunk = curchunks[i];
if(curchunk >= m_strms[i]->cs2.GetCount()) {
continue;
}
@@ -529,7 +529,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) break;
}
- curchunks[n]++;
+ ++curchunks[n];
if(cs2last.t >= 0 && abs((int)cs2min.n - (int)cs2last.n) >= 1000) {
fInterleaved = false;
@@ -543,7 +543,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) if(fInterleaved && !fKeepInfo) {
// this is not needed anymore, let's save a little memory then
- for(int i = 0; i < (int)m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.RemoveAll();
}
}
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp index 18b2dc44f..d522ebbee 100644 --- a/src/filters/parser/AviSplitter/AviReportWnd.cpp +++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp @@ -15,7 +15,7 @@ bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningT m_nChunks = 0;
m_rtDur = 0;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
int cnt = pAF->m_strms[i]->cs2.GetCount();
if(cnt <= 0) {
continue;
@@ -232,8 +232,8 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
- for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy) {
- m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
+ for(DWORD i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < pAF->m_avih.dwStreams; ++i, y += dy) {
+ m_dc.SetTextColor(clr[i % pAF->m_avih.dwStreams]);
m_dc.SetBkMode(TRANSPARENT);
CString str;
str.Format(_T("Stream %d"), i);
@@ -242,7 +242,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) DWORD nmax = 0, tmax = 0;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++) {
+ for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
int cnt = pAF->m_strms[i]->cs2.GetCount();
if(cnt <= 0) {
continue;
@@ -276,9 +276,9 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) while(1) {
CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
- int n = -1;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++) {
- int curchunk = curchunks[i];
+ DWORD n = (DWORD)-1;
+ for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ DWORD curchunk = curchunks[i];
if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) {
continue;
}
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp index da1093520..3dd2c7052 100644 --- a/src/filters/parser/AviSplitter/AviSplitter.cpp +++ b/src/filters/parser/AviSplitter/AviSplitter.cpp @@ -359,7 +359,7 @@ bool CAviSplitterFilter::DemuxInit() bool fReIndex = false;
- for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++) {
+ for(DWORD i = 0; i < m_pFile->m_avih.dwStreams && !fReIndex; ++i) {
if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i)) {
fReIndex = true;
}
@@ -471,7 +471,7 @@ void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt) if(rt > 0) {
UINT64 minfp = _I64_MAX;
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++) {
+ for(size_t j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
int f = s->GetKeyFrame(rt);
@@ -482,10 +482,10 @@ void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt) }
}
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++) {
+ for(size_t j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
- for(int i = 0; i < s->cs.GetCount(); i++) {
+ for(size_t i = 0; i < s->cs.GetCount(); ++i) {
CAviFile::strm_t::chunk& c = s->cs[i];
if(c.filepos >= minfp) {
m_tFrame[j] = i;
@@ -502,17 +502,17 @@ bool CAviSplitterFilter::DemuxLoop() {
HRESULT hr = S_OK;
- int nTracks = (int)m_pFile->m_strms.GetCount();
+ size_t nTracks = m_pFile->m_strms.GetCount();
CAtlArray<BOOL> fDiscontinuity;
fDiscontinuity.SetCount(nTracks);
memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
- int minTrack = nTracks;
+ size_t minTrack = nTracks;
UINT64 minFilePos = _I64_MAX;
- for(int i = 0; i < nTracks; i++) {
+ for(size_t i = 0; i < nTracks; ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
DWORD f = m_tFrame[i];
@@ -605,7 +605,7 @@ STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration) CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
if(m_timeformat == TIME_FORMAT_FRAME) {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++) {
+ for(size_t i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
if(s->strh.fccType == FCC('vids')) {
*pDuration = s->cs.GetCount();
|