Fix some errors reported by clang static analyzer.
authorIlya Zhuravlev <zhuravlevilya@ya.ru>
Sun, 12 Jan 2014 18:07:35 +0000 (22:07 +0400)
committerIlya Zhuravlev <zhuravlevilya@ya.ru>
Sun, 12 Jan 2014 23:29:12 +0000 (03:29 +0400)
src/environment.cpp
src/script/lua_api/l_object.cpp

index 034db00d520901ea47158de0ed1e6da7ad1a2d8a..5249dd9ec5757de6b1a8afb981feaa4e34ef83d7 100644 (file)
@@ -1005,7 +1005,8 @@ void ServerEnvironment::clearAllObjects()
                }
                num_blocks_checked++;
 
-               if(num_blocks_checked % report_interval == 0){
+               if(report_interval != 0 &&
+                               num_blocks_checked % report_interval == 0){
                        float percent = 100.0 * (float)num_blocks_checked /
                                        loadable_blocks.size();
                        infostream<<"ServerEnvironment::clearAllObjects(): "
index 457d8ea7bd7a23dbe9504ff30ecf422e79622b5b..6d4ce54fc1a3e3bfae2d2c89eb370352be1f5187 100644 (file)
@@ -944,12 +944,15 @@ int ObjectRef::l_hud_change(lua_State *L)
                case HUD_STAT_DIR:
                        e->dir = lua_tonumber(L, 4);
                        value = &e->dir;
+                       break;
                case HUD_STAT_ALIGN:
                        e->align = read_v2f(L, 4);
                        value = &e->align;
+                       break;
                case HUD_STAT_OFFSET:
                        e->offset = read_v2f(L, 4);
                        value = &e->offset;
+                       break;
        }
 
        getServer(L)->hudChange(player, id, stat, value);