Skip to content

Commit 118e2ae

Browse files
committedApr 15, 2014
Fix all warnings reported by clang
1 parent d436502 commit 118e2ae

27 files changed

+49
-63
lines changed
 

Diff for: ‎src/camera.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
4444

4545
Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
4646
IGameDef *gamedef):
47-
m_smgr(smgr),
4847
m_playernode(NULL),
4948
m_headnode(NULL),
5049
m_cameranode(NULL),

Diff for: ‎src/camera.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ class Camera
136136
void drawWieldedTool();
137137

138138
private:
139-
// Scene manager and nodes
140-
scene::ISceneManager* m_smgr;
139+
// Nodes
141140
scene::ISceneNode* m_playernode;
142141
scene::ISceneNode* m_headnode;
143142
scene::ICameraSceneNode* m_cameranode;

Diff for: ‎src/cguittfont/irrUString.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -3395,7 +3395,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const short ri
33953395
template <typename TAlloc>
33963396
inline ustring16<TAlloc> operator+(const short left, const ustring16<TAlloc>& right)
33973397
{
3398-
ustring16<TAlloc> ret(core::stringc(left));
3398+
ustring16<TAlloc> ret((core::stringc(left)));
33993399
ret += right;
34003400
return ret;
34013401
}
@@ -3415,7 +3415,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
34153415
template <typename TAlloc>
34163416
inline ustring16<TAlloc> operator+(const unsigned short left, const ustring16<TAlloc>& right)
34173417
{
3418-
ustring16<TAlloc> ret(core::stringc(left));
3418+
ustring16<TAlloc> ret((core::stringc(left)));
34193419
ret += right;
34203420
return ret;
34213421
}
@@ -3435,7 +3435,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const int righ
34353435
template <typename TAlloc>
34363436
inline ustring16<TAlloc> operator+(const int left, const ustring16<TAlloc>& right)
34373437
{
3438-
ustring16<TAlloc> ret(core::stringc(left));
3438+
ustring16<TAlloc> ret((core::stringc(left)));
34393439
ret += right;
34403440
return ret;
34413441
}
@@ -3455,7 +3455,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
34553455
template <typename TAlloc>
34563456
inline ustring16<TAlloc> operator+(const unsigned int left, const ustring16<TAlloc>& right)
34573457
{
3458-
ustring16<TAlloc> ret(core::stringc(left));
3458+
ustring16<TAlloc> ret((core::stringc(left)));
34593459
ret += right;
34603460
return ret;
34613461
}
@@ -3475,7 +3475,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const long rig
34753475
template <typename TAlloc>
34763476
inline ustring16<TAlloc> operator+(const long left, const ustring16<TAlloc>& right)
34773477
{
3478-
ustring16<TAlloc> ret(core::stringc(left));
3478+
ustring16<TAlloc> ret((core::stringc(left)));
34793479
ret += right;
34803480
return ret;
34813481
}
@@ -3495,7 +3495,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
34953495
template <typename TAlloc>
34963496
inline ustring16<TAlloc> operator+(const unsigned long left, const ustring16<TAlloc>& right)
34973497
{
3498-
ustring16<TAlloc> ret(core::stringc(left));
3498+
ustring16<TAlloc> ret((core::stringc(left)));
34993499
ret += right;
35003500
return ret;
35013501
}
@@ -3515,7 +3515,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const float ri
35153515
template <typename TAlloc>
35163516
inline ustring16<TAlloc> operator+(const float left, const ustring16<TAlloc>& right)
35173517
{
3518-
ustring16<TAlloc> ret(core::stringc(left));
3518+
ustring16<TAlloc> ret((core::stringc(left)));
35193519
ret += right;
35203520
return ret;
35213521
}
@@ -3535,7 +3535,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const double r
35353535
template <typename TAlloc>
35363536
inline ustring16<TAlloc> operator+(const double left, const ustring16<TAlloc>& right)
35373537
{
3538-
ustring16<TAlloc> ret(core::stringc(left));
3538+
ustring16<TAlloc> ret((core::stringc(left)));
35393539
ret += right;
35403540
return ret;
35413541
}

Diff for: ‎src/clientiface.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ namespace con {
141141
class Connection;
142142
}
143143

