Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP warning redux #5260

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/SpaceStationType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ void SpaceStationType::OnSetupComplete()
}
}

numDockingPorts = m_portPaths.size();
#pragma message("FIX: warning of data loss (x64)")
numDockingPorts = uint32_t(m_portPaths.size());

// sanity
assert(!m_portPaths.empty());
Expand Down Expand Up @@ -421,10 +422,12 @@ void SpaceStationType::Init()
const SpaceStationType *SpaceStationType::RandomStationType(Random &random, const bool bIsGround)
{
if (bIsGround) {
return &surfaceTypes[random.Int32(SpaceStationType::surfaceTypes.size())];
#pragma message("FIX: warning of data loss (x64)")
return &surfaceTypes[random.Int32(int(SpaceStationType::surfaceTypes.size()))];
}

return &orbitalTypes[random.Int32(SpaceStationType::orbitalTypes.size())];
#pragma message("FIX: warning of data loss (x64)")
return &orbitalTypes[random.Int32(int(SpaceStationType::orbitalTypes.size()))];
}

/*static*/
Expand Down
11 changes: 6 additions & 5 deletions src/SystemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ static vector3d position_of_surface_starport_relative_to_parent(const SystemBody
vector3d(0.0, 1.0, 0.0) *
// we need the distance to the center of the planet
(Pi::game->IsNormalSpace() && Pi::game->GetSpace()->GetStarSystem()->GetPath().IsSameSystem(Pi::game->GetSectorView()->GetSelected()) ?
// if we look at the current system, the relief is known, we take the height from the physical body
Pi::game->GetSpace()->FindBodyForPath(&(starport->GetPath()))->GetPosition().Length() :
// if the remote system - take the radius of the planet
parent->GetRadius());
// if we look at the current system, the relief is known, we take the height from the physical body
Pi::game->GetSpace()->FindBodyForPath(&(starport->GetPath()))->GetPosition().Length() :
// if the remote system - take the radius of the planet
parent->GetRadius());
Web-eWorks marked this conversation as resolved.
Show resolved Hide resolved
}

void SystemView::PutBody(const SystemBody *b, const vector3d &offset, const matrix4x4f &trans)
Expand Down Expand Up @@ -486,7 +486,8 @@ void SystemView::Update()
AnimationCurves::Approach(m_rot_y, m_rot_y_to, ft);

