diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-28 20:39:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-28 20:39:24 +0000 |
commit | 7021acd12bc0ae847b7e3f00a63ef2a5f8e89843 (patch) | |
tree | bc3b05d80358d626154658c9c2a2643264b59d24 /plugins/MirandaG15/src/LCDFramework | |
parent | ec7ac33c495d89d4732979a8b30080edafbe8b7a (diff) |
warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@13888 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15/src/LCDFramework')
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp | 8 | ||||
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp | 42 | ||||
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp | 12 | ||||
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp | 14 | ||||
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/misc.h | 4 |
5 files changed, 39 insertions, 41 deletions
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index 681fc608a9..c8e4ed75d5 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -302,7 +302,7 @@ void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText) dtp.cbSize = sizeof(DRAWTEXTPARAMS);
RECT rBounds = {nX,nY,GetClipWidth(),GetClipHeight()};
- DrawTextEx(m_hDC,(LPTSTR)sText,mir_tstrlen(sText),&rBounds,(DT_LEFT | DT_NOPREFIX),&dtp);
+ DrawTextEx(m_hDC, (LPTSTR)sText, (int)mir_tstrlen(sText), &rBounds, (DT_LEFT | DT_NOPREFIX), &dtp);
// restores
SetMapMode(m_hDC, nOldMapMode);
@@ -323,7 +323,7 @@ void CLCDGfx::DrawText(int nX,int nY,int nWidth,tstring strText) int *piWidths = new int[strText.length()];
int iMaxChars = 0;
- GetTextExtentExPoint(GetHDC(),strText.c_str(),strText.length(),nWidth,&iMaxChars,piWidths,&sizeLine);
+ GetTextExtentExPoint(GetHDC(), strText.c_str(), (int)strText.length(), nWidth, &iMaxChars, piWidths, &sizeLine);
if(iMaxChars < strText.length()) {
for(iMaxChars--;iMaxChars>0;iMaxChars--)
@@ -671,7 +671,7 @@ void CLCDGfx::Cache() {
if(m_LMovingPixels.size() > 0 && iTransitionPixels > 0)
{
- pSource = m_LMovingPixels[GetRandomInt(0,m_LMovingPixels.size()-1)];
+ pSource = m_LMovingPixels[GetRandomInt(0, (int)m_LMovingPixels.size()-1)];
pPixel->Destination = pSource->Destination;
}
else
@@ -705,7 +705,7 @@ void CLCDGfx::Cache() if(!bRandom)
{
- pSource = m_LMovingPixels[GetRandomInt(0,m_LMovingPixels.size()-1)];
+ pSource = m_LMovingPixels[GetRandomInt(0, (int)m_LMovingPixels.size()-1)];
pPixel->Start = pSource->Start;
}
else
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp index 647cf8bf49..773645edac 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp @@ -63,7 +63,7 @@ void CLCDInput::SetScrollbar(CLCDBar *pScrollbar) if(m_pScrollbar)
{
m_pScrollbar->SetSliderSize(m_iLineCount);
- m_pScrollbar->SetRange(0,m_vLineOffsets.size());
+ m_pScrollbar->SetRange(0, (int)m_vLineOffsets.size());
m_pScrollbar->ScrollTo(m_iLinePosition);
}
}
@@ -84,7 +84,7 @@ bool CLCDInput::Update() if(!CLCDTextObject::Update())
return false;
- if(m_lBlinkTimer + 500 <= GetTickCount())
+ if(m_lBlinkTimer + 500 <= (long)GetTickCount())
{
m_bShowMarker = !m_bShowMarker;
m_lBlinkTimer = GetTickCount();
@@ -119,8 +119,7 @@ bool CLCDInput::Draw(CLCDGfx *pGfx) if(m_bShowSymbols && m_vLineOffsets[iLine+1].bLineBreak)
pGfx->DrawFilledRect(m_vLineOffsets[iLine].iWidth+1,rBoundary.top+m_iFontHeight/3,m_iFontHeight/3,m_iFontHeight/3);
}
- else
- iLen = m_strText.length() - m_vLineOffsets[iLine].iOffset;
+ else iLen = (int)m_strText.length() - m_vLineOffsets[iLine].iOffset;
// Draw the text
pcOffset = (TCHAR*)m_strText.c_str() + m_vLineOffsets[iLine].iOffset;
@@ -174,7 +173,7 @@ void CLCDInput::ShowSymbols(bool bShow) //************************************************************************
void CLCDInput::SetBreakKeys(int iKeys)
{
- m_iBreakKeys = iKeys;
+ m_iBreakKeys = iKeys != 0;
}
//************************************************************************
@@ -221,7 +220,7 @@ void CLCDInput::OnFontChanged() m_Marker[0].iLine = 0;
m_Marker[0].iPosition = 0;
- m_Marker[0].iPosition = m_strText.length();
+ m_Marker[0].iPosition = (int)m_strText.length();
// Delete all offsets and recalculate them
m_vLineOffsets.clear();
@@ -293,7 +292,7 @@ LRESULT CLCDInput::ProcessKeyEvent(int Code, WPARAM wParam, LPARAM lParam) KBDLLHOOKSTRUCT *key = (KBDLLHOOKSTRUCT *)(lParam);
bool bKeyDown = !(key->flags & LLKHF_UP);
- bool bToggled = (m_acKeyboardState[key->vkCode] & 0x0F);
+ bool bToggled = (m_acKeyboardState[key->vkCode] & 0x0F) != 0;
if(bKeyDown)
bToggled = !bToggled;
m_acKeyboardState[key->vkCode] = (bKeyDown?0x80:0x00) | (bToggled?0x01:0x00);
@@ -363,11 +362,10 @@ LRESULT CLCDInput::ProcessKeyEvent(int Code, WPARAM wParam, LPARAM lParam) else if(key->vkCode == VK_END)
{
if(m_vLineOffsets.size()-1 == m_Marker[0].iLine)
- res = m_strText.length() - m_Marker[0].iPosition;
+ res = (int)m_strText.length() - m_Marker[0].iPosition;
else
- {
res = (m_vLineOffsets[m_Marker[0].iLine+1].iOffset - 1 - m_vLineOffsets[m_Marker[0].iLine+1].bLineBreak) -m_Marker[0].iPosition;
- }
+
scroll = 1;
}
else if(key->vkCode == VK_UP)
@@ -396,7 +394,7 @@ LRESULT CLCDInput::ProcessKeyEvent(int Code, WPARAM wParam, LPARAM lParam) if(key->vkCode == VK_RETURN)
{
- bool bCtrlDown = (bool)(m_acKeyboardState[VK_CONTROL] & 0x80);
+ bool bCtrlDown = (m_acKeyboardState[VK_CONTROL] & 0x80) != 0;
if( bCtrlDown != (m_iBreakKeys == KEYS_RETURN))
{
DeactivateInput();
@@ -491,7 +489,7 @@ void CLCDInput::MoveMarker(int iDir,int iMove,bool bShift) if(m_Marker[0].iLine < m_vLineOffsets.size() -1)
iLen = m_vLineOffsets[m_Marker[0].iLine+1].iOffset - m_vLineOffsets[m_Marker[0].iLine].iOffset;
else
- iLen = m_strText.length() - m_vLineOffsets[m_Marker[0].iLine].iOffset;
+ iLen = (int)m_strText.length() - m_vLineOffsets[m_Marker[0].iLine].iOffset;
HDC hDC = CreateCompatibleDC(NULL);
if(NULL == hDC)
@@ -549,7 +547,7 @@ void CLCDInput::MoveMarker(int iDir,int iMove,bool bShift) if(m_Marker[i].iPosition < 0)
m_Marker[i].iPosition = 0;
else if(m_Marker[i].iPosition > m_strText.length() )
- m_Marker[i].iPosition = m_strText.length();
+ m_Marker[i].iPosition = (int)m_strText.length();
}
if(m_Marker[0].iPosition > 0 && m_strText[m_Marker[0].iPosition-1] == '\r')
m_Marker[0].iPosition+= (iDir == MARKER_HORIZONTAL && iMove>0)?1:-1;
@@ -608,7 +606,7 @@ void CLCDInput::UpdateOffsets(int iModified) m_Marker[0].iXWidth = 1;
// Initialize variables
- int iLen = m_strText.length();
+ int iLen = (int)m_strText.length();
int *piWidths = new int[iLen];
TCHAR *pszText = (TCHAR*)m_strText.c_str();
tstring::size_type pos = 0;
@@ -621,7 +619,7 @@ void CLCDInput::UpdateOffsets(int iModified) int iLine = -1;
// Find the first line to update
- for(int i=m_vLineOffsets.size()-1;i>=0;i--)
+ for(int i = (int)m_vLineOffsets.size()-1; i >= 0; i--)
if(m_vLineOffsets[i].iOffset <= m_Marker[0].iPosition)
{
iLine = i;
@@ -661,8 +659,8 @@ void CLCDInput::UpdateOffsets(int iModified) // check for linebreaks
if(pos != tstring::npos && pos >= iChar && pos <= iChar + iMaxChars)
{
- iWordOffset = pos + 1;
- iMaxChars = pos - iChar;
+ iWordOffset = (int)pos + 1;
+ iMaxChars = (int)pos - iChar;
}
// if the string doesnt fit, try to wrap the last word to the next line
else
@@ -670,7 +668,7 @@ void CLCDInput::UpdateOffsets(int iModified) // find the last space in the line
pos = m_strText.rfind(_T(" "),iChar + iMaxChars);
if(pos != tstring::npos && pos >= iChar)
- iWordOffset = pos +1;
+ iWordOffset = (int)pos +1;
else
iWordOffset = iChar+iMaxChars;
}
@@ -783,7 +781,7 @@ finished: DeleteObject(hDC);
if(m_pScrollbar)
- m_pScrollbar->SetRange(0,m_vLineOffsets.size()-1);
+ m_pScrollbar->SetRange(0, (int)m_vLineOffsets.size()-1);
}
//************************************************************************
@@ -792,7 +790,7 @@ finished: void CLCDInput::UpdateMarker()
{
// Adjust the markers propertys
- for(int i=m_vLineOffsets.size()-1;i>= 0;i--)
+ for(int i = (int)m_vLineOffsets.size()-1;i>= 0;i--)
if(m_Marker[0].iPosition >= m_vLineOffsets[i].iOffset)
{
if(m_Marker[0].iPosition == m_vLineOffsets[i].iOffset)
@@ -835,7 +833,7 @@ void CLCDInput::ScrollToMarker() }
if(m_iLinePosition > m_vLineOffsets.size()-1)
- m_iLinePosition = m_vLineOffsets.size() -1;
+ m_iLinePosition = (int)m_vLineOffsets.size() -1;
if(m_iLinePosition < 0)
m_iLinePosition = 0;
@@ -848,7 +846,7 @@ void CLCDInput::ScrollToMarker() //************************************************************************
int CLCDInput::GetLineCount()
{
- return m_vLineOffsets.size();
+ return (int)m_vLineOffsets.size();
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp index c5fecce751..7415ea5567 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp @@ -70,7 +70,7 @@ bool CLCDLabel::Draw(CLCDGfx *pGfx) vector<tstring>::iterator iter = m_vLines.begin();
while(!m_vLines.empty() && iter != m_vLines.end())
{
- DrawTextEx(pGfx->GetHDC(), (LPTSTR)(*iter).c_str(), (*iter).length(), &rBoundary, m_iTextFormat, &m_dtp);
+ DrawTextEx(pGfx->GetHDC(), (LPTSTR)(*iter).c_str(), (int)(*iter).length(), &rBoundary, m_iTextFormat, &m_dtp);
rBoundary.top += m_iFontHeight;
iter++;
}
@@ -118,7 +118,7 @@ void CLCDLabel::SetWordWrap(bool bEnable) //************************************************************************
void CLCDLabel::UpdateCutOffIndex()
{
- int iLen = m_strText.length();
+ int iLen = (int)m_strText.length();
m_vLines.clear();
@@ -158,7 +158,7 @@ void CLCDLabel::UpdateCutOffIndex() while(i<iLen && m_vLines.size() < iAvailableLines)
{
- GetTextExtentExPoint(hDC,szString+i,m_strText.length()-i,GetWidth(),&iMaxChars,piExtents,&sizeLine);
+ GetTextExtentExPoint(hDC, szString+i, (int)m_strText.length()-i, GetWidth(), &iMaxChars, piExtents, &sizeLine);
// filter out spaces or line breaks at the beginning of a new line
if(m_strText[i] == '\n' || m_strText[i] == ' ')
@@ -167,14 +167,14 @@ void CLCDLabel::UpdateCutOffIndex() pos = m_strText.find(_T("\n"),i);
// check for linebreaks
if(pos != tstring::npos && pos != i && pos >= i && pos != i+iMaxChars)
- iMaxChars = 1 + pos - i;
+ iMaxChars = 1 + (int)pos - i;
// if the string doesnt fit, try to wrap the last word to the next line
else if(iMaxChars < iLen - i || sizeLine.cx >= GetWidth())
{
// find the last space in the line ( substract -1 from offset to ignore spaces as last chars )
pos = m_strText.rfind(_T(" "),i + iMaxChars -1 );
if(pos != tstring::npos && pos != i && pos >= i && pos != i+iMaxChars)
- iMaxChars = 1 + pos - i;
+ iMaxChars = 1 + (int)pos - i;
}
if(m_vLines.size() == iAvailableLines-1)
@@ -195,7 +195,7 @@ void CLCDLabel::UpdateCutOffIndex() int *piWidths = new int[(*--m_vLines.end()).length()];
int iMaxChars = 0;
- GetTextExtentExPoint(hDC,(*--m_vLines.end()).c_str(),(*--m_vLines.end()).length(),iWidth,&iMaxChars,piWidths,&sizeLine);
+ GetTextExtentExPoint(hDC,(*--m_vLines.end()).c_str(),(int)(*--m_vLines.end()).length(),iWidth,&iMaxChars,piWidths,&sizeLine);
if(iMaxChars < (*--m_vLines.end()).length())
{
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp index a2cd753099..9814f93024 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp @@ -91,7 +91,7 @@ bool CLCDTextLog::Draw(CLCDGfx *pGfx) int iLine = (m_iPosition + iLinesDrawn) - iPosition;
for(;iLinesDrawn < iLineCount && iLine < pEntry->iLines;iLine++)
{
- DrawTextEx(pGfx->GetHDC(), (LPTSTR)pEntry->vLines[iLine].c_str(), pEntry->vLines[iLine].size(), &rBoundary, m_iTextFormat, &m_dtp);
+ DrawTextEx(pGfx->GetHDC(), (LPTSTR)pEntry->vLines[iLine].c_str(), (int)pEntry->vLines[iLine].size(), &rBoundary, m_iTextFormat, &m_dtp);
rBoundary.top += m_iFontHeight;
rBoundary.bottom += m_iFontHeight;
iLinesDrawn++;
@@ -297,7 +297,7 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) if(NULL == hDC)
return;
- int iLen = strString.size();
+ int iLen = (int)strString.size();
int i = 0;
tstring strLine = _T("");
tstring strWord = _T("");
@@ -316,7 +316,7 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) {
while(i<iLen)
{
- GetTextExtentExPoint(hDC,szString+i,strString.length()-i,GetWidth(),&iMaxChars,piExtents,&sizeLine);
+ GetTextExtentExPoint(hDC, szString+i, (int)strString.length()-i, GetWidth(), &iMaxChars, piExtents, &sizeLine);
// filter out spaces or line breaks at the beginning of a new line
if(strString[i] == '\n' || strString[i] == ' ')
@@ -325,14 +325,14 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) pos = strString.rfind(_T("\n"),i+iMaxChars);
// check for linebreaks
if(pos != tstring::npos && pos != i && pos >= i && pos != i+iMaxChars)
- iMaxChars = 1 + pos - i;
+ iMaxChars = 1 + (int)pos - i;
// if the string doesnt fit, try to wrap the last word to the next line
else if(iMaxChars < iLen - i || sizeLine.cx >= GetWidth())
{
// find the last space in the line ( substract -1 from offset to ignore spaces as last chars )
pos = strString.rfind(_T(" "),i + iMaxChars -1 );
- if(pos != tstring::npos && pos != i && pos >= i & pos != i+iMaxChars)
- iMaxChars = 1 + pos - i;
+ if(pos != tstring::npos && pos != i && pos >= i && pos != i+iMaxChars)
+ iMaxChars = 1 + (int)pos - i;
}
pEntry->vLines.push_back(strString.substr(i,iMaxChars));
i += iMaxChars;
@@ -375,7 +375,7 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) */
DeleteObject(hDC);
- pEntry->iLines = pEntry->vLines.size();
+ pEntry->iLines = (int)pEntry->vLines.size();
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/LCDFramework/misc.h b/plugins/MirandaG15/src/LCDFramework/misc.h index 43e35327c5..0dd4494f0c 100644 --- a/plugins/MirandaG15/src/LCDFramework/misc.h +++ b/plugins/MirandaG15/src/LCDFramework/misc.h @@ -4,7 +4,7 @@ extern tstring toLower(const tstring &i_str); extern std::wstring toWideString( const char* pStr , int len=-1 ) ;
inline std::wstring toWideString( const std::string& str )
{
- return toWideString(str.c_str(),str.length()) ;
+ return toWideString(str.c_str(), (int)str.length()) ;
}
inline std::wstring toWideString( const wchar_t* pStr , int len=-1 )
{
@@ -17,7 +17,7 @@ inline std::wstring toWideString( const std::wstring& str ) extern std::string toNarrowString( const wchar_t* pStr , int len=-1 ) ;
inline std::string toNarrowString( const std::wstring& str )
{
- return toNarrowString(str.c_str(),str.length()) ;
+ return toNarrowString(str.c_str(), (int)str.length()) ;
}
inline std::string toNarrowString( const char* pStr , int len=-1 )
{
|