144+
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
145+
144146
enum ClientState
145147
{
146148
Invalid,
@@ -219,7 +221,6 @@ class RemoteClient
219221
m_nearest_unsent_d(0),
220222
m_nearest_unsent_reset_timer(0.0),
221223
m_excess_gotblocks(0),
222-
m_nothing_to_send_counter(0),
223224
m_nothing_to_send_pause_timer(0.0),
224225
m_name(""),
225226
m_version_major(0),
@@ -355,7 +356,6 @@ class RemoteClient
355356
u32 m_excess_gotblocks;
356357

357358
// CPU usage optimization
358-
u32 m_nothing_to_send_counter;
359359
float m_nothing_to_send_pause_timer;
360360

361361
/*
@@ -433,7 +433,7 @@ class ClientInterface {
433433
{ assert(m_env == 0); m_env = env; }
434434

435435
static std::string state2Name(ClientState state) {
436-
assert(state < sizeof(statenames));
436+
assert((int) state < ARRAYSIZE(statenames));
437437
return statenames[state];
438438
}
439439

Diff for: ‎src/clientobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ClientActiveObject : public ActiveObject
5555
virtual void updateLight(u8 light_at_pos){}
5656
virtual v3s16 getLightPosition(){return v3s16(0,0,0);}
5757
virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;}
58-
virtual core::aabbox3d<f32>* getCollisionBox(){return NULL;}
58+
virtual bool getCollisionBox(aabb3f *toset){return false;}
5959
virtual bool collideWithObjects(){return false;}
6060
virtual v3f getPosition(){return v3f(0,0,0);}
6161
virtual scene::IMeshSceneNode *getMeshSceneNode(){return NULL;}

Diff for: ‎src/clouds.h

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class Clouds : public scene::ISceneNode
7676
video::SMaterial m_material;
7777
core::aabbox3d<f32> m_box;
7878
float m_cloud_y;
79-
float m_brightness;
8079
video::SColorf m_color;
8180
u32 m_seed;
8281
v2f m_camera_pos;

Diff for: ‎src/connection.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ SharedBuffer<u8> makeReliablePacket(
212212
ReliablePacketBuffer
213213
*/
214214

215-
ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0),writeptr(0) {}
215+
ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0) {}
216216

217217
void ReliablePacketBuffer::print()
218218
{
@@ -1941,8 +1941,7 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
19411941

19421942
ConnectionReceiveThread::ConnectionReceiveThread(Connection* parent,
19431943
unsigned int max_packet_size) :
1944-
m_connection(parent),
1945-
m_max_packet_size(max_packet_size)
1944+
m_connection(parent)
19461945
{
19471946
}
19481947

Diff for: ‎src/connection.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,11 @@ class ReliablePacketBuffer
339339
RPBSearchResult findPacket(u16 seqnum);
340340

341341
std::list<BufferedPacket> m_list;
342-
u16 m_list_size;
342+
u32 m_list_size;
343343

344344
u16 m_oldest_non_answered_ack;
345345

346346
JMutex m_list_mutex;
347-
348-
unsigned int writeptr;
349347
};
350348

