You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2019/01/02 08:22:08 UTC
[rocketmq-client-cpp] branch master updated: Fix warning while
compiling rocketmq_static (#47)
This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new 476a219 Fix warning while compiling rocketmq_static (#47)
476a219 is described below
commit 476a2195fd59f8e9c233f0aac7998e4fba96c880
Author: Felix <st...@gmail.com>
AuthorDate: Wed Jan 2 16:22:05 2019 +0800
Fix warning while compiling rocketmq_static (#47)
1. the return value of "UtilAll::ReplaceFile" is bool, not integer.
2. gcc suggest parentheses around '&&' within '||'。
---
src/MQClientAPIImpl.cpp | 4 ++--
src/consumer/OffsetStore.cpp | 2 +-
src/producer/DefaultMQProducer.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/MQClientAPIImpl.cpp b/src/MQClientAPIImpl.cpp
index 6217086..244d674 100644
--- a/src/MQClientAPIImpl.cpp
+++ b/src/MQClientAPIImpl.cpp
@@ -152,7 +152,7 @@ string MQClientAPIImpl::fetchNameServerAddr(const string& NSDomain) {
// update the snapshot local file if nameSrv changes or
// m_firstFetchNameSrv==true
if (writeDataToFile(fileBak, addrs, true)) {
- if (UtilAll::ReplaceFile(fileBak, file) == -1)
+ if (!UtilAll::ReplaceFile(fileBak, file))
LOG_ERROR("could not rename bak file:%s", strerror(errno));
}
}
@@ -160,7 +160,7 @@ string MQClientAPIImpl::fetchNameServerAddr(const string& NSDomain) {
if (!boost::filesystem::exists(snapshot_file)) {
// the name server snapshot local file maybe deleted by force, create it
if (writeDataToFile(fileBak, m_nameSrvAddr, true)) {
- if (UtilAll::ReplaceFile(fileBak, file) == -1)
+ if (!UtilAll::ReplaceFile(fileBak, file))
LOG_ERROR("could not rename bak file:%s", strerror(errno));
}
}
diff --git a/src/consumer/OffsetStore.cpp b/src/consumer/OffsetStore.cpp
index a7463a6..25d1b32 100644
--- a/src/consumer/OffsetStore.cpp
+++ b/src/consumer/OffsetStore.cpp
@@ -214,7 +214,7 @@ void LocalFileOffsetStore::persistAll(const std::vector<MQMessageQueue>& mqs) {
"persistAll:open offset store file failed", -1);
}
s.close();
- if (UtilAll::ReplaceFile(storefile_bak, m_storeFile) == -1)
+ if (!UtilAll::ReplaceFile(storefile_bak, m_storeFile))
LOG_ERROR("could not rename bak file:%s", strerror(errno));
m_offsetTable_tmp.clear();
} else {
diff --git a/src/producer/DefaultMQProducer.cpp b/src/producer/DefaultMQProducer.cpp
index 4c39bd2..1411ebd 100755
--- a/src/producer/DefaultMQProducer.cpp
+++ b/src/producer/DefaultMQProducer.cpp
@@ -244,7 +244,7 @@ void DefaultMQProducer::setMaxMessageSize(int maxMessageSize) {
int DefaultMQProducer::getCompressLevel() const { return m_compressLevel; }
void DefaultMQProducer::setCompressLevel(int compressLevel) {
- assert(compressLevel >= 0 && compressLevel <= 9 || compressLevel == -1);
+ assert((compressLevel >= 0 && compressLevel <= 9) || compressLevel == -1);
m_compressLevel = compressLevel;
}