Commit 643a812e by NTAuthority

fix some more project-wide compiler warnings

parent cabee64f
......@@ -2,6 +2,9 @@
#include <utils/CallStack.h>
#include <windows.h>
// dbghelp.h causes this warning
#pragma warning(disable: 4091)
#include <dbghelp.h>
#pragma comment(lib, "dbghelp.lib")
......
......@@ -3,7 +3,9 @@
#include <windows.h>
#include <d3d9.h>
#ifndef RW_D3D9
#define RW_D3D9
#endif
#include "src/rwd3d.h"
#include "src/rwd3d9.h"
......
......@@ -12,7 +12,7 @@ void* FrpUseSequentialAllocator::operator new[] (size_t size)
{
char* arenaPtr = reinterpret_cast<char*>(g_seqArena) + (g_seqPage * (8 * 1024 * 1024));
LONG offset = InterlockedAdd(&g_seqStart, size) - size;
LONG offset = InterlockedAdd(&g_seqStart, static_cast<LONG>(size)) - static_cast<LONG>(size);
void* retPtr = &arenaPtr[offset];
return retPtr;
......
......@@ -228,7 +228,7 @@ void FontRendererImpl::DrawText(const std::string& text, const Rect& rect, const
noColorTextString = noColorText.str();
}
m_dwFactory->CreateTextLayout(noColorTextString.c_str(), noColorTextString.length(), textFormat.Get(), rect.Width(), rect.Height(), textLayout.GetAddressOf());
m_dwFactory->CreateTextLayout(noColorTextString.c_str(), static_cast<UINT32>(noColorTextString.length()), textFormat.Get(), rect.Width(), rect.Height(), textLayout.GetAddressOf());
m_textLayoutCache[layoutKey] = textLayout;
......@@ -283,7 +283,7 @@ bool FontRendererImpl::GetStringMetrics(const std::string& characterString, floa
std::wstring wide = ToWide(stripped);
ComPtr<IDWriteTextLayout> textLayout;
m_dwFactory->CreateTextLayout(wide.c_str(), wide.length(), textFormat.Get(), 8192.0, 8192.0, textLayout.GetAddressOf());
m_dwFactory->CreateTextLayout(wide.c_str(), static_cast<UINT32>(wide.length()), textFormat.Get(), 8192.0, 8192.0, textLayout.GetAddressOf());
DWRITE_TEXT_METRICS textMetrics;
textLayout->GetMetrics(&textMetrics);
......
......@@ -62,7 +62,7 @@ size_t Win32Device::Read(THandle handle, void* outBuffer, size_t size)
assert(handle != Device::InvalidHandle);
DWORD bytesRead;
BOOL result = ReadFile(reinterpret_cast<HANDLE>(handle), outBuffer, size, &bytesRead, nullptr);
BOOL result = ReadFile(reinterpret_cast<HANDLE>(handle), outBuffer, static_cast<DWORD>(size), &bytesRead, nullptr);
return (!result) ? -1 : bytesRead;
}
......@@ -75,7 +75,7 @@ size_t Win32Device::ReadBulk(THandle handle, uint64_t ptr, void* outBuffer, size
overlapped.Offset = (ptr & 0xFFFFFFFF);
overlapped.OffsetHigh = ptr >> 32;
BOOL result = ReadFile(reinterpret_cast<HANDLE>(handle), outBuffer, size, nullptr, &overlapped);
BOOL result = ReadFile(reinterpret_cast<HANDLE>(handle), outBuffer, static_cast<DWORD>(size), nullptr, &overlapped);
bool ioPending = false;
if (!result)
......@@ -114,7 +114,7 @@ size_t Win32Device::Write(THandle handle, const void* buffer, size_t size)
assert(handle != Device::InvalidHandle);
DWORD bytesWritten;
BOOL result = WriteFile(reinterpret_cast<HANDLE>(handle), buffer, size, &bytesWritten, nullptr);
BOOL result = WriteFile(reinterpret_cast<HANDLE>(handle), buffer, static_cast<DWORD>(size), &bytesWritten, nullptr);
return (result) ? bytesWritten : -1;
}
......@@ -142,15 +142,15 @@ size_t Win32Device::Seek(THandle handle, intptr_t offset, int seekType)
}
else if (seekType == SEEK_END)
{
moveMethod == FILE_END;
Please register or sign in to reply
moveMethod = FILE_END;
}
return SetFilePointer(reinterpret_cast<HANDLE>(handle), offset, nullptr, moveMethod);
return SetFilePointer(reinterpret_cast<HANDLE>(handle), static_cast<LONG>(offset), nullptr, moveMethod);
}
bool Win32Device::Close(THandle handle)
{
return CloseHandle(reinterpret_cast<HANDLE>(handle));
return CloseHandle(reinterpret_cast<HANDLE>(handle)) != FALSE;
}
bool Win32Device::CloseBulk(THandle handle)
......@@ -161,7 +161,7 @@ bool Win32Device::CloseBulk(THandle handle)
bool Win32Device::RemoveFile(const std::string& filename)
{
std::wstring wideName = ToWide(filename);
return DeleteFile(wideName.c_str());
return DeleteFile(wideName.c_str()) != FALSE;
}
bool Win32Device::RenameFile(const std::string& from, const std::string& to)
......@@ -169,21 +169,21 @@ bool Win32Device::RenameFile(const std::string& from, const std::string& to)
std::wstring fromName = ToWide(from);
std::wstring toName = ToWide(to);
return MoveFile(fromName.c_str(), toName.c_str());
return MoveFile(fromName.c_str(), toName.c_str()) != FALSE;
}
bool Win32Device::CreateDirectory(const std::string& name)
{
std::wstring wideName = ToWide(name);
return CreateDirectoryW(wideName.c_str(), nullptr);
return CreateDirectoryW(wideName.c_str(), nullptr) != FALSE;
}
bool Win32Device::RemoveDirectory(const std::string& name)
{
std::wstring wideName = ToWide(name);
return RemoveDirectoryW(wideName.c_str());
return RemoveDirectoryW(wideName.c_str()) != FALSE;
}
size_t Win32Device::GetLength(THandle handle)
......@@ -191,7 +191,7 @@ size_t Win32Device::GetLength(THandle handle)
DWORD highPortion;
DWORD lowPortion = GetFileSize(reinterpret_cast<HANDLE>(handle), &highPortion);
return lowPortion | (highPortion << 32);
return lowPortion | (static_cast<size_t>(highPortion) << 32);
}
Device::THandle Win32Device::FindFirst(const std::string& folder, FindData* findData)
......@@ -225,7 +225,7 @@ bool Win32Device::FindNext(THandle handle, FindData* findData)
findData->name = ToNarrow(winFindData.cFileName);
}
return result;
return result != FALSE;
}
void Win32Device::FindClose(THandle handle)
......
......@@ -145,8 +145,8 @@ void EditorCameraControls::OnFrame( Camera *camera )
// Linear turn velocity, based on euler angles.
{
double yaw_velo_val = this->yaw_velo.GetCurrent() * frame_delta;
double pitch_velo_val = this->pitch_velo.GetCurrent() * frame_delta;
float yaw_velo_val = this->yaw_velo.GetCurrent() * frame_delta;
float pitch_velo_val = this->pitch_velo.GetCurrent() * frame_delta;
if ( yaw_velo_val != 0 || pitch_velo_val != 0 )
{
......
......@@ -301,7 +301,7 @@ static rw::Atomic* GetFirstClumpAtomic( rw::Clump *clump )
[&]( rw::Atomic *atom )
{
const char* nodeName = gta::getNodeName(atom->getFrame());
int nodeNameLength = strlen(nodeName);
size_t nodeNameLength = strlen(nodeName);
if (nodeNameLength > 3)
{
......
......@@ -176,8 +176,8 @@ void World::RenderWorld( void *gfxDevice )
static EventListener<MouseEvent> eventListener([] (const MouseEvent* event)
{
// calculate angle movement
float mx = event->GetDeltaX();
float my = event->GetDeltaY();
float mx = static_cast<float>(event->GetDeltaX());
float my = static_cast<float>(event->GetDeltaY());
// historical values for filtering
static int mouseDx[2];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment