Skip to content

Commit 3a38e1c

Browse files
committed
Remove NOMINMAX
1 parent 7418ab3 commit 3a38e1c

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

include/kafka/KafkaProducer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class KafkaProducer: public KafkaClient
5454
* Possible error values:
5555
* - RD_KAFKA_RESP_ERR__TIMED_OUT: The `timeout` was reached before all outstanding requests were completed.
5656
*/
57-
Error flush(std::chrono::milliseconds timeout = std::chrono::milliseconds::max());
57+
Error flush(std::chrono::milliseconds timeout = InfiniteTimeout);
5858

5959
/**
6060
* Purge messages currently handled by the KafkaProducer.
@@ -64,7 +64,7 @@ class KafkaProducer: public KafkaClient
6464
/**
6565
* Close this producer. This method would wait up to timeout for the producer to complete the sending of all incomplete requests (before purging them).
6666
*/
67-
void close(std::chrono::milliseconds timeout = std::chrono::milliseconds::max());
67+
void close(std::chrono::milliseconds timeout = InfiniteTimeout);
6868

6969
/**
7070
* Options for sending messages.
@@ -142,7 +142,7 @@ class KafkaProducer: public KafkaClient
142142
/**
143143
* Needs to be called before any other methods when the transactional.id is set in the configuration.
144144
*/
145-
void initTransactions(std::chrono::milliseconds timeout = std::chrono::milliseconds::max());
145+
void initTransactions(std::chrono::milliseconds timeout = InfiniteTimeout);
146146

147147
/**
148148
* Should be called before the start of each new transaction.
@@ -152,12 +152,12 @@ class KafkaProducer: public KafkaClient
152152
/**
153153
* Commit the ongoing transaction.
154154
*/
155-
void commitTransaction(std::chrono::milliseconds timeout = std::chrono::milliseconds::max());
155+
void commitTransaction(std::chrono::milliseconds timeout = InfiniteTimeout);
156156

157157
/**
158158
* Abort the ongoing transaction.
159159
*/
160-
void abortTransaction(std::chrono::milliseconds timeout = std::chrono::milliseconds::max());
160+
void abortTransaction(std::chrono::milliseconds timeout = InfiniteTimeout);
161161

162162

163163
/**

include/kafka/Project.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
// #define KAFKA_API_ENABLE_UNIT_TEST_STUBS
1111
// #endif
1212

13-
#if defined(WIN32) && !defined(NOMINMAX)
14-
#define NOMINMAX
15-
#endif
1613

1714
#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))
1815
#define COMPILER_SUPPORTS_CPP_17 1

include/kafka/Types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ class ConstBuffer
6060
std::size_t _size;
6161
};
6262

63+
64+
/**
65+
* Infinite timeout.
66+
*/
67+
#if COMPILER_SUPPORTS_CPP_17
68+
const inline std::chrono::milliseconds InfiniteTimeout = (std::chrono::milliseconds::max)();
69+
#else
70+
const static std::chrono::milliseconds InfiniteTimeout = (std::chrono::milliseconds::max)();
71+
#endif
72+
73+
6374
/**
6475
* Topic name.
6576
*/

include/kafka/addons/KafkaRecoverableProducer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class KafkaRecoverableProducer
138138
* Possible error values:
139139
* - RD_KAFKA_RESP_ERR__TIMED_OUT: The `timeout` was reached before all outstanding requests were completed.
140140
*/
141-
Error flush(std::chrono::milliseconds timeout = std::chrono::milliseconds::max())
141+
Error flush(std::chrono::milliseconds timeout = InfiniteTimeout)
142142
{
143143
std::lock_guard<std::mutex> lock(_producerMutex);
144144

@@ -158,7 +158,7 @@ class KafkaRecoverableProducer
158158
/**
159159
* Close this producer. This method would wait up to timeout for the producer to complete the sending of all incomplete requests (before purging them).
160160
*/
161-
void close(std::chrono::milliseconds timeout = std::chrono::milliseconds::max())
161+
void close(std::chrono::milliseconds timeout = InfiniteTimeout)
162162
{
163163
std::lock_guard<std::mutex> lock(_producerMutex);
164164

@@ -247,7 +247,7 @@ class KafkaRecoverableProducer
247247
/**
248248
* Needs to be called before any other methods when the transactional.id is set in the configuration.
249249
*/
250-
void initTransactions(std::chrono::milliseconds timeout = std::chrono::milliseconds::max())
250+
void initTransactions(std::chrono::milliseconds timeout = InfiniteTimeout)
251251
{
252252
std::lock_guard<std::mutex> lock(_producerMutex);
253253

@@ -267,7 +267,7 @@ class KafkaRecoverableProducer
267267
/**
268268
* Commit the ongoing transaction.
269269
*/
270-
void commitTransaction(std::chrono::milliseconds timeout = std::chrono::milliseconds::max())
270+
void commitTransaction(std::chrono::milliseconds timeout = InfiniteTimeout)
271271
{
272272
std::lock_guard<std::mutex> lock(_producerMutex);
273273

@@ -277,7 +277,7 @@ class KafkaRecoverableProducer
277277
/**
278278
* Abort the ongoing transaction.
279279
*/
280-
void abortTransaction(std::chrono::milliseconds timeout = std::chrono::milliseconds::max())
280+
void abortTransaction(std::chrono::milliseconds timeout = InfiniteTimeout)
281281
{
282282
std::lock_guard<std::mutex> lock(_producerMutex);
283283

0 commit comments

Comments
 (0)