Print operation names using InstallOperationTypeName().

PayloadFile had a local array to convert from the operation type enum
to a human-readable string name. Since the enum is converted to an int
this method will not fail to compile whenever new operations are added.

This patch removes such array and uses the existing
InstallOperationTypeName() function to convert the enum to string. This
fixes a buffer overflow in test code that generates new operations.

Bug: chromium:543593
Test: USE="clang asan" FEATURES=test emerge-link update_engine

Change-Id: Ib8d80711d039edf18a323aefaad4ce96e5dfc2e3
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index b376326..670027b 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -36,15 +36,6 @@
 
 namespace {
 
-static const char* kInstallOperationTypes[] = {
-  "REPLACE",
-  "REPLACE_BZ",
-  "MOVE",
-  "BSDIFF",
-  "SOURCE_COPY",
-  "SOURCE_BSDIFF"
-};
-
 struct DeltaObject {
   DeltaObject(const string& in_name, const int in_type, const off_t in_size)
       : name(in_name),
@@ -313,11 +304,14 @@
 
   static const char kFormatString[] = "%6.2f%% %10jd %-10s %s\n";
   for (const DeltaObject& object : objects) {
-    fprintf(stderr, kFormatString,
-            object.size * 100.0 / total_size,
-            static_cast<intmax_t>(object.size),
-            object.type >= 0 ? kInstallOperationTypes[object.type] : "-",
-            object.name.c_str());
+    fprintf(
+        stderr, kFormatString,
+        object.size * 100.0 / total_size,
+        static_cast<intmax_t>(object.size),
+        (object.type >= 0 ? InstallOperationTypeName(
+                                static_cast<InstallOperation_Type>(object.type))
+                          : "-"),
+        object.name.c_str());
   }
   fprintf(stderr, kFormatString,
           100.0, static_cast<intmax_t>(total_size), "", "<total>");