1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +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"); fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.rate\"\n");
} }
if (rate > 0) { if (rate > 0) { ret = (double)rate / (double)1000; }
ret = (double)rate/(double)1000;
}
snprintf(buffer, n, "%.1f", ret); snprintf(buffer, n, "%.1f", ret);
} }

View File

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

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) { void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
static int reported = 0; 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; char *ptr;
long current_now, voltage_now; long current_now, voltage_now;
FILE *current_now_file; FILE *current_now_file;
FILE *voltage_now_file; FILE *voltage_now_file;
double result; double result;
snprintf(current_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/current_now", bat); snprintf(current_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/current_now",
snprintf(voltage_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/voltage_now", bat); bat);
snprintf(voltage_now_path, 255, SYSFS_BATTERY_BASE_PATH "/%s/voltage_now",
bat);
current_now_file = open_file(current_now_path, &reported); current_now_file = open_file(current_now_path, &reported);
voltage_now_file = open_file(voltage_now_path, &reported); voltage_now_file = open_file(voltage_now_path, &reported);

View File

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