clang-format: update to latest from docs repo
This is from openbmc/docs/style/cpp/.clang-format
Other OpenBMC repos are doing the same.
Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/src/ast_jpeg_decoder_test.cpp b/src/ast_jpeg_decoder_test.cpp
index 1552f46..7491f5a 100644
--- a/src/ast_jpeg_decoder_test.cpp
+++ b/src/ast_jpeg_decoder_test.cpp
@@ -22,7 +22,7 @@
// This binary blog was created on the aspeed hardware using a blue screen
// consisting of the color 0x8EFFFA in a web browser window
- FILE *fp = fopen("test_resources/aspeedbluescreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedbluescreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen =
fread(out.buffer.data(), sizeof(decltype(out.buffer)::value_type),
@@ -47,7 +47,7 @@
// compression artifacts and quanitization)
for (int i = 0; i < out.width * out.height; i++)
{
- ast_video::RGB &pixel = d.outBuffer[i];
+ ast_video::RGB& pixel = d.outBuffer[i];
EXPECT_GT(pixel.r, 0x8E - tolerance);
EXPECT_LT(pixel.r, 0x8E + tolerance);
EXPECT_GT(pixel.g, 0xFF - tolerance);
@@ -62,7 +62,7 @@
ast_video::RawVideoBuffer out;
// This binary blog was created on the aspeed hardware using a black screen
- FILE *fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -100,7 +100,7 @@
// This binary blog was created on the aspeed hardware using a blue screen
// consisting of the color 0x8EFFFA in a web browser window
- FILE *fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
+ FILE* fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -138,7 +138,7 @@
ast_video::RawVideoBuffer out;
// This binary blog was created on the aspeed hardware using a black screen
- FILE *fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -156,7 +156,7 @@
d.decode(out.buffer, out.width, out.height, out.mode, out.ySelector,
out.uvSelector);
// reserved pixel should be default value
- for (auto &pixel : d.outBuffer)
+ for (auto& pixel : d.outBuffer)
{
EXPECT_EQ(pixel.reserved, 0xAA);
}
diff --git a/src/ast_video_puller_test.cpp b/src/ast_video_puller_test.cpp
index f84b302..a69f47b 100644
--- a/src/ast_video_puller_test.cpp
+++ b/src/ast_video_puller_test.cpp
@@ -5,6 +5,7 @@
#include <ast_jpeg_decoder.hpp>
#include <ast_video_puller.hpp>
+
#include <chrono>
#include <fstream>
#include <iomanip>
@@ -27,7 +28,7 @@
}
else
{
- FILE *fp =
+ FILE* fp =
fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
if (fp)
{
@@ -47,7 +48,7 @@
}
}
- FILE *fp = fopen("/tmp/screendata.bin", "wb");
+ FILE* fp = fopen("/tmp/screendata.bin", "wb");
fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp);
fclose(fp);
diff --git a/src/base64.cpp b/src/base64.cpp
index 2e64bfa..4b5cc26 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -2,7 +2,7 @@
namespace base64
{
-bool base64_encode(const std::string &input, std::string &output)
+bool base64_encode(const std::string& input, std::string& output)
{
// As is, this array is 64 bytes long, which should be greater than the max
// of 0b00111111 when indexed NOLINT calls below are to silence clang-tidy
@@ -67,7 +67,7 @@
return true;
}
-bool base64_decode(const std::string &input, std::string &output)
+bool base64_decode(const std::string& input, std::string& output)
{
constexpr char nop = -1;
// See note on encoding_data[] in above function
diff --git a/src/crow_test.cpp b/src/crow_test.cpp
index f427a2f..f53e519 100644
--- a/src/crow_test.cpp
+++ b/src/crow_test.cpp
@@ -1,9 +1,9 @@
+#include "crow.h"
+
#include <iostream>
#include <sstream>
#include <vector>
-#include "crow.h"
-
#include "gtest/gtest.h"
using namespace std;
@@ -22,7 +22,8 @@
error_print(args...);
}
-template <typename... Args> void fail(Args... args)
+template <typename... Args>
+void fail(Args... args)
{
error_print(args...);
failed__ = true;
@@ -58,8 +59,7 @@
fail("empty handler should fail to validate");
}
catch (runtime_error& e)
- {
- }
+ {}
int x = 0;
@@ -484,33 +484,27 @@
struct NullMiddleware
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request&, Response&, Context&, AllContext&)
- {
- }
+ {}
template <typename AllContext>
void afterHandle(Request&, Response&, Context&, AllContext&)
- {
- }
+ {}
};
struct NullSimpleMiddleware
{
struct Context
- {
- };
+ {};
void beforeHandle(Request& /*req*/, Response& /*res*/, Context& /*ctx*/)
- {
- }
+ {}
void afterHandle(Request& /*req*/, Response& /*res*/, Context& /*ctx*/)
- {
- }
+ {}
};
TEST(Crow, middleware_simple)
@@ -569,8 +563,7 @@
struct SecondMW
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request& req, Response& res, Context&,
AllContext& all_ctx)
@@ -590,8 +583,7 @@
struct ThirdMW
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request&, Response&, Context&, AllContext& all_ctx)
{
@@ -895,8 +887,7 @@
fail();
}
catch (std::exception&)
- {
- }
+ {}
// app is in an invalid state when routeDynamic throws an exception.
try
@@ -905,8 +896,7 @@
fail();
}
catch (std::exception&)
- {
- }
+ {}
{
boost::beast::http::request<boost::beast::http::string_body> r{};
diff --git a/src/gtest_main.cpp b/src/gtest_main.cpp
index 77e70aa..8d2d071 100644
--- a/src/gtest_main.cpp
+++ b/src/gtest_main.cpp
@@ -1,7 +1,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/kvm_websocket_test.cpp b/src/kvm_websocket_test.cpp
index 40470a9..07ca515 100644
--- a/src/kvm_websocket_test.cpp
+++ b/src/kvm_websocket_test.cpp
@@ -1,3 +1,5 @@
+#include "crow.h"
+
#include "gzip_helper.hpp"
#include "web_kvm.hpp"
@@ -5,8 +7,6 @@
#include <sstream>
#include <vector>
-#include "crow.h"
-
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/src/token_authorization_middleware_test.cpp b/src/token_authorization_middleware_test.cpp
index 8f4c5c8..3ac7947 100644
--- a/src/token_authorization_middleware_test.cpp
+++ b/src/token_authorization_middleware_test.cpp
@@ -16,8 +16,7 @@
TokenAuth() :
lk(std::unique_lock<std::mutex>(m)),
io(std::make_shared<boost::asio::io_context>())
- {
- }
+ {}
std::mutex m;
std::condition_variable cv;
diff --git a/src/webassets_test.cpp b/src/webassets_test.cpp
index 4f010a6..48dc398 100644
--- a/src/webassets_test.cpp
+++ b/src/webassets_test.cpp
@@ -3,9 +3,10 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <gzip_helper.hpp>
-#include <sstream>
#include <webassets.hpp>
+#include <sstream>
+
#include "gtest/gtest.h"
#include <gmock/gmock.h>
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index f4e6207..738fb28 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -6,9 +6,10 @@
#include <dbus_singleton.hpp>
#include <image_upload.hpp>
#include <kvm_websocket.hpp>
-#include <memory>
#include <obmc_console.hpp>
#include <openbmc_dbus_rest.hpp>
+
+#include <memory>
#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
#include <ibm/management_console_rest.hpp>
#endif
@@ -20,12 +21,13 @@
#include <sdbusplus/server.hpp>
#include <security_headers_middleware.hpp>
#include <ssl_key_handler.hpp>
-#include <string>
#include <token_authorization_middleware.hpp>
#include <vm_websocket.hpp>
#include <webassets.hpp>
#include <webserver_common.hpp>
+#include <string>
+
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
#include <nbd_proxy.hpp>
#endif