Skip to content

Commit 8d7e353

Browse files
clover2123ksh8281
authored andcommitted
Fill omitted member initializations
* fix minor code defects Signed-off-by: HyukWoo Park <[email protected]>
1 parent 6e3220b commit 8d7e353

File tree

7 files changed

+32
-4
lines changed

7 files changed

+32
-4
lines changed

src/intl/IntlDateTimeFormat.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ IntlDateTimeFormatObject::IntlDateTimeFormatObject(ExecutionState& state, Object
319319
, m_calendar(String::emptyString)
320320
, m_numberingSystem(String::emptyString)
321321
, m_timeZone(String::emptyString)
322+
, m_icuDateFormat(nullptr)
322323
{
323324
// Let requestedLocales be ? CanonicalizeLocaleList(locales).
324325
ValueVector requestedLocales = Intl::canonicalizeLocaleList(state, locales);

src/intl/IntlDisplayNames.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ namespace Escargot {
3232

3333
IntlDisplayNamesObject::IntlDisplayNamesObject(ExecutionState& state, Object* proto, Value locales, Value options)
3434
: DerivedObject(state, proto)
35+
, m_style(nullptr)
36+
, m_type(nullptr)
37+
, m_fallback(nullptr)
38+
, m_locale(nullptr)
39+
, m_languageDisplay(nullptr)
40+
, m_icuLocaleDisplayNames(nullptr)
3541
{
3642
#if defined(ENABLE_RUNTIME_ICU_BINDER)
3743
UVersionInfo versionArray;

src/intl/IntlListFormat.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ namespace Escargot {
3535

3636
IntlListFormatObject::IntlListFormatObject(ExecutionState& state, Object* proto, Value locales, Value options)
3737
: DerivedObject(state, proto)
38+
, m_locale(nullptr)
39+
, m_type(nullptr)
40+
, m_style(nullptr)
41+
, m_icuListFormatter(nullptr)
3842
{
3943
// https://tc39.es/ecma402/#sec-Intl.ListFormat
4044
#if defined(ENABLE_RUNTIME_ICU_BINDER)

src/intl/IntlLocale.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ IntlLocaleObject::IntlLocaleObject(ExecutionState& state, String* tag, Optional<
202202

203203
IntlLocaleObject::IntlLocaleObject(ExecutionState& state, Object* proto, String* tag, Optional<Object*> options)
204204
: DerivedObject(state, proto)
205+
, m_language(nullptr)
206+
, m_script(nullptr)
207+
, m_region(nullptr)
208+
, m_baseName(nullptr)
209+
, m_locale(nullptr)
205210
{
206211
// Set tag to ? ApplyOptionsToTag(tag, options).
207212
Intl::CanonicalizedLangunageTag buildResult = applyOptionsToTag(state, tag, options);

src/intl/IntlPluralRules.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ void* IntlPluralRulesObject::operator new(size_t size)
7272

7373
IntlPluralRulesObject::IntlPluralRulesObject(ExecutionState& state, Object* proto, Value locales, Value options)
7474
: DerivedObject(state, proto)
75+
, m_locale(nullptr)
76+
, m_type(nullptr)
77+
, m_minimumIntegerDigits(0)
78+
, m_minimumFractionDigits(0)
79+
, m_maximumFractionDigits(0)
7580
, m_icuPluralRules(nullptr)
7681
, m_icuNumberFormat(nullptr)
7782
{

src/intl/IntlRelativeTimeFormat.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ IntlRelativeTimeFormatObject::IntlRelativeTimeFormatObject(ExecutionState& state
5656

5757
IntlRelativeTimeFormatObject::IntlRelativeTimeFormatObject(ExecutionState& state, Object* proto, Value locales, Value optionsInput)
5858
: DerivedObject(state, proto)
59+
, m_locale(nullptr)
60+
, m_dataLocale(nullptr)
61+
, m_numberingSystem(nullptr)
62+
, m_style(nullptr)
63+
, m_numeric(nullptr)
64+
, m_icuRelativeDateTimeFormatter(nullptr)
5965
{
6066
#if defined(ENABLE_RUNTIME_ICU_BINDER)
6167
UVersionInfo versionArray;

src/util/Vector.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,16 +374,17 @@ class Vector : public gc {
374374

375375
void shrinkToFit()
376376
{
377+
ASSERT(m_size <= m_capacity);
377378
if (m_size != m_capacity) {
378379
if (m_size) {
380+
ASSERT(!!m_buffer);
379381
T* newBuffer = Allocator().allocate(m_size);
380382
VectorCopier<T>::copy(newBuffer, m_buffer, m_size);
381383

382-
size_t oldC = m_capacity;
383-
m_capacity = m_size;
384-
if (m_buffer)
385-
Allocator().deallocate(m_buffer, oldC);
384+
Allocator().deallocate(m_buffer, m_capacity);
385+
386386
m_buffer = newBuffer;
387+
m_capacity = m_size;
387388
} else {
388389
clear();
389390
}

0 commit comments

Comments
 (0)