Fix compilation and some warnings

This commit is contained in:
Jérôme Leclercq 2017-10-02 16:18:15 +02:00
parent 40a678889d
commit 99d21b8722
7 changed files with 32 additions and 11 deletions

View File

@ -90,8 +90,8 @@ namespace Nz
void UnboundedSet(std::size_t bit, bool val = true);
bool UnboundedTest(std::size_t bit) const;
Bit operator[](int index);
bool operator[](int index) const;
Bit operator[](std::size_t index);
bool operator[](std::size_t index) const;
Bitset operator~() const;

View File

@ -958,7 +958,7 @@ namespace Nz
*/
template<typename Block, class Allocator>
typename Bitset<Block, Allocator>::Bit Bitset<Block, Allocator>::operator[](int index)
typename Bitset<Block, Allocator>::Bit Bitset<Block, Allocator>::operator[](std::size_t index)
{
return Bit(m_blocks[GetBlockIndex(index)], Block(1U) << GetBitIndex(index));
}
@ -969,7 +969,7 @@ namespace Nz
*/
template<typename Block, class Allocator>
bool Bitset<Block, Allocator>::operator[](int index) const
bool Bitset<Block, Allocator>::operator[](std::size_t index) const
{
return Test(index);
}

View File

@ -25,6 +25,7 @@ namespace Nz
SparsePtr();
SparsePtr(T* ptr);
SparsePtr(VoidPtr ptr, int stride);
SparsePtr(VoidPtr ptr, std::size_t stride);
template<typename U> SparsePtr(const SparsePtr<U>& ptr);
SparsePtr(const SparsePtr& ptr) = default;
~SparsePtr() = default;

View File

@ -2,7 +2,10 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/SparsePtr.hpp>
#include <cassert>
#include <iterator>
#include <limits>
#include <Nazara/Core/Debug.hpp>
namespace Nz
@ -48,6 +51,22 @@ namespace Nz
Reset(ptr, stride);
}
/*!
* \brief Constructs a SparsePtr object with a pointer and a step
*
* \param ptr Pointer to data
* \param stride Step between two elements
*
* \remark This constructor only exists because std::size_t is a frequent type for constructing this object, but stride may not be higher than int max
*/
template<typename T>
SparsePtr<T>::SparsePtr(VoidPtr ptr, std::size_t stride)
{
assert(stride <= std::numeric_limits<int>::max());
Reset(ptr, static_cast<int>(stride));
}
/*!
* \brief Constructs a SparsePtr object from another type of SparsePtr
*

View File

@ -1,4 +1,4 @@
// Copyright (C) 2017 Jérôme Leclercq
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
@ -21,8 +21,8 @@
namespace Nz
{
class Joint;
class VertexStruct_XYZ_Normal_UV_Tangent;
class VertexStruct_XYZ_Normal_UV_Tangent_Skinning;
struct VertexStruct_XYZ_Normal_UV_Tangent;
struct VertexStruct_XYZ_Normal_UV_Tangent_Skinning;
using MeshVertex = VertexStruct_XYZ_Normal_UV_Tangent;
using SkeletalMeshVertex = VertexStruct_XYZ_Normal_UV_Tangent_Skinning;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2017 Jérôme Leclercq
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
@ -20,6 +20,7 @@
#include <Nazara/Math/Box.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
namespace Nz
@ -52,8 +53,8 @@ namespace Nz
class Skeleton;
class SubMesh;
typedef VertexStruct_XYZ_Normal_UV_Tangent MeshVertex;
typedef VertexStruct_XYZ_Normal_UV_Tangent_Skinning SkeletalMeshVertex;
using MeshVertex = VertexStruct_XYZ_Normal_UV_Tangent;
using SkeletalMeshVertex = VertexStruct_XYZ_Normal_UV_Tangent_Skinning;
using MeshConstRef = ObjectRef<const Mesh>;
using MeshLibrary = ObjectLibrary<Mesh>;

View File

@ -161,7 +161,7 @@ namespace Nz
#endif
const char* tmp = source.GetConstBuffer();
GLint length = source.GetSize();
GLint length = static_cast<GLint>(source.GetSize());
glShaderSource(m_id, 1, &tmp, &length);
}