Fix some MSVC warnings.

Several fixes are warnings about truncations on 64-bit, while others are
complaints about mixed signed / unsigned integer operations.
deque
slothlife 11 years ago
parent ead801f2d0
commit 9ea22324f7

@ -615,6 +615,7 @@ if (WIN32)
4244 # Storing value of one type in variable of another (size_t in int, for example) 4244 # Storing value of one type in variable of another (size_t in int, for example)
4305 # Truncating value (double to float, for example) 4305 # Truncating value (double to float, for example)
4309 # Variable overflow, trying to store 128 in a signed char for example 4309 # Variable overflow, trying to store 128 in a signed char for example
4351 # New behavior: elements of array 'array' will be default initialized (desired behavior)
4355 # Using 'this' in member initialization list 4355 # Using 'this' in member initialization list
4505 # Unreferenced local function has been removed 4505 # Unreferenced local function has been removed
4701 # Potentially uninitialized local variable used 4701 # Potentially uninitialized local variable used
@ -633,7 +634,9 @@ if (WIN32)
set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101") set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101")
set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS}) set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS})
set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS})
set_target_properties(oics PROPERTIES COMPILE_FLAGS ${WARNINGS}) # oics uses tinyxml, which has an initialized but unused variable
set(OICS_WARNINGS "${WARNINGS} /wd4189")
set_target_properties(oics PROPERTIES COMPILE_FLAGS ${OICS_WARNINGS})
set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS})
if (BUILD_LAUNCHER) if (BUILD_LAUNCHER)
set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS})

@ -87,7 +87,7 @@ namespace CSVRender
std::stringstream windowHandle; std::stringstream windowHandle;
#ifdef WIN32 #ifdef WIN32
windowHandle << Ogre::StringConverter::toString((unsigned long)(this->winId())); windowHandle << Ogre::StringConverter::toString((uintptr_t)(this->winId()));
#else #else
windowHandle << this->winId(); windowHandle << this->winId();
#endif #endif

@ -101,7 +101,7 @@ namespace MWGui
size_t viewRange = mScrollView->getCanvasSize().height; size_t viewRange = mScrollView->getCanvasSize().height;
if(viewPosition > viewRange) if(viewPosition > viewRange)
viewPosition = viewRange; viewPosition = viewRange;
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); mScrollView->setViewOffset(MyGUI::IntPoint(0, viewPosition * -1));
} }
void MWList::setPropertyOverride(const std::string &_key, const std::string &_value) void MWList::setPropertyOverride(const std::string &_key, const std::string &_value)

@ -319,7 +319,7 @@ void LocalMap::createFogOfWar(const std::string& texturePrefix)
std::vector<uint32> buffer; std::vector<uint32> buffer;
// initialize to (0, 0, 0, 1) // initialize to (0, 0, 0, 1)
buffer.resize(sFogOfWarResolution*sFogOfWarResolution, (255 << 24)); buffer.resize(sFogOfWarResolution*sFogOfWarResolution, 0xFF000000);
// upload to the texture // upload to the texture
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4); memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);

@ -747,7 +747,7 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts)
* buffer. We use this to store the global_pts in * buffer. We use this to store the global_pts in
* a frame at the time it is allocated. * a frame at the time it is allocated.
*/ */
static uint64_t global_video_pkt_pts = AV_NOPTS_VALUE; static uint64_t global_video_pkt_pts = static_cast<uint64_t>(AV_NOPTS_VALUE);
static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic) static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic)
{ {
int ret = avcodec_default_get_buffer(c, pic); int ret = avcodec_default_get_buffer(c, pic);

@ -385,7 +385,7 @@ namespace MWSound
sound = mOutput->playSound3D(file, initialPos, volume, basevol, pitch, min, max, mode|type, offset); sound = mOutput->playSound3D(file, initialPos, volume, basevol, pitch, min, max, mode|type, offset);
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId); mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
} }
catch(std::exception &e) catch(std::exception &)
{ {
//std::cout <<"Sound Error: "<<e.what()<< std::endl; //std::cout <<"Sound Error: "<<e.what()<< std::endl;
} }

@ -118,7 +118,7 @@ namespace Terrain
// North // North
row = verts-1; row = verts-1;
outerStep = 1 << (lodDeltas[North] + lodLevel); outerStep = size_t(1) << (lodDeltas[North] + lodLevel);
for (size_t col = 0; col < verts-1; col += outerStep) for (size_t col = 0; col < verts-1; col += outerStep)
{ {
indices.push_back(verts*(col+outerStep)+row); indices.push_back(verts*(col+outerStep)+row);
@ -142,7 +142,7 @@ namespace Terrain
// West // West
size_t col = 0; size_t col = 0;
outerStep = 1 << (lodDeltas[West] + lodLevel); outerStep = size_t(1) << (lodDeltas[West] + lodLevel);
for (size_t row = 0; row < verts-1; row += outerStep) for (size_t row = 0; row < verts-1; row += outerStep)
{ {
indices.push_back(verts*col+row+outerStep); indices.push_back(verts*col+row+outerStep);
@ -166,7 +166,7 @@ namespace Terrain
// East // East
col = verts-1; col = verts-1;
outerStep = 1 << (lodDeltas[East] + lodLevel); outerStep = size_t(1) << (lodDeltas[East] + lodLevel);
for (size_t row = 0; row < verts-1; row += outerStep) for (size_t row = 0; row < verts-1; row += outerStep)
{ {
indices.push_back(verts*col+row); indices.push_back(verts*col+row);

@ -32,7 +32,7 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
#ifdef WIN32 #ifdef WIN32
case SDL_SYSWM_WINDOWS: case SDL_SYSWM_WINDOWS:
// Windows code // Windows code
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window); winHandle = Ogre::StringConverter::toString((uintptr_t)wmInfo.info.win.window);
break; break;
#elif __MACOSX__ #elif __MACOSX__
case SDL_SYSWM_COCOA: case SDL_SYSWM_COCOA:

Loading…
Cancel
Save