Skip to content

Commit

Permalink
Fix[MQB, BMQ]: -Wconversion warnings (bloomberg#401)
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
  • Loading branch information
678098 authored and alexander-e1off committed Oct 24, 2024
1 parent 11014b4 commit e1777cd
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/groups/bmq/bmqp/bmqp_optionutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ inline int OptionUtil::OptionMeta::size() const
// PRECONDITIONS
BSLS_ASSERT_SAFE(!isNull());

return sizeof(OptionHeader) + d_payloadSize + d_padding;
return static_cast<int>(sizeof(OptionHeader)) + d_payloadSize + d_padding;
}

inline int OptionUtil::OptionMeta::padding() const
Expand Down
2 changes: 1 addition & 1 deletion src/groups/bmq/bmqt/bmqt_encodingtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool EncodingType::fromAscii(EncodingType::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(EncodingType::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = EncodingType::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/bmq/bmqt/bmqt_propertytype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool PropertyType::fromAscii(PropertyType::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(PropertyType::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = PropertyType::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/bmq/bmqt/bmqt_queueflags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bool QueueFlags::fromAscii(QueueFlags::Enum* out, const bslstl::StringRef& str)
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(QueueFlags::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = QueueFlags::e_##M; \
return true; \
}
Expand Down
14 changes: 7 additions & 7 deletions src/groups/bmq/bmqt/bmqt_resultcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool GenericResult::fromAscii(GenericResult::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(GenericResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = GenericResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -143,7 +143,7 @@ bool OpenQueueResult::fromAscii(OpenQueueResult::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(OpenQueueResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = OpenQueueResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -217,7 +217,7 @@ bool ConfigureQueueResult::fromAscii(ConfigureQueueResult::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(ConfigureQueueResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ConfigureQueueResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -290,7 +290,7 @@ bool CloseQueueResult::fromAscii(CloseQueueResult::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(CloseQueueResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = CloseQueueResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -365,7 +365,7 @@ bool EventBuilderResult::fromAscii(EventBuilderResult::Enum* out,
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(EventBuilderResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = EventBuilderResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -440,7 +440,7 @@ bool AckResult::fromAscii(AckResult::Enum* out, const bslstl::StringRef& str)
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(AckResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = AckResult::e_##M; \
return true; \
}
Expand Down Expand Up @@ -514,7 +514,7 @@ bool PostResult::fromAscii(PostResult::Enum* out, const bslstl::StringRef& str)
#define BMQT_CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(PostResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = PostResult::e_##M; \
return true; \
}
Expand Down
4 changes: 2 additions & 2 deletions src/groups/mqb/mqbc/mqbc_clusterstateledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bool ClusterStateLedgerConsistency::fromAscii(
if (bdlb::String::areEqualCaseless( \
toAscii(ClusterStateLedgerConsistency::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ClusterStateLedgerConsistency::e_##M; \
return true; \
}
Expand Down Expand Up @@ -138,7 +138,7 @@ bool ClusterStateLedgerCommitStatus::fromAscii(
if (bdlb::String::areEqualCaseless( \
toAscii(ClusterStateLedgerCommitStatus::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ClusterStateLedgerCommitStatus::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool ClusterStateLedgerUtilRc::fromAscii(ClusterStateLedgerUtilRc::Enum* out,
if (bdlb::String::areEqualCaseless( \
toAscii(ClusterStateLedgerUtilRc::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ClusterStateLedgerUtilRc::e_##M; \
return true; \
}
Expand Down
4 changes: 2 additions & 2 deletions src/groups/mqb/mqbc/mqbc_clusterstatetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool ClusterStateTableState::fromAscii(ClusterStateTableState::Enum* out,
if (bdlb::String::areEqualCaseless( \
toAscii(ClusterStateTableState::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ClusterStateTableState::e_##M; \
return true; \
}
Expand Down Expand Up @@ -161,7 +161,7 @@ bool ClusterStateTableEvent::fromAscii(ClusterStateTableEvent::Enum* out,
if (bdlb::String::areEqualCaseless( \
toAscii(ClusterStateTableEvent::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ClusterStateTableEvent::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbi/mqbi_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool StorageResult::fromAscii(StorageResult::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(StorageResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = StorageResult::e_##M; \
return true; \
}
Expand Down
6 changes: 3 additions & 3 deletions src/groups/mqb/mqbnet/mqbnet_elector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool ElectorIOEventType::fromAscii(ElectorIOEventType::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(ElectorIOEventType::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ElectorIOEventType::e_##M; \
return true; \
}
Expand Down Expand Up @@ -206,7 +206,7 @@ bool ElectorTimerEventType::fromAscii(ElectorTimerEventType::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(ElectorTimerEventType::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ElectorTimerEventType::e_##M; \
return true; \
}
Expand Down Expand Up @@ -266,7 +266,7 @@ bool ElectorState::fromAscii(ElectorState::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(ElectorState::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ElectorState::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbs/mqbs_filestoreprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ bool DataHeaderFlags::fromAscii(DataHeaderFlags::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(DataHeaderFlags::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = DataHeaderFlags::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbsi/mqbsi_ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ bool LedgerOpResult::fromAscii(LedgerOpResult::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(LedgerOpResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = LedgerOpResult::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbsi/mqbsi_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool LogOpResult::fromAscii(LogOpResult::Enum* out,
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(LogOpResult::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = LogOpResult::e_##M; \
return true; \
}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbu/mqbu_exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool ExitCode::fromAscii(ExitCode::Enum* out, const bslstl::StringRef& str)
#define CHECKVALUE(M) \
if (bdlb::String::areEqualCaseless(toAscii(ExitCode::e_##M), \
str.data(), \
str.length())) { \
static_cast<int>(str.length()))) { \
*out = ExitCode::e_##M; \
return true; \
}
Expand Down

0 comments on commit e1777cd

Please sign in to comment.