// to capture mouse when button was pressed and release when released
if (Pi::input->MouseButtonState(SDL_BUTTON_MIDDLE) != m_rotateWithMouseButton) {
#pragma message("FIX: warning comparing int with bool")
if (bool(Pi::input->MouseButtonState(SDL_BUTTON_MIDDLE)) != m_rotateWithMouseButton) {
m_rotateWithMouseButton = !m_rotateWithMouseButton;
Pi::input->SetCapturingMouse(m_rotateWithMouseButton);
}
Expand Down
15 changes: 11 additions & 4 deletions src/collider/GeomTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#include "Weld.h"
#include "scenegraph/Serializer.h"

#pragma message("FIX: warning unknown pragma")
#ifdef __GNUC__
#pragma GCC optimize("O3")
#endif /* __GNUC__ */
Web-eWorks marked this conversation as resolved.
Show resolved Hide resolved

GeomTree::~GeomTree()
{
Expand Down Expand Up @@ -57,7 +60,8 @@ GeomTree::GeomTree(const int numVerts, const int numTris, const std::vector<vect
std::vector<Uint32> xrefs;
nv::Weld<vector3f> weld;
weld(m_vertices, xrefs);
m_numVertices = m_vertices.size();
#pragma message("FIX: warning of data loss (x64)")
m_numVertices = 0xFFFFFFFF & m_vertices.size();

//Output("--- %d vertices welded\n", count - newCount);

Expand Down Expand Up @@ -109,12 +113,14 @@ GeomTree::GeomTree(const int numVerts, const int numTris, const std::vector<vect
}

//int t = SDL_GetTicks();
m_triTree.reset(new BVHTree(activeTris.size(), &activeTris[0], aabbs));
#pragma message("FIX: warning of data loss (x64)")
m_triTree.reset(new BVHTree(int(activeTris.size()), &activeTris[0], aabbs));
delete[] aabbs;
}
//Output("Tri tree of %d tris build in %dms\n", activeTris.size(), SDL_GetTicks() - t);

m_numEdges = edges.size();
#pragma message("FIX: warning of data loss (x64)")
m_numEdges = int32_t(edges.size());
m_edges.resize(m_numEdges);
// to build Edge bvh tree with.
m_aabbs.resize(m_numEdges);
Expand Down Expand Up @@ -212,7 +218,8 @@ GeomTree::GeomTree(Serializer::Reader &rd)
aabbs[i].Update(v2);
aabbs[i].Update(v3);
}
m_triTree.reset(new BVHTree(activeTris.size(), &activeTris[0], aabbs));
#pragma message("FIX: warning of data loss (x64)")
m_triTree.reset(new BVHTree(int(activeTris.size()), &activeTris[0], aabbs));
delete[] aabbs;

//
Expand Down
9 changes: 5 additions & 4 deletions src/collider/Weld.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ namespace nv {
// xrefs maps old elements to new elements
Uint32 operator()(std::vector<T> &p, std::vector<Uint32> &xrefs)
{
const Uint32 N = p.size(); // # of input vertices.
Uint32 outputCount = 0; // # of output vertices
Uint32 hashSize = nextPowerOfTwo(N); // size of the hash table
#pragma message("FIX: warning of data loss (x64)")
const Uint32 N = uint32_t(p.size()); // # of input vertices.
Uint32 outputCount = 0; // # of output vertices
Uint32 hashSize = nextPowerOfTwo(N); // size of the hash table
Uint32 *hashTable = new Uint32[hashSize + N]; // hash table + linked list
Uint32 *next = hashTable + hashSize; // use bottom part as linked list
Uint32 *next = hashTable + hashSize; // use bottom part as linked list

xrefs.resize(N);
memset(hashTable, NIL, (hashSize + N) * sizeof(Uint32)); // init hash table (NIL = 0xFFFFFFFF so memset works)
Expand Down
9 changes: 9 additions & 0 deletions src/galaxy/SystemPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ static int ParseInt(const std::string &str)
int i = 0;
try {
i = std::stoi(str);
#ifndef __GNUC__
/* GCC doesnt know pragma warning push/disable/pop */
#pragma message("FIX: warning of unused variable")
#pragma warning(push)
#pragma warning(disable : 4101)
#endif /* __GNUC__ */
} catch (const std::invalid_argument &e) {
throw SystemPath::ParseFailure();
}
#ifndef __GNUC__
#pragma warning(pop)
#endif /* __GNUC__ */
Web-eWorks marked this conversation as resolved.
Show resolved Hide resolved
return i;
}

Expand Down
9 changes: 6 additions & 3 deletions src/graphics/opengl/Program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,22 @@ namespace Graphics {
void AppendSource(const char *str)
{
blocks.push_back(str);
block_sizes.push_back(std::strlen(str));
#pragma message("FIX: warning of data loss (x64)")
block_sizes.push_back(int(std::strlen(str)));
}

void AppendSource(StringRange str)
{
blocks.push_back(str.begin);
block_sizes.push_back(str.Size());
#pragma message("FIX: warning of data loss (x64)")
block_sizes.push_back(int(str.Size()));
}

void Compile(GLuint shader_id)
{
assert(blocks.size() == block_sizes.size());
glShaderSource(shader_id, blocks.size(), &blocks[0], &block_sizes[0]);
#pragma message("FIX: warning of data loss (x64)")
glShaderSource(shader_id, GLsizei(blocks.size()), &blocks[0], &block_sizes[0]);
glCompileShader(shader_id);
}

Expand Down
10 changes: 6 additions & 4 deletions src/graphics/opengl/RendererGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ namespace Graphics {
if (!m_windowRenderTarget->CheckStatus()) {
GLuint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
Log::Fatal("Pioneer window render target is invalid. (Error: {})\n"
"Does your graphics driver support multisample anti-aliasing?\n"
"If this issue persists, try setting AntiAliasingMode=0 in your config file.\n",
"Does your graphics driver support multisample anti-aliasing?\n"
"If this issue persists, try setting AntiAliasingMode=0 in your config file.\n",
gl_framebuffer_error_to_string(status));
}

Expand Down Expand Up @@ -541,15 +541,17 @@ namespace Graphics {
buffer.vtxBuffer->Reset();
}

stat.SetStatCount(Stats::STAT_DYNAMIC_DRAW_BUFFER_INUSE, s_DynamicDrawBufferMap.size());
#pragma message("FIX: warning of data loss (x64)")
stat.SetStatCount(Stats::STAT_DYNAMIC_DRAW_BUFFER_INUSE, uint32_t(s_DynamicDrawBufferMap.size()));
stat.SetStatCount(Stats::STAT_DRAW_UNIFORM_BUFFER_INUSE, uint32_t(m_drawUniformBuffers.size()));
stat.SetStatCount(Stats::STAT_DRAW_UNIFORM_BUFFER_ALLOCS, numAllocs);

uint32_t numShaderPrograms = 0;
for (auto &pair : m_shaders)
numShaderPrograms += pair.second->GetNumVariants();

stat.SetStatCount(Stats::STAT_NUM_RENDER_STATES, m_renderStateCache->m_stateDescCache.size());
#pragma message("FIX: warning of data loss (x64)")
stat.SetStatCount(Stats::STAT_NUM_RENDER_STATES, uint32_t(m_renderStateCache->m_stateDescCache.size()));
stat.SetStatCount(Stats::STAT_NUM_SHADER_PROGRAMS, numShaderPrograms);

return true;
Expand Down
6 changes: 5 additions & 1 deletion src/graphics/opengl/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ namespace Graphics {
void Reload();

Program *GetProgramForDesc(const MaterialDescriptor &desc);
uint32_t GetNumVariants() const { return m_variants.size(); }
#pragma message("FIX: warning of data loss (x64)")
uint32_t GetNumVariants() const
{
return uint32_t(m_variants.size());
}

TextureBindingData GetTextureBindingInfo(size_t name) const;
size_t GetNumTextureBindings() const { return m_textureBindingInfo.size(); }
Expand Down
12 changes: 8 additions & 4 deletions src/scenegraph/Serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ namespace Serializer {

void writeObject(const std::string &obj)
{
writeObject<Uint32>(obj.size());
#pragma message("FIX: warning of data loss (x64)")
writeObject<Uint32>(uint32_t(obj.size()));
m_str.append(obj.c_str(), obj.size());
}

Expand All @@ -56,7 +57,8 @@ namespace Serializer {
return;
}

Uint32 len = strlen(s);
#pragma message("FIX: warning of data loss (x64)")
uint32_t len = uint32_t(strlen(s));
*this << len;
m_str.append(s, len);
}
Expand All @@ -80,7 +82,8 @@ namespace Serializer {
void Blob(ByteRange range)
{
assert(range.Size() < SDL_MAX_UINT32);
Int32(range.Size());
#pragma message("FIX: warning of data loss (x64)")
Int32(uint32_t(range.Size()));
if (range.Size()) {
m_str.append(range.begin, range.Size());
}
Expand Down Expand Up @@ -179,7 +182,8 @@ namespace Serializer {

ByteRange Blob()
{
auto len = Int32();
#pragma message("FIX: signed/unsigned mismatch")
int32_t len = Int32();
if (len == 0) return ByteRange();
if (len > (m_data.end - m_at))
throw std::out_of_range("Serializer::Reader encountered truncated stream.");
Expand Down
6 changes: 4 additions & 2 deletions src/text/TextSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace Text {
do {
++str;
} while ((*str & 0xC0) == 0x80);
return (str - start);
#pragma message("FIX: warning of data loss (x64)")
return int(str - start);
} else
return 1;
}
Expand All @@ -57,7 +58,8 @@ namespace Text {
while ((str > begin) && ((*str & 0xC0) == 0x80)) {
--str;
}
return (start - str);
#pragma message("FIX: warning of data loss (x64)")
return int(start - str);
} else
return 1;
}
Expand Down
6 changes: 4 additions & 2 deletions src/win32/TextUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
std::wstring transcode_utf8_to_utf16(const char *s, size_t nbytes)
{
std::wstring buf(nbytes, L'x');
int reqchars = MultiByteToWideChar(CP_UTF8, 0, s, nbytes, &buf[0], buf.size());
#pragma message("FIX: warning of data loss (x64)")
int reqchars = MultiByteToWideChar(CP_UTF8, 0, s, int(nbytes), &buf[0], int(buf.size()));
if (!reqchars) {
fprintf(stderr, "failed to transcode UTF-8 to UTF-16\n");
abort();
Expand All @@ -29,7 +30,8 @@ std::wstring transcode_utf8_to_utf16(const std::string &s)
std::string transcode_utf16_to_utf8(const wchar_t *s, size_t nchars)
{
std::string buf(nchars * 2, 'x');
int reqbytes = WideCharToMultiByte(CP_UTF8, 0, s, nchars, &buf[0], buf.size(), 0, 0);
#pragma message("FIX: warning of data loss (x64)")
int reqbytes = WideCharToMultiByte(CP_UTF8, 0, s, int(nchars), &buf[0], int(buf.size()), 0, 0);
if (!reqbytes) {
fprintf(stderr, "failed to transcode UTF-16 to UTF-8\n");
abort();
Expand Down