Issues found by Cppcheck 1.55

src/logic/widelands_geometry.h:127: (warning) Member variable 'FCoords::field' is not initialized in the constructor.
src/logic/widelands_geometry.h:137: (warning) Member variable 'FCoords::field' is not initialized in the constructor.
src/logic/world.h:48: (warning) Member variable 'Resource_Descr::m_is_detectable' is not initialized in the constructor.
src/logic/world.h:136: (style) The struct 'MapGenAreaInfo 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
src/logic/world.h:205: (style) The struct 'MapGenBobArea 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
src/logic/world.h:232: (style) The struct 'MapGenInfo 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
src/logic/field.h:61: (style) The struct 'Field 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
src/logic/productionsite.h:199: (warning) Member variable 'State::program' is not initialized in the constructor.
src/logic/player.h:140: (warning) Member variable 'Field::constructionsite' is not initialized in the constructor.
src/logic/player.h:140: (warning) Member variable 'Field::border' is not initialized in the constructor.
src/logic/player.h:140: (warning) Member variable 'Field::border_r' is not initialized in the constructor.
src/logic/player.h:140: (warning) Member variable 'Field::border_br' is not initialized in the constructor.
src/logic/player.h:140: (warning) Member variable 'Field::border_bl' is not initialized in the constructor.
src/ai/ai_help_structs.h:166: (warning) Member variable 'BuildableField::avoid_military' is not initialized in the constructor.
src/ai/ai_help_structs.h:166: (warning) Member variable 'BuildableField::enemy_nearby' is not initialized in the constructor.
src/io/basic_fileread.h:53: (warning) Member variable 'basic_FileRead::length' is not initialized in the constructor.
src/io/basic_filewrite.h:97: (error) Common realloc mistake: 'data' nulled but not freed upon failure
src/logic/path.h:54: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/path.h:87: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_id.h:49: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_id.h:50: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_id.h:51: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_queue.h:70: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_queue.h:109: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/message_queue.h:125: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/production_program.h:180: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/production_program.h:193: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/productionsite.h:77: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/productionsite.h:80: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/productionsite.h:268: (performance) Parameter 'Ware' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/tribe.h:77: (performance) Parameter 'index' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/tribe.h:96: (performance) Parameter 'index' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/tribe.h:99: (performance) Parameter 'index' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/tribe.h:102: (performance) Parameter 'index' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/tribe.h:111: (performance) Parameter 'index' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.h:102: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.h:423: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.h:429: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.h:468: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.h:526: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/manager.h:97: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/manager.h:101: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/descr_maintainer.h:133: (performance) Parameter 'idx' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/descr_maintainer.h:69: (performance) Parameter 'n' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/io/basic_filewrite.h:79: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/io/basic_filewrite.h:86: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/io/basic_fileread.h:98: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/io/basic_fileread.h:117: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/io/basic_fileread.h:130: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/machdep.h:70: (error) Uninitialized variable: s
src/machdep.h:72: (error) Uninitialized variable: s
src/machdep.h:74: (error) Uninitialized variable: s
src/machdep.h:76: (error) Uninitialized variable: s
src/machdep.h:78: (error) Uninitialized variable: s
src/graphic/animation_gfx.h:41: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/animation_gfx.h:57: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/rect.h:27: (performance) Parameter 'p' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/warelist.h:55: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:112: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:115: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:129: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:132: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:135: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/economy.h:138: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/chat.cc:74: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/map_io/widelands_map_message_saver.h:43: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/map_io/widelands_map_message_saver.h:47: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/warehousesupply.h:44: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/warehousesupply.h:47: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/flag.cc:87: (error) Uninitialized variable: state
src/economy/test/test_road.cc:35: (performance) Parameter 'c' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/test/test_routing.cc:97] -> [src/economy/test/test_routing.cc:97: (style) Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.
src/economy/test/test_routing.cc:411: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/economy/test/test_routing.cc:139: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/economy/test/test_routing.cc:142: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/wui/overlay_manager.h:68: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wui/overlay_manager.h:72: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wui/overlay_manager.h:171: (performance) Parameter 'Jobid' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wui/overlay_manager.h:173: (performance) Parameter 'Hotspot' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/ui_basic/checkbox.h:97: (performance) Parameter 'p' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/editor/tools/editor_draw_tool.cc:47: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_draw_tool.cc:63: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_place_bob_tool.cc:66: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_place_bob_tool.cc:95: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_place_immovable_tool.cc:72: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_place_immovable_tool.cc:102: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_set_resources_tool.cc:133: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_set_resources_tool.cc:134: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_set_terrain_tool.cc:64: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/editor/tools/editor_set_terrain_tool.cc:92: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/logic/cmd_expire_message.h:38: (performance) Parameter 'm' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:64: (warning) Member variable 'Cmd_Bulldoze::recurse' is not initialized in the constructor.
src/logic/playercommand.h:133: (warning) Member variable 'Cmd_BuildRoad::path' is not initialized in the constructor.
src/logic/playercommand.h:133: (warning) Member variable 'Cmd_BuildRoad::steps' is not initialized in the constructor.
src/logic/playercommand.h:92: (performance) Parameter 'c' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:93: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:114: (performance) Parameter 'c' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:201: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:543: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:561: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/playercommand.h:576: (performance) Parameter 'i' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:1191: (performance) Parameter 'rc' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:1192: (performance) Parameter 'viewpoint' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:1193: (performance) Parameter 'framepoint' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:1130: (performance) Parameter 'ptopleft' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:1131: (performance) Parameter 'pbottomright' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/terrain_sdl.h:563: (performance) Parameter 'start' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/terrain_sdl.h:563: (performance) Parameter 'end' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/terrain_sdl.h:536: (performance) Parameter 'start' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/terrain_sdl.h:536: (performance) Parameter 'end' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/graphic/render/gameview.cc:264: (error) Uninitialized variable: r_player_field
src/graphic/render/surface_sdl.cc:125: (style) Variable 'pix' is assigned a value that is never used
src/graphic/texture.cc:177: (error) Common realloc mistake: 'm_pixels' nulled but not freed upon failure
src/i18n.cc:159: (style) Variable 'alt_str' is assigned a value that is never used
src/io/dedicated_log.cc:46: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/io/dedicated_log.cc:76: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/io/dedicated_log.cc:163: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/io/dedicated_log.cc:166: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/io/dedicated_log.cc:200: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/io/filesystem/filesystem.cc:69: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_root' a value by passing the value to the constructor in the initialization list.
src/journal.cc:219: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/journal.cc:269: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/logic/battle.cc:40: (warning) Member variable 'Battle::m_last_attack_hits' is not initialized in the constructor.
src/logic/bob.cc:1181: (performance) Checking for 'm_stack' emptiness might be inefficient. Using m_stack.empty() instead of m_stack.size() can be faster. m_stack.size() can take linear time but m_stack.empty() is guaranteed to take constant time.
src/logic/building.cc:521: (style) Statements following return, break, continue, goto or throw will never be executed.
src/logic/building.cc:533: (style) Statements following return, break, continue, goto or throw will never be executed.
src/logic/building.cc:292: (error) Uninitialized variable: state
src/logic/cmd_incorporate.h:31: (warning) Member variable 'Cmd_Incorporate::worker' is not initialized in the constructor.
src/logic/cmd_luacoroutine.h:31: (warning) Member variable 'Cmd_LuaCoroutine::m_cr' is not initialized in the constructor.
src/logic/dismantlesite.cc:67: (performance) Parameter 'c' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/game.cc:505: (style) Variable 'no_name' is not assigned a value
src/logic/game.cc:128: (warning) Member variable 'Game::m_replayreader' is not initialized in the constructor.
src/gamesettings.h:76: (warning) Member variable 'GameSettings::scenario' is not initialized in the constructor.
src/gamesettings.h:76: (warning) Member variable 'GameSettings::multiplayer' is not initialized in the constructor.
src/network/network.h:133: (style) The struct 'Deserializer 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
src/logic/game.cc:588: (style) Found obsolete function 'usleep'. POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008 removes it. It is recommended that new applications use the 'nanosleep' or 'setitimer' function.
src/logic/immovable.cc:509: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/map.cc:1781: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/logic/map.cc:71: (warning) Member variable 'Map::m_filename' is not initialized in the constructor.
src/logic/map.cc:71: (warning) Member variable 'Map::m_author' is not initialized in the constructor.
src/logic/map.cc:71: (warning) Member variable 'Map::m_name' is not initialized in the constructor.
src/logic/map.cc:71: (warning) Member variable 'Map::m_description' is not initialized in the constructor.
src/logic/map.cc:629: (error) Common realloc mistake: 'm_starting_pos' nulled but not freed upon failure
src/logic/map.cc:812: (performance) Parameter 'cur' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/map.cc:899: (performance) Parameter 'cur' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/map.cc:1008: (performance) Parameter 'cur' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/path.cc:150: (performance) Parameter 'after' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/path.cc:162: (performance) Parameter 'before' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.cc:615: (performance) Parameter 'index_of_new_building' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.cc:1129: (performance) Parameter 'ware' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.cc:1141: (performance) Parameter 'ware' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.cc:1149: (performance) Parameter 'ware' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/player.cc:1011: (performance) Checking for 'm_team_player' emptiness might be inefficient. Using m_team_player.empty() instead of m_team_player.size() can be faster. m_team_player.size() can take linear time but m_team_player.empty() is guaranteed to take constant time.
src/logic/player.cc:1043: (performance) Checking for 'm_team_player' emptiness might be inefficient. Using m_team_player.empty() instead of m_team_player.size() can be faster. m_team_player.size() can take linear time but m_team_player.empty() is guaranteed to take constant time.
src/logic/playercommand.cc:1547: (warning) Member variable 'Cmd_SetStockPolicy::m_isworker' is not initialized in the constructor.
src/logic/playercommand.cc:210: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'bi' a value by passing the value to the constructor in the initialization list.
src/logic/playercommand.cc:262: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'coords' a value by passing the value to the constructor in the initialization list.
src/logic/playercommand.cc:315: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'start' a value by passing the value to the constructor in the initialization list.
src/logic/replay.cc:182: (style) The second of the two statements can never be executed, and so should be removed.
src/logic/soldier.cc:312: (warning) Member variable 'Soldier::m_combat_walking' is not initialized in the constructor.
src/logic/soldier.cc:536: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/logic/soldier.cc:193: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/logic/world.cc:259: (style) Variable 'res_str' is assigned a value that is never used
src/map_generator.cc:457: (style) The scope of the variable 'landType' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. src/map_generator.cc:133: (performance) Parameter 'fc' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/map_generator.cc:442: (performance) Parameter 'c0' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/map_generator.cc:442: (performance) Parameter 'c1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/map_generator.cc:442: (performance) Parameter 'c2' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/map_io/widelands_map_player_names_and_tribes_data_packet.cc:96: (style) Unused variable: name
src/map_io/widelands_map_player_names_and_tribes_data_packet.cc:96: (style) Unused variable: tribe
src/map_io/widelands_map_players_view_data_packet.cc:846: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/map_io/widelands_map_players_view_data_packet.cc:858: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/map_io/widelands_map_players_view_data_packet.cc:869: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/map_io/widelands_map_players_view_data_packet.cc:871: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/map_io/widelands_map_players_view_data_packet.cc:873: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/map_io/widelands_map_players_view_data_packet.cc:504: (error) Memory leak: mod
src/map_io/widelands_map_players_view_data_packet.cc:556: (error) Memory leak: mod
src/map_io/widelands_map_players_view_data_packet.cc:580: (error) Memory leak: mod
src/map_io/widelands_map_players_view_data_packet.cc:744: (error) Uninitialized variable: csi
src/network/internet_gaming.cc:104: (portability) Found non reentrant function 'gethostbyname'. For threadsafe applications it is recommended to use the reentrant replacement function 'gethostbyname_r'
src/network/internet_gaming.cc:104: (style) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function
src/network/netclient.cc:737: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. This means that you should only use 'auto_ptr' for pointers obtained with operator 'new'. This excludes arrays, which are allocated by operator 'new[]' and must be deallocated by operator 'delete[]'.
src/network/netclient.cc:822: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. This means that you should only use 'auto_ptr' for pointers obtained with operator 'new'. This excludes arrays, which are allocated by operator 'new[]' and must be deallocated by operator 'delete[]'.
src/network/nethost.cc:441: (style) Unused variable: name
src/network/nethost.cc:787: (style) Variable 'tips' is assigned a value that is never used
src/network/nethost.cc:2559: (style) Variable 'name' is assigned a value that is never used
src/network/nethost.cc:66: (warning) Member variable 'HostGameSettingsProvider::m_lua' is not initialized in the constructor.
src/network/nethost.cc:581: (warning) Member variable 'NetHostImpl::promoter' is not initialized in the constructor.
src/network/nethost.cc:581: (warning) Member variable 'NetHostImpl::game' is not initialized in the constructor.
src/network/nethost.cc:581: (warning) Member variable 'NetHostImpl::waiting' is not initialized in the constructor.
src/network/nethost.cc:581: (warning) Member variable 'NetHostImpl::syncreport_pending' is not initialized in the constructor.
src/network/nethost.cc:581: (warning) Member variable 'NetHostImpl::syncreport_arrived' is not initialized in the constructor.
src/network/nethost.cc:734: (style) Found obsolete function 'usleep'. POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008 removes it. It is recommended that new applications use the 'nanosleep' or 'setitimer' function.
src/network/nethost.cc:741: (style) Found obsolete function 'usleep'. POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008 removes it. It is recommended that new applications use the 'nanosleep' or 'setitimer' function.
src/network/nethost.cc:264: (performance) Parameter 'ps' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/network/nethost.cc:1120: (performance) Useless call of function 'substr' because it returns a copy of the object. Use operator= instead.
src/network/nethost.cc:711: (style) Variable 'needip' is assigned a value that is never used
src/scripting/c_utils.h:52: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:463: (style) Variable 'title' is assigned a value that is never used
src/scripting/lua_game.cc:464: (style) Variable 'body' is assigned a value that is never used
src/scripting/lua_game.cc:985: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_name' a value by passing the value to the constructor in the initialization list.
src/scripting/lua_game.cc:150: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:169: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:989: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:1009: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:1019: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_game.cc:1034: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:338: (style) Statements following return, break, continue, goto or throw will never be executed.
src/scripting/lua_map.cc:235: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:1054: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:1065: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:2375: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:2471: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/lua_map.cc:2493: (performance) The conversion from const char* as returned by c_str to std::string creates an unnecessary string copy. Solve that by directly passing the string.
src/scripting/pluto.cc:1333: (warning) Redundant assignment of "stacksize" to itself
src/scripting/pluto.cc:1001: (style) The scope of the variable 'sizep' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. src/scripting/pluto.cc:1001: (style) The scope of the variable 'sizek' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. src/scripting/scripting.cc:252: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.
src/sound/sound_handler.cc:58: (warning) Member variable 'Sound_Handler::m_egbase' is not initialized in the constructor.
src/text_parser.cc:106: (style) Unused variable: block_text
src/text_parser.cc:54: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_font_color' a value by passing the value to the constructor in the initialization list.
src/timestring.cc:34: (portability) Found non reentrant function 'localtime'. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'
src/ui_basic/checkbox.cc:145: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/ui_fsmenu/internet_lobby.cc:400: (portability) Found non reentrant function 'gethostbyname'. For threadsafe applications it is recommended to use the reentrant replacement function 'gethostbyname_r'
src/ui_fsmenu/internet_lobby.cc:400: (style) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function
src/ui_fsmenu/internet_lobby.cc:312: (performance) Either inefficent or wrong usage of string::find. string::compare will be faster if string::find's result is compared with 0, because it will not scan the whole string. If your intention is to check that there are no findings in the string, you should compare with string::npos.
src/ui_fsmenu/mapselect.h:63: (warning) Member variable 'MapData::scenario' is not initialized in the constructor.
src/ui_fsmenu/launchMPG.cc:603: (performance) Either inefficent or wrong usage of string::find. string::compare will be faster if string::find's result is compared with 0, because it will not scan the whole string. If your intention is to check that there are no findings in the string, you should compare with string::npos.
src/ui_fsmenu/netsetup_lan.cc:157: (portability) Found non reentrant function 'gethostbyname'. For threadsafe applications it is recommended to use the reentrant replacement function 'gethostbyname_r'
src/ui_fsmenu/netsetup_lan.cc:157: (style) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function
src/wlapplication.cc:1762: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/wlapplication.cc:126: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:127: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:130: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:141: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:142: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:145: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:159: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:160: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:163: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:189: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:190: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:193: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:1249: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:1263: (style) The exception is caught as a value. It could be caught as a (const) reference which is usually recommended in C++.
src/wlapplication.cc:1919: (performance) Parameter 'ps' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wlapplication.cc:1475: (style) Found obsolete function 'usleep'. POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008 removes it. It is recommended that new applications use the 'nanosleep' or 'setitimer' function.
src/wlapplication.cc:2284: (style) Variable 'name_length' is assigned a value that is never used
src/wui/encyclopedia_window.h:52: (performance) Parameter 'o' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wui/fieldaction.cc:970: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/wui/game_debug_ui.cc:291: (style) 'else if' condition matches previous condition at line 289
src/wui/game_debug_ui.cc:293: (style) 'else if' condition matches previous condition at line 289
src/wui/game_tips.cc:57: (performance) Checking for 'm_tips' emptiness might be inefficient. Using m_tips.empty() instead of m_tips.size() can be faster. m_tips.size() can take linear time but m_tips.empty() is guaranteed to take constant time.
src/wui/interactive_player.cc:445: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/wui/interactive_spectator.cc:277: (style) Suspicious expression. Boolean result is used in bitwise operation. The ! operator and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses.
src/vector.h:44: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/vector.h:49: (performance) Parameter 'other' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
src/wui/military_box.cc:108: (style) The scope of the variable 'buf' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. src/wui/military_box.cc:123: (style) The scope of the variable 'buf' can be reduced. Warning: It can be unsafe to fix this message. Be careful. Especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. src/wui/overlay_manager.cc:28: (warning) Member variable 'Overlay_Manager::m_callback_data' is not initialized in the constructor.
src/wui/quicknavigation.cc:38: (performance) When an object of a class is created, the constructors of all member variables are called consecutivly in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_history_index' a value by passing the value to the constructor in the initialization list.
src/wui/waresdisplay.cc:400: (performance) Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.