diff --git a/misc/winresource.rc b/misc/winresource.rc index b93c045f..6d7c4c9e 100644 --- a/misc/winresource.rc +++ b/misc/winresource.rc @@ -1,7 +1,9 @@ #include #include #include +#ifndef USE_CMAKE_CONFIG_H #define USE_CMAKE_CONFIG_H +#endif #include "config.h" #undef USE_CMAKE_CONFIG_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b9e3cd0..efa01e36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 535266ea..eff1baf6 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -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<getModified()) diff --git a/src/mg_schematic.cpp b/src/mg_schematic.cpp index db4206cf..f7194932 100644 --- a/src/mg_schematic.cpp +++ b/src/mg_schematic.cpp @@ -56,7 +56,7 @@ void SchematicManager::clear() DecoSchematic *dschem = dynamic_cast(deco); if (dschem) dschem->schematic = NULL; - } catch (std::bad_cast) { + } catch (const std::bad_cast &) { } } diff --git a/src/mods.cpp b/src/mods.cpp index b1029b6a..ff9628b0 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -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"); diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 5b07db4b..8b7c96a1 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -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++) { diff --git a/src/noise.h b/src/noise.h index 41b93ae0..3e811364 100644 --- a/src/noise.h +++ b/src/noise.h @@ -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) { diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp index e38a260b..3e9c9b03 100644 --- a/src/script/lua_api/l_server.cpp +++ b/src/script/lua_api/l_server.cpp @@ -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 diff --git a/src/server.cpp b/src/server.cpp index 78b0cc37..b9cd59d6 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1043,7 +1043,7 @@ void Server::Receive() { DSTACK(FUNCTION_NAME); SharedBuffer data; - u16 peer_id; + u16 peer_id = 0; try { NetworkPacket pkt; m_con.Receive(&pkt);