msl_verify: dos2unix

These two files were saved with 'dos' newline characters.  Run
'dos2unix' on them to make them Unix-style newline.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9ac15b830a1becbfaba327967022a050beb8fe54
diff --git a/msl_verify.cpp b/msl_verify.cpp
index 3cd2278..6a1c7aa 100644
--- a/msl_verify.cpp
+++ b/msl_verify.cpp
@@ -1,96 +1,96 @@
-#include "config.h"

-

-#include "msl_verify.hpp"

-

-#include "version.hpp"

-

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

-

-#include <regex>

-

-using namespace phosphor::logging;

-

-int minimum_ship_level::compare(const Version& versionToCompare,

-                                const Version& mslVersion)

-{

-    if (versionToCompare.major > mslVersion.major)

-        return (1);

-    if (versionToCompare.major < mslVersion.major)

-        return (-1);

-

-    if (versionToCompare.minor > mslVersion.minor)

-        return (1);

-    if (versionToCompare.minor < mslVersion.minor)

-        return (-1);

-

-    if (versionToCompare.rev > mslVersion.rev)

-        return (1);

-    if (versionToCompare.rev < mslVersion.rev)

-        return (-1);

-

-    // Both string are equal and there is no need to make an upgrade return 0.

-    return 0;

-}

-

-// parse Function copy  inpVersion onto outVersion in Version format

-// {major,minor,rev}.

-void minimum_ship_level::parse(const std::string& inpVersion,

-                               Version& outVersion)

-{

-    std::smatch match;

-    outVersion = {0, 0, 0};

-

-    std::regex rx{REGEX_BMC_MSL, std::regex::extended};

-

-    if (!std::regex_search(inpVersion, match, rx))

-    {

-        log<level::ERR>("Unable to parse BMC version",

-                        entry("VERSION=%s", inpVersion.c_str()));

-        return;

-    }

-

-    outVersion.major = std::stoi(match[2]);

-    outVersion.minor = std::stoi(match[3]);

-    outVersion.rev = std::stoi(match[4]);

-}

-

-bool minimum_ship_level::verify(const std::string& versionManifest)

-{

-

-    //  If there is no msl or mslRegex return upgrade is needed.

-    std::string msl{BMC_MSL};

-    std::string mslRegex{REGEX_BMC_MSL};

-    if (msl.empty() || mslRegex.empty())

-    {

-        return true;

-    }

-

-    // Define mslVersion variable and populate in Version format

-    // {major,minor,rev} using parse function.

-

-    Version mslVersion = {0, 0, 0};

-    parse(msl, mslVersion);

-

-    // Define actualVersion variable and populate in Version format

-    // {major,minor,rev} using parse function.

-    std::string tmpStr{};

-

-    tmpStr = versionManifest;

-    Version actualVersion = {0, 0, 0};

-    parse(versionManifest, actualVersion);

-

-    // Compare actualVersion vs MSL.

-    auto rc = compare(actualVersion, mslVersion);

-    if (rc < 0)

-    {

-        log<level::ERR>(

-            "BMC Minimum Ship Level NOT met",

-            entry("MIN_VERSION=%s", msl.c_str()),

-            entry("ACTUAL_VERSION=%s", tmpStr.c_str()),

-            entry("VERSION_PURPOSE=%s",

-                  "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"));

-        return false;

-    }

-

-    return true;

-}

