From 762b2c53a407c5f352436507a8dbf9cacd3e8482 Mon Sep 17 00:00:00 2001 From: Pranav Rathi <4427674+pranavrth@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:40:18 +0530 Subject: [PATCH] Style fixes --- examples/describe_topics.c | 5 +++-- src/rdbase64.c | 13 +++++++------ src/rdkafka.c | 2 +- src/rdkafka.h | 6 ++++-- src/rdkafka_admin.h | 6 +++--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/examples/describe_topics.c b/examples/describe_topics.c index 83ad38a8cd..cf38a70e21 100644 --- a/examples/describe_topics.c +++ b/examples/describe_topics.c @@ -204,8 +204,9 @@ static void print_topic_info(const rd_kafka_TopicDescription_t *topic) { size_t authorized_operations_cnt; const rd_kafka_TopicPartitionInfo_t **partitions; size_t partition_cnt; - const rd_kafka_Uuid_t *topic_id = rd_kafka_TopicDescription_topic_id(topic); - const char *topic_id_str = rd_kafka_Uuid_base64str(topic_id); + const rd_kafka_Uuid_t *topic_id = + rd_kafka_TopicDescription_topic_id(topic); + const char *topic_id_str = rd_kafka_Uuid_base64str(topic_id); if (rd_kafka_error_code(error)) { printf("Topic: %s (Topic Id: %s) has error[%" PRId32 "]: %s\n", diff --git a/src/rdbase64.c b/src/rdbase64.c index 4a342ce581..aaf2fb138e 100644 --- a/src/rdbase64.c +++ b/src/rdbase64.c @@ -32,15 +32,14 @@ #include #else -# define conv_bin2ascii(a, table) ((table)[(a)&0x3f]) +#define conv_bin2ascii(a, table) ((table)[(a)&0x3f]) static const unsigned char data_bin2ascii[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static int base64_encoding_conversion(unsigned char *out, const unsigned char *in, - int dlen) -{ + int dlen) { int i, ret = 0; unsigned long l; @@ -59,7 +58,9 @@ static int base64_encoding_conversion(unsigned char *out, *(out++) = conv_bin2ascii(l >> 18L, data_bin2ascii); *(out++) = conv_bin2ascii(l >> 12L, data_bin2ascii); - *(out++) = (i == 1) ? '=' : conv_bin2ascii(l >> 6L, data_bin2ascii); + *(out++) = + (i == 1) ? '=' + : conv_bin2ascii(l >> 6L, data_bin2ascii); *(out++) = '='; } ret += 4; @@ -96,8 +97,8 @@ void rd_base64_encode(const rd_chariov_t *in, rd_chariov_t *out) { out->size = EVP_EncodeBlock((unsigned char *)out->ptr, (unsigned char *)in->ptr, (int)in->size); #else - out->size = base64_encoding_conversion((unsigned char *)out->ptr, - (unsigned char *)in->ptr, (int)in->size); + out->size = base64_encoding_conversion( + (unsigned char *)out->ptr, (unsigned char *)in->ptr, (int)in->size); #endif rd_assert(out->size < max_len); diff --git a/src/rdkafka.c b/src/rdkafka.c index fd5ea3a61a..1098e17b17 100644 --- a/src/rdkafka.c +++ b/src/rdkafka.c @@ -5087,7 +5087,7 @@ const char *rd_kafka_Uuid_base64str(const rd_kafka_Uuid_t *uuid) { if (!out_base64_str) return NULL; - rd_strlcpy((char *) uuid->base64str, out_base64_str, + rd_strlcpy((char *)uuid->base64str, out_base64_str, 23 /* Removing extra ('=') padding */); rd_free(out_base64_str); return uuid->base64str; diff --git a/src/rdkafka.h b/src/rdkafka.h index badb45bb11..0802d6507d 100644 --- a/src/rdkafka.h +++ b/src/rdkafka.h @@ -1654,7 +1654,8 @@ RD_EXPORT const char *rd_kafka_Uuid_base64str(const rd_kafka_Uuid_t *uuid); * * @return least significant 64 bits for the given UUID. */ -RD_EXPORT int64_t rd_kafka_Uuid_least_significant_bits(const rd_kafka_Uuid_t *uuid); +RD_EXPORT int64_t +rd_kafka_Uuid_least_significant_bits(const rd_kafka_Uuid_t *uuid); /** @@ -1664,7 +1665,8 @@ RD_EXPORT int64_t rd_kafka_Uuid_least_significant_bits(const rd_kafka_Uuid_t *uu * * @return most significant 64 bits for the given UUID. */ -RD_EXPORT int64_t rd_kafka_Uuid_most_significant_bits(const rd_kafka_Uuid_t *uuid); +RD_EXPORT int64_t +rd_kafka_Uuid_most_significant_bits(const rd_kafka_Uuid_t *uuid); /** diff --git a/src/rdkafka_admin.h b/src/rdkafka_admin.h index 235727ed0f..3e7378af56 100644 --- a/src/rdkafka_admin.h +++ b/src/rdkafka_admin.h @@ -525,10 +525,10 @@ struct rd_kafka_TopicPartitionInfo_s { * @struct DescribeTopics result */ struct rd_kafka_TopicDescription_s { - char *topic; /**< Topic name */ + char *topic; /**< Topic name */ rd_kafka_Uuid_t topic_id; /**< Topic Id */ - int partition_cnt; /**< Number of partitions in \p partitions*/ - rd_bool_t is_internal; /**< Is the topic is internal to Kafka? */ + int partition_cnt; /**< Number of partitions in \p partitions*/ + rd_bool_t is_internal; /**< Is the topic is internal to Kafka? */ rd_kafka_TopicPartitionInfo_t **partitions; /**< Partitions */ rd_kafka_error_t *error; /**< Topic error reported by broker */ int authorized_operations_cnt; /**< Count of operations allowed for