From 20becee2c9c3aeca5c05d664f84ea31b8a522432 Mon Sep 17 00:00:00 2001 From: Strive-Sun <1096235292@qq.com> Date: Wed, 6 Mar 2024 20:31:35 +0800 Subject: [PATCH] improve format --- CMakeLists.txt | 5 ++--- src/sentry_transport.c | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d71484ebf..2d444e2a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ endif() option(SENTRY_PIC "Build sentry (and dependent) libraries as position independent libraries" ON) -option(SENTRY_TRANSPORT_COMPRESSION " Enable transport gzip compression" OFF) +option(SENTRY_TRANSPORT_COMPRESSION "Enable transport gzip compression" OFF) option(SENTRY_BUILD_TESTS "Build sentry-native tests" "${SENTRY_MAIN_PROJECT}") option(SENTRY_BUILD_EXAMPLES "Build sentry-native example(s)" "${SENTRY_MAIN_PROJECT}") @@ -299,8 +299,7 @@ if(SENTRY_TRANSPORT_COMPRESSION) endif() target_link_libraries(sentry PRIVATE ZLIB::ZLIB) - - add_definitions(-DGZIP_COMPRESSION) + add_definitions(-DSENTRY_GZIPPED_COMPRESSION) endif() set_property(TARGET sentry PROPERTY C_VISIBILITY_PRESET hidden) diff --git a/src/sentry_transport.c b/src/sentry_transport.c index 049bc38a4..92a03e218 100644 --- a/src/sentry_transport.c +++ b/src/sentry_transport.c @@ -5,12 +5,13 @@ #include "sentry_ratelimiter.h" #include "sentry_string.h" -#ifdef GZIP_COMPRESSION +#ifdef SENTRY_GZIPPED_COMPRESSION #include "zlib.h" #endif #define ENVELOPE_MIME "application/x-sentry-envelope" -// The headers we use are: `x-sentry-auth`, `content-type`, `content-encoding`, `content-length` +// The headers we use are: `x-sentry-auth`, `content-type`, `content-encoding`, +// `content-length` #define MAX_HTTP_HEADERS 4 typedef struct sentry_transport_s { @@ -152,7 +153,7 @@ sentry_transport_free(sentry_transport_t *transport) sentry_free(transport); } -#ifdef GZIP_COMPRESSION +#ifdef SENTRY_GZIPPED_COMPRESSION static bool gzipped_with_compression(const char *body, const size_t body_len, char **compressed_body, size_t *compressed_body_len) @@ -220,7 +221,7 @@ sentry__prepare_http_request(sentry_envelope_t *envelope, } bool compressed = false; -#ifdef GZIP_COMPRESSION +#ifdef SENTRY_GZIPPED_COMPRESSION char *compressed_body = NULL; size_t compressed_body_len = 0; compressed = gzipped_with_compression(