From 9d4e9c59de533ae28badb22da87cb553783dd133 Mon Sep 17 00:00:00 2001
From: Perttu Ahola <celeron55@gmail.com>
Date: Mon, 11 Apr 2011 11:36:13 +0300
Subject: [PATCH] fixed warnings reported by cppcheck

---
 src/client.cpp       | 3 ++-
 src/clientobject.cpp | 3 ++-
 src/debug.cpp        | 1 +
 src/map.cpp          | 3 ++-
 src/map.h            | 3 ++-
 src/mapblockobject.h | 6 ++++--
 src/server.cpp       | 1 +
 src/socket.cpp       | 2 ++
 src/utility.h        | 4 ++--
 src/voxel.h          | 2 +-
 10 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/client.cpp b/src/client.cpp
index fca7b1b02..e2877f5fc 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -82,7 +82,8 @@ Client::Client(
 	camera_direction(0,0,1),
 	m_server_ser_ver(SER_FMT_VER_INVALID),
 	m_inventory_updated(false),
-	m_time_of_day(0)
+	m_time_of_day(0),
+	m_map_seed(0)
 {
 	m_packetcounter_timer = 0.0;
 	m_delete_unused_sectors_timer = 0.0;
diff --git a/src/clientobject.cpp b/src/clientobject.cpp
index 1d9dd215b..5b744de6c 100644
--- a/src/clientobject.cpp
+++ b/src/clientobject.cpp
@@ -404,7 +404,8 @@ RatCAO::RatCAO():
 	ClientActiveObject(0),
 	m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS/2.,BS/3.),
 	m_node(NULL),
-	m_position(v3f(0,10*BS,0))
+	m_position(v3f(0,10*BS,0)),
+	m_yaw(0)
 {
 	ClientActiveObject::registerType(getType(), create);
 }
diff --git a/src/debug.cpp b/src/debug.cpp
index d4d07375d..a19186232 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -90,6 +90,7 @@ DebugStack::DebugStack(threadid_t id)
 	threadid = id;
 	stack_i = 0;
 	stack_max_i = 0;
+	memset(stack, 0, DEBUG_STACK_SIZE*DEBUG_STACK_TEXT_SIZE);
 }
 
 void DebugStack::print(FILE *file, bool everything)
diff --git a/src/map.cpp b/src/map.cpp
index 2d16710b1..82317aec5 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -6030,7 +6030,8 @@ void MapVoxelManipulator::blitBack
 }
 
 ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map):
-		MapVoxelManipulator(map)
+		MapVoxelManipulator(map),
+		m_create_area(false)
 {
 }
 
diff --git a/src/map.h b/src/map.h
index cb48cb32b..206dc7d7b 100644
--- a/src/map.h
+++ b/src/map.h
@@ -780,7 +780,8 @@ struct ChunkMakeData
 
 	ChunkMakeData():
 		no_op(false),
-		vmanip(NULL)
+		vmanip(NULL),
+		seed(0)
 	{}
 };
 
diff --git a/src/mapblockobject.h b/src/mapblockobject.h
index 6a0c36d9c..db8006fd9 100644
--- a/src/mapblockobject.h
+++ b/src/mapblockobject.h
@@ -563,7 +563,8 @@ class RatObject : public MovingObject
 				(-BS*0.3,-BS*.25,-BS*0.3, BS*0.3,BS*0.25,BS*0.3);
 		m_selection_box = new core::aabbox3d<f32>
 				(-BS*0.3,-BS*.25,-BS*0.3, BS*0.3,BS*0.25,BS*0.3);
-
+		
+		m_yaw = 0;
 		m_counter1 = 0;
 		m_counter2 = 0;
 		m_age = 0;
@@ -906,7 +907,8 @@ class PlayerObject : public MovingObject
 public:
 	PlayerObject(MapBlock *block, s16 id, v3f pos):
 		MovingObject(block, id, pos),
-		m_node(NULL)
+		m_node(NULL),
+		m_yaw(0)
 	{
 		m_collision_box = new core::aabbox3d<f32>
 				(-BS*0.3,-BS*.25,-BS*0.3, BS*0.3,BS*0.25,BS*0.3);
diff --git a/src/server.cpp b/src/server.cpp
index 3a1949d98..b4c3d71f4 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -892,6 +892,7 @@ void RemoteClient::SetBlocksNotSent(core::map<v3s16, MapBlock*> &blocks)
 PlayerInfo::PlayerInfo()
 {
 	name[0] = 0;
+	avg_rtt = 0;
 }
 
 void PlayerInfo::PrintLine(std::ostream *s)
diff --git a/src/socket.cpp b/src/socket.cpp
index b159fa14c..ab3ca62c5 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -53,6 +53,8 @@ void sockets_cleanup()
 
 Address::Address()
 {
+	m_address = 0;
+	m_port = 0;
 }
 
 Address::Address(unsigned int address, unsigned short port)
diff --git a/src/utility.h b/src/utility.h
index 50bbe1496..e3a977400 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -1903,7 +1903,7 @@ inline v3f intToFloat(v3s16 p, f32 d)
 */
 
 // Creates a string with the length as the first two bytes
-inline std::string serializeString(const std::string plain)
+inline std::string serializeString(const std::string &plain)
 {
 	assert(plain.size() <= 65535);
 	char buf[2];
@@ -1945,7 +1945,7 @@ inline std::string deSerializeString(std::istream &is)
 }
 
 // Creates a string with the length as the first four bytes
-inline std::string serializeLongString(const std::string plain)
+inline std::string serializeLongString(const std::string &plain)
 {
 	char buf[4];
 	writeU32((u8*)&buf[0], plain.size());
diff --git a/src/voxel.h b/src/voxel.h
index 5d45ab183..2e8015eb1 100644
--- a/src/voxel.h
+++ b/src/voxel.h
@@ -553,7 +553,7 @@ class VoxelManipulator /*: public NodeContainer*/
 	/*
 		Some settings
 	*/
-	bool m_disable_water_climb;
+	//bool m_disable_water_climb;
 
 private:
 };
-- 
GitLab