You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/11 17:48:33 UTC
[GitHub] [pulsar] BewareMyPower commented on pull request #11633: Sync up C error code with C++
BewareMyPower commented on pull request #11633:
URL: https://github.com/apache/pulsar/pull/11633#issuecomment-897026051
The Pulsar C++ source code is formatted by clang-format 5.0. The rule is a little different from latest clang-format. If you have trouble installing clang-format 5.0, you can run `docker-format.sh`.
For this PR, you can apply following diff to fix format check:
```diff
diff --git a/pulsar-client-cpp/include/pulsar/c/client_configuration.h b/pulsar-client-cpp/include/pulsar/c/client_configuration.h
index 3bf94322641..0c9fbb8d2e7 100644
--- a/pulsar-client-cpp/include/pulsar/c/client_configuration.h
+++ b/pulsar-client-cpp/include/pulsar/c/client_configuration.h
@@ -25,13 +25,7 @@
extern "C" {
#endif
-typedef enum
-{
- pulsar_DEBUG = 0,
- pulsar_INFO = 1,
- pulsar_WARN = 2,
- pulsar_ERROR = 3
-} pulsar_logger_level_t;
+typedef enum { pulsar_DEBUG = 0, pulsar_INFO = 1, pulsar_WARN = 2, pulsar_ERROR = 3 } pulsar_logger_level_t;
typedef void (*pulsar_logger)(pulsar_logger_level_t level, const char *file, int line, const char *message,
void *ctx);
diff --git a/pulsar-client-cpp/include/pulsar/c/consumer_configuration.h b/pulsar-client-cpp/include/pulsar/c/consumer_configuration.h
index efa49a141bc..efe353ad167 100644
--- a/pulsar-client-cpp/include/pulsar/c/consumer_configuration.h
+++ b/pulsar-client-cpp/include/pulsar/c/consumer_configuration.h
@@ -28,8 +28,7 @@ extern "C" {
typedef struct _pulsar_consumer_configuration pulsar_consumer_configuration_t;
-typedef enum
-{
+typedef enum {
/**
* There can be only 1 consumer on the same topic with the same consumerName
*/
@@ -53,8 +52,7 @@ typedef enum
pulsar_ConsumerKeyShared
} pulsar_consumer_type;
-typedef enum
-{
+typedef enum {
/**
* the latest position which means the start consuming position will be the last message
*/
@@ -65,8 +63,7 @@ typedef enum
initial_position_earliest
} initial_position;
-typedef enum
-{
+typedef enum {
// This is the default option to fail consume until crypto succeeds
pulsar_ConsumerFail,
// Message is silently acknowledged and not delivered to the application
diff --git a/pulsar-client-cpp/include/pulsar/c/producer_configuration.h b/pulsar-client-cpp/include/pulsar/c/producer_configuration.h
index 64ae83c594c..17653d42807 100644
--- a/pulsar-client-cpp/include/pulsar/c/producer_configuration.h
+++ b/pulsar-client-cpp/include/pulsar/c/producer_configuration.h
@@ -28,22 +28,15 @@
extern "C" {
#endif
-typedef enum
-{
+typedef enum {
pulsar_UseSinglePartition,
pulsar_RoundRobinDistribution,
pulsar_CustomPartition
} pulsar_partitions_routing_mode;
-typedef enum
-{
- pulsar_Murmur3_32Hash,
- pulsar_BoostHash,
- pulsar_JavaStringHash
-} pulsar_hashing_scheme;
+typedef enum { pulsar_Murmur3_32Hash, pulsar_BoostHash, pulsar_JavaStringHash } pulsar_hashing_scheme;
-typedef enum
-{
+typedef enum {
pulsar_CompressionNone = 0,
pulsar_CompressionLZ4 = 1,
pulsar_CompressionZLib = 2,
@@ -51,8 +44,7 @@ typedef enum
pulsar_CompressionSNAPPY = 4
} pulsar_compression_type;
-typedef enum
-{
+typedef enum {
pulsar_None = 0,
pulsar_String = 1,
pulsar_Json = 2,
@@ -71,8 +63,7 @@ typedef enum
pulsar_AutoPublish = -4,
} pulsar_schema_type;
-typedef enum
-{
+typedef enum {
// This is the default option to fail send if crypto operation fails
pulsar_ProducerFail,
// Ignore crypto failure and proceed with sending unencrypted messages
diff --git a/pulsar-client-cpp/include/pulsar/c/result.h b/pulsar-client-cpp/include/pulsar/c/result.h
index ea9321cfd84..22cdb4c0f3d 100644
--- a/pulsar-client-cpp/include/pulsar/c/result.h
+++ b/pulsar-client-cpp/include/pulsar/c/result.h
@@ -25,8 +25,7 @@
extern "C" {
#endif
-typedef enum
-{
+typedef enum {
pulsar_result_Ok, /// Operation successful
pulsar_result_UnknownError, /// Unknown error happened on broker
diff --git a/pulsar-client-cpp/lib/LogUtils.cc b/pulsar-client-cpp/lib/LogUtils.cc
index 31746087b92..7967fbe7545 100644
--- a/pulsar-client-cpp/lib/LogUtils.cc
+++ b/pulsar-client-cpp/lib/LogUtils.cc
@@ -27,7 +27,7 @@
namespace pulsar {
void LogUtils::init(const std::string& logfilePath) {
- // If this is called explicitely, we fallback to Log4cxx config, if enabled
+// If this is called explicitely, we fallback to Log4cxx config, if enabled
#ifdef USE_LOG4CXX
if (!logfilePath.empty()) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org