From 46cc299f5e98f09a05f6f624731ed7b08f50ec62 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 3 Jan 2013 21:02:04 +0000 Subject: [PATCH] base: fix more memory corruptions in the Array class. --- src/lol/base/array.h | 70 ++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/lol/base/array.h b/src/lol/base/array.h index 104c80a3..ff14f887 100644 --- a/src/lol/base/array.h +++ b/src/lol/base/array.h @@ -309,14 +309,14 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; - this->m_data[this->m_count].m4 = m4; - this->m_data[this->m_count].m5 = m5; - this->m_data[this->m_count].m6 = m6; - this->m_data[this->m_count].m7 = m7; - this->m_data[this->m_count].m8 = m8; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); + new (&this->m_data[this->m_count].m4) T4(m4); + new (&this->m_data[this->m_count].m5) T5(m5); + new (&this->m_data[this->m_count].m6) T6(m6); + new (&this->m_data[this->m_count].m7) T7(m7); + new (&this->m_data[this->m_count].m8) T8(m8); } ++this->m_count; } @@ -347,13 +347,13 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; - this->m_data[this->m_count].m4 = m4; - this->m_data[this->m_count].m5 = m5; - this->m_data[this->m_count].m6 = m6; - this->m_data[this->m_count].m7 = m7; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); + new (&this->m_data[this->m_count].m4) T4(m4); + new (&this->m_data[this->m_count].m5) T5(m5); + new (&this->m_data[this->m_count].m6) T6(m6); + new (&this->m_data[this->m_count].m7) T7(m7); } ++this->m_count; } @@ -383,12 +383,12 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; - this->m_data[this->m_count].m4 = m4; - this->m_data[this->m_count].m5 = m5; - this->m_data[this->m_count].m6 = m6; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); + new (&this->m_data[this->m_count].m4) T4(m4); + new (&this->m_data[this->m_count].m5) T5(m5); + new (&this->m_data[this->m_count].m6) T6(m6); } ++this->m_count; } @@ -416,11 +416,11 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; - this->m_data[this->m_count].m4 = m4; - this->m_data[this->m_count].m5 = m5; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); + new (&this->m_data[this->m_count].m4) T4(m4); + new (&this->m_data[this->m_count].m5) T5(m5); } ++this->m_count; } @@ -445,10 +445,10 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; - this->m_data[this->m_count].m4 = m4; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); + new (&this->m_data[this->m_count].m4) T4(m4); } ++this->m_count; } @@ -472,9 +472,9 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; - this->m_data[this->m_count].m3 = m3; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); + new (&this->m_data[this->m_count].m3) T3(m3); } ++this->m_count; } @@ -497,8 +497,8 @@ public: } else { - this->m_data[this->m_count].m1 = m1; - this->m_data[this->m_count].m2 = m2; + new (&this->m_data[this->m_count].m1) T1(m1); + new (&this->m_data[this->m_count].m2) T2(m2); } ++this->m_count; }