Skip to content

Commit 5070ca2

Browse files
committedApr 4, 2018
Fix 5 issues reported by PVS studio
* src/sky.cpp 146 warn V519 The 'suncolor_f.r' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 142, 146. * src/sky.cpp 147 warn V519 The 'suncolor_f.g' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 143, 147. * src/sky.cpp 148 warn V519 The 'suncolor_f.b' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 144, 148. * src/threading/thread.cpp 63 err V730 Not all members of a class are initialized inside the constructor. Consider inspecting: m_thread_obj. * src/server.cpp 3243 err V595 The 'log' pointer was utilized before it was verified against nullptr. Check lines: 3243, 3258.
1 parent 8e0b80a commit 5070ca2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
 

Diff for: ‎src/server.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3237,7 +3237,8 @@ bool Server::rollbackRevertActions(const std::list<RollbackAction> &actions,
32373237
ServerMap *map = (ServerMap*)(&m_env->getMap());
32383238

32393239
// Fail if no actions to handle
3240-
if(actions.empty()){
3240+
if (actions.empty()) {
3241+
assert(log);
32413242
log->push_back("Nothing to do.");
32423243
return false;
32433244
}

Diff for: ‎src/sky.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ void Sky::render()
141141
suncolor_f.g = MYMAX(0.3, MYMIN(1.0, 0.7 + m_time_brightness * 0.5));
142142
suncolor_f.b = MYMAX(0.0, m_brightness * 0.95);
143143
video::SColorf suncolor2_f(1, 1, 1, 1);
144-
suncolor_f.r = 1;
145-
suncolor_f.g = MYMAX(0.3, MYMIN(1.0, 0.85 + m_time_brightness * 0.5));
146-
suncolor_f.b = MYMAX(0.0, m_brightness);
144+
suncolor2_f.r = 1;
145+
suncolor2_f.g = MYMAX(0.3, MYMIN(1.0, 0.85 + m_time_brightness * 0.5));
146+
suncolor2_f.b = MYMAX(0.0, m_brightness);
147147

148148
float moonsize = 0.04;
149149
video::SColorf mooncolor_f(0.50, 0.57, 0.65, 1);

Diff for: ‎src/threading/thread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Thread {
152152
std::mutex m_mutex;
153153
std::mutex m_start_finished_mutex;
154154

155-
std::thread *m_thread_obj;
155+
std::thread *m_thread_obj = nullptr;
156156

157157

158158
#ifdef _AIX

0 commit comments

Comments
 (0)
Please sign in to comment.