From 8caf4b5aaf91b5ffabc65d2ac2f000d8603ba233 Mon Sep 17 00:00:00 2001 From: Underground78 Date: Wed, 10 Aug 2011 20:08:23 +0000 Subject: Fix ~130 C4018 warnings (signed/unsigned mismatch). Patch partially by XhmikosR. git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@3637 10f7b99b-c216-0410-bff0-8a66a9350fd8 --- src/Subtitles/GFN.cpp | 2 +- src/Subtitles/RTS.cpp | 38 ++++++++++++++++++------------------- src/Subtitles/Rasterizer.cpp | 1 + src/Subtitles/STS.cpp | 22 ++++++++++----------- src/Subtitles/TextFile.cpp | 4 ++-- src/Subtitles/USFSubtitles.cpp | 2 +- src/Subtitles/VobSubFile.cpp | 20 +++++++++---------- src/Subtitles/VobSubFileRipper.cpp | 22 ++++++++++----------- src/Subtitles/VobSubImage.cpp | 2 +- src/Subtitles/libssf/Rasterizer.cpp | 6 +++--- 10 files changed, 60 insertions(+), 59 deletions(-) (limited to 'src/Subtitles') diff --git a/src/Subtitles/GFN.cpp b/src/Subtitles/GFN.cpp index 8c34e69b3..4b3e8408b 100644 --- a/src/Subtitles/GFN.cpp +++ b/src/Subtitles/GFN.cpp @@ -94,7 +94,7 @@ void GetSubFileNames(CString fn, CAtlArray& paths, CAtlArray& WIN32_FIND_DATA wfd, wfd2; HANDLE hFile, hFile2; - for(ptrdiff_t k = 0; k < paths.GetCount(); k++) { + for(size_t k = 0; k < paths.GetCount(); k++) { CString path = paths[k]; path.Replace('\\', '/'); diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index 871ef9cc1..3b8ada52f 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -251,7 +251,7 @@ void CWord::Transform_C( CPoint &org ) } #endif - for(ptrdiff_t i = 0; i < mPathPoints; i++) { + for (size_t i = 0; i < mPathPoints; i++) { double x, y, z, xx, yy, zz; x = mpPathPoints[i].x; @@ -841,20 +841,20 @@ bool CPolygon::ParseStr() int minx = INT_MAX, miny = INT_MAX, maxx = -INT_MAX, maxy = -INT_MAX; - for(i = 0; i < m_pathTypesOrg.GetCount(); i++) { - m_pathPointsOrg[i].x = (int)(64 * m_scalex * m_pathPointsOrg[i].x); - m_pathPointsOrg[i].y = (int)(64 * m_scaley * m_pathPointsOrg[i].y); - if(minx > m_pathPointsOrg[i].x) { - minx = m_pathPointsOrg[i].x; + for (size_t k = 0; k < m_pathTypesOrg.GetCount(); k++) { + m_pathPointsOrg[k].x = (int)(64 * m_scalex * m_pathPointsOrg[k].x); + m_pathPointsOrg[k].y = (int)(64 * m_scaley * m_pathPointsOrg[k].y); + if (minx > m_pathPointsOrg[k].x) { + minx = m_pathPointsOrg[k].x; } - if(miny > m_pathPointsOrg[i].y) { - miny = m_pathPointsOrg[i].y; + if (miny > m_pathPointsOrg[k].y) { + miny = m_pathPointsOrg[k].y; } - if(maxx < m_pathPointsOrg[i].x) { - maxx = m_pathPointsOrg[i].x; + if (maxx < m_pathPointsOrg[k].x) { + maxx = m_pathPointsOrg[k].x; } - if(maxy < m_pathPointsOrg[i].y) { - maxy = m_pathPointsOrg[i].y; + if (maxy < m_pathPointsOrg[k].y) { + maxy = m_pathPointsOrg[k].y; } } @@ -869,7 +869,7 @@ bool CPolygon::ParseStr() m_ascent = ((int)(m_style.fontScaleY/100 * m_ascent) + 4) >> 3; m_descent = ((int)(m_style.fontScaleY/100 * m_descent) + 4) >> 3; - return(true); + return true; } bool CPolygon::CreatePath() @@ -1642,23 +1642,23 @@ void CScreenLayoutAllocator::Empty() void CScreenLayoutAllocator::AdvanceToSegment(int segment, const CAtlArray& sa) { POSITION pos = m_subrects.GetHeadPosition(); - while(pos) { + while (pos) { POSITION prev = pos; SubRect& sr = m_subrects.GetNext(pos); bool fFound = false; - if(abs(sr.segment - segment) <= 1) { // using abs() makes it possible to play the subs backwards, too :) - for(ptrdiff_t i = 0; i < sa.GetCount() && !fFound; i++) { - if(sa[i] == sr.entry) { + if (abs(sr.segment - segment) <= 1) { // using abs() makes it possible to play the subs backwards, too :) + for (size_t i = 0; i < sa.GetCount() && !fFound; i++) { + if (sa[i] == sr.entry) { sr.segment = segment; fFound = true; } } } - if(!fFound) { + if (!fFound) { m_subrects.RemoveAt(prev); } } @@ -2951,7 +2951,7 @@ bool CRenderedTextSubtitle::ParseHtmlTag(CSubtitle* sub, CStringW str, STSStyle& style.fStrikeOut = !fClosing ? true : org.fStrikeOut; } else if(tag == L"font") { if(!fClosing) { - for(i = 0; i < attribs.GetCount(); i++) { + for(size_t i = 0; i < attribs.GetCount(); i++) { if(params[i].IsEmpty()) { continue; } diff --git a/src/Subtitles/Rasterizer.cpp b/src/Subtitles/Rasterizer.cpp index 712c5cbd7..da585a492 100644 --- a/src/Subtitles/Rasterizer.cpp +++ b/src/Subtitles/Rasterizer.cpp @@ -1388,6 +1388,7 @@ void Rasterizer::Draw_Alpha_sp_noBody_sse2(RasterizerNfo& rnfo) int gran = min(rnfo.sw[3]+1-rnfo.xo,rnfo.w); int color2 = rnfo.sw[2]; UNUSED_ALWAYS(color2); + while(h--) { #ifdef _VSMOD // patch m006. moveable vector clip for(int wt=0; wt= s.end) { @@ -2249,7 +2249,7 @@ void CSimpleTextSubtitle::ChangeUnknownStylesToDefault() CAtlMap > unknown; bool fReport = true; - for(ptrdiff_t i = 0; i < GetCount(); i++) { + for(size_t i = 0; i < GetCount(); i++) { STSEntry& stse = GetAt(i); STSStyle* val; @@ -2483,13 +2483,13 @@ const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ i } } - if(0 <= ret && ret < m_segments.GetCount()) { + if(0 <= ret && (size_t)ret < m_segments.GetCount()) { if(iSegment) { *iSegment = ret; } } - if(0 <= ret && ret < m_segments.GetCount() + if(0 <= ret && (size_t)ret < m_segments.GetCount() && m_segments[ret].subs.GetCount() > 0 && TranslateSegmentStart(ret, fps) <= t && t < TranslateSegmentEnd(ret, fps)) { return(&m_segments[ret]); @@ -2500,7 +2500,7 @@ const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ i int CSimpleTextSubtitle::TranslateStart(int i, double fps) { - return(i < 0 || GetCount() <= i ? -1 : + return(i < 0 || GetCount() <= (size_t)i ? -1 : m_mode == TIME ? GetAt(i).start : m_mode == FRAME ? (int)(GetAt(i).start*1000/fps) : 0); @@ -2508,7 +2508,7 @@ int CSimpleTextSubtitle::TranslateStart(int i, double fps) int CSimpleTextSubtitle::TranslateEnd(int i, double fps) { - return(i < 0 || GetCount() <= i ? -1 : + return(i < 0 || GetCount() <= (size_t)i ? -1 : m_mode == TIME ? GetAt(i).end : m_mode == FRAME ? (int)(GetAt(i).end*1000/fps) : 0); @@ -2516,7 +2516,7 @@ int CSimpleTextSubtitle::TranslateEnd(int i, double fps) int CSimpleTextSubtitle::TranslateSegmentStart(int i, double fps) { - return(i < 0 || m_segments.GetCount() <= i ? -1 : + return(i < 0 || m_segments.GetCount() <= (size_t)i ? -1 : m_mode == TIME ? m_segments[i].start : m_mode == FRAME ? (int)(m_segments[i].start*1000/fps) : 0); @@ -2524,7 +2524,7 @@ int CSimpleTextSubtitle::TranslateSegmentStart(int i, double fps) int CSimpleTextSubtitle::TranslateSegmentEnd(int i, double fps) { - return(i < 0 || m_segments.GetCount() <= i ? -1 : + return(i < 0 || m_segments.GetCount() <= (size_t)i ? -1 : m_mode == TIME ? m_segments[i].end : m_mode == FRAME ? (int)(m_segments[i].end*1000/fps) : 0); @@ -2700,7 +2700,7 @@ void CSimpleTextSubtitle::CreateSegments() { m_segments.RemoveAll(); - int i, j; + size_t i, j; CAtlArray breakpoints; diff --git a/src/Subtitles/TextFile.cpp b/src/Subtitles/TextFile.cpp index 2a64547a8..fe85256b7 100644 --- a/src/Subtitles/TextFile.cpp +++ b/src/Subtitles/TextFile.cpp @@ -187,7 +187,7 @@ void CTextFile::WriteString(LPCWSTR lpsz/*CStringW str*/) Write((LPCSTR)stra, stra.GetLength()); } else if(m_encoding == UTF8) { str.Replace(L"\n", L"\r\n"); - for(size_t i = 0; i < str.GetLength(); i++) { + for(int i = 0; i < str.GetLength(); i++) { DWORD c = (WORD)str[i]; if(0 <= c && c < 0x80) { // 0xxxxxxx @@ -211,7 +211,7 @@ void CTextFile::WriteString(LPCWSTR lpsz/*CStringW str*/) Write((LPCWSTR)str, str.GetLength()*2); } else if(m_encoding == BE16) { str.Replace(L"\n", L"\r\n"); - for(size_t i = 0; i < str.GetLength(); i++) { + for(int i = 0; i < str.GetLength(); i++) { str.SetAt(i, ((str[i]>>8)&0x00ff)|((str[i]<<8)&0xff00)); } Write((LPCWSTR)str, str.GetLength()*2); diff --git a/src/Subtitles/USFSubtitles.cpp b/src/Subtitles/USFSubtitles.cpp index f50de280c..1ebefa9be 100644 --- a/src/Subtitles/USFSubtitles.cpp +++ b/src/Subtitles/USFSubtitles.cpp @@ -64,7 +64,7 @@ static CStringW GetXML(CComPtr pNode) CStringW str(bstr); str.Remove('\r'); str.Replace('\n', ' '); - for(size_t i = 0; (i = str.Find(L" ", i)) >= 0; ) { + for(int i = 0; (i = str.Find(L" ", i)) >= 0; ) { for(++i; i < str.GetLength() && (str[i] == ' ');) { str.Delete(i); } diff --git a/src/Subtitles/VobSubFile.cpp b/src/Subtitles/VobSubFile.cpp index cdd3a480d..e5b28e2b8 100644 --- a/src/Subtitles/VobSubFile.cpp +++ b/src/Subtitles/VobSubFile.cpp @@ -237,7 +237,7 @@ bool CVobSubFile::Copy(CVobSubFile& vsf) dst.name = src.name; dst.alt = src.alt; - for(ptrdiff_t j = 0; j < src.subpos.GetCount(); j++) { + for(size_t j = 0; j < src.subpos.GetCount(); j++) { SubPos& sp = src.subpos[j]; if(!sp.fValid) { continue; @@ -320,7 +320,7 @@ bool CVobSubFile::Open(CString fn) for(ptrdiff_t i = 0; i < 32; i++) { CAtlArray& sp = m_langs[i].subpos; - for(ptrdiff_t j = 0; j < sp.GetCount(); j++) { + for(size_t j = 0; j < sp.GetCount(); j++) { sp[j].stop = sp[j].start; sp[j].fForced = false; @@ -1031,7 +1031,7 @@ bool CVobSubFile::WriteIdx(CString fn) char vobid = -1, cellid = -1; - for(ptrdiff_t j = 0; j < sp.GetCount(); j++) { + for(size_t j = 0; j < sp.GetCount(); j++) { if(!sp[j].fValid) { continue; } @@ -1093,7 +1093,7 @@ BYTE* CVobSubFile::GetPacket(int idx, int& packetsize, int& datasize, int iLang) CAtlArray& sp = m_langs[iLang].subpos; do { - if(idx < 0 || idx >= sp.GetCount()) { + if(idx < 0 || (size_t)idx >= sp.GetCount()) { break; } @@ -1156,7 +1156,7 @@ bool CVobSubFile::GetFrame(int idx, int iLang) } CAtlArray& sp = m_langs[iLang].subpos; - if(idx < 0 || idx >= sp.GetCount()) { + if(idx < 0 || (size_t)idx >= sp.GetCount()) { return(false); } @@ -1169,13 +1169,13 @@ bool CVobSubFile::GetFrame(int idx, int iLang) } m_img.start = sp[idx].start; - m_img.delay = idx < (sp.GetCount()-1) + m_img.delay = (size_t)idx < (sp.GetCount()-1) ? sp[idx+1].start - sp[idx].start : 3000; bool ret = m_img.Decode(buff, packetsize, datasize, m_fCustomPal, m_tridx, m_orgpal, m_cuspal, true); - if(idx < (sp.GetCount()-1)) { + if((size_t)idx < (sp.GetCount()-1)) { m_img.delay = min(m_img.delay, sp[idx+1].start - m_img.start); } @@ -1685,7 +1685,7 @@ bool CVobSubFile::SaveWinSubMux(CString fn) } CAtlArray& sp = m_langs[m_iLang].subpos; - for(ptrdiff_t i = 0; i < sp.GetCount(); i++) { + for(size_t i = 0; i < sp.GetCount(); i++) { if(!GetFrame(i)) { continue; } @@ -1920,7 +1920,7 @@ bool CVobSubFile::SaveScenarist(CString fn) int pc[4] = {1, 1, 1, 1}, pa[4] = {15, 15, 15, 0}; CAtlArray& sp = m_langs[m_iLang].subpos; - for(ptrdiff_t i = 0, k = 0; i < sp.GetCount(); i++) { + for(size_t i = 0, k = 0; i < sp.GetCount(); i++) { if(!GetFrame(i)) { continue; } @@ -2150,7 +2150,7 @@ bool CVobSubFile::SaveMaestro(CString fn) int pc[4] = {1,1,1,1}, pa[4] = {15,15,15,0}; CAtlArray& sp = m_langs[m_iLang].subpos; - for(ptrdiff_t i = 0, k = 0; i < sp.GetCount(); i++) { + for(size_t i = 0, k = 0; i < sp.GetCount(); i++) { if(!GetFrame(i)) { continue; } diff --git a/src/Subtitles/VobSubFileRipper.cpp b/src/Subtitles/VobSubFileRipper.cpp index 86fde3f8d..39505c4de 100644 --- a/src/Subtitles/VobSubFileRipper.cpp +++ b/src/Subtitles/VobSubFileRipper.cpp @@ -522,7 +522,7 @@ bool CVobSubFileRipper::Create() { CAutoLock cAutoLock(&m_csAccessLock); - if(m_rd.iSelPGC < 0 || m_rd.iSelPGC >= m_rd.pgcs.GetCount()) { + if(m_rd.iSelPGC < 0 || (size_t)m_rd.iSelPGC >= m_rd.pgcs.GetCount()) { Log(LOG_ERROR, _T("Invalid program chain number (%d)!"), m_rd.iSelPGC); return(false); } @@ -578,7 +578,7 @@ bool CVobSubFileRipper::Create() CAtlMap selvcmap; selvcmap.RemoveAll(); - for(ptrdiff_t i = 0; i < m_rd.selvcs.GetCount(); i++) { + for(size_t i = 0; i < m_rd.selvcs.GetCount(); i++) { selvcmap[m_rd.selvcs[i]] = 90000; } @@ -587,7 +587,7 @@ bool CVobSubFileRipper::Create() if(m_vob.IsDVD()) { Log(LOG_INFO, _T("Indexing mode: DVD")); - for(ptrdiff_t i = 0; i < angle.GetCount(); i++) { + for(size_t i = 0; i < angle.GetCount(); i++) { DWORD vc = (angle[i].vob<<16)|angle[i].cell; if(!selvcmap.Lookup(vc)) { continue; @@ -602,7 +602,7 @@ bool CVobSubFileRipper::Create() } else if(LoadChunks(loadedchunks)) { Log(LOG_INFO, _T("Indexing mode: File")); - for(ptrdiff_t i = 0; i < loadedchunks.GetCount(); i++) { + for(size_t i = 0; i < loadedchunks.GetCount(); i++) { DWORD vcid = loadedchunks[i].vc; if(!selvcmap.Lookup(vcid)) { continue; @@ -621,11 +621,11 @@ bool CVobSubFileRipper::Create() } __int64 sizedone = 0, sizetotal = 0; - for(ptrdiff_t i = 0; i < chunks.GetCount(); i++) { + for(size_t i = 0; i < chunks.GetCount(); i++) { sizetotal += chunks[i].end - chunks[i].start; } - for(ptrdiff_t i = 0; !m_fBreakThread && i < chunks.GetCount(); i++) { + for(size_t i = 0; !m_fBreakThread && i < chunks.GetCount(); i++) { __int64 curpos = chunks[i].start, endpos = chunks[i].end; vcchunk curchunk = {curpos, curpos, chunks[i].vc}; @@ -722,7 +722,7 @@ bool CVobSubFileRipper::Create() tOffset = tTotal = 0; - for(ptrdiff_t i = 0; i < angle.GetCount(); i++) { + for(size_t i = 0; i < angle.GetCount(); i++) { if(angle[i].vob == vob && angle[i].cell == cell) { tPrevOffset = tOffset; tOffset = (__int64)angle[i].tOffset; @@ -1003,7 +1003,7 @@ STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn) phase = P_PGC; } else if(phase == P_PGC) { m_rd.iSelPGC = _tcstol(line, NULL, 10)-1; - if(m_rd.iSelPGC < 0 || m_rd.iSelPGC >= m_rd.pgcs.GetCount()) { + if(m_rd.iSelPGC < 0 || (size_t)m_rd.iSelPGC >= m_rd.pgcs.GetCount()) { break; } phase = P_ANGLE; @@ -1028,7 +1028,7 @@ STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn) if(*s == 'v' || s == e-1) { s++; if(vob != 0 && cell == 0) { - for(ptrdiff_t i = 0; i < angle.GetCount(); i++) { + for(size_t i = 0; i < angle.GetCount(); i++) { if(angle[i].vob == vob) { m_rd.selvcs.Add((angle[i].vob<<16)|angle[i].cell); } @@ -1041,7 +1041,7 @@ STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn) s++; cell = _tcstol(s, &s, 10); - for(ptrdiff_t i = 0; i < angle.GetCount(); i++) { + for(size_t i = 0; i < angle.GetCount(); i++) { if(angle[i].vob == vob && angle[i].cell == cell) { m_rd.selvcs.Add((vob<<16)|cell); break; @@ -1052,7 +1052,7 @@ STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn) } } } else { - for(ptrdiff_t i = 0; i < angle.GetCount(); i++) { + for(size_t i = 0; i < angle.GetCount(); i++) { m_rd.selvcs.Add((angle[i].vob<<16)|angle[i].cell); } } diff --git a/src/Subtitles/VobSubImage.cpp b/src/Subtitles/VobSubImage.cpp index d8cea8327..4edcd2d85 100644 --- a/src/Subtitles/VobSubImage.cpp +++ b/src/Subtitles/VobSubImage.cpp @@ -1145,7 +1145,7 @@ bool CVobSubImage::Polygonize(CAtlArray& pathTypes, CAtlArray& pat pos = ol->GetHeadPosition(); while(pos) { CAtlArray& pa = ol->GetNext(pos)->pa; - for(ptrdiff_t i = 0; i < pa.GetCount(); i++) { + for(size_t i = 0; i < pa.GetCount(); i++) { pa[i].x = (pa[i].x-topleft.x)<> FONT_AA; int w = mOverlayWidth; int h = mOverlayHeight; - int xo = 0, yo = 0; + unsigned int xo = 0, yo = 0; if(x < r.left) { xo = r.left - x; @@ -691,7 +691,7 @@ namespace ssf const DWORD* sw = switchpts; if(fSSE2) - for(int wt=0; wt= sw[1]) { while(wt+xo >= sw[1]) { sw += 2; @@ -701,7 +701,7 @@ namespace ssf pixmix_sse2(&dst[wt], color, src[wt*4]); } else - for(int wt=0; wt= sw[1]) { while(wt+xo >= sw[1]) { sw += 2; -- cgit v1.2.3