Skip to content

Commit

Permalink
Use std::vector for cfobject::object_t::m_array
Browse files Browse the repository at this point in the history
  • Loading branch information
reupen committed Oct 12, 2018
1 parent e8dffaa commit 61358c3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion foo_dop/bplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace bplist
size = pfc::downcast_guarded<t_size>(reader.read_sized_int_bendian(1<< (temp&0x0f), m_abort));
}
t_size i;
object->m_array.set_count(size);
object->m_array.resize(size);
for (i=0; i<size; i++)
{
t_uint64 indexchild = reader.read_sized_int_bendian(m_footer.objectRefSize, m_abort);
Expand Down
4 changes: 2 additions & 2 deletions foo_dop/cfobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace cfobject
case kTagArray:
{
p_out << "{\r\n";
for (t_size i = 0, count = ptr->m_array.get_count(); i<count; i++)
for (t_size i = 0, count = ptr->m_array.size(); i<count; i++)
{
g_print_object(ptr->m_array[i], p_out);
p_out << "\r\n";
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace cfobject
case kTagArray:
{
p_out << "<array>\n";
for (t_size i = 0, count = ptr->m_array.get_count(); i<count; i++)
for (t_size i = 0, count = ptr->m_array.size(); i<count; i++)
{
g_export_object_to_inner_xml(ptr->m_array[i], p_out);
}
Expand Down
8 changes: 4 additions & 4 deletions foo_dop/cfobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ namespace cfobject
bool m_boolean;
t_int64 m_integer;
double m_float;
pfc::string_simple_t<WCHAR> m_string;
pfc::string_simple_t<WCHAR> m_key;
pfc::list_t<object_t::ptr_t> m_array;
pfc::string_simple_t<wchar_t> m_string;
pfc::string_simple_t<wchar_t> m_key;
std::vector<object_t::ptr_t> m_array;
dictionary m_dictionary;
pfc::array_t<t_uint8> m_data;
pfc::array_t<std::uint8_t> m_data;
t_filetimestamp m_date;

bool get_bool() {return m_boolean || m_integer;}
Expand Down
4 changes: 2 additions & 2 deletions foo_dop/mobile_device_cfobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool g_get_CFType_object (const in_mobile_device_api_handle_sync & api, CFTypeRe
p_out->m_type = cfobject::kTagArray;
CFArrayRef arr = (CFArrayRef)ref;
t_size i, count = api->CFArrayGetCount(arr);
p_out->m_array.set_size(count);
p_out->m_array.resize(count);
for (i=0; i<count; i++)
{
CFTypeRef child = api->CFArrayGetValueAtIndex(arr, i);
Expand Down Expand Up @@ -121,7 +121,7 @@ void g_get_sql_commands (cfobject::object_t::ptr_t const & cfobj, pfc::string_li

if (CommandSet.is_valid() && CommandSet->m_dictionary.get_child(L"Commands", Commands))
{
t_size j, count = Commands->m_array.get_count();
t_size j, count = Commands->m_array.size();
for (j=0; j<count; j++)
if (Commands->m_array[j].is_valid())
names.add_item(pfc::stringcvt::string_utf8_from_wide(Commands->m_array[j]->m_string.get_ptr()));
Expand Down
4 changes: 2 additions & 2 deletions foo_dop/mobile_device_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void mobile_device_handle::initialise_international()
m_icu_context.m_trans = lockedAPI->utrans_openU_4_0(International_NameTransform->m_string, -1, 0, 0, 0, 0, &status);

lockedAPI->ucol_setAttribute_4_0(m_icu_context.m_coll, 7, 17, &status);
t_size section_count = International_SectionHeaders->m_array.get_count();
t_size section_count = International_SectionHeaders->m_array.size();
m_icu_context.m_SortSections.set_count(section_count);
t_size rollingCount = 0;
for (t_size i = 0; i<section_count; i++)
Expand All @@ -245,7 +245,7 @@ void mobile_device_handle::initialise_international()
&& International_SectionHeaders->m_array[i]->m_dictionary.get_child(L"FirstCharacterAfterLanguage", FirstCharacterAfterLanguage))
{
lockedAPI.icu_get_sort_key_bound(m_icu_context.m_coll, FirstCharacterAfterLanguage->m_string.get_ptr(), -1, true, m_icu_context.m_SortSections[i].m_FirstCharacterAfterLanguageSortKey);
t_size HeaderCount = Headers->m_array.get_count();
t_size HeaderCount = Headers->m_array.size();
m_icu_context.m_SortSections[i].m_HeaderSortKeys.set_size(HeaderCount);
for (t_size j=0; j<HeaderCount; j++)
{
Expand Down
4 changes: 2 additions & 2 deletions foo_dop/plist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void XMLPlistParser::get_cfobject_for_key(const key_t & key, cfobject::object_t:
key_t key_child;
if (!g_get_tag_v2(ptr, key_child)) break;
get_cfobject_for_key(key_child, temp);
p_out->m_array.add_item(temp);
p_out->m_array.emplace_back(std::move(temp));
}
}
break;
Expand Down Expand Up @@ -346,7 +346,7 @@ void XMLPlistParser::get_cfobject_for_key(const key_t & key, cfobject::object_t:

void g_get_checkpoint_artwork_format_single(cfobject::object_t::ptr_t const & AlbumArt, pfc::list_t<artwork_format_t> & p_out)
{
t_size i, count = AlbumArt->m_array.get_count();
t_size i, count = AlbumArt->m_array.size();
for (i=0; i<count; i++)
{
if (!AlbumArt->m_array[i].is_valid()) break;
Expand Down
2 changes: 1 addition & 1 deletion foo_dop/reader_playcounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace ipod
{
if (root->m_dictionary.get_child(L"tracks", tracks))
{
t_size j, jcount = tracks->m_array.get_count();
t_size j, jcount = tracks->m_array.size();
mobilecounts.set_size(jcount);
for (j = 0; j<jcount; j++)
{
Expand Down
2 changes: 1 addition & 1 deletion foo_dop/reader_purchases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace ipod
cfobject::object_t::ptr_t assetOrdering;
if (p_reader_data.m_root_object->m_dictionary.get_child(L"assetOrdering", assetOrdering))
{
for (t_size i = 0, count = assetOrdering->m_array.get_count(); i<count; i++)
for (t_size i = 0, count = assetOrdering->m_array.size(); i<count; i++)
{
pfc::string8 fname;

Expand Down

0 comments on commit 61358c3

Please sign in to comment.