[core] explicitly initialize a few fields to null

This commit is contained in:
Konstantin Käfer
2016-02-24 17:14:59 +01:00
committed by John Firebaugh
parent 661e9e7f49
commit 8112ac3371
6 changed files with 12 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ public:
~HeadlessDisplay();
#if MBGL_USE_CGL
CGLPixelFormatObj pixelFormat;
CGLPixelFormatObj pixelFormat = nullptr;
#endif
#if MBGL_USE_GLX

View File

@@ -54,7 +54,7 @@ private:
std::shared_ptr<HeadlessDisplay> display;
const float pixelRatio;
std::array<uint16_t, 2> dimensions;
bool needsResize;
bool needsResize = false;
#if MBGL_USE_CGL
CGLContextObj glContext = nullptr;

View File

@@ -18,10 +18,10 @@ struct Faded {
Faded(const T& v) : to(v) {}
T from;
float fromScale;
float fromScale = 0;
T to;
float toScale;
float t;
float toScale = 0;
float t = 0;
};
// -------------------------------------------------------------------------------------------------

View File

@@ -161,9 +161,9 @@ private:
float depthRangeSize;
const float depthEpsilon = 1.0f / (1 << 16);
SpriteAtlas* spriteAtlas;
GlyphAtlas* glyphAtlas;
LineAtlas* lineAtlas;
SpriteAtlas* spriteAtlas = nullptr;
GlyphAtlas* glyphAtlas = nullptr;
LineAtlas* lineAtlas = nullptr;
FrameHistory frameHistory;

View File

@@ -81,8 +81,8 @@ private:
std::thread thread;
Object* object;
RunLoop* loop;
Object* object = nullptr;
RunLoop* loop = nullptr;
};
template <class Object>

View File

@@ -72,7 +72,7 @@ public:
}
private:
sqlite3* db;
sqlite3* db = nullptr;
bool locked = false;
};
@@ -115,7 +115,7 @@ TEST(OfflineDatabase, SchemaVersion) {
std::string path("test/fixtures/database/offline.db");
{
sqlite3* db;
sqlite3* db = nullptr;
sqlite3_open_v2(path.c_str(), &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
sqlite3_exec(db, "PRAGMA user_version = 1", nullptr, nullptr, nullptr);
sqlite3_close_v2(db);