diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-16 23:28:57 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-16 23:28:57 +0400 |
commit | e9e09d64fbc9c884e7e00f22bfa9de18b8748bb9 (patch) | |
tree | 1a147ec652bb6baef603d72fc6bb9129c416b38b /src/apps/mplayerc/PlayerSubresyncBar.cpp | |
parent | 3a990e7f323a3f68c286ad8b3395c681368ff46b (diff) |
Some warnings fixed (uninitialized local variable, unused local variable, comparison signed/unsigned type, assignment in if)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1886 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/PlayerSubresyncBar.cpp')
-rw-r--r-- | src/apps/mplayerc/PlayerSubresyncBar.cpp | 110 |
1 files changed, 59 insertions, 51 deletions
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index 03f3a0989..1beff5075 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -157,7 +157,8 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) m_list.SetFont(&m_font);
}
#endif
- for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++)
+ m_list.DeleteColumn(0);
m_list.InsertColumn(COL_START, _T("Time"), LVCFMT_LEFT, 90);
m_list.InsertColumn(COL_END, _T("End"), LVCFMT_LEFT, 4);
m_list.InsertColumn(COL_PREVSTART, _T("Preview"), LVCFMT_LEFT, 80);
@@ -202,7 +203,8 @@ void CPlayerSubresyncBar::ResetSubtitle() FormatTime(i, buff, 0, true);
m_list.SetItemText(i, COL_END, buff);
- if(prevstart > m_subtimes[i].orgstart) m_list.SetItemData(i, TSEP);
+ if(prevstart > m_subtimes[i].orgstart)
+ m_list.SetItemData(i, (DWORD_PTR)TSEP);
prevstart = m_subtimes[i].orgstart;
SetCheck(i, false, false);
@@ -313,14 +315,18 @@ void CPlayerSubresyncBar::UpdatePreview() m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
? m_subtimes[start].newend
: (m_subtimes[start].orgend + dt);
- }
+ }
}
else if(schk.GetCount() >= 2)
{
- int i0, i1, ti0, ds;
+ int i0 = 0;
+ int i1 = 0;
+ int ti0 = 0;
+ int ds = 0;
double m = 0;
- for(int k = 0, l = schk.GetCount()-1; k < l; k++)
+ int k, l;
+ for(k = 0, l = schk.GetCount()-1; k < l; k++)
{
i0 = schk[k];
i1 = schk[k+1];
@@ -328,54 +334,21 @@ void CPlayerSubresyncBar::UpdatePreview() ti0 = m_subtimes[i0].orgstart;
ds = m_subtimes[i1].orgstart - ti0;
- if(ds == 0)
- {
- for(; start < i1; start++)
- {
- m_sts[start].start = ti0;
- m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
- ? m_subtimes[start].newend
- : (ti0 + m_subtimes[start].orgend - m_subtimes[start].orgstart);
- }
- }
- else
- {
- m = double(m_subtimes[i1].newstart - m_subtimes[i0].newstart) / ds;
+ if (ds == 0)
+ SetSTS0(start, i1, ti0);
+ else
+ {
+ m = double(m_subtimes[i1].newstart - m_subtimes[i0].newstart) / ds;
+ SetSTS1(start, i1, ti0, m, i0);
+ }
- for(; start < i1; start++)
- {
- m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
- m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
- ? m_subtimes[start].newend
- : m_mode == VOBSUB
- ? (m_sts[start].start + m_subtimes[start].orgend - m_subtimes[start].orgstart)
- : (m_sts[start].start + int((m_subtimes[start].orgend - m_subtimes[start].orgstart)*m));
- }
- }
}
- if(ds == 0)
- {
- for(; start < end; start++)
- {
- m_sts[start].start = ti0;
- m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
- ? m_subtimes[start].newend
- : (ti0 + (m_subtimes[start].orgend - m_subtimes[start].orgstart));
- }
- }
- else
- {
- for(; start < end; start++)
- {
- m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
- m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
- ? m_subtimes[start].newend
- : m_mode == VOBSUB
- ? (m_sts[start].start + m_subtimes[start].orgend - m_subtimes[start].orgstart)
- : (m_sts[start].start + int((m_subtimes[start].orgend - m_subtimes[start].orgstart)*m));
- }
- }
+ ASSERT(k > 0);
+ if (ds == 0)
+ SetSTS0(start, end, ti0);
+ else
+ SetSTS1(start, end, ti0, m, i0);
}
i = end;
@@ -400,6 +373,40 @@ void CPlayerSubresyncBar::UpdatePreview() }
}
+void CPlayerSubresyncBar::SetSTS0( int &start, int end, int ti0 )
+{
+ for(; start < end; start++)
+ {
+ m_sts[start].start = ti0;
+ int endpos;
+ if (m_list.GetItemData(start)&TEMOD)
+ endpos = m_subtimes[start].newend;
+ else
+ endpos = ti0 + m_subtimes[start].orgend - m_subtimes[start].orgstart;
+ m_sts[start].end = endpos;
+ }
+}
+
+void CPlayerSubresyncBar::SetSTS1( int &start, int end, int ti0, double m, int i0 )
+{
+ for(; start < end; start++)
+ {
+ m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
+ int endpos;
+ if (m_list.GetItemData(start)&TEMOD)
+ endpos = m_subtimes[start].newend;
+ else
+ {
+ int diff = m_subtimes[start].orgend - m_subtimes[start].orgstart;
+ if (m_mode == VOBSUB)
+ endpos = m_sts[start].start + diff;
+ else
+ endpos = m_sts[start].start + int(diff*m);
+ }
+ m_sts[start].end = endpos;
+ }
+}
+
void CPlayerSubresyncBar::UpdateStrings()
{
CString str;
@@ -1159,7 +1166,8 @@ void CPlayerSubresyncBar::OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult) void CPlayerSubresyncBar::OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult)
{
- LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
+ LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
+ UNUSED_ALWAYS(pLVKeyDown);
*pResult = 0;
}
|