From 30047bf9647215951ba5dfe21ceb3e58a1b405a4 Mon Sep 17 00:00:00 2001 From: Patrick Venture Date: Thu, 1 Nov 2018 18:52:15 -0700 Subject: minor cleanup, std namespacing Added std namespace to places where there is a cpp version. Change-Id: I60a05a7c9cdcd79cfffc3c4968005fcbe34acf81 Signed-off-by: Patrick Venture --- elog_meta.cpp | 4 ++-- elog_meta.hpp | 4 ++-- log_manager.cpp | 7 +++++-- logging_test.cpp | 5 +++-- phosphor-rsyslog-config/server-conf.cpp | 4 +++- test/remote_logging_test_config.cpp | 3 ++- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/elog_meta.cpp b/elog_meta.cpp index 98425d4..f2883b7 100644 --- a/elog_meta.cpp +++ b/elog_meta.cpp @@ -24,12 +24,12 @@ void build( if (metadata.end() != iter) { auto comp = [](const auto& first, const auto& second) { - return (strcmp(std::get<0>(first), second) < 0); + return (std::strcmp(std::get<0>(first), second) < 0); }; auto callout = std::lower_bound(callouts.begin(), callouts.end(), (iter->second).c_str(), comp); if ((callouts.end() != callout) && - !strcmp((iter->second).c_str(), std::get<0>(*callout))) + !std::strcmp((iter->second).c_str(), std::get<0>(*callout))) { list.emplace_back(std::make_tuple( CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION, diff --git a/elog_meta.hpp b/elog_meta.hpp index b44f52d..fe14a11 100644 --- a/elog_meta.hpp +++ b/elog_meta.hpp @@ -80,12 +80,12 @@ inline void if (metadata.end() != iter) { auto comp = [](const auto& first, const auto& second) { - return (strcmp(std::get<0>(first), second) < 0); + return (std::strcmp(std::get<0>(first), second) < 0); }; auto callout = std::lower_bound(callouts.begin(), callouts.end(), (iter->second).c_str(), comp); if ((callouts.end() != callout) && - !strcmp((iter->second).c_str(), std::get<0>(*callout))) + !std::strcmp((iter->second).c_str(), std::get<0>(*callout))) { constexpr auto ROOT = "/xyz/openbmc_project/inventory"; diff --git a/log_manager.cpp b/log_manager.cpp index ddb5a1d..3dc14d7 100644 --- a/log_manager.cpp +++ b/log_manager.cpp @@ -14,9 +14,12 @@ #include #include +#include #include +#include #include #include +#include #include #include #include @@ -90,7 +93,7 @@ void Manager::_commit(uint64_t transactionId, std::string&& errMsg, } constexpr const auto transactionIdVar = "TRANSACTION_ID"; // Length of 'TRANSACTION_ID' string. - constexpr const auto transactionIdVarSize = strlen(transactionIdVar); + constexpr const auto transactionIdVarSize = std::strlen(transactionIdVar); // Length of 'TRANSACTION_ID=' string. constexpr const auto transactionIdVarOffset = transactionIdVarSize + 1; @@ -361,7 +364,7 @@ void Manager::journalSync() // See if a sync happened by now std::string timestampStr; std::getline(syncedFile, timestampStr); - auto timestamp = stoll(timestampStr); + auto timestamp = std::stoll(timestampStr); if (timestamp >= start) { return; diff --git a/logging_test.cpp b/logging_test.cpp index 3a144f8..279d02b 100644 --- a/logging_test.cpp +++ b/logging_test.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -202,7 +203,7 @@ int elog_test() void commitError(const char* text) { - if (strcmp(text, "AutoTestSimple") == 0) + if (std::strcmp(text, "AutoTestSimple") == 0) { try { @@ -216,7 +217,7 @@ void commitError(const char* text) commit(e.name()); } } - else if (strcmp(text, "AutoTestCreateAndCommit") == 0) + else if (std::strcmp(text, "AutoTestCreateAndCommit") == 0) { report( example::xyz::openbmc_project::Example::Elog::AutoTestSimple:: diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp index 4bf167c..836e83b 100644 --- a/phosphor-rsyslog-config/server-conf.cpp +++ b/phosphor-rsyslog-config/server-conf.cpp @@ -13,6 +13,8 @@ #include #include +#include + namespace phosphor { namespace rsyslog_config @@ -131,7 +133,7 @@ void Server::restore(const char* filePath) std::fstream stream(filePath, std::fstream::in); std::string line; - getline(stream, line); + std::getline(stream, line); // Ignore if line is commented if ('#' != line.at(0)) diff --git a/test/remote_logging_test_config.cpp b/test/remote_logging_test_config.cpp index 59feedd..a4c6207 100644 --- a/test/remote_logging_test_config.cpp +++ b/test/remote_logging_test_config.cpp @@ -1,6 +1,7 @@ #include "remote_logging_tests.hpp" #include +#include namespace phosphor { @@ -13,7 +14,7 @@ std::string getConfig(const char* filePath) { std::fstream stream(filePath, std::fstream::in); std::string line; - getline(stream, line); + std::getline(stream, line); return line; } -- cgit v1.2.1