From b3be20245d5d72810657ac5e0d235fdd9f2a8e47 Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Fri, 30 Aug 2024 11:20:41 +0200 Subject: [PATCH] Fix formatting --- util/compressutils.c | 13 +++++++------ util/compressutils_tests.c | 39 +++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/util/compressutils.c b/util/compressutils.c index baed77bb..efd8e88c 100644 --- a/util/compressutils.c +++ b/util/compressutils.c @@ -242,11 +242,11 @@ gvm_compress_gzipheader (const void *src, unsigned long srclen, /** * @brief Read decompressed data from a gzip file. - * + * * @param[in] cookie The gzFile to read from. * @param[in] buffer The buffer to output decompressed data to. * @param[in] buffer_size The size of the buffer. - * + * * @return The number of bytes read into the buffer. */ static ssize_t @@ -259,9 +259,9 @@ gz_file_read (void *cookie, char *buffer, size_t buffer_size) /** * @brief Close a gzip file. - * + * * @param[in] cookie The gzFile to close. - * + * * @return 0 on success, other values on error (see gzclose() from zlib). */ static int @@ -269,7 +269,8 @@ gz_file_close (void *cookie) { gzFile gz_file = cookie; - return gzclose (gz_file);; + return gzclose (gz_file); + ; } /** @@ -288,7 +289,7 @@ gvm_gzip_open_file_reader (const char *path) .seek = NULL, .close = gz_file_close, }; - + if (path == NULL) { return NULL; diff --git a/util/compressutils_tests.c b/util/compressutils_tests.c index ddc35d62..4731cc13 100644 --- a/util/compressutils_tests.c +++ b/util/compressutils_tests.c @@ -17,52 +17,52 @@ AfterEach (compressutils) { } -Ensure(compressutils, can_compress_and_uncompress_without_header) +Ensure (compressutils, can_compress_and_uncompress_without_header) { const char *testdata = "TEST-12345-12345-TEST"; size_t compressed_len; - char *compressed - = gvm_compress (testdata, strlen(testdata) + 1, &compressed_len); + char *compressed = + gvm_compress (testdata, strlen (testdata) + 1, &compressed_len); assert_that (compressed_len, is_greater_than (0)); assert_that (compressed, is_not_null); assert_that (compressed, is_not_equal_to_string (testdata)); size_t uncompressed_len; - char *uncompressed - = gvm_uncompress (compressed, compressed_len, &uncompressed_len); - assert_that (uncompressed_len, is_equal_to (strlen(testdata) + 1)); + char *uncompressed = + gvm_uncompress (compressed, compressed_len, &uncompressed_len); + assert_that (uncompressed_len, is_equal_to (strlen (testdata) + 1)); assert_that (uncompressed, is_equal_to_string (testdata)); } -Ensure(compressutils, can_compress_and_uncompress_with_header) +Ensure (compressutils, can_compress_and_uncompress_with_header) { const char *testdata = "TEST-12345-12345-TEST"; size_t compressed_len; - char *compressed - = gvm_compress_gzipheader (testdata, strlen(testdata) + 1, &compressed_len); + char *compressed = + gvm_compress_gzipheader (testdata, strlen (testdata) + 1, &compressed_len); assert_that (compressed_len, is_greater_than (0)); assert_that (compressed, is_not_null); assert_that (compressed, is_not_equal_to_string (testdata)); // Check for gzip magic number and deflate compression mode byte - assert_that (compressed[0], is_equal_to((char)0x1f)); - assert_that (compressed[1], is_equal_to((char)0x8b)); - assert_that (compressed[2], is_equal_to(8)); + assert_that (compressed[0], is_equal_to ((char) 0x1f)); + assert_that (compressed[1], is_equal_to ((char) 0x8b)); + assert_that (compressed[2], is_equal_to (8)); size_t uncompressed_len; - char *uncompressed - = gvm_uncompress (compressed, compressed_len, &uncompressed_len); - assert_that (uncompressed_len, is_equal_to (strlen(testdata) + 1)); + char *uncompressed = + gvm_uncompress (compressed, compressed_len, &uncompressed_len); + assert_that (uncompressed_len, is_equal_to (strlen (testdata) + 1)); assert_that (uncompressed, is_equal_to_string (testdata)); } -Ensure(compressutils, can_uncompress_using_reader) +Ensure (compressutils, can_uncompress_using_reader) { const char *testdata = "TEST-12345-12345-TEST"; size_t compressed_len; - char *compressed - = gvm_compress_gzipheader (testdata, strlen(testdata) + 1, &compressed_len); + char *compressed = + gvm_compress_gzipheader (testdata, strlen (testdata) + 1, &compressed_len); char compressed_filename[35] = "/tmp/gvm_gzip_test_XXXXXX"; int compressed_fd = mkstemp (compressed_filename); @@ -91,8 +91,7 @@ main (int argc, char **argv) can_compress_and_uncompress_without_header); add_test_with_context (suite, compressutils, can_compress_and_uncompress_with_header); - add_test_with_context (suite, compressutils, - can_uncompress_using_reader); + add_test_with_context (suite, compressutils, can_uncompress_using_reader); if (argc > 1) return run_single_test (suite, argv[1], create_text_reporter ());