1
0
Fork 0

(svn r26056) -Fix: a number of possibly uninitialised variables

release/1.4
rubidium 2013-11-22 21:50:43 +00:00
parent bdd62a4b3e
commit 2e54c8fdfa
6 changed files with 13 additions and 9 deletions

View File

@ -29,9 +29,11 @@ assert_compile((int)CRR_END == (int)ADMIN_CRR_END);
* Create the admin handler for the given socket. * Create the admin handler for the given socket.
* @param s The socket to communicate over. * @param s The socket to communicate over.
*/ */
NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) : status(ADMIN_STATUS_INACTIVE)
{ {
this->sock = s; this->sock = s;
this->admin_name[0] = '\0';
this->admin_version[0] = '\0';
} }
NetworkAdminSocketHandler::~NetworkAdminSocketHandler() NetworkAdminSocketHandler::~NetworkAdminSocketHandler()

View File

@ -26,12 +26,10 @@
* Create a new socket for the game connection. * Create a new socket for the game connection.
* @param s The socket to connect with. * @param s The socket to connect with.
*/ */
NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(NULL),
last_frame(_frame_counter), last_frame_server(_frame_counter), last_packet(_realtime_tick)
{ {
this->sock = s; this->sock = s;
this->last_frame = _frame_counter;
this->last_frame_server = _frame_counter;
this->last_packet = _realtime_tick;
} }
/** /**

View File

@ -137,7 +137,7 @@ class CommandQueue {
public: public:
/** Initialise the command queue. */ /** Initialise the command queue. */
CommandQueue() : first(NULL), last(NULL) {} CommandQueue() : first(NULL), last(NULL), count(0) {}
/** Clear the command queue. */ /** Clear the command queue. */
~CommandQueue() { this->Free(); } ~CommandQueue() { this->Free(); }
void Append(CommandPacket *p); void Append(CommandPacket *p);

View File

@ -705,7 +705,8 @@ ClientNetworkContentSocketHandler::ClientNetworkContentSocketHandler() :
http_response_index(-2), http_response_index(-2),
curFile(NULL), curFile(NULL),
curInfo(NULL), curInfo(NULL),
isConnecting(false) isConnecting(false),
lastActivity(_realtime_tick)
{ {
} }

View File

@ -154,6 +154,8 @@ bool IsNetworkCompatibleVersion(const char *version);
* Everything we need to know about a command to be able to execute it. * Everything we need to know about a command to be able to execute it.
*/ */
struct CommandPacket : CommandContainer { struct CommandPacket : CommandContainer {
/** Make sure the pointer is NULL. */
CommandPacket() : next(NULL) {}
CommandPacket *next; ///< the next command packet (if in queue) CommandPacket *next; ///< the next command packet (if in queue)
CompanyByte company; ///< company that is executing the command CompanyByte company; ///< company that is executing the command
uint32 frame; ///< the frame in which this packet is executed uint32 frame; ///< the frame in which this packet is executed

View File

@ -560,11 +560,12 @@ static const control_point_list_t _curve_maps[] = {
static void HeightMapCurves(uint level) static void HeightMapCurves(uint level)
{ {
height_t ht[lengthof(_curve_maps)]; height_t ht[lengthof(_curve_maps)];
MemSetT(ht, 0, lengthof(ht));
/* Set up a grid to choose curve maps based on location */ /* Set up a grid to choose curve maps based on location */
uint sx = Clamp(1 << level, 2, 32); uint sx = Clamp(1 << level, 2, 32);
uint sy = Clamp(1 << level, 2, 32); uint sy = Clamp(1 << level, 2, 32);
byte *c = (byte *)alloca(sx * sy); byte *c = AllocaM(byte, sx * sy);
for (uint i = 0; i < sx * sy; i++) { for (uint i = 0; i < sx * sy; i++) {
c[i] = Random() % lengthof(_curve_maps); c[i] = Random() % lengthof(_curve_maps);