From 6c30f6e3d28345740bec510db7ea6747c1fcc6e0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 4 Sep 2018 15:57:39 -0700 Subject: [PATCH] fuzzy_fastboot: Use uint64_t for partition sizes. Bug: N/A Test: fuzzy_fastboot Conformance.PartitionInfo passes Change-Id: I27182585a1522d22dd3ddfe83ce22e06dd7fc762 --- fastboot/fastboot_driver.cpp | 4 ++-- fastboot/fastboot_driver.h | 2 +- fastboot/fuzzy_fastboot/main.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fastboot/fastboot_driver.cpp b/fastboot/fastboot_driver.cpp index 6bd61282b..f9e640ab3 100644 --- a/fastboot/fastboot_driver.cpp +++ b/fastboot/fastboot_driver.cpp @@ -126,7 +126,7 @@ RetCode FastBootDriver::FlashPartition(const std::string& part, sparse_file* s) return RawCommand(Commands::FLASH + part); } -RetCode FastBootDriver::Partitions(std::vector>* parts) { +RetCode FastBootDriver::Partitions(std::vector>* parts) { std::vector all; RetCode ret; if ((ret = GetVarAll(&all))) { @@ -140,7 +140,7 @@ RetCode FastBootDriver::Partitions(std::vector if (std::regex_match(s, sm, reg)) { std::string m1(sm[1]); std::string m2(sm[2]); - uint32_t tmp = strtol(m2.c_str(), 0, 16); + uint64_t tmp = strtoll(m2.c_str(), 0, 16); parts->push_back(std::make_tuple(m1, tmp)); } } diff --git a/fastboot/fastboot_driver.h b/fastboot/fastboot_driver.h index 2651690cb..ca9003a0b 100644 --- a/fastboot/fastboot_driver.h +++ b/fastboot/fastboot_driver.h @@ -99,7 +99,7 @@ class FastBootDriver { RetCode FlashPartition(const std::string& part, int fd, uint32_t sz); RetCode FlashPartition(const std::string& part, sparse_file* s); - RetCode Partitions(std::vector>* parts); + RetCode Partitions(std::vector>* parts); RetCode Require(const std::string& var, const std::vector& allowed, bool* reqmet, bool invert = false); diff --git a/fastboot/fuzzy_fastboot/main.cpp b/fastboot/fuzzy_fastboot/main.cpp index 1d30f8bd8..a7b22c6cf 100644 --- a/fastboot/fuzzy_fastboot/main.cpp +++ b/fastboot/fuzzy_fastboot/main.cpp @@ -304,7 +304,7 @@ TEST_F(Conformance, UnlockAbility) { } TEST_F(Conformance, PartitionInfo) { - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed"; EXPECT_GT(parts.size(), 0) << "getvar:all did not report any partition-size: through INFO responses"; @@ -340,7 +340,7 @@ TEST_F(Conformance, Slots) { // Can't run out of alphabet letters... ASSERT_LE(num_slots, 26) << "What?! You can't have more than 26 slots"; - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed"; std::map> part_slots; @@ -587,14 +587,14 @@ TEST_F(UnlockPermissions, DownloadFlash) { std::vector buf{'a', 'o', 's', 'p'}; EXPECT_EQ(fb->Download(buf), SUCCESS) << "Download failed in unlocked mode"; ; - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed in unlocked mode"; } TEST_F(LockPermissions, DownloadFlash) { std::vector buf{'a', 'o', 's', 'p'}; EXPECT_EQ(fb->Download(buf), SUCCESS) << "Download failed in locked mode"; - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed in locked mode"; std::string resp; for (const auto tup : parts) { @@ -607,7 +607,7 @@ TEST_F(LockPermissions, DownloadFlash) { } TEST_F(LockPermissions, Erase) { - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed"; std::string resp; for (const auto tup : parts) { @@ -619,7 +619,7 @@ TEST_F(LockPermissions, Erase) { } TEST_F(LockPermissions, SetActive) { - std::vector> parts; + std::vector> parts; EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed"; std::string resp; @@ -916,7 +916,7 @@ INSTANTIATE_TEST_CASE_P(XMLGetVar, ExtensionsGetVarConformance, TEST_P(AnyPartition, ReportedGetVarAll) { // As long as the partition is reported in INFO, it would be tested by generic Conformance - std::vector> parts; + std::vector> parts; ASSERT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed"; const std::string name = GetParam().first; if (GetParam().second.slots) {