[dasher] SendMessage TBM_GETPOS returns a 32 bit integer



commit 6d5a08c857a1e3b8c8b214e9da688fcebb9470a5
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Sat Feb 9 14:55:21 2013 +0000

    SendMessage TBM_GETPOS returns a 32 bit integer
    
    While here, sprinkle a few casts to paper over cracks.

 Src/DasherCore/FrameRate.cpp            |    2 +-
 Src/DasherCore/OneDimensionalFilter.cpp |    2 +-
 Src/DasherCore/ScreenGameModule.cpp     |    4 ++--
 Src/Win32/Widgets/ControlPage.cpp       |    3 +--
 Src/Win32/Widgets/Screen.inl            |    2 +-
 5 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/Src/DasherCore/FrameRate.cpp b/Src/DasherCore/FrameRate.cpp
index 9677a8a..4396d28 100644
--- a/Src/DasherCore/FrameRate.cpp
+++ b/Src/DasherCore/FrameRate.cpp
@@ -53,7 +53,7 @@ void CFrameRate::RecordFrame(unsigned long Time)
 void CFrameRate::HandleEvent(int iParameter) {
   switch (iParameter) {
     case LP_X_LIMIT_SPEED:
-      m_dBitsAtLimX = (log(CDasherModel::MAX_Y) - log (2*GetLongParameter(LP_X_LIMIT_SPEED)))/log(2);
+      m_dBitsAtLimX = (log(static_cast<double>(CDasherModel::MAX_Y)) - log (2.*GetLongParameter(LP_X_LIMIT_SPEED)))/log(2.);
       //fallthrough
     case LP_MAX_BITRATE:
     case LP_FRAMERATE:
diff --git a/Src/DasherCore/OneDimensionalFilter.cpp b/Src/DasherCore/OneDimensionalFilter.cpp
index 90ebe52..d3ffe49 100644
--- a/Src/DasherCore/OneDimensionalFilter.cpp
+++ b/Src/DasherCore/OneDimensionalFilter.cpp
@@ -83,7 +83,7 @@ CStartHandler *COneDimensionalFilter::MakeStartHandler() {
       CDasherScreen::point CircleCenter(CDasherView *pView) {
         if (m_iScreenRadius==-1) {//if we need to recompute
           CCircleStartHandler::CircleCenter(pView); //that does the radius
-          const myint rad(GetLongParameter(LP_CIRCLE_PERCENT) * CDasherModel::ORIGIN_Y / 100); //~~rad/2 in dasher-coords
+          const myint rad(static_cast<myint>(GetLongParameter(LP_CIRCLE_PERCENT)) * CDasherModel::ORIGIN_Y / 100); //~~rad/2 in dasher-coords
           m_pView->Dasher2Screen(CDasherModel::ORIGIN_X-static_cast<COneDimensionalFilter*>(m_pFilter)->forwardmax+rad, CDasherModel::ORIGIN_Y,m_fwdCenter.x, m_fwdCenter.y);
         }
         if (!static_cast<COneDimensionalFilter*>(m_pFilter)->isPaused()) return CCircleStartHandler::CircleCenter(pView);
diff --git a/Src/DasherCore/ScreenGameModule.cpp b/Src/DasherCore/ScreenGameModule.cpp
index b4bc3cd..64787f4 100644
--- a/Src/DasherCore/ScreenGameModule.cpp
+++ b/Src/DasherCore/ScreenGameModule.cpp
@@ -66,7 +66,7 @@ void CScreenGameModule::DrawText(CDasherView *pView) {
     //Of course, this may be a bit academic, if platforms have their own game displays...
     for (bool bIncreased=false;;) {
       m_pLabEntered = pScreen->MakeLabel(m_strEntered, uFontSize);
-      int w = pScreen->TextSize(m_pLabEntered, uFontSize).first;
+      screenint w = pScreen->TextSize(m_pLabEntered, uFontSize).first;
       if (w < maxX/3 && m_iFirstSym) {
         m_strEntered = m_pAlph->GetText(targetSyms()[--m_iFirstSym]) + m_strEntered;
         bIncreased = true;
@@ -78,7 +78,7 @@ void CScreenGameModule::DrawText(CDasherView *pView) {
     }
     for (bool bIncreased=false;;) {
       m_pLabTarget = pScreen->MakeLabel(m_strTarget, uFontSize);
-      int w = pScreen->TextSize(m_pLabTarget, uFontSize).first;
+      screenint w = pScreen->TextSize(m_pLabTarget, uFontSize).first;
       if (w < 2*maxX/3 && m_iLastSym < targetSyms().size()-1) {
         m_strTarget += m_pAlph->GetText(targetSyms()[m_iLastSym++]);
         bIncreased = true;
diff --git a/Src/Win32/Widgets/ControlPage.cpp b/Src/Win32/Widgets/ControlPage.cpp
index 8919d29..4ec5828 100644
--- a/Src/Win32/Widgets/ControlPage.cpp
+++ b/Src/Win32/Widgets/ControlPage.cpp
@@ -174,8 +174,7 @@ bool CControlPage::Apply()
 		return FALSE; // TODO notify user
 	}
 
-  double NewSpeed;
-  NewSpeed = SendMessage(SB_slider, TBM_GETPOS, 0, 0);
+  int NewSpeed = SendMessage(SB_slider, TBM_GETPOS, 0, 0);
   m_pAppSettings->SetLongParameter( LP_MAX_BITRATE, NewSpeed);
 
   if(SendMessage(GetDlgItem(m_hwnd, IDC_MOUSEPOS), BM_GETCHECK, 0, 0) == BST_CHECKED ) {
diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl
index 59f33a8..f736ac8 100644
--- a/Src/Win32/Widgets/Screen.inl
+++ b/Src/Win32/Widgets/Screen.inl
@@ -20,7 +20,7 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
 
 #ifndef _WIN32_WCE
 
-  if(GetWidth() != -1) {
+  if(GetWidth() != (screenint)-1) {
 
     point aPoints[5];
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]