summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--CONTRIBUTING.md5
-rw-r--r--VC2013/CryptoPP.vcxproj1
-rw-r--r--VC2013/CryptoPP.vcxproj.filters6
-rw-r--r--VC2013/MCServer.vcxproj7
-rw-r--r--VC2013/MCServer.vcxproj.filters67
-rw-r--r--VC2013/ToLua.vcxproj1
-rw-r--r--VC2013/ToLua.vcxproj.filters3
-rw-r--r--lib/lua/CMakeLists.txt2
-rw-r--r--lib/sqlite/CMakeLists.txt2
-rw-r--r--lib/tolua++/Makefile341
-rw-r--r--src/Bindings/LuaState.cpp2
-rw-r--r--src/Bindings/ManualBindings.cpp1
-rw-r--r--src/BlockArea.cpp6
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp8
-rw-r--r--src/BlockEntities/HopperEntity.cpp1
-rw-r--r--src/ChunkMap.cpp2
-rw-r--r--src/Generating/Caves.cpp8
-rw-r--r--src/Generating/DistortedHeightmap.cpp3
-rw-r--r--src/Generating/FinishGen.cpp2
-rw-r--r--src/Generating/Ravines.cpp2
-rw-r--r--src/Globals.h15
-rw-r--r--src/HTTPServer/HTTPConnection.cpp2
-rw-r--r--src/HTTPServer/HTTPFormParser.cpp1
-rw-r--r--src/HTTPServer/MultipartParser.cpp2
-rw-r--r--src/HTTPServer/NameValueParser.cpp1
-rw-r--r--src/Item.cpp2
-rw-r--r--src/Item.h4
-rw-r--r--src/Items/ItemSeeds.h1
-rw-r--r--src/LightingThread.cpp2
-rw-r--r--src/LineBlockTracer.cpp2
-rw-r--r--src/Protocol/Protocol132.cpp4
-rw-r--r--src/Protocol/Protocol132.h4
-rw-r--r--src/Protocol/Protocol15x.cpp2
-rw-r--r--src/Protocol/Protocol17x.cpp3
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp2
-rw-r--r--src/Server.cpp2
-rw-r--r--src/StringCompression.cpp4
-rw-r--r--src/StringUtils.cpp50
-rw-r--r--src/StringUtils.h3
-rw-r--r--src/UI/SlotArea.cpp4
-rw-r--r--src/WorldStorage/FastNBT.cpp13
42 files changed, 169 insertions, 435 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 451854074..135826abc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,6 +97,17 @@ if (WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
endif()
+#On Unix we use two dynamic loading libraries dl and ltdl.
+#Preference is for dl on unknown systems as it is specified in POSIX
+#the dynamic loader is used by lua and sqllite.
+if (UNIX)
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+ set(DYNAMIC_LOADER ltdl)
+ else()
+ set(DYNAMIC_LOADER dl)
+ endif()
+endif()
+
# The Expat library is linked in statically, make the source files aware of that:
add_definitions(-DXML_STATIC)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5aba6ac9e..83173a6af 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,4 +1,3 @@
-
Code Stuff
----------
@@ -23,7 +22,9 @@ Code Stuff
- This helps prevent mistakes such as "if (a & 1 == 0)"
* White space is free, so use it freely
- "freely" as in "plentifully", not "arbitrarily"
- * Please leave the first line of all files blank, to get around an IDE bug.
+ * Each and every control statement deserves its braces. This helps maintainability later on when the file is edited, lines added or removed - the control logic doesn't break so easily.
+ * Please leave the first line of all source files blank, to get around an IDE bug.
+ * Also leave the last line of all source files blank (GCC and GIT can complain otherwise)
Copyright
diff --git a/VC2013/CryptoPP.vcxproj b/VC2013/CryptoPP.vcxproj
index 7ad8edaf6..6f7ddae0c 100644
--- a/VC2013/CryptoPP.vcxproj
+++ b/VC2013/CryptoPP.vcxproj
@@ -186,6 +186,7 @@
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
diff --git a/VC2013/CryptoPP.vcxproj.filters b/VC2013/CryptoPP.vcxproj.filters
index d9d18befa..becd042b8 100644
--- a/VC2013/CryptoPP.vcxproj.filters
+++ b/VC2013/CryptoPP.vcxproj.filters
@@ -2,15 +2,15 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
- <UniqueIdentifier>{de7b3b89-9cfa-4441-97a1-a41eb499d273}</UniqueIdentifier>
+ <UniqueIdentifier>{3c30caed-20a3-4bd8-b12e-fdd1e13455e5}</UniqueIdentifier>
<Extensions>.cpp</Extensions>
</Filter>
<Filter Include="Header Files">
- <UniqueIdentifier>{1ddea6e2-83c2-4c5f-962a-7ad7f117cc85}</UniqueIdentifier>
+ <UniqueIdentifier>{770573d2-b90d-43f4-ac1c-464ab10c46ec}</UniqueIdentifier>
<Extensions>.;.h</Extensions>
</Filter>
<Filter Include="Miscellaneous">
- <UniqueIdentifier>{41edc228-f641-4aea-ad4b-14a4918be0a3}</UniqueIdentifier>
+ <UniqueIdentifier>{1ac058bb-f217-4ac3-a14b-9c6ba021e030}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj
index 50a938ad2..9daecba07 100644
--- a/VC2013/MCServer.vcxproj
+++ b/VC2013/MCServer.vcxproj
@@ -224,7 +224,6 @@
<ResourceCompile Include="MCServer.rc" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\src\Entities\Floater.h" />
<ClInclude Include="resource_MCServer.h" />
<ClInclude Include="..\src\Authenticator.h" />
<ClInclude Include="..\src\BlockArea.h" />
@@ -234,7 +233,6 @@
<ClInclude Include="..\src\ByteBuffer.h" />
<ClInclude Include="..\src\ChatColor.h" />
<ClInclude Include="..\src\Chunk.h" />
- <ClInclude Include="..\src\Chunk.inl.h" />
<ClInclude Include="..\src\ChunkDef.h" />
<ClInclude Include="..\src\ChunkMap.h" />
<ClInclude Include="..\src\ChunkSender.h" />
@@ -325,6 +323,7 @@
<ClInclude Include="..\src\Entities\Entity.h" />
<ClInclude Include="..\src\Entities\ExpOrb.h" />
<ClInclude Include="..\src\Entities\FallingBlock.h" />
+ <ClInclude Include="..\src\Entities\Floater.h" />
<ClInclude Include="..\src\Entities\Minecart.h" />
<ClInclude Include="..\src\Entities\Pawn.h" />
<ClInclude Include="..\src\Entities\Pickup.h" />
@@ -351,6 +350,7 @@
<ClInclude Include="..\src\OSSupport\GZipFile.h" />
<ClInclude Include="..\src\OSSupport\IsThread.h" />
<ClInclude Include="..\src\OSSupport\ListenThread.h" />
+ <ClInclude Include="..\src\OSSupport\Queue.h" />
<ClInclude Include="..\src\OSSupport\Semaphore.h" />
<ClInclude Include="..\src\OSSupport\Sleep.h" />
<ClInclude Include="..\src\OSSupport\Socket.h" />
@@ -468,6 +468,7 @@
<ClInclude Include="..\src\Items\ItemComparator.h" />
<ClInclude Include="..\src\items\ItemDoor.h" />
<ClInclude Include="..\src\items\ItemDye.h" />
+ <ClInclude Include="..\src\Items\ItemFishingRod.h" />
<ClInclude Include="..\src\Items\ItemFlowerPot.h" />
<ClInclude Include="..\src\items\ItemFood.h" />
<ClInclude Include="..\src\items\ItemHandler.h" />
@@ -629,7 +630,6 @@
<ClCompile Include="..\src\Cuboid.cpp" />
<ClCompile Include="..\src\DeadlockDetect.cpp" />
<ClCompile Include="..\src\Enchantments.cpp" />
- <ClCompile Include="..\src\Entities\Floater.cpp" />
<ClCompile Include="..\src\FastRandom.cpp" />
<ClCompile Include="..\src\FurnaceRecipe.cpp" />
<ClCompile Include="..\src\Globals.cpp">
@@ -763,6 +763,7 @@
<ClCompile Include="..\src\Entities\Entity.cpp" />
<ClCompile Include="..\src\Entities\ExpOrb.cpp" />
<ClCompile Include="..\src\Entities\FallingBlock.cpp" />
+ <ClCompile Include="..\src\Entities\Floater.cpp" />
<ClCompile Include="..\src\Entities\Minecart.cpp" />
<ClCompile Include="..\src\Entities\Pawn.cpp" />
<ClCompile Include="..\src\Entities\Pickup.cpp" />
diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters
index 74ddfafa8..30e90a9b0 100644
--- a/VC2013/MCServer.vcxproj.filters
+++ b/VC2013/MCServer.vcxproj.filters
@@ -10,73 +10,73 @@
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\Mobs">
- <UniqueIdentifier>{977716f7-b383-498a-950f-49afc6d551f6}</UniqueIdentifier>
+ <UniqueIdentifier>{813698c3-b2c1-4f3d-a89c-7ac6239fff97}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Entities">
- <UniqueIdentifier>{14ac2998-63d0-4bb3-97e3-1bd0007ffc74}</UniqueIdentifier>
+ <UniqueIdentifier>{b120a538-d8b9-4576-8675-36cf01fd69fc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\UI">
- <UniqueIdentifier>{272cba2d-aa26-4c69-b6fa-94465078e351}</UniqueIdentifier>
+ <UniqueIdentifier>{85037cf1-81a5-47c7-8c2e-899ea706b8e7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Simulator">
- <UniqueIdentifier>{1fabcea5-dba3-4265-b691-5795c69c4471}</UniqueIdentifier>
+ <UniqueIdentifier>{46c9cb22-7c7f-4589-b9b2-1fc79d2bdbdf}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\OSSupport">
- <UniqueIdentifier>{c29beffd-33f6-44eb-8310-3e0462cdddf9}</UniqueIdentifier>
+ <UniqueIdentifier>{f12178cb-2ecb-4e48-9a8d-ba3e2e73cfbc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\OSSupport\Android Specific">
- <UniqueIdentifier>{430cae6d-cfb2-49a2-9fb2-614fde244868}</UniqueIdentifier>
+ <UniqueIdentifier>{488bc224-735f-405c-83de-870373cb52cb}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Bindings">
- <UniqueIdentifier>{87060076-8ef4-4535-88ee-7a609e4391ae}</UniqueIdentifier>
+ <UniqueIdentifier>{41c0d7c9-43b5-4d17-b50e-3c8ac3aa2905}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\External">
- <UniqueIdentifier>{4e33e863-d055-4476-bb95-efd5ebc115d3}</UniqueIdentifier>
+ <UniqueIdentifier>{2c71a15a-8c65-4be7-bdfb-e083f4841c4a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\WorldStorage">
- <UniqueIdentifier>{ae97007e-0940-4f87-9786-8ed1d201e52c}</UniqueIdentifier>
+ <UniqueIdentifier>{2227f719-f0ac-444e-af14-230853017c45}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Generating">
- <UniqueIdentifier>{99483c91-c76c-47c7-838d-ba25c2066c79}</UniqueIdentifier>
+ <UniqueIdentifier>{eb070b55-ba10-4bce-ba06-5d785a055e54}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Blocks">
- <UniqueIdentifier>{51b8f5f3-83b3-4068-8825-503f19b42542}</UniqueIdentifier>
+ <UniqueIdentifier>{779dac55-c718-4fe1-8b67-547d431b9ebc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Items">
- <UniqueIdentifier>{959da118-757d-44c1-a4bd-d3345cfeb637}</UniqueIdentifier>
+ <UniqueIdentifier>{89847a5d-608a-4137-a766-1557276b4fcf}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Protocol">
- <UniqueIdentifier>{be413233-b7df-4ef1-9eb3-8aa1de96bf3e}</UniqueIdentifier>
+ <UniqueIdentifier>{e159d08d-daec-46de-9b60-9f8e660da91d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SQLite">
- <UniqueIdentifier>{224e8323-4bcc-4d7e-bdba-09fa22f42d66}</UniqueIdentifier>
+ <UniqueIdentifier>{0278092b-abe5-4276-81cf-59e4079e5bc7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\LuaExpat">
- <UniqueIdentifier>{f9ad84f7-9199-45d1-a609-128f60baa996}</UniqueIdentifier>
+ <UniqueIdentifier>{e4879cf2-e769-4e1d-8905-0f6c40ee5bc1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\BlockEntities">
- <UniqueIdentifier>{74088e2e-f7dc-478a-ae7f-bcfcb1a13dcc}</UniqueIdentifier>
+ <UniqueIdentifier>{d641a9d4-f5dc-4808-bee6-194306505244}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\HTTPServer">
- <UniqueIdentifier>{5e5eae6e-3154-4f85-868e-2682d072a5b2}</UniqueIdentifier>
+ <UniqueIdentifier>{a1e39415-2aca-4779-a558-2567a9de304f}</UniqueIdentifier>
</Filter>
<Filter Include="Config files">
- <UniqueIdentifier>{124dfea0-3dcd-45c0-a196-ec9bd6e00b6a}</UniqueIdentifier>
+ <UniqueIdentifier>{eb5f3060-03ed-4548-8bde-340454d3d23a}</UniqueIdentifier>
</Filter>
<Filter Include="Plugins">
- <UniqueIdentifier>{bc156df0-b3f8-4bf2-a434-59e63f5eafcc}</UniqueIdentifier>
+ <UniqueIdentifier>{7c681450-041a-4846-acf6-951c1f4e32a4}</UniqueIdentifier>
</Filter>
<Filter Include="Plugins\Core">
- <UniqueIdentifier>{2bbb71f4-860a-4fc4-b9d9-ac05f806fea1}</UniqueIdentifier>
+ <UniqueIdentifier>{e961964c-9fb7-4513-89fa-05e0b760e0f1}</UniqueIdentifier>
</Filter>
<Filter Include="Plugins\ChatLog">
- <UniqueIdentifier>{05facd8b-76e8-4bc5-9135-831b49ac5c65}</UniqueIdentifier>
+ <UniqueIdentifier>{70696c83-2307-43c6-8851-81aa3baa8523}</UniqueIdentifier>
</Filter>
<Filter Include="Plugins\Debuggers">
- <UniqueIdentifier>{6b70646e-a784-4617-8b26-941de4f8fd20}</UniqueIdentifier>
+ <UniqueIdentifier>{d3b692db-0684-4b89-9d38-2e5af12e9a6e}</UniqueIdentifier>
</Filter>
<Filter Include="Plugins\APIDump">
- <UniqueIdentifier>{a2b234d1-1013-47c0-8a44-f3b294d83d19}</UniqueIdentifier>
+ <UniqueIdentifier>{6eee304c-f055-4758-a248-a125e1af7e73}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
@@ -117,9 +117,6 @@
<ClInclude Include="..\src\Chunk.h">
<Filter>Source Files</Filter>
</ClInclude>
- <ClInclude Include="..\src\Chunk.inl.h">
- <Filter>Source Files</Filter>
- </ClInclude>
<ClInclude Include="..\src\ChunkDef.h">
<Filter>Source Files</Filter>
</ClInclude>
@@ -390,6 +387,9 @@
<ClInclude Include="..\src\Entities\FallingBlock.h">
<Filter>Source Files\Entities</Filter>
</ClInclude>
+ <ClInclude Include="..\src\Entities\Floater.h">
+ <Filter>Source Files\Entities</Filter>
+ </ClInclude>
<ClInclude Include="..\src\Entities\Minecart.h">
<Filter>Source Files\Entities</Filter>
</ClInclude>
@@ -468,6 +468,9 @@
<ClInclude Include="..\src\OSSupport\ListenThread.h">
<Filter>Source Files\OSSupport</Filter>
</ClInclude>
+ <ClInclude Include="..\src\OSSupport\Queue.h">
+ <Filter>Source Files\OSSupport</Filter>
+ </ClInclude>
<ClInclude Include="..\src\OSSupport\Semaphore.h">
<Filter>Source Files\OSSupport</Filter>
</ClInclude>
@@ -798,6 +801,9 @@
<ClInclude Include="..\src\items\ItemDye.h">
<Filter>Source Files\Items</Filter>
</ClInclude>
+ <ClInclude Include="..\src\Items\ItemFishingRod.h">
+ <Filter>Source Files\Items</Filter>
+ </ClInclude>
<ClInclude Include="..\src\Items\ItemFlowerPot.h">
<Filter>Source Files\Items</Filter>
</ClInclude>
@@ -945,9 +951,6 @@
<ClInclude Include="..\src\HTTPServer\NameValueParser.h">
<Filter>Source Files\HTTPServer</Filter>
</ClInclude>
- <ClInclude Include="..\src\Entities\Floater.h">
- <Filter>Source Files\Entities</Filter>
- </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\webadmin\template.html">
@@ -1372,6 +1375,9 @@
<ClCompile Include="..\src\Entities\FallingBlock.cpp">
<Filter>Source Files\Entities</Filter>
</ClCompile>
+ <ClCompile Include="..\src\Entities\Floater.cpp">
+ <Filter>Source Files\Entities</Filter>
+ </ClCompile>
<ClCompile Include="..\src\Entities\Minecart.cpp">
<Filter>Source Files\Entities</Filter>
</ClCompile>
@@ -1660,9 +1666,6 @@
<ClCompile Include="..\src\HTTPServer\NameValueParser.cpp">
<Filter>Source Files\HTTPServer</Filter>
</ClCompile>
- <ClCompile Include="..\src\Entities\Floater.cpp">
- <Filter>Source Files\Entities</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="..\lib\sqlite\urls.txt">
diff --git a/VC2013/ToLua.vcxproj b/VC2013/ToLua.vcxproj
index 86f80d691..309d9635a 100644
--- a/VC2013/ToLua.vcxproj
+++ b/VC2013/ToLua.vcxproj
@@ -163,6 +163,7 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\lib\tolua++\src\bin\tolua.c" />
<ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c" />
<ClCompile Include="..\lib\tolua++\src\lib\tolua_is.c" />
<ClCompile Include="..\lib\tolua++\src\lib\tolua_map.c" />
diff --git a/VC2013/ToLua.vcxproj.filters b/VC2013/ToLua.vcxproj.filters
index 095111dc8..5d104d7d0 100644
--- a/VC2013/ToLua.vcxproj.filters
+++ b/VC2013/ToLua.vcxproj.filters
@@ -7,6 +7,9 @@
</Filter>
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\lib\tolua++\src\bin\tolua.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/lib/lua/CMakeLists.txt b/lib/lua/CMakeLists.txt
index 63ac18e90..b4b5b5f1d 100644
--- a/lib/lua/CMakeLists.txt
+++ b/lib/lua/CMakeLists.txt
@@ -26,5 +26,5 @@ else()
endif()
if (UNIX)
- target_link_libraries(lua m dl)
+ target_link_libraries(lua m ${DYNAMIC_LOADER})
endif()
diff --git a/lib/sqlite/CMakeLists.txt b/lib/sqlite/CMakeLists.txt
index 07e5a22cb..0815127ef 100644
--- a/lib/sqlite/CMakeLists.txt
+++ b/lib/sqlite/CMakeLists.txt
@@ -21,5 +21,5 @@ endif()
add_library(sqlite ${SOURCE})
if (UNIX)
- target_link_libraries(sqlite dl)
+ target_link_libraries(sqlite ${DYNAMIC_LOADER})
endif()
diff --git a/lib/tolua++/Makefile b/lib/tolua++/Makefile
deleted file mode 100644
index 3bbda9b15..000000000
--- a/lib/tolua++/Makefile
+++ /dev/null
@@ -1,341 +0,0 @@
-# CMAKE generated file: DO NOT EDIT!
-# Generated by "Unix Makefiles" Generator, CMake Version 2.8
-
-# Default target executed when no arguments are given to make.
-default_target: all
-.PHONY : default_target
-
-#=============================================================================
-# Special targets provided by cmake.
-
-# Disable implicit rules so canonical targets will work.
-.SUFFIXES:
-
-# Remove some rules from gmake that .SUFFIXES does not remove.
-SUFFIXES =
-
-.SUFFIXES: .hpux_make_needs_suffix_list
-
-# Suppress display of executed commands.
-$(VERBOSE).SILENT:
-
-# A target that is always out of date.
-cmake_force:
-.PHONY : cmake_force
-
-#=============================================================================
-# Set environment variables for the build.
-
-# The shell in which to execute make rules.
-SHELL = /bin/sh
-
-# The CMake executable.
-CMAKE_COMMAND = /usr/bin/cmake
-
-# The command to remove a file.
-RM = /usr/bin/cmake -E remove -f
-
-# Escaping for special characters.
-EQUALS = =
-
-# The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /home/tycho/MCServer
-
-# The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /home/tycho/MCServer
-
-#=============================================================================
-# Targets provided globally by CMake.
-
-# Special rule for the target edit_cache
-edit_cache:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
- /usr/bin/cmake -i .
-.PHONY : edit_cache
-
-# Special rule for the target edit_cache
-edit_cache/fast: edit_cache
-.PHONY : edit_cache/fast
-
-# Special rule for the target rebuild_cache
-rebuild_cache:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
- /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
-.PHONY : rebuild_cache
-
-# Special rule for the target rebuild_cache
-rebuild_cache/fast: rebuild_cache
-.PHONY : rebuild_cache/fast
-
-# The main all target
-all: cmake_check_build_system
- cd /home/tycho/MCServer && $(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles /home/tycho/MCServer/lib/tolua++/CMakeFiles/progress.marks
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/all
- $(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles 0
-.PHONY : all
-
-# The main clean target
-clean:
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/clean
-.PHONY : clean
-
-# The main clean target
-clean/fast: clean
-.PHONY : clean/fast
-
-# Prepare targets for installation.
-preinstall: all
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
-.PHONY : preinstall
-
-# Prepare targets for installation.
-preinstall/fast:
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
-.PHONY : preinstall/fast
-
-# clear depends
-depend:
- cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
-.PHONY : depend
-
-# Convenience name for target.
-lib/tolua++/CMakeFiles/tolua.dir/rule:
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolua.dir/rule
-.PHONY : lib/tolua++/CMakeFiles/tolua.dir/rule
-
-# Convenience name for target.
-tolua: lib/tolua++/CMakeFiles/tolua.dir/rule
-.PHONY : tolua
-
-# fast build rule for target.
-tolua/fast:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/build
-.PHONY : tolua/fast
-
-# Convenience name for target.
-lib/tolua++/CMakeFiles/tolualib.dir/rule:
- cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolualib.dir/rule
-.PHONY : lib/tolua++/CMakeFiles/tolualib.dir/rule
-
-# Convenience name for target.
-tolualib: lib/tolua++/CMakeFiles/tolualib.dir/rule
-.PHONY : tolualib
-
-# fast build rule for target.
-tolualib/fast:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/build
-.PHONY : tolualib/fast
-
-src/bin/tolua.o: src/bin/tolua.c.o
-.PHONY : src/bin/tolua.o
-
-# target to build an object file
-src/bin/tolua.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.o
-.PHONY : src/bin/tolua.c.o
-
-src/bin/tolua.i: src/bin/tolua.c.i
-.PHONY : src/bin/tolua.i
-
-# target to preprocess a source file
-src/bin/tolua.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.i
-.PHONY : src/bin/tolua.c.i
-
-src/bin/tolua.s: src/bin/tolua.c.s
-.PHONY : src/bin/tolua.s
-
-# target to generate assembly for a file
-src/bin/tolua.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.s
-.PHONY : src/bin/tolua.c.s
-
-src/bin/toluabind.o: src/bin/toluabind.c.o
-.PHONY : src/bin/toluabind.o
-
-# target to build an object file
-src/bin/toluabind.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.o
-.PHONY : src/bin/toluabind.c.o
-
-src/bin/toluabind.i: src/bin/toluabind.c.i
-.PHONY : src/bin/toluabind.i
-
-# target to preprocess a source file
-src/bin/toluabind.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.i
-.PHONY : src/bin/toluabind.c.i
-
-src/bin/toluabind.s: src/bin/toluabind.c.s
-.PHONY : src/bin/toluabind.s
-
-# target to generate assembly for a file
-src/bin/toluabind.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.s
-.PHONY : src/bin/toluabind.c.s
-
-src/lib/tolua_event.o: src/lib/tolua_event.c.o
-.PHONY : src/lib/tolua_event.o
-
-# target to build an object file
-src/lib/tolua_event.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.o
-.PHONY : src/lib/tolua_event.c.o
-
-src/lib/tolua_event.i: src/lib/tolua_event.c.i
-.PHONY : src/lib/tolua_event.i
-
-# target to preprocess a source file
-src/lib/tolua_event.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.i
-.PHONY : src/lib/tolua_event.c.i
-
-src/lib/tolua_event.s: src/lib/tolua_event.c.s
-.PHONY : src/lib/tolua_event.s
-
-# target to generate assembly for a file
-src/lib/tolua_event.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.s
-.PHONY : src/lib/tolua_event.c.s
-
-src/lib/tolua_is.o: src/lib/tolua_is.c.o
-.PHONY : src/lib/tolua_is.o
-
-# target to build an object file
-src/lib/tolua_is.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.o
-.PHONY : src/lib/tolua_is.c.o
-
-src/lib/tolua_is.i: src/lib/tolua_is.c.i
-.PHONY : src/lib/tolua_is.i
-
-# target to preprocess a source file
-src/lib/tolua_is.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.i
-.PHONY : src/lib/tolua_is.c.i
-
-src/lib/tolua_is.s: src/lib/tolua_is.c.s
-.PHONY : src/lib/tolua_is.s
-
-# target to generate assembly for a file
-src/lib/tolua_is.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.s
-.PHONY : src/lib/tolua_is.c.s
-
-src/lib/tolua_map.o: src/lib/tolua_map.c.o
-.PHONY : src/lib/tolua_map.o
-
-# target to build an object file
-src/lib/tolua_map.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.o
-.PHONY : src/lib/tolua_map.c.o
-
-src/lib/tolua_map.i: src/lib/tolua_map.c.i
-.PHONY : src/lib/tolua_map.i
-
-# target to preprocess a source file
-src/lib/tolua_map.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.i
-.PHONY : src/lib/tolua_map.c.i
-
-src/lib/tolua_map.s: src/lib/tolua_map.c.s
-.PHONY : src/lib/tolua_map.s
-
-# target to generate assembly for a file
-src/lib/tolua_map.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.s
-.PHONY : src/lib/tolua_map.c.s
-
-src/lib/tolua_push.o: src/lib/tolua_push.c.o
-.PHONY : src/lib/tolua_push.o
-
-# target to build an object file
-src/lib/tolua_push.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.o
-.PHONY : src/lib/tolua_push.c.o
-
-src/lib/tolua_push.i: src/lib/tolua_push.c.i
-.PHONY : src/lib/tolua_push.i
-
-# target to preprocess a source file
-src/lib/tolua_push.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.i
-.PHONY : src/lib/tolua_push.c.i
-
-src/lib/tolua_push.s: src/lib/tolua_push.c.s
-.PHONY : src/lib/tolua_push.s
-
-# target to generate assembly for a file
-src/lib/tolua_push.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.s
-.PHONY : src/lib/tolua_push.c.s
-
-src/lib/tolua_to.o: src/lib/tolua_to.c.o
-.PHONY : src/lib/tolua_to.o
-
-# target to build an object file
-src/lib/tolua_to.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.o
-.PHONY : src/lib/tolua_to.c.o
-
-src/lib/tolua_to.i: src/lib/tolua_to.c.i
-.PHONY : src/lib/tolua_to.i
-
-# target to preprocess a source file
-src/lib/tolua_to.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.i
-.PHONY : src/lib/tolua_to.c.i
-
-src/lib/tolua_to.s: src/lib/tolua_to.c.s
-.PHONY : src/lib/tolua_to.s
-
-# target to generate assembly for a file
-src/lib/tolua_to.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.s
-.PHONY : src/lib/tolua_to.c.s
-
-# Help Target
-help:
- @echo "The following are some of the valid targets for this Makefile:"
- @echo "... all (the default if no target is provided)"
- @echo "... clean"
- @echo "... depend"
- @echo "... edit_cache"
- @echo "... rebuild_cache"
- @echo "... tolua"
- @echo "... tolualib"
- @echo "... src/bin/tolua.o"
- @echo "... src/bin/tolua.i"
- @echo "... src/bin/tolua.s"
- @echo "... src/bin/toluabind.o"
- @echo "... src/bin/toluabind.i"
- @echo "... src/bin/toluabind.s"
- @echo "... src/lib/tolua_event.o"
- @echo "... src/lib/tolua_event.i"
- @echo "... src/lib/tolua_event.s"
- @echo "... src/lib/tolua_is.o"
- @echo "... src/lib/tolua_is.i"
- @echo "... src/lib/tolua_is.s"
- @echo "... src/lib/tolua_map.o"
- @echo "... src/lib/tolua_map.i"
- @echo "... src/lib/tolua_map.s"
- @echo "... src/lib/tolua_push.o"
- @echo "... src/lib/tolua_push.i"
- @echo "... src/lib/tolua_push.s"
- @echo "... src/lib/tolua_to.o"
- @echo "... src/lib/tolua_to.i"
- @echo "... src/lib/tolua_to.s"
-.PHONY : help
-
-
-
-#=============================================================================
-# Special targets to cleanup operation of make.
-
-# Special rule to run CMake to check the build system integrity.
-# No rule that depends on this can have commands that come from listfiles
-# because they might be regenerated.
-cmake_check_build_system:
- cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
-.PHONY : cmake_check_build_system
-
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index a684620f3..83351591c 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -297,7 +297,7 @@ void cLuaState::Push(const AString & a_String)
{
ASSERT(IsValid());
- tolua_pushcppstring(m_LuaState, a_String);
+ lua_pushlstring(m_LuaState, a_String.data(), a_String.size());
m_NumCurrentFunctionArgs += 1;
}
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 64f542880..6221727c4 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -1164,7 +1164,6 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
}
else if (tolua_isusertable(S, 1, "cPluginManager", 0, &err))
{
- LOGD("AddHook recommended style");
// Style 1, use the global PlgMgr, but increment ParamIdx
ParamIdx++;
}
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index dd8e0da31..910661f60 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -828,7 +828,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
int yd = dy - dx / 2;
int zd = dz - dx / 2;
- while (true)
+ for (;;)
{
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
@@ -860,7 +860,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
int xd = dx - dy / 2;
int zd = dz - dy / 2;
- while (true)
+ for (;;)
{
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
@@ -894,7 +894,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
int xd = dx - dz / 2;
int yd = dy - dz / 2;
- while (true)
+ for (;;)
{
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index b1409f5cc..f15553968 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -70,8 +70,8 @@ void cFurnaceEntity::UsedBy(cPlayer * a_Player)
if (a_Player->GetWindow() != Window)
{
a_Player->OpenWindow(Window);
- BroadcastProgress(PROGRESSBAR_FUEL, m_LastProgressFuel);
- BroadcastProgress(PROGRESSBAR_SMELTING, m_LastProgressCook);
+ BroadcastProgress(PROGRESSBAR_FUEL, (short)m_LastProgressFuel);
+ BroadcastProgress(PROGRESSBAR_SMELTING, (short)m_LastProgressCook);
}
}
}
@@ -445,14 +445,14 @@ void cFurnaceEntity::UpdateProgressBars(void)
int CurFuel = (m_FuelBurnTime > 0) ? (200 - 200 * m_TimeBurned / m_FuelBurnTime) : 0;
if ((CurFuel / 8) != (m_LastProgressFuel / 8))
{
- BroadcastProgress(PROGRESSBAR_FUEL, CurFuel);
+ BroadcastProgress(PROGRESSBAR_FUEL, (short)CurFuel);
m_LastProgressFuel = CurFuel;
}
int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0;
if ((CurCook / 8) != (m_LastProgressCook / 8))
{
- BroadcastProgress(PROGRESSBAR_SMELTING, CurCook);
+ BroadcastProgress(PROGRESSBAR_SMELTING, (short)CurCook);
m_LastProgressCook = CurCook;
}
}
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index 0aca3209f..eac59e74d 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -488,7 +488,6 @@ bool cHopperEntity::MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_Blo
// Feed the fuel slot of the furnace
return MoveItemsToSlot(*Furnace, cFurnaceEntity::fsFuel);
}
- return false;
}
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 86fbceff7..e14090b18 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -991,7 +991,7 @@ bool cChunkMap::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ)
int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ)
{
- while (true)
+ for (;;)
{
cCSLock Lock(m_CSLayers);
int ChunkX, ChunkZ, BlockY = 0;
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index df45bb4c2..c94113f5c 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -285,7 +285,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints &
void cCaveTunnel::Smooth(void)
{
cCaveDefPoints Pts;
- while (true)
+ for (;;)
{
if (!RefineDefPoints(m_Points, Pts))
{
@@ -331,7 +331,7 @@ void cCaveTunnel::FinishLinear(void)
int yd = dy - dx / 2;
int zd = dz - dx / 2;
- while (true)
+ for (;;)
{
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
@@ -363,7 +363,7 @@ void cCaveTunnel::FinishLinear(void)
int xd = dx - dy / 2;
int zd = dz - dy / 2;
- while (true)
+ for (;;)
{
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
@@ -397,7 +397,7 @@ void cCaveTunnel::FinishLinear(void)
int xd = dx - dz / 2;
int yd = dy - dz / 2;
- while (true)
+ for (;;)
{
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp
index 15e352e30..eb9fe92ba 100644
--- a/src/Generating/DistortedHeightmap.cpp
+++ b/src/Generating/DistortedHeightmap.cpp
@@ -774,10 +774,11 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
return;
}
default:
+ {
ASSERT(!"Unhandled biome");
return;
+ }
} // switch (Biome)
- ASSERT(!"Unexpected fallthrough");
}
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 866551e8a..145fe22e0 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -528,7 +528,7 @@ cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cI
bool IsWater = (a_Fluid == E_BLOCK_WATER);
AString SectionName = IsWater ? "WaterSprings" : "LavaSprings";
AString DefaultHeightDistribution;
- int DefaultChance;
+ int DefaultChance = 0;
switch (a_World.GetDimension())
{
case dimNether:
diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp
index 6413b963b..cfda47e32 100644
--- a/src/Generating/Ravines.cpp
+++ b/src/Generating/Ravines.cpp
@@ -381,7 +381,7 @@ void cStructGenRavines::cRavine::FinishLinear(void)
int R = itr->m_Radius;
int T = itr->m_Top;
int B = itr->m_Bottom;
- while (true)
+ for (;;)
{
m_Points.push_back(cRavDefPoint(PrevX, PrevZ, R, T, B));
if ((PrevX == x1) && (PrevZ == z1))
diff --git a/src/Globals.h b/src/Globals.h
index a761da404..f886ba2d0 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -17,16 +17,21 @@
#pragma warning(disable:4100) // Unreferenced formal parameter
// Useful warnings from warning level 4:
+ #pragma warning(3 : 4127) // Conditional expression is constant
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
- #pragma warning(3 : 4702) // Unreachable code
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
- #pragma warning(3 : 4389) // Signed/unsigned mismatch
- #pragma warning(3 : 4701) // Potentially unitialized local variable used
- #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
#pragma warning(3 : 4310) // Cast truncates constant value
+ #pragma warning(3 : 4389) // Signed/unsigned mismatch
#pragma warning(3 : 4505) // Unreferenced local function has been removed
- #pragma warning(3 : 4127) // Conditional expression is constant
+ #pragma warning(3 : 4701) // Potentially unitialized local variable used
+ #pragma warning(3 : 4702) // Unreachable code
#pragma warning(3 : 4706) // Assignment within conditional expression
+
+ // Disabling this warning, because we know what we're doing when we're doing this:
+ #pragma warning(disable: 4355) // 'this' used in initializer list
+
+ // 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places
+ // #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
#define OBSOLETE __declspec(deprecated)
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index 68afdfc11..3d30ab177 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -57,7 +57,7 @@ void cHTTPConnection::SendNeedAuth(const AString & a_Realm)
void cHTTPConnection::Send(const cHTTPResponse & a_Response)
{
- ASSERT(m_State = wcsRecvIdle);
+ ASSERT(m_State == wcsRecvIdle);
a_Response.AppendToData(m_OutgoingData);
m_State = wcsSendingResp;
m_HTTPServer.NotifyConnectionWrite(*this);
diff --git a/src/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp
index 01c68881a..e661ea6f9 100644
--- a/src/HTTPServer/HTTPFormParser.cpp
+++ b/src/HTTPServer/HTTPFormParser.cpp
@@ -133,7 +133,6 @@ bool cHTTPFormParser::HasFormData(const cHTTPRequest & a_Request)
(a_Request.GetURL().find('?') != AString::npos)
)
);
- return false;
}
diff --git a/src/HTTPServer/MultipartParser.cpp b/src/HTTPServer/MultipartParser.cpp
index b49f6ec07..14c2c00fa 100644
--- a/src/HTTPServer/MultipartParser.cpp
+++ b/src/HTTPServer/MultipartParser.cpp
@@ -156,7 +156,7 @@ void cMultipartParser::Parse(const char * a_Data, int a_Size)
// Append to buffer, then parse it:
m_IncomingData.append(a_Data, a_Size);
- while (true)
+ for (;;)
{
if (m_EnvelopeParser.IsInHeaders())
{
diff --git a/src/HTTPServer/NameValueParser.cpp b/src/HTTPServer/NameValueParser.cpp
index fd56f6b24..9ea8594ae 100644
--- a/src/HTTPServer/NameValueParser.cpp
+++ b/src/HTTPServer/NameValueParser.cpp
@@ -253,7 +253,6 @@ void cNameValueParser::Parse(const char * a_Data, int a_Size)
m_State = psValueRaw;
break;
}
- i++;
} // while (i < a_Size)
break;
} // case psEqual
diff --git a/src/Item.cpp b/src/Item.cpp
index 196a260ef..a44515019 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -246,7 +246,7 @@ void cItems::Delete(int a_Idx)
-void cItems::Set(int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemDamage)
+void cItems::Set(int a_Idx, short a_ItemType, char a_ItemCount, short a_ItemDamage)
{
if ((a_Idx < 0) || (a_Idx >= (int)size()))
{
diff --git a/src/Item.h b/src/Item.h
index c60d0542c..64a30ade1 100644
--- a/src/Item.h
+++ b/src/Item.h
@@ -181,9 +181,9 @@ public:
void Delete(int a_Idx);
void Clear (void) {clear(); }
int Size (void) {return size(); }
- void Set (int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemDamage);
+ void Set (int a_Idx, short a_ItemType, char a_ItemCount, short a_ItemDamage);
- void Add (ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemDamage)
+ void Add (short a_ItemType, char a_ItemCount, short a_ItemDamage)
{
push_back(cItem(a_ItemType, a_ItemCount, a_ItemDamage));
}
diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h
index 8ca86663f..67f0d38bd 100644
--- a/src/Items/ItemSeeds.h
+++ b/src/Items/ItemSeeds.h
@@ -56,7 +56,6 @@ public:
case E_ITEM_SEEDS: a_BlockType = E_BLOCK_CROPS; return true;
default: a_BlockType = E_BLOCK_AIR; return true;
}
- return false;
}
} ;
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp
index 7c3cc9c76..a823c08cc 100644
--- a/src/LightingThread.cpp
+++ b/src/LightingThread.cpp
@@ -216,7 +216,7 @@ void cLightingThread::ChunkReady(int a_ChunkX, int a_ChunkZ)
void cLightingThread::Execute(void)
{
- while (true)
+ for (;;)
{
{
cCSLock Lock(m_CS);
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index 110c6b5dc..da1c7f2fd 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -196,7 +196,7 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
ASSERT((m_CurrentY >= 0) && (m_CurrentY < cChunkDef::Height)); // This should be provided by FixStartAboveWorld() / FixStartBelowWorld()
// This is the actual line tracing loop.
- while (true)
+ for (;;)
{
// Report the current block through the callbacks:
if (a_Chunk == NULL)
diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp
index ab15509b7..302d1298c 100644
--- a/src/Protocol/Protocol132.cpp
+++ b/src/Protocol/Protocol132.cpp
@@ -877,7 +877,7 @@ void cProtocol132::SendCompass(const cWorld & a_World)
void cProtocol132::SendEncryptionKeyRequest(void)
{
cCSLock Lock(m_CSPacket);
- WriteByte((char)0xfd);
+ WriteByte(0xfd);
WriteString(cRoot::Get()->GetServer()->GetServerID());
WriteShort((short)m_ServerPublicKey.size());
SendData(m_ServerPublicKey.data(), m_ServerPublicKey.size());
@@ -925,7 +925,7 @@ void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const A
{
// Send encryption key response:
cCSLock Lock(m_CSPacket);
- WriteByte((char)0xfc);
+ WriteByte(0xfc);
WriteShort(0);
WriteShort(0);
Flush();
diff --git a/src/Protocol/Protocol132.h b/src/Protocol/Protocol132.h
index d36384a88..80fc8740a 100644
--- a/src/Protocol/Protocol132.h
+++ b/src/Protocol/Protocol132.h
@@ -14,9 +14,9 @@
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4127)
- #pragma warning(disable:4244)
- #pragma warning(disable:4231)
#pragma warning(disable:4189)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4244)
#pragma warning(disable:4702)
#endif
diff --git a/src/Protocol/Protocol15x.cpp b/src/Protocol/Protocol15x.cpp
index 7e2aa9490..0f1e59f10 100644
--- a/src/Protocol/Protocol15x.cpp
+++ b/src/Protocol/Protocol15x.cpp
@@ -112,7 +112,7 @@ int cProtocol150::ParseWindowClick(void)
}
// Convert Button, Mode, SlotNum and HeldItem into eClickAction:
- eClickAction Action;
+ eClickAction Action = caUnknown;
switch ((Mode << 8) | Button)
{
case 0x0000: Action = (SlotNum != -999) ? caLeftClick : caLeftClickOutside; break;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 2d00776ae..4d08df2d9 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -983,10 +983,9 @@ void cProtocol172::AddReceivedData(const char * a_Data, int a_Size)
}
// Handle all complete packets:
- while (true)
+ for (;;)
{
UInt32 PacketLen;
- int PacketStart = m_ReceivedData.GetDataStart();
if (!m_ReceivedData.ReadVarInt(PacketLen))
{
// Not enough data
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 1cae4a750..e2ea0e6e5 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -198,7 +198,7 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason)
else
{
// This is used when the client sends a server-ping, respond with the default packet:
- WriteByte ((char)0xff); // PACKET_DISCONNECT
+ WriteByte (0xff); // PACKET_DISCONNECT
WriteString(a_Reason);
}
}
diff --git a/src/Server.cpp b/src/Server.cpp
index e2a73541a..b0439391c 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -507,7 +507,7 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac
if (split[0].compare("killmem") == 0)
{
- while (true)
+ for (;;)
{
new char[100 * 1024 * 1024]; // Allocate and leak 100 MiB in a loop -> fill memory and kill MCS
}
diff --git a/src/StringCompression.cpp b/src/StringCompression.cpp
index 36946b282..e15058840 100644
--- a/src/StringCompression.cpp
+++ b/src/StringCompression.cpp
@@ -74,7 +74,7 @@ int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed
return res;
}
- while (true)
+ for (;;)
{
res = deflate(&strm, Z_FINISH);
switch (res)
@@ -137,7 +137,7 @@ extern int UncompressStringGZIP(const char * a_Data, int a_Length, AString & a_U
return res;
}
- while (true)
+ for (;;)
{
res = inflate(&strm, Z_FINISH);
switch (res)
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 5c6b99d88..e6deb0705 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -612,7 +612,7 @@ AString StripColorCodes(const AString & a_Message)
{
AString res(a_Message);
size_t idx = 0;
- while (true)
+ for (;;)
{
idx = res.find("\xc2\xa7", idx);
if (idx == AString::npos)
@@ -765,6 +765,54 @@ AString Base64Decode(const AString & a_Base64String)
+AString Base64Encode(const AString & a_Input)
+{
+ static const char BASE64[64] = {
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
+ 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
+ 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
+ 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
+ };
+
+ std::string output;
+ output.resize(((a_Input.size() + 2) / 3) * 4);
+
+ size_t output_index = 0;
+ size_t size_full24 = (a_Input.size() / 3) * 3;
+
+ for (size_t i = 0; i < size_full24; i += 3)
+ {
+ output[output_index++] = BASE64[(unsigned char)a_Input[i] >> 2];
+ output[output_index++] = BASE64[((unsigned char)a_Input[i] << 4 | (unsigned char)a_Input[i + 1] >> 4) & 63];
+ output[output_index++] = BASE64[((unsigned char)a_Input[i + 1] << 2 | (unsigned char)a_Input[i + 2] >> 6) & 63];
+ output[output_index++] = BASE64[(unsigned char)a_Input[i + 2] & 63];
+ }
+
+ if (size_full24 < a_Input.size())
+ {
+ output[output_index++] = BASE64[(unsigned char)a_Input[size_full24] >> 2];
+ if (size_full24 + 1 == a_Input.size())
+ {
+ output[output_index++] = BASE64[((unsigned char)a_Input[size_full24] << 4) & 63];
+ output[output_index++] = '=';
+ }
+ else
+ {
+ output[output_index++] = BASE64[((unsigned char)a_Input[size_full24] << 4 | (unsigned char)a_Input[size_full24 + 1] >> 4) & 63];
+ output[output_index++] = BASE64[((unsigned char)a_Input[size_full24 + 1] << 2) & 63];
+ }
+
+ output[output_index++] = '=';
+ }
+ assert(output_index == output.size());
+
+ return output;
+}
+
+
+
+
+
short GetBEShort(const char * a_Mem)
{
return (((short)a_Mem[0]) << 8) | a_Mem[1];
diff --git a/src/StringUtils.h b/src/StringUtils.h
index 471e843e4..2373f3843 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -81,6 +81,9 @@ extern AString ReplaceAllCharOccurrences(const AString & a_String, char a_From,
/// Decodes a Base64-encoded string into the raw data
extern AString Base64Decode(const AString & a_Base64String);
+/// Encodes a string into Base64
+extern AString Base64Encode(const AString & a_Input);
+
/// Reads two bytes from the specified memory location and interprets them as BigEndian short
extern short GetBEShort(const char * a_Mem);
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 61e432665..a721e6b7e 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -491,7 +491,7 @@ void cSlotAreaCrafting::ShiftClickedResult(cPlayer & a_Player)
return;
}
cItem * PlayerSlots = GetPlayerSlots(a_Player) + 1;
- do
+ for (;;)
{
// Try distributing the result. If it fails, bail out:
cItem ResultCopy(Result);
@@ -517,7 +517,7 @@ void cSlotAreaCrafting::ShiftClickedResult(cPlayer & a_Player)
// The recipe has changed, bail out
return;
}
- } while (true);
+ }
}
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index 64220f09a..8f80c3f75 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -16,9 +16,12 @@
#define NBT_RESERVE_SIZE 200
#endif // NBT_RESERVE_SIZE
-#define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while (0)
-
-
+#ifdef _MSC_VER
+ // Dodge a C4127 (conditional expression is constant) for this specific macro usage
+ #define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while ((false, false))
+#else
+ #define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while (false)
+#endif
@@ -99,7 +102,7 @@ bool cParsedNBT::ReadCompound(void)
// Reads the latest tag as a compound
int ParentIdx = m_Tags.size() - 1;
int PrevSibling = -1;
- while (true)
+ for (;;)
{
NEEDBYTES(1);
eTagType TagType = (eTagType)(m_Data[m_Pos]);
@@ -276,7 +279,7 @@ int cParsedNBT::FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLen
for (int Child = m_Tags[a_Tag].m_FirstChild; Child != -1; Child = m_Tags[Child].m_NextSibling)
{
if (
- (m_Tags[Child].m_NameLength == a_NameLength) &&
+ (m_Tags[Child].m_NameLength == (int)a_NameLength) &&
(memcmp(m_Data + m_Tags[Child].m_NameStart, a_Name, a_NameLength) == 0)
)
{