1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 05:59:07 +00:00

Run clang-format.

This commit is contained in:
Brenden Matthews 2022-10-13 14:44:26 -05:00
parent 1f661d2432
commit b06f658ebf
No known key found for this signature in database
GPG Key ID: B49ABB7270D9D4FD
6 changed files with 40 additions and 62 deletions

View File

@ -474,9 +474,7 @@ void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.rate\"\n");
}
if (rate > 0) {
ret = (double)rate/(double)1000;
}
if (rate > 0) { ret = (double)rate / (double)1000; }
snprintf(buffer, n, "%.1f", ret);
}

View File

@ -70,13 +70,9 @@ void gradient_factory::setup_masks() {
mask[2] |= 1 << i;
}
if (colour_depth % 3 == 1) {
mask[1] |= 1 << (colour_depth / 3);
}
if (colour_depth % 3 == 1) { mask[1] |= 1 << (colour_depth / 3); }
for (int i = 0; i < 3; i++) {
mask[i] = mask[i] << shift[i];
}
for (int i = 0; i < 3; i++) { mask[i] = mask[i] << shift[i]; }
}
void gradient_factory::setup_colour_depth() {

View File

@ -50,7 +50,7 @@ class gradient_factory {
public:
gradient_factory(int width, unsigned long first_colour,
unsigned long last_colour);
virtual ~gradient_factory() { }
virtual ~gradient_factory() {}
colour_array create_gradient();

View File

@ -2353,15 +2353,18 @@ void get_battery_short_status(char *buffer, unsigned int n, const char *bat) {
void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
static int reported = 0;
char current_now_path[256], voltage_now_path[256], current_now_val[256], voltage_now_val[256];
char current_now_path[256], voltage_now_path[256], current_now_val[256],
voltage_now_val[256];
char *ptr;
long current_now, voltage_now;
FILE *current_now_file;
FILE *voltage_now_file;
double result;
snprintf(current_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/current_now", bat);
snprintf(voltage_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/voltage_now", bat);
snprintf(current_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/current_now",
bat);
snprintf(voltage_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/voltage_now",
bat);
current_now_file = open_file(current_now_path, &reported);
voltage_now_file = open_file(voltage_now_path, &reported);
@ -2373,7 +2376,7 @@ void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
current_now = strtol(current_now_val, &ptr, 10);
voltage_now = strtol(voltage_now_val, &ptr, 10);
result = (double)(current_now*voltage_now)/(double)1000000000000;
result = (double)(current_now * voltage_now) / (double)1000000000000;
snprintf(buffer, n, "%.1f", result);
fclose(current_now_file);
fclose(voltage_now_file);

View File

@ -66,15 +66,9 @@ TEST_CASE("gradient_factory::convert_from_rgb returns correct value") {
factory->convert_from_rgb(colour, result);
SECTION("red") {
REQUIRE(result[0] == expected_red * full_scale);
}
SECTION("green") {
REQUIRE(result[1] == expected_green * full_scale);
}
SECTION("blue") {
REQUIRE(result[2] == expected_blue * full_scale);
}
SECTION("red") { REQUIRE(result[0] == expected_red * full_scale); }
SECTION("green") { REQUIRE(result[1] == expected_green * full_scale); }
SECTION("blue") { REQUIRE(result[2] == expected_blue * full_scale); }
delete factory;
}
@ -85,15 +79,9 @@ TEST_CASE("gradient_factory::convert_from_rgb returns correct value") {
factory->convert_from_rgb(colour, result);
SECTION("hue") {
REQUIRE(result[0] == expected_hue * 60);
}
SECTION("saturation") {
REQUIRE(result[1] == expected_saturation);
}
SECTION("value") {
REQUIRE(result[2] == expected_value * full_scale);
}
SECTION("hue") { REQUIRE(result[0] == expected_hue * 60); }
SECTION("saturation") { REQUIRE(result[1] == expected_saturation); }
SECTION("value") { REQUIRE(result[2] == expected_value * full_scale); }
delete factory;
}
@ -104,15 +92,9 @@ TEST_CASE("gradient_factory::convert_from_rgb returns correct value") {
factory->convert_from_rgb(colour, result);
SECTION("hue") {
REQUIRE(result[0] == expected_hue * 60);
}
SECTION("chroma") {
REQUIRE(result[1] == expected_chroma * full_scale);
}
SECTION("luma") {
REQUIRE(result[2] == expected_luma);
}
SECTION("hue") { REQUIRE(result[0] == expected_hue * 60); }
SECTION("chroma") { REQUIRE(result[1] == expected_chroma * full_scale); }
SECTION("luma") { REQUIRE(result[2] == expected_luma); }
delete factory;
}
@ -121,7 +103,6 @@ TEST_CASE("gradient_factory::convert_from_rgb returns correct value") {
TEST_CASE(
"gradient_factory should convert to and from rgb "
"and get the initial value") {
SECTION("rgb_gradient_factory") {
long tmp[3];
auto factory = new conky::rgb_gradient_factory(width, colour, colour);