platform-mc : Migrate to placement_new from reinterpret casting

reinterpret_cast is prohibited by the C++ core guidelines because
it takes the behavior outside the language definition and gives
problems with type safety. Placement-new on the other-hand allows
to control the object storage while still properly instantiating
an object,keeping the behavior inside the C++ language
specification.

Change-Id: I006bb4a5de9f7d0cef4dbc7507f63e1d6798ddfe
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/platform-mc/terminus.cpp b/platform-mc/terminus.cpp
index 03f1ba4..d59ac26 100644
--- a/platform-mc/terminus.cpp
+++ b/platform-mc/terminus.cpp
@@ -126,7 +126,7 @@
 
     for (auto& pdr : pdrs)
     {
-        auto pdrHdr = reinterpret_cast<pldm_pdr_hdr*>(pdr.data());
+        auto pdrHdr = new (pdr.data()) pldm_pdr_hdr;
         switch (pdrHdr->type)
         {
             case PLDM_SENSOR_AUXILIARY_NAMES_PDR:
@@ -323,8 +323,7 @@
     size_t decodedPdrSize =
         sizeof(struct pldm_entity_auxiliary_names_pdr) + names_size;
     auto vPdr = std::vector<char>(decodedPdrSize);
-    auto decodedPdr =
-        reinterpret_cast<struct pldm_entity_auxiliary_names_pdr*>(vPdr.data());
+    auto decodedPdr = new (vPdr.data()) pldm_entity_auxiliary_names_pdr;
 
     auto rc = decode_entity_auxiliary_names_pdr(pdrData.data(), pdrData.size(),
                                                 decodedPdr, decodedPdrSize);
@@ -444,6 +443,7 @@
     std::vector<std::vector<std::pair<NameLanguageTag, SensorName>>>
         sensorAuxNames{};
     AuxiliaryNames nameStrings{};
+
     auto pdr =
         reinterpret_cast<const pldm_compact_numeric_sensor_pdr*>(sPdr.data());