summaryrefslogtreecommitdiff
path: root/ACE/ace/CDR_Base.cpp
diff options
context:
space:
mode:
authorAdam Mitz <mitza@ociweb.com>2015-05-11 15:22:12 -0500
committerAdam Mitz <mitza@ociweb.com>2015-05-11 15:33:46 -0500
commit57397b45b69524f4493d63ee951e9badcd3a4ea4 (patch)
tree290c4ac421e8050b8c4eb0efd803fb01b9bb80bf /ACE/ace/CDR_Base.cpp
parent68e94809286173bf801cf81e4e636943af9b1542 (diff)
downloadATCD-57397b45b69524f4493d63ee951e9badcd3a4ea4.tar.gz
Fixed coverity issues 1297401 and 1297404
Diffstat (limited to 'ACE/ace/CDR_Base.cpp')
-rw-r--r--ACE/ace/CDR_Base.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/ACE/ace/CDR_Base.cpp b/ACE/ace/CDR_Base.cpp
index b2ee413e985..bef9c40e67f 100644
--- a/ACE/ace/CDR_Base.cpp
+++ b/ACE/ace/CDR_Base.cpp
@@ -852,7 +852,7 @@ ACE_CDR::Fixed ACE_CDR::Fixed::from_floating (LongDouble val)
#endif
Fixed f;
- f.digits_ = 0;
+ f.digits_ = f.scale_ = 0;
bool negative = false;
if (val < 0)
{
@@ -864,7 +864,10 @@ ACE_CDR::Fixed ACE_CDR::Fixed::from_floating (LongDouble val)
const size_t digits_left =
static_cast<size_t> (1 + ((val > 0) ? std::log10 (val) : 0));
if (digits_left > MAX_DIGITS)
- return f;
+ {
+ ACE_OS::memset (f.value_, 0, sizeof f.value_);
+ return f;
+ }
f.digits_ = MAX_DIGITS;
f.scale_ = 0;
@@ -948,8 +951,8 @@ void ACE_CDR::Fixed::normalize (UShort min_scale)
ACE_CDR::Fixed ACE_CDR::Fixed::from_string (const char *str)
{
- const bool negative = str && *str == '-';
- if (negative || (str && *str == '+'))
+ const bool negative = *str == '-';
+ if (negative || *str == '+')
++str;
const size_t span = ACE_OS::strspn (str, ".0123456789");