Merge "Cope with angler\'s whitespace-padded partition size reporting." am: 8ce943b3f6
am: 3de5363367

* commit '3de536336707c954f7196658bc03d0465af568b6':
  Cope with angler's whitespace-padded partition size reporting.
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index be30d81..b9d03e5 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1017,6 +1017,11 @@
         }
         partition_size = size_override;
     }
+    // Some bootloaders (angler, for example), send spurious leading whitespace.
+    partition_size = android::base::Trim(partition_size);
+    // Some bootloaders (hammerhead, for example) use implicit hex.
+    // This code used to use strtol with base 16.
+    if (!android::base::StartsWith(partition_size, "0x")) partition_size = "0x" + partition_size;
 
     gen = fs_get_generator(partition_type);
     if (!gen) {
@@ -1030,10 +1035,6 @@
         return;
     }
 
-    // Some bootloaders (hammerhead, for example) use implicit hex.
-    // This code used to use strtol with base 16.
-    if (!android::base::StartsWith(partition_size, "0x")) partition_size = "0x" + partition_size;
-
     int64_t size;
     if (!android::base::ParseInt(partition_size.c_str(), &size)) {
         fprintf(stderr, "Couldn't parse partition size '%s'.\n", partition_size.c_str());