Make sure various fields are initialised properly

This commit is contained in:
Michał Janiszewski 2017-01-27 07:35:48 +01:00 committed by GitHub
parent 8d56821f56
commit 6bd9e3eca8
10 changed files with 44 additions and 49 deletions

View file

@ -58,8 +58,8 @@ struct DirectoryChild
std::string Name;
// Files only
uint64 Size;
uint64 LastModified;
uint64 Size = 0;
uint64 LastModified = 0;
};
static uint32 GetPathChecksum(const utf8 * path);
@ -302,7 +302,7 @@ protected:
void GetDirectoryChildren(std::vector<DirectoryChild> &children, const std::string &path) override
{
struct dirent * * namelist;
sint32 count = scandir(path.c_str(), &namelist, FilterFunc, alphasort);
sint32 count = scandir(path.c_str(), &namelist, FilterFunc, alphasort);
if (count > 0)
{
for (sint32 i = 0; i < count; i++)

View file

@ -58,16 +58,14 @@ private:
static constexpr uint32 MaxRainPixels = 0xFFFE;
size_t _rainPixelsCapacity;
uint32 _rainPixelsCount;
RainPixel * _rainPixels;
rct_drawpixelinfo * _screenDPI;
size_t _rainPixelsCapacity = MaxRainPixels;
uint32 _rainPixelsCount = 0;
RainPixel * _rainPixels = nullptr;
rct_drawpixelinfo * _screenDPI = nullptr;
public:
RainDrawer()
{
_rainPixelsCapacity = MaxRainPixels;
_rainPixelsCount = 0;
_rainPixels = new RainPixel[_rainPixelsCapacity];
}
@ -161,8 +159,8 @@ public:
class SoftwareDrawingContext final : public IDrawingContext
{
private:
SoftwareDrawingEngine * _engine;
rct_drawpixelinfo * _dpi;
SoftwareDrawingEngine * _engine = nullptr;
rct_drawpixelinfo * _dpi = nullptr;
public:
explicit SoftwareDrawingContext(SoftwareDrawingEngine * engine);

View file

@ -175,8 +175,8 @@ class OpenGLDrawingEngine;
class OpenGLDrawingContext final : public IDrawingContext
{
private:
OpenGLDrawingEngine * _engine;
rct_drawpixelinfo * _dpi;
OpenGLDrawingEngine * _engine = nullptr;
rct_drawpixelinfo * _dpi = nullptr;
DrawImageShader * _drawImageShader = nullptr;
DrawLineShader * _drawLineShader = nullptr;
@ -184,12 +184,12 @@ private:
TextureCache * _textureCache = nullptr;
sint32 _offsetX;
sint32 _offsetY;
sint32 _clipLeft;
sint32 _clipTop;
sint32 _clipRight;
sint32 _clipBottom;
sint32 _offsetX = 0;
sint32 _offsetY = 0;
sint32 _clipLeft = 0;
sint32 _clipTop = 0;
sint32 _clipRight = 0;
sint32 _clipBottom = 0;
struct {
std::vector<DrawRectCommand> rectangles;
@ -230,7 +230,7 @@ class OpenGLDrawingEngine : public IDrawingEngine
{
private:
SDL_Window * _window = nullptr;
SDL_GLContext _context;
SDL_GLContext _context = nullptr;
uint32 _width = 0;
uint32 _height = 0;

View file

@ -33,12 +33,12 @@ class OpenGLFramebuffer;
class SwapFramebuffer final
{
private:
sint32 _width;
sint32 _height;
uint8 _targetFramebufferIndex;
OpenGLFramebuffer * _targetFramebuffer;
OpenGLFramebuffer * _sourceFramebuffer;
OpenGLFramebuffer * _framebuffer[2];
sint32 _width = 0;
sint32 _height = 0;
uint8 _targetFramebufferIndex = 0;
OpenGLFramebuffer * _targetFramebuffer = nullptr;
OpenGLFramebuffer * _sourceFramebuffer = nullptr;
OpenGLFramebuffer * _framebuffer[2] = { 0 };
CopyFramebufferShader * _copyFramebufferShader = nullptr;

View file

@ -26,10 +26,6 @@ extern "C"
#include "../../drawing.h"
}
TextureCache::TextureCache()
{
}
TextureCache::~TextureCache()
{
FreeTextures();

View file

@ -75,12 +75,14 @@ struct CachedTextureInfo
class Atlas final
{
private:
GLuint _index;
sint32 _imageSize;
sint32 _atlasWidth, _atlasHeight;
GLuint _index = 0;
sint32 _imageSize = 0;
sint32 _atlasWidth = 0;
sint32 _atlasHeight = 0;
std::vector<GLuint> _freeSlots;
sint32 _cols, _rows;
sint32 _cols = 0;
sint32 _rows = 0;
public:
Atlas(GLuint index, sint32 imageSize)
@ -187,10 +189,10 @@ class TextureCache final
private:
bool _atlasesTextureInitialised = false;
GLuint _atlasesTexture;
GLint _atlasesTextureDimensions;
GLuint _atlasesTextureIndices;
GLint _atlasesTextureIndicesLimit;
GLuint _atlasesTexture = 0;
GLint _atlasesTextureDimensions = 0;
GLuint _atlasesTextureIndices = 0;
GLint _atlasesTextureIndicesLimit = 0;
std::vector<Atlas> _atlases;
std::unordered_map<uint32, CachedTextureInfo> _imageTextureMap;
@ -200,7 +202,7 @@ private:
SDL_Color _palette[256];
public:
TextureCache();
TextureCache() = default;
~TextureCache();
void SetPalette(const SDL_Color * palette);
void InvalidateImage(uint32 image);

View file

@ -100,7 +100,7 @@ private:
_lastAdvertiseTime = SDL_GetTicks();
// Send the registration request
http_request_t request;
http_request_t request = { 0 };
request.tag = this;
request.url = GetMasterServerUrl();
request.method = HTTP_METHOD_POST;
@ -130,7 +130,7 @@ private:
void SendHeartbeat()
{
http_request_t request;
http_request_t request = { 0 };
request.tag = this;
request.url = GetMasterServerUrl();
request.method = HTTP_METHOD_PUT;

View file

@ -2203,7 +2203,7 @@ void game_command_modify_groups(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *e
uint8 groupid = (uint8)(*eax >> 8);
uint8 nameChunkIndex = (uint8)(*eax >> 16);
char oldName[128];
char oldName[128] = { 0 };
static char newName[128];
switch (action)

View file

@ -195,7 +195,7 @@ private:
ITcpSocket * listening_socket = nullptr;
uint16 listening_port = 0;
NetworkConnection server_connection;
SOCKET_STATUS _lastConnectStatus;
SOCKET_STATUS _lastConnectStatus = SOCKET_STATUS_CLOSED;
uint32 last_tick_sent_time = 0;
uint32 last_ping_sent_time = 0;
uint32 server_tick = 0;
@ -211,7 +211,7 @@ private:
INetworkServerAdvertiser * _advertiser = nullptr;
uint32 server_connect_time = 0;
uint8 default_group = 0;
SDL_RWops *_chatLogStream;
SDL_RWops *_chatLogStream = nullptr;
std::string _chatLogPath;
void UpdateServer();

View file

@ -94,17 +94,16 @@ static void ReportMissingObject(const rct_object_entry * entry);
class ObjectRepository final : public IObjectRepository
{
IPlatformEnvironment * _env = nullptr;
const IPlatformEnvironment * _env = nullptr;
std::vector<ObjectRepositoryItem> _items;
QueryDirectoryResult _queryDirectoryResult = { 0 };
ObjectEntryMap _itemMap;
uint16 _languageId = 0;
sint32 _numConflicts;
uint16 _languageId = 0;
sint32 _numConflicts = 0;
public:
ObjectRepository(IPlatformEnvironment * env)
ObjectRepository(IPlatformEnvironment * env) : _env(env)
{
_env = env;
}
~ObjectRepository() final