Format source file by dos2unix

dos2unix to format source file which has dos end char ^M

Change-Id: Ie975dcd4762bf7d51f627bb6c1693f13a916481b
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
diff --git a/include/manager_serialize.hpp b/include/manager_serialize.hpp
index 000314e..6682617 100644
--- a/include/manager_serialize.hpp
+++ b/include/manager_serialize.hpp
@@ -1,28 +1,28 @@
-#pragma once

-

-#include "manager.hpp"

-

-#include <filesystem>

-

-namespace bios_config

-{

-

-/** @brief Serialize and persist the bios manager object

- *

- *  @param[in] obj - bios manager object

- *  @param[in] path - path to the file where the bios manager object

- *                    is to be serialized

- */

-void serialize(const Manager& obj, const fs::path& path);

-

-/** @brief Deserialize the persisted data and populate the bios manager object

- *

- *  @param[in] path - path to the persisted file

- *  @param[in/out] entry - reference to the bios manager object which is the

- *                         target of deserialization.

- *

- *  @return bool - true if the deserialization was successful, false otherwise.

- */

-bool deserialize(const fs::path& path, Manager& entry);

-

+#pragma once
+
+#include "manager.hpp"
+
+#include <filesystem>
+
+namespace bios_config
+{
+
+/** @brief Serialize and persist the bios manager object
+ *
+ *  @param[in] obj - bios manager object
+ *  @param[in] path - path to the file where the bios manager object
+ *                    is to be serialized
+ */
+void serialize(const Manager& obj, const fs::path& path);
+
+/** @brief Deserialize the persisted data and populate the bios manager object
+ *
+ *  @param[in] path - path to the persisted file
+ *  @param[in/out] entry - reference to the bios manager object which is the
+ *                         target of deserialization.
+ *
+ *  @return bool - true if the deserialization was successful, false otherwise.
+ */
+bool deserialize(const fs::path& path, Manager& entry);
+
 } // namespace bios_config
\ No newline at end of file
diff --git a/src/manager_serialize.cpp b/src/manager_serialize.cpp
index ef7b1b4..0756006 100644
--- a/src/manager_serialize.cpp
+++ b/src/manager_serialize.cpp
@@ -1,92 +1,92 @@
-#include "manager_serialize.hpp"

-

-#include <cereal/archives/binary.hpp>

-#include <cereal/cereal.hpp>

-#include <cereal/types/map.hpp>

-#include <cereal/types/string.hpp>

-#include <cereal/types/tuple.hpp>

-#include <cereal/types/variant.hpp>

-#include <cereal/types/vector.hpp>

-#include <phosphor-logging/log.hpp>

-

-#include <fstream>

-

-namespace bios_config

-{

-

-using namespace phosphor::logging;

-

-/** @brief Function required by Cereal to perform serialization.

- *

- *  @tparam Archive - Cereal archive type (binary in this case).

- *  @param[in] archive - reference to cereal archive.

- *  @param[in] entry- const reference to bios manager object

- *  @param[in] version - Class version that enables handling a serialized data

- *                       across code levels

- */

-template <class Archive>

-void save(Archive& archive, const Manager& entry,

-          const std::uint32_t /*version*/)

-{

-    archive(entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::

-                baseBIOSTable(),

-            entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::

-                pendingAttributes());

-}

-

-/** @brief Function required by Cereal to perform deserialization.

- *

- *  @tparam Archive - Cereal archive type (binary in our case).

- *  @param[in] archive - reference to cereal archive.

- *  @param[out] entry - reference to bios manager object

- *  @param[in] version - Class version that enables handling a serialized data

- *                       across code levels

- */

-template <class Archive>

-void load(Archive& archive, Manager& entry, const std::uint32_t /*version*/)

-{

-    Manager::BaseTable baseTable;

-    Manager::PendingAttributes pendingAttrs;

-

-    archive(baseTable, pendingAttrs);

-    entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::

-        baseBIOSTable(baseTable, true);

-    entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::

-        pendingAttributes(pendingAttrs, true);

-}

-

-void serialize(const Manager& obj, const fs::path& path)

-{

-    std::ofstream os(path.c_str(), std::ios::out | std::ios::binary);

-    cereal::BinaryOutputArchive oarchive(os);

-    oarchive(obj);

-}

-

-bool deserialize(const fs::path& path, Manager& entry)

-{

-    try

-    {

-        if (fs::exists(path))

-        {

-            std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);

-            cereal::BinaryInputArchive iarchive(is);

-            iarchive(entry);

-            return true;

-        }

-        return false;

-    }

-    catch (cereal::Exception& e)

-    {

-        log<level::ERR>(e.what());

-        fs::remove(path);

-        return false;

-    }

-    catch (const std::length_error& e)

-    {

-        log<level::ERR>(e.what());

-        fs::remove(path);

-        return false;

-    }

-}

-

+#include "manager_serialize.hpp"
+
+#include <cereal/archives/binary.hpp>
+#include <cereal/cereal.hpp>
+#include <cereal/types/map.hpp>
+#include <cereal/types/string.hpp>
+#include <cereal/types/tuple.hpp>
+#include <cereal/types/variant.hpp>
+#include <cereal/types/vector.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <fstream>
+
+namespace bios_config
+{
+
+using namespace phosphor::logging;
+
+/** @brief Function required by Cereal to perform serialization.
+ *
+ *  @tparam Archive - Cereal archive type (binary in this case).
+ *  @param[in] archive - reference to cereal archive.
+ *  @param[in] entry- const reference to bios manager object
+ *  @param[in] version - Class version that enables handling a serialized data
+ *                       across code levels
+ */
+template <class Archive>
+void save(Archive& archive, const Manager& entry,
+          const std::uint32_t /*version*/)
+{
+    archive(entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::
+                baseBIOSTable(),
+            entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::
+                pendingAttributes());
+}
+
+/** @brief Function required by Cereal to perform deserialization.
+ *
+ *  @tparam Archive - Cereal archive type (binary in our case).
+ *  @param[in] archive - reference to cereal archive.
+ *  @param[out] entry - reference to bios manager object
+ *  @param[in] version - Class version that enables handling a serialized data
+ *                       across code levels
+ */
+template <class Archive>
+void load(Archive& archive, Manager& entry, const std::uint32_t /*version*/)
+{
+    Manager::BaseTable baseTable;
+    Manager::PendingAttributes pendingAttrs;
+
+    archive(baseTable, pendingAttrs);
+    entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::
+        baseBIOSTable(baseTable, true);
+    entry.sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager::
+        pendingAttributes(pendingAttrs, true);
+}
+
+void serialize(const Manager& obj, const fs::path& path)
+{
+    std::ofstream os(path.c_str(), std::ios::out | std::ios::binary);
+    cereal::BinaryOutputArchive oarchive(os);
+    oarchive(obj);
+}
+
+bool deserialize(const fs::path& path, Manager& entry)
+{
+    try
+    {
+        if (fs::exists(path))
+        {
+            std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);
+            cereal::BinaryInputArchive iarchive(is);
+            iarchive(entry);
+            return true;
+        }
+        return false;
+    }
+    catch (cereal::Exception& e)
+    {
+        log<level::ERR>(e.what());
+        fs::remove(path);
+        return false;
+    }
+    catch (const std::length_error& e)
+    {
+        log<level::ERR>(e.what());
+        fs::remove(path);
+        return false;
+    }
+}
+
 } // namespace bios_config
\ No newline at end of file