351349
/*
@@ -975,7 +973,6 @@ class ConnectionReceiveThread : public JThread {
975973

976974

977975
Connection* m_connection;
978-
unsigned int m_max_packet_size;
979976
};
980977

981978
class Connection

Diff for: ‎src/content_cao.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class TestCAO : public ClientActiveObject
166166

167167
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
168168
IrrlichtDevice *irr);
169-
void removeFromScene();
169+
void removeFromScene(bool permanent);
170170
void updateLight(u8 light_at_pos);
171171
v3s16 getLightPosition();
172172
void updateNodePos();
@@ -236,7 +236,7 @@ void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
236236
updateNodePos();
237237
}
238238

239-
void TestCAO::removeFromScene()
239+
void TestCAO::removeFromScene(bool permanent)
240240
{
241241
if(m_node == NULL)
242242
return;
@@ -310,7 +310,7 @@ class ItemCAO : public ClientActiveObject
310310

311311
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
312312
IrrlichtDevice *irr);
313-
void removeFromScene();
313+
void removeFromScene(bool permanent);
314314
void updateLight(u8 light_at_pos);
315315
v3s16 getLightPosition();
316316
void updateNodePos();
@@ -412,7 +412,7 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
412412
updateTexture();
413413
}
414414

415-
void ItemCAO::removeFromScene()
415+
void ItemCAO::removeFromScene(bool permanent)
416416
{
417417
if(m_node == NULL)
418418
return;
@@ -648,7 +648,6 @@ class GenericCAO : public ClientActiveObject
648648

649649
bool getCollisionBox(aabb3f *toset) {
650650
if (m_prop.physical) {
651-
aabb3f retval;
652651
//update collision box
653652
toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
654653
toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;

Diff for: ‎src/emerge.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void *EmergeThread::Thread() {
465465

466466
v3s16 last_tried_pos(-32768,-32768,-32768); // For error output
467467
v3s16 p;
468-
u8 flags;
468+
u8 flags = 0;
469469

470470
map = (ServerMap *)&(m_server->m_env->getMap());
471471
emerge = m_server->m_emerge;

Diff for: ‎src/environment.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ ServerEnvironment::ServerEnvironment(ServerMap *map,
314314
m_map(map),
315315
m_script(scriptIface),
316316
m_gamedef(gamedef),
317-
m_random_spawn_timer(3),
318317
m_send_recommended_timer(0),
319318
m_active_block_interval_overload_skip(0),
320319
m_game_time(0),
@@ -1097,7 +1096,7 @@ void ServerEnvironment::step(float dtime)
10971096
continue;
10981097

10991098
// Move
1100-
player->move(dtime, *m_map, 100*BS);
1099+
player->move(dtime, this, 100*BS);
11011100
}
11021101
}
11031102

@@ -2395,7 +2394,7 @@ void ClientEnvironment::step(float dtime)
23952394
if(player->isLocal() == false)
23962395
{
23972396
// Move
2398-
player->move(dtime, *m_map, 100*BS);
2397+
player->move(dtime, this, 100*BS);
23992398

24002399
}
24012400

Diff for: ‎src/environment.h

-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ class ServerEnvironment : public Environment
374374
// Outgoing network message buffer for active objects
375375
std::list<ActiveObjectMessage> m_active_object_messages;
376376
// Some timers
377-
float m_random_spawn_timer; // used for experimental code
378377
float m_send_recommended_timer;
379378
IntervalLimiter m_object_management_interval;
380379
// List of active blocks

Diff for: ‎src/game.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct LocalFormspecHandler : public TextDest
132132
m_client = client;
133133
}
134134

135-
void gotText(std::string message) {
135+
void gotText(std::wstring message) {
136136
errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
137137
}
138138

Diff for: ‎src/guiVolumeChange.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
4141
IMenuManager *menumgr,
4242
Client* client
4343
):
44-
GUIModalMenu(env, parent, id, menumgr),
45-
m_client(client)
44+
GUIModalMenu(env, parent, id, menumgr)
4645
{
4746
}
4847

Diff for: ‎src/guiVolumeChange.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ class GUIVolumeChange : public GUIModalMenu
4444

4545
bool OnEvent(const SEvent& event);
4646

47-
bool pausesGame(){ return true; }
48-
49-
private:
50-
Client* m_client;
51-
47+
bool pausesGame() { return true; }
5248
};
5349

5450
#endif

Diff for: ‎src/localplayer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ LocalPlayer::~LocalPlayer()
6565
{
6666
}
6767

68-
void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
68+
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
6969
std::list<CollisionInfo> *collision_info)
7070
{
7171
Map *map = &env->getMap();
@@ -360,7 +360,7 @@ void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
360360
m_can_jump = false;
361361
}
362362

363-
void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d)
363+
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
364364
{
365365
move(dtime, env, pos_max_d, NULL);
366366
}

Diff for: ‎src/localplayer.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2323
#include "player.h"
2424
#include <list>
2525

26-
class ClientEnvironment;
26+
class Environment;
2727

2828
class ClientActiveObject;
2929

@@ -46,9 +46,9 @@ class LocalPlayer : public Player
4646

4747
v3f overridePosition;
4848

49-
void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
49+
void move(f32 dtime, Environment *env, f32 pos_max_d);
50+
void move(f32 dtime, Environment *env, f32 pos_max_d,
5051
std::list<CollisionInfo> *collision_info);
51-
void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d);
5252

5353
void applyControl(float dtime);
5454

Diff for: ‎src/main.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ class MyEventReceiver : public IEventReceiver
360360
s32 mouse_wheel;
361361

362362
private:
363-
IrrlichtDevice *m_device;
364363

365364
// The current state of keys
366365
KeyList keyIsDown;

Diff for: ‎src/map.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -2596,6 +2596,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
25962596
// Sector metadata is loaded from disk if not already loaded.
25972597
ServerMapSector *sector = createSector(sectorpos);
25982598
assert(sector);
2599+
(void) sector;
25992600

26002601
for(s16 y=blockpos_min.Y-extra_borders.Y;
26012602
y<=blockpos_max.Y+extra_borders.Y; y++)
@@ -3261,12 +3262,13 @@ std::string ServerMap::getSectorDir(v2s16 pos, int layout)
32613262
return m_savedir + DIR_DELIM + "sectors2" + DIR_DELIM + cc;
32623263
default:
32633264
assert(false);
3265+
return "";
32643266
}
32653267
}
32663268

32673269
v2s16 ServerMap::getSectorPos(std::string dirname)
32683270
{
3269-
unsigned int x, y;
3271+
unsigned int x = 0, y = 0;
32703272
int r;
32713273
std::string component;
32723274
fs::RemoveLastPathComponent(dirname, &component, 1);

Diff for: ‎src/mapgen.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Ore *createOre(OreType type);
209209

210210

211211
enum DecorationType {
212-
DECO_SIMPLE,
212+
DECO_SIMPLE = 1,
213213
DECO_SCHEMATIC,
214214
DECO_LSYSTEM
215215
};

Diff for: ‎src/mapgen_indev.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2626

2727
///////////////////////////////////////////////////////////////////////////////
2828

29-
void NoiseIndev::init(NoiseIndevParams *np, int seed, int sx, int sy, int sz) {
30-
Noise::init((NoiseParams*)np, seed, sx, sy, sz);
31-
this->npindev = np;
29+
void NoiseIndev::init(NoiseParams *np, int seed, int sx, int sy, int sz) {
30+
Noise::init(np, seed, sx, sy, sz);
31+
this->npindev = (NoiseIndevParams*) np;
3232
}
3333

3434
NoiseIndev::NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy) : Noise(np, seed, sx, sy) {

0 commit comments

Comments
 (0)
Please sign in to comment.