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 all 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
15 changes: 10 additions & 5 deletions contrib/base64/base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Base64 {

out->resize(EncodedLength(in));

int input_len = in.size();
#pragma message("FIX: warning of data loss (x64)")
int input_len = int(in.size());
std::string::const_iterator input = in.begin();

while (input_len--) {
Expand Down Expand Up @@ -125,7 +126,8 @@ class Base64 {
unsigned char a3[3];
unsigned char a4[4];

int input_len = in.size();
#pragma message("FIX: warning of data loss (x64)")
int input_len = int(in.size());
std::string::const_iterator input = in.begin();

out->resize(DecodedLength(in));
Expand Down Expand Up @@ -226,12 +228,14 @@ class Base64 {
const char *in_end = in + in_length;
while (*--in_end == '=') ++numEq;

return ((6 * in_length) / 8) - numEq;
#pragma message("FIX: warning of data loss (x64)")
return int(((6 * in_length) / 8) - numEq);
}

static int DecodedLength(const std::string &in) {
int numEq = 0;
int n = in.size();
#pragma message("FIX: warning of data loss (x64)")
int n = int(in.size());

for (std::string::const_reverse_iterator it = in.rbegin(); *it == '='; ++it) {
++numEq;
Expand All @@ -241,7 +245,8 @@ class Base64 {
}

inline static int EncodedLength(size_t length) {
return (length + 2 - ((length + 2) % 3)) / 3 * 4;
#pragma message("FIX: warning of data loss (x64)")
return int((length + 2 - ((length + 2) % 3)) / 3 * 4);
}

inline static int EncodedLength(const std::string &in) {
Expand Down
3 changes: 2 additions & 1 deletion contrib/profiler/Profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ namespace Profiler {
f64 milliseconds() { return ms(ticks); }
f64 currentmilliseconds() { return ms(ticks + (getticks() - started)); }
f64 avg() { return average(ticks, calls); }
f64 avgms() { return ms(average(ticks, calls)); }
#pragma message("FIX: warning of data loss (x64)")
f64 avgms() { return ms(u64(average(ticks, calls))); }

void operator+=(const Clock &b)
{
Expand Down
3 changes: 2 additions & 1 deletion src/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ namespace FileSystem {
assert((m_path.size() <= 1) || (m_path[m_path.size() - 1] != '/'));
std::size_t slashpos = m_path.rfind('/');
if (slashpos != std::string::npos) {
m_dirLen = slashpos + 1;
#pragma message("FIX: warning of data loss (x64)")
m_dirLen = int(slashpos + 1);
} else {
m_dirLen = 0;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ void Player::StaticUpdate(const float timeStep)
{
Ship::StaticUpdate(timeStep);

for (size_t i = 0; i < GUNMOUNT_MAX; i++)
#pragma message("FIX: warning of data loss (x64)")
for (int i = 0; i < GUNMOUNT_MAX; i++)
if (GetFixedGuns()->IsGunMounted(i))
GetFixedGuns()->UpdateLead(timeStep, i, this, GetCombatTarget());

Expand Down
3 changes: 2 additions & 1 deletion src/SDLWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SDLSurfacePtr LoadSurfaceFromFile(const std::string &fname, FileSystem::FileSour
return SDLSurfacePtr();
}

SDL_RWops *datastream = SDL_RWFromConstMem(filedata->GetData(), filedata->GetSize());
#pragma message("FIX: warning of data loss (x64)")
SDL_RWops *datastream = SDL_RWFromConstMem(filedata->GetData(), int(filedata->GetSize()));
SDL_Surface *surface = IMG_Load_RW(datastream, 1);
if (!surface) {
Output("LoadSurfaceFromFile: %s: %s\n", fname.c_str(), IMG_GetError());
Expand Down
9 changes: 6 additions & 3 deletions src/SectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,8 @@ void SectorView::SetupRouteLines(const vector3f &playerAbsPos)
m_setupRouteLines = false;

std::unique_ptr<Graphics::VertexArray> verts;
verts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, m_route.size() * 2));
#pragma message("FIX: warning of data loss (x64)")
verts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, int(m_route.size()) * 2));
verts->Clear();

vector3f startPos = playerAbsPos;
Expand Down Expand Up @@ -1252,7 +1253,8 @@ void SectorView::DrawFarSectors(const matrix4x4f &modelview)

// always draw the stars, slightly altering their size for different different resolutions, so they still look okay
if (m_farstars.size() > 0) {
m_farstarsPoints.SetData(m_renderer, m_farstars.size(), &m_farstars[0], &m_farstarsColor[0], modelview, 0.25f * (Graphics::GetScreenHeight() / 720.f));
#pragma message("FIX: warning of data loss (x64)")
m_farstarsPoints.SetData(m_renderer, int(m_farstars.size()), &m_farstars[0], &m_farstarsColor[0], modelview, 0.25f * (Graphics::GetScreenHeight() / 720.f));
m_farstarsPoints.Draw(m_renderer, m_farStarsMat.Get());
}

Expand Down Expand Up @@ -1346,7 +1348,8 @@ void SectorView::Update()
if (InputBindings.mapViewPitch->IsActive()) m_rotXMovingTo += 0.5f * moveSpeed * InputBindings.mapViewPitch->GetValue();

// 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
3 changes: 2 additions & 1 deletion src/SectorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

class Game;
class Galaxy;
class ImDrawList;
#pragma message("FIX: struct declared as class")
struct ImDrawList;

class SectorView : public PiGuiView, public DeleteEmitter {
public:
Expand Down
3 changes: 2 additions & 1 deletion src/Sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ void SfxManager::RenderAll(Renderer *renderer, FrameId fId, FrameId camFrameId)
}

// NB - we're (ab)using the normal type to hold (uv coordinate offset value + point size)
Graphics::VertexArray pointArray(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_NORMAL, numInstances);
#pragma message("FIX: warning of data loss (x64)")
Graphics::VertexArray pointArray(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_NORMAL, int(numInstances));

for (size_t i = 0; i < numInstances; i++) {
Sfx &inst(f->m_sfx->GetInstanceByIndex(SFX_TYPE(t), i));
Expand Down
3 changes: 2 additions & 1 deletion src/Shields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ void Shields::Update(const float coolDown, const float shieldStrength)
// setup the render params
// FIXME: don't use a static variable to hold all of this
if (shieldStrength > 0.0f) {
Uint32 numHits = std::min(m_hits.size(), MAX_SHIELD_HITS);
#pragma message("FIX: warning of data loss (x64)")
Uint32 numHits = uint32_t(std::min(m_hits.size(), MAX_SHIELD_HITS));
for (Uint32 i = 0; i < numHits; ++i) {
const Hits &hit = m_hits[i];

Expand Down
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
3 changes: 2 additions & 1 deletion src/StringF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ FormatSpec::FormatSpec(const char *format_) :
format(format_)
{
assert(format_);
parseFormat(strlen(format));
#pragma message("FIX: warning of data loss (x64)")
parseFormat(int(strlen(format)));
}

FormatSpec::FormatSpec(const char *format_, int formatlen_) :
Expand Down
14 changes: 8 additions & 6 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 Expand Up @@ -573,7 +574,8 @@ void SystemView::DrawGrid()
double diameter = std::floor(m_system->GetRootBody()->GetMaxChildOrbitalDistance() * 1.2 / AU);
m_grid_lines = int(diameter) + 1;

m_lineVerts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, m_grid_lines * 4 + (m_gridDrawing == GridDrawing::GRID_AND_LEGS ? m_projected.size() * 2 : 0)));
#pragma message("FIX: warning of data loss (x64)")
m_lineVerts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, m_grid_lines * 4 + (m_gridDrawing == GridDrawing::GRID_AND_LEGS ? int(m_projected.size()) * 2 : 0)));

float zoom = float(AU);
vector3d pos = m_trans;
Expand Down
3 changes: 2 additions & 1 deletion src/Tombstone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void Tombstone::Draw(float _time)
m_renderer->SetTransform(matrix4x4f::Identity());

m_renderer->SetAmbientColor(m_ambientColor);
m_renderer->SetLights(m_lights.size(), &m_lights[0]);
#pragma message("FIX: warning of data loss (x64)")
m_renderer->SetLights(uint32_t(m_lights.size()), &m_lights[0]);

matrix4x4f rot = matrix4x4f::RotateYMatrix(_time * 2);
rot[14] = -std::max(150.0f - 30.0f * _time, 30.0f);
Expand Down
19 changes: 15 additions & 4 deletions src/collider/GeomTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#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
#ifdef _MSC_BUILD
#pragma message("collider/GeomTree.cpp: OPTIMIZE OVERRIDE: Turning on full optimizations for MSVC")
#pragma optimize("O2b2ity", on)
#endif /* _MSC_BUILD */

GeomTree::~GeomTree()
{
Expand Down Expand Up @@ -57,7 +64,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 +117,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 +222,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
3 changes: 2 additions & 1 deletion src/galaxy/SystemPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ static int ParseInt(const std::string &str)
int i = 0;
try {
i = std::stoi(str);
} catch (const std::invalid_argument &e) {
#pragma message("FIX: warning of unused variable")
} catch (const std::invalid_argument &) {
throw SystemPath::ParseFailure();
}
return i;
Expand Down
3 changes: 2 additions & 1 deletion src/graphics/Drawables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ namespace Graphics {
}

//Create vtx & index buffers and copy data
Graphics::IndexBuffer *indexBuffer = renderer->CreateIndexBuffer(indices.size(), BUFFER_USAGE_STATIC);
#pragma message("FIX: warning of data loss (x64)")
Graphics::IndexBuffer *indexBuffer = renderer->CreateIndexBuffer(uint32_t(indices.size()), BUFFER_USAGE_STATIC);
Uint32 *idxPtr = indexBuffer->Map(Graphics::BUFFER_MAP_WRITE);
for (auto it : indices) {
*idxPtr = it;
Expand Down
12 changes: 8 additions & 4 deletions src/graphics/opengl/MaterialGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,26 @@ namespace Graphics {
m_activeVariant = s->GetProgramForDesc(GetDescriptor());

// Allocate storage for texture bindings
GLuint numTextureBindings = s->GetNumTextureBindings();
#pragma message("FIX: warning of data loss (x64)")
GLuint numTextureBindings = GLuint(s->GetNumTextureBindings());
if (numTextureBindings) {
m_textureBindings.reset(new Texture *[numTextureBindings]);
for (GLuint i = 0; i < numTextureBindings; i++)
m_textureBindings.get()[i] = nullptr;
}

// Allocate storage for buffer bindings
GLuint numBufferBindings = s->GetNumBufferBindings();
#pragma message("FIX: warning of data loss (x64)")
GLuint numBufferBindings = GLuint(s->GetNumBufferBindings());
if (numBufferBindings) {
m_bufferBindings.reset(new BufferBinding<UniformBuffer>[numBufferBindings]);
for (GLuint i = 0; i < numBufferBindings; i++)
m_bufferBindings.get()[i] = { nullptr, 0, 0 };
}

// Allocate storage for push constants
GLuint constantStorageSize = s->GetConstantStorageSize();
#pragma message("FIX: warning of data loss (x64)")
GLuint constantStorageSize = GLuint(s->GetConstantStorageSize());
if (constantStorageSize) {
m_pushConstants.reset(new char[constantStorageSize]);
std::fill_n(m_pushConstants.get(), constantStorageSize, '\0');
Expand Down Expand Up @@ -199,7 +202,8 @@ namespace Graphics {

auto &bufferSlot = m_bufferBindings[info.index];

auto allocation = m_renderer->GetDrawUniformBuffer(size)->Allocate(buffer, size);
#pragma message("FIX: warning of data loss (x64)")
auto allocation = m_renderer->GetDrawUniformBuffer(uint32_t(size))->Allocate(buffer, size);
bufferSlot.buffer = allocation.buffer;
bufferSlot.offset = allocation.offset;
bufferSlot.size = allocation.size;
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
Loading