From 8502aed590eaa233f209d5d3c470a1a9b1fb4f3f Mon Sep 17 00:00:00 2001 From: erobot Date: Wed, 25 Dec 2024 19:37:57 +0800 Subject: [PATCH] Fix some compiler warnings in public headers --- examples/CMakeLists.txt | 2 ++ include/pulsar/BrokerConsumerStats.h | 2 +- include/pulsar/Message.h | 2 +- include/pulsar/c/client_configuration.h | 4 ++-- lib/BrokerConsumerStats.cc | 2 +- lib/Message.cc | 2 +- lib/c/c_ClientConfiguration.cc | 6 ++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d54c2284..5f5779c7 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,6 +17,8 @@ # under the License. # +add_compile_options(-Wextra -Wno-unused-parameter) + if (NOT MSVC) set(CMAKE_C_FLAGS " -std=c99 ${CMAKE_C_FLAGS}") endif() diff --git a/include/pulsar/BrokerConsumerStats.h b/include/pulsar/BrokerConsumerStats.h index e179e4b4..37eb4548 100644 --- a/include/pulsar/BrokerConsumerStats.h +++ b/include/pulsar/BrokerConsumerStats.h @@ -73,7 +73,7 @@ class PULSAR_PUBLIC BrokerConsumerStats { virtual const std::string getConnectedSince() const; /** Returns Whether this subscription is Exclusive or Shared or Failover */ - virtual const ConsumerType getType() const; + virtual ConsumerType getType() const; /** Returns the rate of messages expired on this subscription. msg/s */ virtual double getMsgRateExpired() const; diff --git a/include/pulsar/Message.h b/include/pulsar/Message.h index c8c18fad..2e78e982 100644 --- a/include/pulsar/Message.h +++ b/include/pulsar/Message.h @@ -176,7 +176,7 @@ class PULSAR_PUBLIC Message { /** * Get the redelivery count for this message */ - const int getRedeliveryCount() const; + int getRedeliveryCount() const; /** * Check if schema version exists diff --git a/include/pulsar/c/client_configuration.h b/include/pulsar/c/client_configuration.h index 6c4f3dfb..9e154530 100644 --- a/include/pulsar/c/client_configuration.h +++ b/include/pulsar/c/client_configuration.h @@ -195,13 +195,13 @@ PULSAR_PUBLIC const char *pulsar_client_configuration_get_listener_name(pulsar_c PULSAR_PUBLIC void pulsar_client_configuration_set_partitions_update_interval( pulsar_client_configuration_t *conf, const unsigned int intervalInSeconds); -PULSAR_PUBLIC const unsigned int pulsar_client_configuration_get_partitions_update_interval( +PULSAR_PUBLIC unsigned int pulsar_client_configuration_get_partitions_update_interval( pulsar_client_configuration_t *conf); /* * Get the stats interval set in the client. */ -PULSAR_PUBLIC const unsigned int pulsar_client_configuration_get_stats_interval_in_seconds( +PULSAR_PUBLIC unsigned int pulsar_client_configuration_get_stats_interval_in_seconds( pulsar_client_configuration_t *conf); PULSAR_PUBLIC void pulsar_client_configuration_set_keep_alive_interval_in_seconds( diff --git a/lib/BrokerConsumerStats.cc b/lib/BrokerConsumerStats.cc index a403772b..b2eaa8fb 100644 --- a/lib/BrokerConsumerStats.cc +++ b/lib/BrokerConsumerStats.cc @@ -63,7 +63,7 @@ const std::string BrokerConsumerStats::getAddress() const { return impl_->getAdd const std::string BrokerConsumerStats::getConnectedSince() const { return impl_->getConnectedSince(); } -const ConsumerType BrokerConsumerStats::getType() const { return impl_->getType(); } +ConsumerType BrokerConsumerStats::getType() const { return impl_->getType(); } double BrokerConsumerStats::getMsgRateExpired() const { return impl_->getMsgRateExpired(); } diff --git a/lib/Message.cc b/lib/Message.cc index 06fa5dbb..2a6e8a3e 100644 --- a/lib/Message.cc +++ b/lib/Message.cc @@ -184,7 +184,7 @@ const std::string& Message::getTopicName() const { return impl_->getTopicName(); } -const int Message::getRedeliveryCount() const { +int Message::getRedeliveryCount() const { if (!impl_) { return 0; } diff --git a/lib/c/c_ClientConfiguration.cc b/lib/c/c_ClientConfiguration.cc index 9f7b6b3d..483c74ef 100644 --- a/lib/c/c_ClientConfiguration.cc +++ b/lib/c/c_ClientConfiguration.cc @@ -173,8 +173,7 @@ void pulsar_client_configuration_set_stats_interval_in_seconds(pulsar_client_con conf->conf.setStatsIntervalInSeconds(interval); } -const unsigned int pulsar_client_configuration_get_stats_interval_in_seconds( - pulsar_client_configuration_t *conf) { +unsigned int pulsar_client_configuration_get_stats_interval_in_seconds(pulsar_client_configuration_t *conf) { return conf->conf.getStatsIntervalInSeconds(); } @@ -204,8 +203,7 @@ void pulsar_client_configuration_set_partitions_update_interval(pulsar_client_co conf->conf.setPartititionsUpdateInterval(intervalInSeconds); } -const unsigned int pulsar_client_configuration_get_partitions_update_interval( - pulsar_client_configuration_t *conf) { +unsigned int pulsar_client_configuration_get_partitions_update_interval(pulsar_client_configuration_t *conf) { return conf->conf.getPartitionsUpdateInterval(); }