Skip to content

Commit

Permalink
Fix all warnings reported by clang
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Apr 15, 2014
1 parent d436502 commit 118e2ae
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 63 deletions.
1 change: 0 additions & 1 deletion src/camera.cpp
Expand Up @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions src/camera.h
Expand Up @@ -136,8 +136,7 @@ class Camera
void drawWieldedTool();

private:
// Scene manager and nodes
scene::ISceneManager* m_smgr;
// Nodes
scene::ISceneNode* m_playernode;
scene::ISceneNode* m_headnode;
scene::ICameraSceneNode* m_cameranode;
Expand Down
16 changes: 8 additions & 8 deletions src/cguittfont/irrUString.h
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/clientiface.h
Expand Up @@ -141,6 +141,8 @@ namespace con {
class Connection;
}

#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))

enum ClientState
{
Invalid,
Expand Down Expand Up @@ -219,7 +221,6 @@ class RemoteClient
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),
Expand Down Expand Up @@ -355,7 +356,6 @@ class RemoteClient
u32 m_excess_gotblocks;

// CPU usage optimization
u32 m_nothing_to_send_counter;
float m_nothing_to_send_pause_timer;

/*
Expand Down Expand Up @@ -433,7 +433,7 @@ class ClientInterface {
{ 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];
}

Expand Down
2 changes: 1 addition & 1 deletion src/clientobject.h
Expand Up @@ -55,7 +55,7 @@ class ClientActiveObject : public ActiveObject
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;}
Expand Down
1 change: 0 additions & 1 deletion src/clouds.h
Expand Up @@ -76,7 +76,6 @@ class Clouds : public scene::ISceneNode
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;
Expand Down
5 changes: 2 additions & 3 deletions src/connection.cpp
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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)
{
}

Expand Down
5 changes: 1 addition & 4 deletions src/connection.h
Expand Up @@ -339,13 +339,11 @@ class ReliablePacketBuffer
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;
};

/*
Expand Down Expand Up @@ -975,7 +973,6 @@ class ConnectionReceiveThread : public JThread {


Connection* m_connection;
unsigned int m_max_packet_size;
};

class Connection
Expand Down
9 changes: 4 additions & 5 deletions src/content_cao.cpp
Expand Up @@ -166,7 +166,7 @@ class TestCAO : public ClientActiveObject

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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -310,7 +310,7 @@ class ItemCAO : public ClientActiveObject

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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -648,7 +648,6 @@ class GenericCAO : public ClientActiveObject

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;
Expand Down
2 changes: 1 addition & 1 deletion src/emerge.cpp
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/environment.cpp
Expand Up @@ -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),
Expand Down Expand Up @@ -1097,7 +1096,7 @@ void ServerEnvironment::step(float dtime)
continue;

// Move
player->move(dtime, *m_map, 100*BS);
player->move(dtime, this, 100*BS);
}
}

Expand Down Expand Up @@ -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);

}

Expand Down
1 change: 0 additions & 1 deletion src/environment.h
Expand Up @@ -374,7 +374,6 @@ class ServerEnvironment : public Environment
// 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
Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/guiVolumeChange.cpp
Expand Up @@ -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)
{
}

Expand Down
6 changes: 1 addition & 5 deletions src/guiVolumeChange.h
Expand Up @@ -44,11 +44,7 @@ class GUIVolumeChange : public GUIModalMenu

bool OnEvent(const SEvent& event);

bool pausesGame(){ return true; }

private:
Client* m_client;

bool pausesGame() { return true; }
};

#endif
Expand Down
4 changes: 2 additions & 2 deletions src/localplayer.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/localplayer.h
Expand Up @@ -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;

Expand All @@ -46,9 +46,9 @@ class LocalPlayer : public Player

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);

Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Expand Up @@ -360,7 +360,6 @@ class MyEventReceiver : public IEventReceiver
s32 mouse_wheel;

private:
IrrlichtDevice *m_device;

// The current state of keys
KeyList keyIsDown;
Expand Down
4 changes: 3 additions & 1 deletion src/map.cpp
Expand Up @@ -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++)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/mapgen.h
Expand Up @@ -209,7 +209,7 @@ Ore *createOre(OreType type);


enum DecorationType {
DECO_SIMPLE,
DECO_SIMPLE = 1,
DECO_SCHEMATIC,
DECO_LSYSTEM
};
Expand Down
6 changes: 3 additions & 3 deletions src/mapgen_indev.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 118e2ae

Please sign in to comment.