Fix some GCC warnings

Former-commit-id: 31c8460b4656c29ac165d7aa28f335851f2565df
This commit is contained in:
Lynix
2016-05-25 13:52:10 +02:00
parent 840b03691a
commit 8a3339badf
19 changed files with 113 additions and 54 deletions

View File

@@ -78,7 +78,7 @@ namespace Nz
* \param v Object to hash
*
* \remark a HashAppend specialization for type T is required
*
*
* \see ComputeHash
*/
template<typename T>
@@ -178,7 +178,7 @@ namespace Nz
{
T reversed = 0;
for (std::size_t i = 0; i < sizeof(T); ++i)
reversed |= T(Detail::BitReverseTable256[(integer >> i * 8) & 0xFF]) << sizeof(T) * 8 - (i + 1) * 8;
reversed |= T(Detail::BitReverseTable256[(integer >> i * 8) & 0xFF]) << (sizeof(T) * 8 - (i + 1) * 8);
return reversed;
}

View File

@@ -13,6 +13,7 @@ namespace Nz
template<typename T>
HandledObject<T>::HandledObject(const HandledObject& object)
{
NazaraUnused(object);
// Don't copy anything, we're a copy of the object, we have no handle right now
}
@@ -40,7 +41,7 @@ namespace Nz
HandledObject<T>& HandledObject<T>::operator=(const HandledObject& object)
{
// Nothing to do
return *this;
return *this;
}
template<typename T>

View File

@@ -9,9 +9,9 @@ namespace Nz
{
inline Light::Light(const Light& light) :
Renderable(light),
m_color(light.m_color),
m_type(light.m_type),
m_shadowMapFormat(light.m_shadowMapFormat),
m_color(light.m_color),
m_shadowMapSize(light.m_shadowMapSize),
m_shadowCastingEnabled(light.m_shadowCastingEnabled),
m_shadowMapUpdated(false),

View File

@@ -21,6 +21,8 @@ namespace Nz
{
SetConstructor([] (Nz::LuaInstance& lua, T* instance)
{
NazaraUnused(lua);
PlacementNew(instance);
return true;
});
@@ -132,9 +134,9 @@ namespace Nz
lua.SetField(pair.first); // Method name
}
m_info->instanceGetters[m_info->name] = [info = m_info] (LuaInstance& lua)
m_info->instanceGetters[m_info->name] = [info = m_info] (LuaInstance& instance)
{
return static_cast<T*>(lua.CheckUserdata(1, info->name));
return static_cast<T*>(instance.CheckUserdata(1, info->name));
};
}
lua.Pop(); // On pop la metatable
@@ -391,11 +393,11 @@ namespace Nz
if (!lua.IsValid(-1))
{
for (const ParentFunc& getter : info->parentGetters)
for (const ParentFunc& parentGetter : info->parentGetters)
{
lua.Pop(); //< Pop the last nil value
getter(lua, instance);
parentGetter(lua, instance);
if (lua.IsValid(-1))
return;
}

View File

@@ -224,7 +224,7 @@ namespace std
// This is SDBM adapted for IP addresses, tested to generate the least collisions possible
// (It doesn't mean it cannot be improved though)
std::size_t hash = 0;
std::size_t h = 0;
switch (ip.GetProtocol())
{
case Nz::NetProtocol_Any:
@@ -233,20 +233,20 @@ namespace std
case Nz::NetProtocol_IPv4:
{
hash = ip.ToUInt32() + (hash << 6) + (hash << 16) - hash;
h = ip.ToUInt32() + (h << 6) + (h << 16) - h;
break;
}
case Nz::NetProtocol_IPv6:
{
Nz::IpAddress::IPv6 v6 = ip.ToIPv6();
for (std::size_t i = 0; i < v6.size(); i++)
hash = v6[i] + (hash << 6) + (hash << 16) - hash;
h = v6[i] + (h << 6) + (h << 16) - h;
break;
}
}
return ip.GetPort() + (hash << 6) + (hash << 16) - hash;
return ip.GetPort() + (h << 6) + (h << 16) - h;
}
};
}

View File

@@ -79,8 +79,8 @@ namespace Nz
PendingPacket m_pendingPacket;
UInt64 m_keepAliveInterval;
UInt64 m_keepAliveTime;
bool m_isLowDelayEnabled;
bool m_isKeepAliveEnabled;
bool m_isLowDelayEnabled;
};
}

View File

@@ -12,29 +12,29 @@
namespace Nz
{
inline PixelFormatInfo::PixelFormatInfo() :
bitsPerPixel(0),
content(PixelFormatContent_Undefined)
content(PixelFormatContent_Undefined),
bitsPerPixel(0)
{
}
inline PixelFormatInfo::PixelFormatInfo(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
bitsPerPixel(bpp),
content(formatContent),
redType(subType),
greenType(subType),
blueType(subType),
alphaType(subType)
{
}
inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
bitsPerPixel(bpp),
content(formatContent),
redType(subType),
greenType(subType),
blueType(subType),
alphaType(subType),
name(formatName)
bitsPerPixel(bpp)
{
}
inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
content(formatContent),
redType(subType),
greenType(subType),
blueType(subType),
alphaType(subType),
name(formatName),
bitsPerPixel(bpp)
{
}