From b033314bf1901d436dc71d41d5e1f37dda47e511 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 12 Dec 2024 16:03:08 +0100 Subject: formatting: Use clang-format on all projects This commit also add braces to all `if` statements. --- userland/libppm/ppm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'userland/libppm/ppm.c') diff --git a/userland/libppm/ppm.c b/userland/libppm/ppm.c index 9f5bac5..2520d69 100644 --- a/userland/libppm/ppm.c +++ b/userland/libppm/ppm.c @@ -88,8 +88,9 @@ int load_ppm6_file(FILE *fp, const struct PPM_IMAGE *img, uint32_t buf_width, uint8_t *rgb = malloc(3 * n_pixels); const int rc = fread(rgb, 3, n_pixels, fp); - if (0 == rc) + if (0 == rc) { return 0; + } uint32_t *p = rgb; u32 buf_size = buf_height * buf_width; @@ -149,8 +150,9 @@ int load_ppm3_file(FILE *fp, const struct PPM_IMAGE *img, uint32_t buf_width, int green; int blue; int rc = fscanf(fp, "%d %d %d", &red, &green, &blue); - if (0 == rc) + if (0 == rc) { break; + } red &= 0xFF; green &= 0xFF; blue &= 0xFF; @@ -175,10 +177,11 @@ int load_ppm3_file(FILE *fp, const struct PPM_IMAGE *img, uint32_t buf_width, int load_ppm_file(FILE *fp, const struct PPM_IMAGE *img, uint32_t buf_width, uint32_t buf_height, uint32_t *buffer) { - if (3 == img->version) + if (3 == img->version) { return load_ppm3_file(fp, img, buf_width, buf_height, buffer); - else if (6 == img->version) + } else if (6 == img->version) { return load_ppm6_file(fp, img, buf_width, buf_height, buffer); + } return 0; } -- cgit v1.2.3