+#include "config.h"
+
+#include "msl_verify.hpp"
+
+#include "version.hpp"
+
+#include <phosphor-logging/log.hpp>
+
+#include <regex>
+
+using namespace phosphor::logging;
+
+int minimum_ship_level::compare(const Version& versionToCompare,
+                                const Version& mslVersion)
+{
+    if (versionToCompare.major > mslVersion.major)
+        return (1);
+    if (versionToCompare.major < mslVersion.major)
+        return (-1);
+
+    if (versionToCompare.minor > mslVersion.minor)
+        return (1);
+    if (versionToCompare.minor < mslVersion.minor)
+        return (-1);
+
+    if (versionToCompare.rev > mslVersion.rev)
+        return (1);
+    if (versionToCompare.rev < mslVersion.rev)
+        return (-1);
+
+    // Both string are equal and there is no need to make an upgrade return 0.
+    return 0;
+}
+
+// parse Function copy  inpVersion onto outVersion in Version format
+// {major,minor,rev}.
+void minimum_ship_level::parse(const std::string& inpVersion,
+                               Version& outVersion)
+{
+    std::smatch match;
+    outVersion = {0, 0, 0};
+
+    std::regex rx{REGEX_BMC_MSL, std::regex::extended};
+
+    if (!std::regex_search(inpVersion, match, rx))
+    {
+        log<level::ERR>("Unable to parse BMC version",
+                        entry("VERSION=%s", inpVersion.c_str()));
+        return;
+    }
+
+    outVersion.major = std::stoi(match[2]);
+    outVersion.minor = std::stoi(match[3]);
+    outVersion.rev = std::stoi(match[4]);
+}
+
+bool minimum_ship_level::verify(const std::string& versionManifest)
+{
+
+    //  If there is no msl or mslRegex return upgrade is needed.
+    std::string msl{BMC_MSL};
+    std::string mslRegex{REGEX_BMC_MSL};
+    if (msl.empty() || mslRegex.empty())
+    {
+        return true;
+    }
+
+    // Define mslVersion variable and populate in Version format
+    // {major,minor,rev} using parse function.
+
+    Version mslVersion = {0, 0, 0};
+    parse(msl, mslVersion);
+
+    // Define actualVersion variable and populate in Version format
+    // {major,minor,rev} using parse function.
+    std::string tmpStr{};
+
+    tmpStr = versionManifest;
+    Version actualVersion = {0, 0, 0};
+    parse(versionManifest, actualVersion);
+
+    // Compare actualVersion vs MSL.
+    auto rc = compare(actualVersion, mslVersion);
+    if (rc < 0)
+    {
+        log<level::ERR>(
+            "BMC Minimum Ship Level NOT met",
+            entry("MIN_VERSION=%s", msl.c_str()),
+            entry("ACTUAL_VERSION=%s", tmpStr.c_str()),
+            entry("VERSION_PURPOSE=%s",
+                  "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"));
+        return false;
+    }
+
+    return true;
+}
diff --git a/msl_verify.hpp b/msl_verify.hpp
index 9fd6695..3f6983e 100644
--- a/msl_verify.hpp
+++ b/msl_verify.hpp
@@ -1,40 +1,40 @@
-#pragma once

-

-#include <string>

-

-namespace minimum_ship_level

-{

-

-/** @brief Version components */

-struct Version

-{

-    uint8_t major;

-    uint8_t minor;

-    uint8_t rev;

-};

-

-/** @brief Verify if the current BMC version meets the min ship level

- *  @return true if the verification succeeded, false otherwise

- */

-bool verify(const std::string& versionStr);

-

-/** @brief Parse the version components into a struct

- *  @details User passes a version string in regex format (REGEX_BMC_MSL)

- *  at compilation time, this value is break down by parse function to allocate

- *  a struct so it can be compared position by position against the (BMC_MSL)

- *  also defined at compile time.

- * @param[in]  versionStr - The version string to be parsed

- * @param[out] version    - The version struct to be populated

- */

-void parse(const std::string& versionStr, Version& version);

-

-/** @brief Compare the versions provided

- *  @param[in] a - The first version to compare

- *  @param[in] b - The second version to compare

- *  @return 1 if a > b

- *          0 if a = b

- *         -1 if a < b

- */

-int compare(const Version& a, const Version& b);

-

-} // namespace minimum_ship_level

+#pragma once
+
+#include <string>
+
+namespace minimum_ship_level
+{
+
+/** @brief Version components */
+struct Version
+{
+    uint8_t major;
+    uint8_t minor;
+    uint8_t rev;
+};
+
+/** @brief Verify if the current BMC version meets the min ship level
+ *  @return true if the verification succeeded, false otherwise
+ */
+bool verify(const std::string& versionStr);
+
+/** @brief Parse the version components into a struct
+ *  @details User passes a version string in regex format (REGEX_BMC_MSL)
+ *  at compilation time, this value is break down by parse function to allocate
+ *  a struct so it can be compared position by position against the (BMC_MSL)
+ *  also defined at compile time.
+ * @param[in]  versionStr - The version string to be parsed
+ * @param[out] version    - The version struct to be populated
+ */
+void parse(const std::string& versionStr, Version& version);
+
+/** @brief Compare the versions provided
+ *  @param[in] a - The first version to compare
+ *  @param[in] b - The second version to compare
+ *  @return 1 if a > b
+ *          0 if a = b
+ *         -1 if a < b
+ */
+int compare(const Version& a, const Version& b);
+
+} // namespace minimum_ship_level