summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-08-10 12:47:24 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-08-10 12:47:24 +0000
commit0baa72aff9737e17741b83c8a6d87891fb03bc0f (patch)
treecfb2f5ab859ce5cf7ebea2ef2724fe721466e213
parentfd16b0c65c1b65908f20527c010a83b6e7e4cf3b (diff)
downloadopenttd-0baa72aff9737e17741b83c8a6d87891fb03bc0f.tar.xz
(svn r25714) -Fix: explicitly cast some things to silence warnings on GCC 4.0
-rw-r--r--src/gfx.cpp6
-rw-r--r--src/gfx_layout.cpp6
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/sound/cocoa_s.cpp2
-rw-r--r--src/video/cocoa/cocoa_v.mm2
-rw-r--r--src/video/cocoa/wnd_quartz.mm10
6 files changed, 15 insertions, 15 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 4fed39194..3fabf0b09 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -437,9 +437,9 @@ static int DrawLayoutLine(ParagraphLayout::Line *line, int y, int left, int righ
/* Not a valid glyph (empty) */
if (glyph == 0xFFFF) continue;
- int begin_x = run->getPositions()[i * 2] + left - offset_x;
- int end_x = run->getPositions()[i * 2 + 2] + left - offset_x - 1;
- int top = run->getPositions()[i * 2 + 1] + y;
+ int begin_x = (int)run->getPositions()[i * 2] + left - offset_x;
+ int end_x = (int)run->getPositions()[i * 2 + 2] + left - offset_x - 1;
+ int top = (int)run->getPositions()[i * 2 + 1] + y;
/* Truncated away. */
if (truncation && (begin_x < min_x || end_x > max_x)) continue;
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index 618474e06..eca2d4ba4 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -262,7 +262,7 @@ int ParagraphLayout::Line::getWidth() const
* the last run gives us the end of the line and thus the width.
*/
const VisualRun *run = this->getVisualRun(this->countRuns() - 1);
- return run->getPositions()[run->getGlyphCount() * 2];
+ return (int)run->getPositions()[run->getGlyphCount() * 2];
}
/**
@@ -593,8 +593,8 @@ const char *Layouter::GetCharAtPosition(int x) const
/* Not a valid glyph (empty). */
if (run->getGlyphs()[i] == 0xFFFF) continue;
- int begin_x = run->getPositions()[i * 2];
- int end_x = run->getPositions()[i * 2 + 2];
+ int begin_x = (int)run->getPositions()[i * 2];
+ int end_x = (int)run->getPositions()[i * 2 + 2];
if (IsInsideMM(x, begin_x, end_x)) {
/* Found our glyph, now convert to UTF-8 string index. */
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 4b5412d81..be2336dce 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -2583,7 +2583,7 @@ struct IndustryCargoesWindow : public Window {
delete lst;
break;
}
- int selected = (this->ind_cargo >= NUM_INDUSTRYTYPES) ? this->ind_cargo - NUM_INDUSTRYTYPES : -1;
+ int selected = (this->ind_cargo >= NUM_INDUSTRYTYPES) ? (int)(this->ind_cargo - NUM_INDUSTRYTYPES) : -1;
ShowDropDownList(this, lst, selected, WID_IC_CARGO_DROPDOWN, 0, true);
break;
}
@@ -2600,7 +2600,7 @@ struct IndustryCargoesWindow : public Window {
delete lst;
break;
}
- int selected = (this->ind_cargo < NUM_INDUSTRYTYPES) ? this->ind_cargo : -1;
+ int selected = (this->ind_cargo < NUM_INDUSTRYTYPES) ? (int)this->ind_cargo : -1;
ShowDropDownList(this, lst, selected, WID_IC_IND_DROPDOWN, 0, true);
break;
}
diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp
index 945c15da2..1dc2a25d4 100644
--- a/src/sound/cocoa_s.cpp
+++ b/src/sound/cocoa_s.cpp
@@ -67,7 +67,7 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
requestedDesc.mBytesPerFrame = requestedDesc.mBitsPerChannel * requestedDesc.mChannelsPerFrame / 8;
requestedDesc.mBytesPerPacket = requestedDesc.mBytesPerFrame * requestedDesc.mFramesPerPacket;
- MxInitialize(requestedDesc.mSampleRate);
+ MxInitialize((uint)requestedDesc.mSampleRate);
/* Locate the default output audio unit */
desc.componentType = kAudioUnitType_Output;
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index fb60a6f16..13264d6b1 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -961,7 +961,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
NSPoint view_pt = [ self convertPoint:[ [ self window ] convertScreenToBase:thePoint ] fromView:nil ];
- Point pt = { view_pt.x, [ self frame ].size.height - view_pt.y };
+ Point pt = { (int)view_pt.x, (int)[ self frame ].size.height - (int)view_pt.y };
const char *ch = _focused_window->GetTextCharacterAtPosition(pt);
if (ch == NULL) return NSNotFound;
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index 3f1223eb5..12021631d 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -151,7 +151,7 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace()
/* Calculate total area we are blitting */
uint32 blitArea = 0;
for (int n = 0; n < dirtyRectCount; n++) {
- blitArea += dirtyRects[n].size.width * dirtyRects[n].size.height;
+ blitArea += (uint32)(dirtyRects[n].size.width * dirtyRects[n].size.height);
}
/*
@@ -335,10 +335,10 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp)
[ this->window setContentSize:contentRect.size ];
/* Ensure frame height - title bar height >= view height */
- contentRect.size.height = Clamp(height, 0, [ this->window frame ].size.height - 22 /* 22 is the height of title bar of window*/);
+ contentRect.size.height = Clamp(height, 0, (int)[ this->window frame ].size.height - 22 /* 22 is the height of title bar of window*/);
if (this->cocoaview != nil) {
- height = contentRect.size.height;
+ height = (int)contentRect.size.height;
[ this->cocoaview setFrameSize:contentRect.size ];
}
}
@@ -569,8 +569,8 @@ bool WindowQuartzSubdriver::WindowResized()
NSRect newframe = [ this->cocoaview frame ];
- this->window_width = newframe.size.width;
- this->window_height = newframe.size.height;
+ this->window_width = (int)newframe.size.width;
+ this->window_height = (int)newframe.size.height;
/* Create Core Graphics Context */
free(this->window_buffer);