Fix all warnings reported by clang

master
Sfan5 2014-04-15 19:49:32 +02:00
parent d436502fa4
commit 118e2ae865
27 changed files with 49 additions and 63 deletions

View File

@ -44,7 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
IGameDef *gamedef):
m_smgr(smgr),
m_playernode(NULL),
m_headnode(NULL),
m_cameranode(NULL),

View File

@ -136,8 +136,7 @@ public:
void drawWieldedTool();
private:
// Scene manager and nodes
scene::ISceneManager* m_smgr;
// Nodes
scene::ISceneNode* m_playernode;
scene::ISceneNode* m_headnode;
scene::ICameraSceneNode* m_cameranode;

View File

@ -3395,7 +3395,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const short ri
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const short left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3415,7 +3415,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const unsigned short left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3435,7 +3435,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const int righ
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const int left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3455,7 +3455,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const unsigned int left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3475,7 +3475,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const long rig
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const long left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3495,7 +3495,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const unsigned long left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3515,7 +3515,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const float ri
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const float left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}
@ -3535,7 +3535,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const double r
template <typename TAlloc>
inline ustring16<TAlloc> operator+(const double left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(core::stringc(left));
ustring16<TAlloc> ret((core::stringc(left)));
ret += right;
return ret;
}

View File

@ -141,6 +141,8 @@ namespace con {
class Connection;
}
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
enum ClientState
{
Invalid,
@ -219,7 +221,6 @@ public:
m_nearest_unsent_d(0),
m_nearest_unsent_reset_timer(0.0),
m_excess_gotblocks(0),
m_nothing_to_send_counter(0),
m_nothing_to_send_pause_timer(0.0),
m_name(""),
m_version_major(0),
@ -355,7 +356,6 @@ private:
u32 m_excess_gotblocks;
// CPU usage optimization
u32 m_nothing_to_send_counter;
float m_nothing_to_send_pause_timer;
/*
@ -433,7 +433,7 @@ public:
{ assert(m_env == 0); m_env = env; }
static std::string state2Name(ClientState state) {
assert(state < sizeof(statenames));
assert((int) state < ARRAYSIZE(statenames));
return statenames[state];
}

View File

@ -55,7 +55,7 @@ public:
virtual void updateLight(u8 light_at_pos){}
virtual v3s16 getLightPosition(){return v3s16(0,0,0);}
virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;}
virtual core::aabbox3d<f32>* getCollisionBox(){return NULL;}
virtual bool getCollisionBox(aabb3f *toset){return false;}
virtual bool collideWithObjects(){return false;}
virtual v3f getPosition(){return v3f(0,0,0);}
virtual scene::IMeshSceneNode *getMeshSceneNode(){return NULL;}

View File

@ -76,7 +76,6 @@ private:
video::SMaterial m_material;
core::aabbox3d<f32> m_box;
float m_cloud_y;
float m_brightness;
video::SColorf m_color;
u32 m_seed;
v2f m_camera_pos;

View File

@ -212,7 +212,7 @@ SharedBuffer<u8> makeReliablePacket(
ReliablePacketBuffer
*/
ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0),writeptr(0) {}
ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0) {}
void ReliablePacketBuffer::print()
{
@ -1941,8 +1941,7 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
ConnectionReceiveThread::ConnectionReceiveThread(Connection* parent,
unsigned int max_packet_size) :
m_connection(parent),
m_max_packet_size(max_packet_size)
m_connection(parent)
{
}

View File

@ -339,13 +339,11 @@ private:
RPBSearchResult findPacket(u16 seqnum);
std::list<BufferedPacket> m_list;
u16 m_list_size;
u32 m_list_size;
u16 m_oldest_non_answered_ack;
JMutex m_list_mutex;
unsigned int writeptr;
};
/*
@ -975,7 +973,6 @@ private:
Connection* m_connection;
unsigned int m_max_packet_size;
};
class Connection

View File

@ -166,7 +166,7 @@ public:
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
IrrlichtDevice *irr);
void removeFromScene();
void removeFromScene(bool permanent);
void updateLight(u8 light_at_pos);
v3s16 getLightPosition();
void updateNodePos();
@ -236,7 +236,7 @@ void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
updateNodePos();
}
void TestCAO::removeFromScene()
void TestCAO::removeFromScene(bool permanent)
{
if(m_node == NULL)
return;
@ -310,7 +310,7 @@ public:
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
IrrlichtDevice *irr);
void removeFromScene();
void removeFromScene(bool permanent);
void updateLight(u8 light_at_pos);
v3s16 getLightPosition();
void updateNodePos();
@ -412,7 +412,7 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
updateTexture();
}
void ItemCAO::removeFromScene()
void ItemCAO::removeFromScene(bool permanent)
{
if(m_node == NULL)
return;
@ -648,7 +648,6 @@ public:
bool getCollisionBox(aabb3f *toset) {
if (m_prop.physical) {
aabb3f retval;
//update collision box
toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;

View File

@ -465,7 +465,7 @@ void *EmergeThread::Thread() {
v3s16 last_tried_pos(-32768,-32768,-32768); // For error output
v3s16 p;
u8 flags;
u8 flags = 0;
map = (ServerMap *)&(m_server->m_env->getMap());
emerge = m_server->m_emerge;

View File

@ -314,7 +314,6 @@ ServerEnvironment::ServerEnvironment(ServerMap *map,
m_map(map),
m_script(scriptIface),
m_gamedef(gamedef),
m_random_spawn_timer(3),
m_send_recommended_timer(0),
m_active_block_interval_overload_skip(0),
m_game_time(0),
@ -1097,7 +1096,7 @@ void ServerEnvironment::step(float dtime)
continue;
// Move
player->move(dtime, *m_map, 100*BS);
player->move(dtime, this, 100*BS);
}
}
@ -2395,7 +2394,7 @@ void ClientEnvironment::step(float dtime)
if(player->isLocal() == false)
{
// Move
player->move(dtime, *m_map, 100*BS);
player->move(dtime, this, 100*BS);
}

View File

@ -374,7 +374,6 @@ private:
// Outgoing network message buffer for active objects
std::list<ActiveObjectMessage> m_active_object_messages;
// Some timers
float m_random_spawn_timer; // used for experimental code
float m_send_recommended_timer;
IntervalLimiter m_object_management_interval;
// List of active blocks

View File

@ -132,7 +132,7 @@ struct LocalFormspecHandler : public TextDest
m_client = client;
}
void gotText(std::string message) {
void gotText(std::wstring message) {
errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
}

View File

@ -41,8 +41,7 @@ GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
IMenuManager *menumgr,
Client* client
):
GUIModalMenu(env, parent, id, menumgr),
m_client(client)
GUIModalMenu(env, parent, id, menumgr)
{
}

View File

@ -44,11 +44,7 @@ public:
bool OnEvent(const SEvent& event);
bool pausesGame(){ return true; }
private:
Client* m_client;
bool pausesGame() { return true; }
};
#endif

View File

@ -65,7 +65,7 @@ LocalPlayer::~LocalPlayer()
{
}
void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
std::list<CollisionInfo> *collision_info)
{
Map *map = &env->getMap();
@ -360,7 +360,7 @@ void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
m_can_jump = false;
}
void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d)
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
{
move(dtime, env, pos_max_d, NULL);
}

View File

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "player.h"
#include <list>
class ClientEnvironment;
class Environment;
class ClientActiveObject;
@ -46,9 +46,9 @@ public:
v3f overridePosition;
void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
void move(f32 dtime, Environment *env, f32 pos_max_d);
void move(f32 dtime, Environment *env, f32 pos_max_d,
std::list<CollisionInfo> *collision_info);
void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d);
void applyControl(float dtime);

View File

@ -360,7 +360,6 @@ public:
s32 mouse_wheel;
private:
IrrlichtDevice *m_device;
// The current state of keys
KeyList keyIsDown;

View File

@ -2596,6 +2596,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
// Sector metadata is loaded from disk if not already loaded.
ServerMapSector *sector = createSector(sectorpos);
assert(sector);
(void) sector;
for(s16 y=blockpos_min.Y-extra_borders.Y;
y<=blockpos_max.Y+extra_borders.Y; y++)
@ -3261,12 +3262,13 @@ std::string ServerMap::getSectorDir(v2s16 pos, int layout)
return m_savedir + DIR_DELIM + "sectors2" + DIR_DELIM + cc;
default:
assert(false);
return "";
}
}
v2s16 ServerMap::getSectorPos(std::string dirname)
{
unsigned int x, y;
unsigned int x = 0, y = 0;
int r;
std::string component;
fs::RemoveLastPathComponent(dirname, &component, 1);

View File

@ -209,7 +209,7 @@ Ore *createOre(OreType type);
enum DecorationType {
DECO_SIMPLE,
DECO_SIMPLE = 1,
DECO_SCHEMATIC,
DECO_LSYSTEM
};

View File

@ -26,9 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
///////////////////////////////////////////////////////////////////////////////
void NoiseIndev::init(NoiseIndevParams *np, int seed, int sx, int sy, int sz) {
Noise::init((NoiseParams*)np, seed, sx, sy, sz);
this->npindev = np;
void NoiseIndev::init(NoiseParams *np, int seed, int sx, int sy, int sz) {
Noise::init(np, seed, sx, sy, sz);
this->npindev = (NoiseIndevParams*) np;
}
NoiseIndev::NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy) : Noise(np, seed, sx, sy) {

View File

@ -61,7 +61,7 @@ public:
virtual ~NoiseIndev() {};
NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy);
NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy, int sz);
void init(NoiseIndevParams *np, int seed, int sx, int sy, int sz);
void init(NoiseParams *np, int seed, int sx, int sy, int sz);
void transformNoiseMapFarScale(float xx = 0, float yy = 0, float zz = 0);
};

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_bloated.h"
#include "inventory.h"
#include "constants.h" // BS
#include <list>
#define PLAYERNAME_SIZE 20
@ -88,6 +89,7 @@ class IGameDef;
struct CollisionInfo;
class PlayerSAO;
struct HudElement;
class Environment;
class Player
{
@ -96,7 +98,10 @@ public:
Player(IGameDef *gamedef);
virtual ~Player() = 0;
virtual void move(f32 dtime, Map &map, f32 pos_max_d)
virtual void move(f32 dtime, Environment *env, f32 pos_max_d)
{}
virtual void move(f32 dtime, Environment *env, f32 pos_max_d,
std::list<CollisionInfo> *collision_info)
{}
v3f getSpeed()

View File

@ -30,7 +30,7 @@ struct ItemDefinition;
class LuaItemStack;
class ModApiItemMod;
class InventoryList;
class InventoryLocation;
struct InventoryLocation;
class ScriptApiItem
: virtual public ScriptApiBase

View File

@ -324,8 +324,8 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
BiomeDefManager *bdef = emerge->biomedef;
enum DecorationType decotype = (DecorationType)getenumfield(L, index,
"deco_type", es_DecorationType, -1);
if (decotype == -1) {
"deco_type", es_DecorationType, 0);
if (decotype == 0) {
errorstream << "register_decoration: unrecognized "
"decoration placement type";
return 0;

View File

@ -210,8 +210,7 @@ public:
class MainShaderConstantSetter : public IShaderConstantSetter
{
public:
MainShaderConstantSetter(IrrlichtDevice *device):
m_device(device)
MainShaderConstantSetter(IrrlichtDevice *device)
{}
~MainShaderConstantSetter() {}
@ -255,9 +254,6 @@ public:
services->setVertexShaderConstant(world.pointer(), 8, 4);
}
private:
IrrlichtDevice *m_device;
};
/*

View File

@ -125,7 +125,6 @@ private:
video::SColor m_skycolor;
video::SColorf m_cloudcolor_f;
v3f m_stars[SKY_STAR_COUNT];
u16 m_star_indices[SKY_STAR_COUNT*4];
video::S3DVertex m_star_vertices[SKY_STAR_COUNT*4];
LocalPlayer* m_player;
};