Fix some warnings

master
MoNTE48 2019-10-11 20:21:22 +02:00
parent c6d149224e
commit 0dbf454870
9 changed files with 16 additions and 12 deletions

View File

@ -1,7 +1,9 @@
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#ifndef USE_CMAKE_CONFIG_H
#define USE_CMAKE_CONFIG_H
#endif
#include "config.h"
#undef USE_CMAKE_CONFIG_H

View File

@ -721,9 +721,12 @@ include(CheckCXXCompilerFlag)
if(MSVC)
# Visual Studio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D /MP")
# EHa enables SEH exceptions (used for catching segfaults)
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE")
endif()
#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF")

View File

@ -997,8 +997,8 @@ std::string analyze_block(MapBlock *block)
std::ostringstream desc;
v3s16 p = block->getPos();
char spos[20];
snprintf(spos, 20, "(%2d,%2d,%2d), ", p.X, p.Y, p.Z);
char spos[25];
snprintf(spos, sizeof(spos), "(%2d,%2d,%2d), ", p.X, p.Y, p.Z);
desc<<spos;
switch(block->getModified())

View File

@ -56,7 +56,7 @@ void SchematicManager::clear()
DecoSchematic *dschem = dynamic_cast<DecoSchematic *>(deco);
if (dschem)
dschem->schematic = NULL;
} catch (std::bad_cast) {
} catch (const std::bad_cast &) {
}
}

View File

@ -373,7 +373,7 @@ Json::Value getModstoreUrl(const std::string &url)
try {
special_http_header = g_settings->getBool("modstore_disable_special_http_header");
} catch (SettingNotFoundException) {}
} catch (SettingNotFoundException&) {}
if (special_http_header) {
extra_headers.push_back("Accept: application/vnd.minetest.mmdb-v1+json");

View File

@ -804,7 +804,6 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
else if (waving == 2)
special_material = TILE_MATERIAL_WAVING_LEAVES;
}
u32 special_shader = shdsrc->getShader("nodes_shader", special_material, drawtype);
// Special tiles (fill in f->special_tiles[])
for (u16 j = 0; j < CF_SPECIAL_COUNT; j++) {

View File

@ -123,7 +123,7 @@ struct NoiseParams {
flags = NOISE_FLAG_DEFAULTS;
}
NoiseParams(float offset_, float scale_, v3f spread_, s32 seed_,
NoiseParams(float offset_, float scale_, const v3f &spread_, s32 seed_,
u16 octaves_, float persist_, float lacunarity_,
u32 flags_=NOISE_FLAG_DEFAULTS)
{

View File

@ -130,7 +130,7 @@ int ModApiServer::l_get_player_ip(lua_State *L)
lua_pushstring(L, ip_str.c_str());
return 1;
}
catch(con::PeerNotFoundException) // unlikely
catch(const con::PeerNotFoundException &e) // unlikely
{
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
lua_pushnil(L); // error
@ -155,7 +155,7 @@ int ModApiServer::l_get_player_information(lua_State *L)
{
addr = getServer(L)->getPeerAddress(player->peer_id);
}
catch(con::PeerNotFoundException) // unlikely
catch(const con::PeerNotFoundException &e) // unlikely
{
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
lua_pushnil(L); // error
@ -297,7 +297,7 @@ int ModApiServer::l_ban_player(lua_State *L)
std::string ip_str = addr.serializeString();
getServer(L)->setIpBanned(ip_str, name);
}
catch(con::PeerNotFoundException) // unlikely
catch(const con::PeerNotFoundException &e) // unlikely
{
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
lua_pushboolean(L, false); // error

View File

@ -1043,7 +1043,7 @@ void Server::Receive()
{
DSTACK(FUNCTION_NAME);
SharedBuffer<u8> data;
u16 peer_id;
u16 peer_id = 0;
try {
NetworkPacket pkt;
m_con.Receive(&pkt);