diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2015-03-01 17:38:59 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2015-03-02 01:19:08 +0300 |
commit | 3d4b2ddb05290322fb3b362d8e09b4e4ca2ba596 (patch) | |
tree | def662b40363aed26773cc83fee1ef93477a0c8c /src/Subtitles | |
parent | 0e9c363560faa6149327a09aa26135659ba9ba6a (diff) |
Suppress type mismatch warnings.
Diffstat (limited to 'src/Subtitles')
-rw-r--r-- | src/Subtitles/RTS.cpp | 8 | ||||
-rw-r--r-- | src/Subtitles/Rasterizer.cpp | 8 | ||||
-rw-r--r-- | src/Subtitles/STS.cpp | 14 | ||||
-rw-r--r-- | src/Subtitles/USFSubtitles.cpp | 4 | ||||
-rw-r--r-- | src/Subtitles/VobSubFile.cpp | 21 | ||||
-rw-r--r-- | src/Subtitles/VobSubFile.h | 2 | ||||
-rw-r--r-- | src/Subtitles/VobSubFileRipper.cpp | 10 | ||||
-rw-r--r-- | src/Subtitles/VobSubImage.cpp | 8 |
8 files changed, 39 insertions, 36 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index 284b1fcfe..e1e7a60e3 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -1333,7 +1333,7 @@ void CSubtitle::CreateClippers(CSize size) int k = std::min(width, w);
for (ptrdiff_t i = 0; i < k; i++, a += da) {
- am[i] = (am[i] * a) >> 14;
+ am[i] = BYTE((am[i] * a) >> 14);
}
a = 0x40 << 8;
@@ -1345,7 +1345,7 @@ void CSubtitle::CreateClippers(CSize size) }
for (ptrdiff_t i = k; i < w; i++, a -= da) {
- am[i] = (am[i] * a) >> 14;
+ am[i] = BYTE((am[i] * a) >> 14);
}
}
} else if (m_effects[EF_SCROLL] && m_effects[EF_SCROLL]->param[4]) {
@@ -1374,7 +1374,7 @@ void CSubtitle::CreateClippers(CSize size) for (ptrdiff_t j = k; j < l; j++, a += da) {
for (ptrdiff_t i = 0; i < w; i++, am++) {
- *am = ((*am) * a) >> 14;
+ *am = BYTE(((*am) * a) >> 14);
}
}
}
@@ -1397,7 +1397,7 @@ void CSubtitle::CreateClippers(CSize size) int j = k;
for (; j < l; j++, a += da) {
for (ptrdiff_t i = 0; i < w; i++, am++) {
- *am = ((*am) * a) >> 14;
+ *am = BYTE(((*am) * a) >> 14);
}
}
diff --git a/src/Subtitles/Rasterizer.cpp b/src/Subtitles/Rasterizer.cpp index 4f68ceba5..3ac3a770c 100644 --- a/src/Subtitles/Rasterizer.cpp +++ b/src/Subtitles/Rasterizer.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2015 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -865,9 +865,9 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) byte* dst = buffer + m_pOverlayData->mOverlayPitch * (y >> 3) + first;
if (first == last) {
- *dst += x2 - x1;
+ *dst += byte(x2 - x1);
} else {
- *dst += ((first + 1) << 3) - x1;
+ *dst += byte(((first + 1) << 3) - x1);
++dst;
while (++first < last) {
@@ -875,7 +875,7 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) ++dst;
}
- *dst += x2 - (last << 3);
+ *dst += byte(x2 - (last << 3));
}
}
}
diff --git a/src/Subtitles/STS.cpp b/src/Subtitles/STS.cpp index 0a2e200f9..8ec947531 100644 --- a/src/Subtitles/STS.cpp +++ b/src/Subtitles/STS.cpp @@ -1261,7 +1261,7 @@ static bool LoadFont(const CString& font) const TCHAR* s = font;
const TCHAR* e = s + len;
for (BYTE* p = pData; s < e; s++, p++) {
- *p = *s - 33;
+ *p = BYTE(*s - 33);
}
for (ptrdiff_t i = 0, j = 0, k = len & ~3; i < k; i += 4, j += 3) {
@@ -1477,7 +1477,7 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C style->colors[2] = style->colors[3]; // style->colors[2] is used for drawing the outline
alpha = std::max(std::min(alpha, 0xff), 0);
for (size_t i = 0; i < 3; i++) {
- style->alpha[i] = alpha;
+ style->alpha[i] = (BYTE)alpha;
}
style->alpha[3] = 0x80;
}
@@ -1639,7 +1639,7 @@ static bool OpenXombieSub(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet style->colors[i] = (COLORREF)GetInt(pszBuff, nBuffLength);
}
for (size_t i = 0; i < 4; i++) {
- style->alpha[i] = GetInt(pszBuff, nBuffLength);
+ style->alpha[i] = (BYTE)GetInt(pszBuff, nBuffLength);
}
style->fontWeight = GetInt(pszBuff, nBuffLength) ? FW_BOLD : FW_NORMAL;
style->fItalic = GetInt(pszBuff, nBuffLength);
@@ -2609,7 +2609,7 @@ bool CSimpleTextSubtitle::Open(CString fn, int CharSet, CString name, CString vi return Open(&f, CharSet, name);
}
-static size_t CountLines(CTextFile* f, ULONGLONG from, ULONGLONG to, CString& s = CString())
+static size_t CountLines(CTextFile* f, ULONGLONG from, ULONGLONG to, CString s = _T(""))
{
size_t n = 0;
f->Seek(from, CFile::begin);
@@ -3032,7 +3032,7 @@ STSStyle& STSStyle::operator = (LOGFONT& lf) LOGFONTA& operator <<= (LOGFONTA& lfa, STSStyle& s)
{
- lfa.lfCharSet = s.charSet;
+ lfa.lfCharSet = (BYTE)s.charSet;
strncpy_s(lfa.lfFaceName, LF_FACESIZE, CStringA(s.fontName), _TRUNCATE);
HDC hDC = GetDC(nullptr);
lfa.lfHeight = -MulDiv((int)(s.fontSize + 0.5), GetDeviceCaps(hDC, LOGPIXELSY), 72);
@@ -3046,7 +3046,7 @@ LOGFONTA& operator <<= (LOGFONTA& lfa, STSStyle& s) LOGFONTW& operator <<= (LOGFONTW& lfw, STSStyle& s)
{
- lfw.lfCharSet = s.charSet;
+ lfw.lfCharSet = (BYTE)s.charSet;
wcsncpy_s(lfw.lfFaceName, LF_FACESIZE, CStringW(s.fontName), _TRUNCATE);
HDC hDC = GetDC(nullptr);
lfw.lfHeight = -MulDiv((int)(s.fontSize + 0.5), GetDeviceCaps(hDC, LOGPIXELSY), 72);
@@ -3100,7 +3100,7 @@ STSStyle& operator <<= (STSStyle& s, const CString& style) s.colors[i] = (COLORREF)GetInt(pszBuff, nBuffLength, L';');
}
for (size_t i = 0; i < 4; i++) {
- s.alpha[i] = GetInt(pszBuff, nBuffLength, L';');
+ s.alpha[i] = (BYTE)GetInt(pszBuff, nBuffLength, L';');
}
s.charSet = GetInt(pszBuff, nBuffLength, L';');
s.fontName = WToT(GetStrW(pszBuff, nBuffLength, L';'));
diff --git a/src/Subtitles/USFSubtitles.cpp b/src/Subtitles/USFSubtitles.cpp index 4d610c1d5..737dad5e0 100644 --- a/src/Subtitles/USFSubtitles.cpp +++ b/src/Subtitles/USFSubtitles.cpp @@ -348,12 +348,12 @@ bool CUSFSubtitles::ConvertToSTS(CSimpleTextSubtitle& sts) for (size_t i = 0; i < 4; i++) {
DWORD color = ColorToDWORD(s->fontstyle.color[i]);
- int alpha = (BYTE)wcstol(s->fontstyle.alpha, nullptr, 10);
+ auto alpha = (BYTE)wcstol(s->fontstyle.alpha, nullptr, 10);
stss->colors[i] = color & 0xffffff;
stss->alpha[i] = (BYTE)(color >> 24);
- stss->alpha[i] = stss->alpha[i] + (255 - stss->alpha[i]) * std::min(std::max(alpha, 0), 100) / 100;
+ stss->alpha[i] = BYTE(stss->alpha[i] + (255 - stss->alpha[i]) * std::min(std::max(alpha, 0ui8), 100ui8) / 100);
}
if (!s->fontstyle.face.IsEmpty()) {
diff --git a/src/Subtitles/VobSubFile.cpp b/src/Subtitles/VobSubFile.cpp index 5aa0bf1d8..bf54b6e5f 100644 --- a/src/Subtitles/VobSubFile.cpp +++ b/src/Subtitles/VobSubFile.cpp @@ -648,7 +648,7 @@ bool CVobSubFile::ReadIdx(CString fn, int& ver) } else if (entry == _T("id")) {
str.MakeLower();
- int langid = ((str[0] & 0xff) << 8) | (str[1] & 0xff);
+ WORD langid = ((str[0] & 0xff) << 8) | (str[1] & 0xff);
i = str.Find(_T("index:"));
if (i < 0) {
@@ -690,8 +690,8 @@ bool CVobSubFile::ReadIdx(CString fn, int& ver) } else if (id >= 0 && entry == _T("timestamp")) {
SubPos sb;
- sb.vobid = vobid;
- sb.cellid = cellid;
+ sb.vobid = (char)vobid;
+ sb.cellid = (char)cellid;
sb.celltimestamp = celltimestamp;
sb.bValid = true;
@@ -1143,13 +1143,15 @@ BYTE* CVobSubFile::GetPacket(size_t idx, size_t& packetSize, size_t& dataSize, s break;
}
+ ASSERT(nLang < BYTE_MAX);
+
// let's check a few things to make sure...
if (*(DWORD*)&buff[0x00] != 0xba010000
|| *(DWORD*)&buff[0x0e] != 0xbd010000
|| !(buff[0x15] & 0x80)
|| (buff[0x17] & 0xf0) != 0x20
|| (buff[buff[0x16] + 0x17] & 0xe0) != 0x20
- || (buff[buff[0x16] + 0x17] & 0x1f) != nLang) {
+ || (buff[buff[0x16] + 0x17] & 0x1f) != (BYTE)nLang) {
break;
}
@@ -1360,7 +1362,7 @@ STDMETHODIMP CVobSubFile::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, rt /= 10000;
- if (!GetFrame(GetFrameIdxByTimeStamp(rt), -1, rt)) {
+ if (!GetFrame(GetFrameIdxByTimeStamp(rt), SIZE_T_ERROR, rt)) {
return E_FAIL;
}
@@ -1496,8 +1498,8 @@ static void PixelAtBiLinear(RGBQUAD& c, int x, int y, CVobSubImage& src) + c21.rgbGreen * v2u1 + c22.rgbGreen * v2u2) >> 24;
c.rgbBlue = (c11.rgbBlue * v1u1 + c12.rgbBlue * v1u2
+ c21.rgbBlue * v2u1 + c22.rgbBlue * v2u2) >> 24;
- c.rgbReserved = (v1u1 + v1u2
- + v2u1 + v2u2) >> 16;
+ c.rgbReserved = BYTE((v1u1 + v1u2
+ + v2u1 + v2u2) >> 16);
}
static void StretchBlt(SubPicDesc& spd, CRect dstrect, CVobSubImage& src)
@@ -1960,7 +1962,8 @@ bool CVobSubFile::SaveScenarist(CString fn, int delay) BYTE colormap[16];
for (size_t i = 0; i < 16; i++) {
- int idx = 0, maxdif = 255 * 255 * 3 + 1;
+ BYTE idx = 0;
+ int maxdif = 255 * 255 * 3 + 1;
for (size_t j = 0; j < 16 && maxdif; j++) {
int rdif = pal[j].rgbRed - m_orgpal[i].rgbRed;
@@ -1970,7 +1973,7 @@ bool CVobSubFile::SaveScenarist(CString fn, int delay) int dif = rdif * rdif + gdif * gdif + bdif * bdif;
if (dif < maxdif) {
maxdif = dif;
- idx = (int)j;
+ idx = (BYTE)j;
}
}
diff --git a/src/Subtitles/VobSubFile.h b/src/Subtitles/VobSubFile.h index 02c9c3369..b1aea10e1 100644 --- a/src/Subtitles/VobSubFile.h +++ b/src/Subtitles/VobSubFile.h @@ -94,7 +94,7 @@ public: };
struct SubLang {
- int id = 0;
+ WORD id = 0;
CString name, alt;
CAtlArray<SubPos> subpos;
};
diff --git a/src/Subtitles/VobSubFileRipper.cpp b/src/Subtitles/VobSubFileRipper.cpp index 031671dd4..9345fe45e 100644 --- a/src/Subtitles/VobSubFileRipper.cpp +++ b/src/Subtitles/VobSubFileRipper.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2015 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -1024,23 +1024,21 @@ STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn) line.TrimLeft();
n = 0;
-
- int langnum;
-
if (_istdigit(lang[0])) {
+ int langnum;
n = _stscanf_s(lang, _T("%d"), &langnum);
if (n != 1) {
break;
}
- m_rd.selids[langnum] = true;
+ m_rd.selids[(BYTE)langnum] = true;
} else if (_istalpha(lang[0])) {
n = _stscanf_s(lang, _T("%s"), langid, _countof(langid));
if (n != 1) {
break;
}
- int id = (langid[0] << 8) + langid[1];
+ BYTE id = BYTE((langid[0] << 8) + langid[1]);
if (id == 'cc') {
m_rd.bClosedCaption = true;
diff --git a/src/Subtitles/VobSubImage.cpp b/src/Subtitles/VobSubImage.cpp index f00fb2b4e..c797f40e5 100644 --- a/src/Subtitles/VobSubImage.cpp +++ b/src/Subtitles/VobSubImage.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2015 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -990,8 +990,8 @@ void CVobSubImage::SplitOutline(const COutline& o, COutline& o1, COutline& o2) }
}
- size_t maxlen = 0, maxidx = -1;
- size_t maxlen2 = 0, maxidx2 = -1;
+ size_t maxlen = 0, maxidx = SIZE_T_ERROR;
+ size_t maxlen2 = 0, maxidx2 = SIZE_T_ERROR;
for (i = 0; i < la.GetCount(); i++) {
if (maxlen < la[i]) {
@@ -1005,6 +1005,8 @@ void CVobSubImage::SplitOutline(const COutline& o, COutline& o1, COutline& o2) }
}
+ ASSERT(maxidx != SIZE_T_ERROR && maxidx2 != SIZE_T_ERROR);
+
if (maxlen == maxlen2) {
maxidx = maxidx2; // if equal choose the inner section
}
|