summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorartemp <artem@mapnik.org>2014-10-27 13:55:14 -0400
committerartemp <artem@mapnik.org>2014-10-27 14:18:11 -0400
commit95213cd3829fb2565c8b492c7eeb44a421df7bc7 (patch)
tree6f88d447c30c5f422829ea3952c83a8a00da48e2 /src
parente4294ec29446a6b1944d4d977d162d0a6bb4573f (diff)
downloadqtlocation-mapboxgl-95213cd3829fb2565c8b492c7eeb44a421df7bc7.tar.gz
c++ style memory allocations/deallocations
Diffstat (limited to 'src')
-rw-r--r--src/geometry/sprite_atlas.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp
index 10922790c0..22e6a29a0b 100644
--- a/src/geometry/sprite_atlas.cpp
+++ b/src/geometry/sprite_atlas.cpp
@@ -53,7 +53,7 @@ bool SpriteAtlas::resize(const float newRatio) {
}
}
- free(old_data);
+ ::operator delete(old_data);
dirty = true;
// Mark all sprite images as in need of update
@@ -154,7 +154,8 @@ void SpriteAtlas::allocate() {
if (!data) {
dimension w = static_cast<dimension>(width * pixelRatio);
dimension h = static_cast<dimension>(height * pixelRatio);
- data = (uint32_t *)calloc(w * h, sizeof(uint32_t));
+ data = static_cast<uint32_t*>(::operator new(w * h * sizeof(uint32_t)));
+ std::fill(data, data + w * h, 0);
}
}
@@ -268,9 +269,5 @@ SpriteAtlas::~SpriteAtlas() {
glDeleteTextures(1, &texture);
texture = 0;
-
- if (data) {
- free(data);
- data = nullptr;
- }
+ ::operator delete(data), data = nullptr;
}