From 61358c38d997134eaca643c29d7ffbdc4df9ab14 Mon Sep 17 00:00:00 2001 From: Reupen Shah Date: Fri, 12 Oct 2018 19:58:25 +0100 Subject: [PATCH] Use std::vector for cfobject::object_t::m_array --- foo_dop/bplist.h | 2 +- foo_dop/cfobject.cpp | 4 ++-- foo_dop/cfobject.h | 8 ++++---- foo_dop/mobile_device_cfobject.cpp | 4 ++-- foo_dop/mobile_device_v2.cpp | 4 ++-- foo_dop/plist.cpp | 4 ++-- foo_dop/reader_playcounts.cpp | 2 +- foo_dop/reader_purchases.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/foo_dop/bplist.h b/foo_dop/bplist.h index 5f05549..5f2c12b 100644 --- a/foo_dop/bplist.h +++ b/foo_dop/bplist.h @@ -233,7 +233,7 @@ namespace bplist size = pfc::downcast_guarded(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; im_array.get_count(); im_array.size(); im_array[i], p_out); p_out << "\r\n"; @@ -153,7 +153,7 @@ namespace cfobject case kTagArray: { p_out << "\n"; - for (t_size i = 0, count = ptr->m_array.get_count(); im_array.size(); im_array[i], p_out); } diff --git a/foo_dop/cfobject.h b/foo_dop/cfobject.h index 353b8c4..360b2ea 100644 --- a/foo_dop/cfobject.h +++ b/foo_dop/cfobject.h @@ -59,11 +59,11 @@ namespace cfobject bool m_boolean; t_int64 m_integer; double m_float; - pfc::string_simple_t m_string; - pfc::string_simple_t m_key; - pfc::list_t m_array; + pfc::string_simple_t m_string; + pfc::string_simple_t m_key; + std::vector m_array; dictionary m_dictionary; - pfc::array_t m_data; + pfc::array_t m_data; t_filetimestamp m_date; bool get_bool() {return m_boolean || m_integer;} diff --git a/foo_dop/mobile_device_cfobject.cpp b/foo_dop/mobile_device_cfobject.cpp index 47e11a7..2be3310 100644 --- a/foo_dop/mobile_device_cfobject.cpp +++ b/foo_dop/mobile_device_cfobject.cpp @@ -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; iCFArrayGetValueAtIndex(arr, i); @@ -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; jm_array[j].is_valid()) names.add_item(pfc::stringcvt::string_utf8_from_wide(Commands->m_array[j]->m_string.get_ptr())); diff --git a/foo_dop/mobile_device_v2.cpp b/foo_dop/mobile_device_v2.cpp index c937320..15118f7 100644 --- a/foo_dop/mobile_device_v2.cpp +++ b/foo_dop/mobile_device_v2.cpp @@ -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; im_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; jm_array.add_item(temp); + p_out->m_array.emplace_back(std::move(temp)); } } break; @@ -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 & p_out) { - t_size i, count = AlbumArt->m_array.get_count(); + t_size i, count = AlbumArt->m_array.size(); for (i=0; im_array[i].is_valid()) break; diff --git a/foo_dop/reader_playcounts.cpp b/foo_dop/reader_playcounts.cpp index 766f929..00a58ce 100644 --- a/foo_dop/reader_playcounts.cpp +++ b/foo_dop/reader_playcounts.cpp @@ -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; jm_dictionary.get_child(L"assetOrdering", assetOrdering)) { - for (t_size i = 0, count = assetOrdering->m_array.get_count(); im_array.size(); i