Attn: Code cleanup based on CI build suggestions

Lessened the scope of some variables, made explicit a constructor,
changed a variable name that was shadowing a function name, removed some
unused code.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I430f6dece8b606318a0ffa476bf06f9a0060f72d
diff --git a/attn/attn_logging.cpp b/attn/attn_logging.cpp
index 3aa0889..f254331 100644
--- a/attn/attn_logging.cpp
+++ b/attn/attn_logging.cpp
@@ -175,15 +175,15 @@
     // GetPEL returns file descriptor (int)
     int fd = -1;
 
-    // Sdbus call specifics
-    constexpr auto service   = "xyz.openbmc_project.Logging";
-    constexpr auto path      = "/xyz/openbmc_project/logging";
-    constexpr auto interface = "org.open_power.Logging.PEL";
-    constexpr auto function  = "GetPEL";
-
     // Get the PEL file descriptor
     try
     {
+        // Sdbus call specifics
+        constexpr auto service   = "xyz.openbmc_project.Logging";
+        constexpr auto path      = "/xyz/openbmc_project/logging";
+        constexpr auto interface = "org.open_power.Logging.PEL";
+        constexpr auto function  = "GetPEL";
+
         auto bus    = sdbusplus::bus::new_default_system();
         auto method = bus.new_method_call(service, path, interface, function);
         method.append(i_pelId);
@@ -225,19 +225,19 @@
     // CreatePELWithFFDCFiles returns log-id and platform log-id
     std::tuple<uint32_t, uint32_t> pelResp = {0, 0};
 
-    // Sdbus call specifics
-    constexpr auto level     = "xyz.openbmc_project.Logging.Entry.Level.Error";
-    constexpr auto service   = "xyz.openbmc_project.Logging";
-    constexpr auto path      = "/xyz/openbmc_project/logging";
-    constexpr auto interface = "org.open_power.Logging.PEL";
-    constexpr auto function  = "CreatePELWithFFDCFiles";
-
     // Need to provide pid when using create or create-with-ffdc methods
     i_additional.emplace("_PID", std::to_string(getpid()));
 
     // Create the PEL
     try
     {
+        // Sdbus call specifics
+        constexpr auto level = "xyz.openbmc_project.Logging.Entry.Level.Error";
+        constexpr auto service   = "xyz.openbmc_project.Logging";
+        constexpr auto path      = "/xyz/openbmc_project/logging";
+        constexpr auto interface = "org.open_power.Logging.PEL";
+        constexpr auto function  = "CreatePELWithFFDCFiles";
+
         auto bus    = sdbusplus::bus::new_default_system();
         auto method = bus.new_method_call(service, path, interface, function);
         method.append(i_event, level, i_additional, i_ffdc);
@@ -266,14 +266,6 @@
  */
 void createPelRaw(std::vector<uint8_t>& i_buffer)
 {
-    // Sdbus call specifics
-    constexpr auto event     = "xyz.open_power.Attn.Error.Terminate";
-    constexpr auto level     = "xyz.openbmc_project.Logging.Entry.Level.Error";
-    constexpr auto service   = "xyz.openbmc_project.Logging";
-    constexpr auto path      = "/xyz/openbmc_project/logging";
-    constexpr auto interface = "xyz.openbmc_project.Logging.Create";
-    constexpr auto function  = "Create";
-
     // Create FFDC file from buffer data
     util::FFDCFile pelFile{util::FFDCFormat::Text};
     auto fd = pelFile.getFileDescriptor();
@@ -291,9 +283,18 @@
     // Create the PEL
     try
     {
+        // Sdbus call specifics
+        constexpr auto pelEvent = "xyz.open_power.Attn.Error.Terminate";
+        constexpr auto level = "xyz.openbmc_project.Logging.Entry.Level.Error";
+        constexpr auto service   = "xyz.openbmc_project.Logging";
+        constexpr auto path      = "/xyz/openbmc_project/logging";
+        constexpr auto interface = "xyz.openbmc_project.Logging.Create";
+        constexpr auto function  = "Create";
+
         auto bus    = sdbusplus::bus::new_default_system();
         auto method = bus.new_method_call(service, path, interface, function);
-        method.append(event, level, additional);
+        method.append(pelEvent, level, additional);
+
         bus.call_noreply(method);
     }
     catch (const sdbusplus::exception::SdBusError& e)
diff --git a/attn/pel/pel_minimal.hpp b/attn/pel/pel_minimal.hpp
index cde0ead..79c0c11 100644
--- a/attn/pel/pel_minimal.hpp
+++ b/attn/pel/pel_minimal.hpp
@@ -46,7 +46,7 @@
      *
      * @param[in] pelBuffer - buffer containing a raw PEL
      */
-    PelMinimal(std::vector<uint8_t>& data);
+    explicit PelMinimal(std::vector<uint8_t>& data);
 
     /**
      * @brief Stream raw PEL data to buffer
diff --git a/attn/pel/private_header.cpp b/attn/pel/private_header.cpp
index 18d06d4..a610594 100644
--- a/attn/pel/private_header.cpp
+++ b/attn/pel/private_header.cpp
@@ -34,25 +34,5 @@
     _sectionCount = sectionCount;
 }
 
-/*
-Stream& operator<<(Stream& s, const CreatorVersion& cv)
-{
-    for (size_t i = 0; i < sizeof(CreatorVersion); i++)
-    {
-        s << cv.version[i];
-    }
-    return s;
-}
-
-Stream& operator>>(Stream& s, CreatorVersion& cv)
-{
-    for (size_t i = 0; i < sizeof(CreatorVersion); i++)
-    {
-        s >> cv.version[i];
-    }
-    return s;
-}
-*/
-
 } // namespace pel
 } // namespace attn
diff --git a/attn/pel/private_header.hpp b/attn/pel/private_header.hpp
index 3b80968..6d447ee 100644
--- a/attn/pel/private_header.hpp
+++ b/attn/pel/private_header.hpp
@@ -1,6 +1,5 @@
 #pragma once
 
-//#include "bcd_time.hpp"
 #include "pel_common.hpp"
 #include "pel_section.hpp"
 #include "stream.hpp"
@@ -10,17 +9,6 @@
 namespace pel
 {
 
-// creator version field type, init to null terminated
-// struct CreatorVersion
-//{
-//    uint8_t version[8];
-
-//    CreatorVersion()
-//    {
-//        memset(version, '\0', sizeof(version));
-//    }
-//};
-
 /**
  * @class PrivateHeader
  *
@@ -121,13 +109,11 @@
      * @brief The creation time timestamp
      */
     uint64_t _createTimestamp;
-    // BCDTime _createTimestamp;
 
     /**
      * @brief The commit time timestamp
      */
     uint64_t _commitTimestamp;
-    // BCDTime _commitTimestamp;
 
     /**
      * @brief The creator ID field
@@ -171,21 +157,5 @@
     uint32_t _id = 0;
 };
 
-/**
- * @brief Stream insertion operator for the CreatorVersion
- *
- * @param[out] s - the stream
- * @param[in] cv - the CreatorVersion object
- */
-// Stream& operator<<(Stream& s, const CreatorVersion& cv);
-
-/**
- * @brief Stream extraction operator for the CreatorVersion
- *
- * @param[in] s - the stream
- * @param[out] cv - the CreatorVersion object
- */
-// Stream& operator>>(Stream& s, CreatorVersion& cv);
-
 } // namespace pel
 } // namespace attn