diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-04-26 16:17:19 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-04-26 16:17:19 +0000 |
commit | 2a3a0443ea73277c990893a6df6221c8bac4cc3d (patch) | |
tree | 20e33a10a49462735603514c49e15fb084ca2be0 /ace | |
parent | 733b3d203783bb22a72d0483bdcb53ea7deb9eae (diff) | |
download | ATCD-2a3a0443ea73277c990893a6df6221c8bac4cc3d.tar.gz |
ChangeLogTag:Mon Apr 26 09:16:14 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/CDR_Base.h | 9 | ||||
-rw-r--r-- | ace/CDR_Stream.cpp | 241 | ||||
-rw-r--r-- | ace/CDR_Stream.h | 139 | ||||
-rw-r--r-- | ace/CDR_Stream.i | 135 |
4 files changed, 264 insertions, 260 deletions
diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index f32326ed0d5..66c6d277d22 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -161,14 +161,7 @@ public: // Definitions of the IDL basic types, for use in the CDR // classes. The cleanest way to avoid complaints from all compilers // is to define them all. -# if defined (CHORUS) && defined (ghs) && !defined (__STANDARD_CXX) - // This is non-compliant, but a nasty bout with - // Green Hills C++68000 1.8.8 forces us into it. - typedef unsigned long Boolean; -# else /* ! (CHORUS && ghs 1.8.8) */ - typedef unsigned char Boolean; -# endif /* ! (CHORUS && ghs 1.8.8) */ - + typedef bool Boolean; typedef unsigned char Octet; typedef char Char; typedef ACE_WCHAR_T WChar; diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index f068d41594c..4ecfdf1be0f 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -34,10 +34,10 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size, ACE_Time_Value::max_time, data_block_allocator, message_block_allocator), - current_is_writable_ (1), current_alignment_ (0), + current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), + good_bit_ (true), memcpy_tradeoff_ (memcpy_tradeoff), major_version_ (major_version), minor_version_ (minor_version), @@ -68,10 +68,10 @@ ACE_OutputCDR::ACE_OutputCDR (char *data, size_t size, ACE_Time_Value::max_time, data_block_allocator, message_block_allocator), - current_is_writable_ (1), current_alignment_ (0), + current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), + good_bit_ (true), memcpy_tradeoff_ (memcpy_tradeoff), major_version_ (major_version), minor_version_ (minor_version), @@ -89,10 +89,10 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, ACE_CDR::Octet major_version, ACE_CDR::Octet minor_version) : start_ (data->data_block ()->duplicate ()), - current_is_writable_ (1), current_alignment_ (0), + current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), + good_bit_ (true), memcpy_tradeoff_ (memcpy_tradeoff), major_version_ (major_version), minor_version_ (minor_version), @@ -137,10 +137,9 @@ ACE_OutputCDR::grow_and_adjust (size_t size, if (minsize < cursize) minsize = cursize; - size_t newsize = - ACE_CDR::next_size (minsize); + const size_t newsize = ACE_CDR::next_size (minsize); - this->good_bit_ = 0; + this->good_bit_ = false; ACE_Message_Block* tmp; ACE_NEW_RETURN (tmp, ACE_Message_Block (newsize, @@ -154,7 +153,7 @@ ACE_OutputCDR::grow_and_adjust (size_t size, ACE_Time_Value::max_time, this->current_->data_block ()->data_block_allocator ()), -1); - this->good_bit_ = 1; + this->good_bit_ = true; // The new block must start with the same alignment as the // previous block finished. @@ -173,7 +172,7 @@ ACE_OutputCDR::grow_and_adjust (size_t size, this->current_->cont (tmp); } this->current_ = this->current_->cont (); - this->current_is_writable_ = 1; + this->current_is_writable_ = true; return this->adjust (size, align, buf); } @@ -186,7 +185,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) if (ACE_OutputCDR::wchar_maxbytes_ == 0) { errno = EACCES; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } if (ACE_static_cast (ACE_CDR::Short, major_version_) == 1 && ACE_static_cast (ACE_CDR::Short, minor_version_) == 2) @@ -218,7 +217,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) else if (ACE_static_cast (ACE_CDR::Short, minor_version_) == 0) { // wchar is not allowed with GIOP 1.0. errno = EINVAL; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, &x)); @@ -257,7 +256,7 @@ ACE_OutputCDR::write_string (ACE_CDR::ULong len, return this->write_char (0); } - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -265,7 +264,7 @@ ACE_OutputCDR::write_string (const ACE_CString &x) { // @@ Leave this method in here, not the `.i' file so that we don't // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (ACE_static_cast (ACE_CDR::ULong, x.length()), + return this->write_string (ACE_static_cast (ACE_CDR::ULong, x.length ()), x.c_str()); } @@ -282,7 +281,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, if (ACE_OutputCDR::wchar_maxbytes_ == 0) { errno = EACCES; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } if (ACE_static_cast (ACE_CDR::Short, this->major_version_) == 1 @@ -309,7 +308,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, } else if (this->write_ulong (1)) return this->write_wchar (0); - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -321,7 +320,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) i != 0; i = i->cont ()) { - size_t length = i->length (); + const size_t length = i->length (); // If the mb does not own its data we are forced to make a copy. if (ACE_BIT_ENABLED (i->flags (), @@ -331,7 +330,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, ACE_static_cast (ACE_CDR::ULong, length))) - return (this->good_bit_ = 0); + return (this->good_bit_ = false); continue; } @@ -342,16 +341,16 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, ACE_static_cast (ACE_CDR::ULong, length))) - return (this->good_bit_ = 0); + return (this->good_bit_ = false); continue; } ACE_Message_Block* cont; - this->good_bit_ = 0; + this->good_bit_ = false; ACE_NEW_RETURN (cont, ACE_Message_Block (i->data_block ()->duplicate ()), 0); - this->good_bit_ = 1; + this->good_bit_ = true; if (cont != 0) { @@ -362,17 +361,17 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) this->current_->cont (cont); this->current_ = cont; - this->current_is_writable_ = 0; + this->current_is_writable_ = false; this->current_alignment_ = (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT; } else { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } } - return 1; + return true; } ACE_CDR::Boolean @@ -381,11 +380,11 @@ ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) char *buf; if (this->adjust (1, buf) == 0) { - *ACE_reinterpret_cast(ACE_CDR::Octet*, buf) = *x; - return 1; + *ACE_reinterpret_cast (ACE_CDR::Octet*, buf) = *x; + return true; } - return 0; + return false; } ACE_CDR::Boolean @@ -396,22 +395,22 @@ ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) { #if !defined (ACE_ENABLE_SWAP_ON_WRITE) *ACE_reinterpret_cast(ACE_CDR::UShort*,buf) = *x; - return 1; + return true; #else if (!this->do_byte_swap_) { *ACE_reinterpret_cast (ACE_CDR::UShort *, buf) = *x; - return 1; + return true; } else { ACE_CDR::swap_2 (ACE_reinterpret_cast (const char*, x), buf); - return 1; + return true; } #endif /* ACE_ENABLE_SWAP_ON_WRITE */ } - return 0; + return false; } ACE_CDR::Boolean @@ -427,17 +426,17 @@ ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) if (!this->do_byte_swap_) { *ACE_reinterpret_cast (ACE_CDR::ULong *, buf) = *x; - return 1; + return true; } else { ACE_CDR::swap_4 (ACE_reinterpret_cast (const char*, x), buf); - return 1; + return true; } #endif /* ACE_ENABLE_SWAP_ON_WRITE */ } - return 0; + return false; } ACE_CDR::Boolean @@ -457,27 +456,27 @@ ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) *ACE_reinterpret_cast (const ACE_UINT32 *, orig + 4); *ACE_reinterpret_cast (ACE_UINT32 *, target) = y; *ACE_reinterpret_cast (ACE_UINT32 *, target + 4) = x; - return 1; + return true; #else # if !defined (ACE_ENABLE_SWAP_ON_WRITE) *ACE_reinterpret_cast (ACE_CDR::ULongLong *,buf) = *x; - return 1; + return true; # else if (!this->do_byte_swap_) { *ACE_reinterpret_cast (ACE_CDR::ULongLong *, buf) = *x; - return 1; + return true; } else { ACE_CDR::swap_8 (ACE_reinterpret_cast (const char*, x), buf); - return 1; + return true; } # endif /* ACE_ENABLE_SWAP_ON_WRITE */ #endif /* !__arm__ */ } - return 0; + return false; } ACE_CDR::Boolean @@ -495,17 +494,17 @@ ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x) if (!this->do_byte_swap_) { *ACE_reinterpret_cast (ACE_CDR::LongDouble *, buf) = *x; - return 1; + return true; } else { ACE_CDR::swap_16 (ACE_reinterpret_cast (const char*, x), buf); - return 1; + return true; } #endif /* ACE_ENABLE_SWAP_ON_WRITE */ } - return 0; + return false; } ACE_CDR::Boolean @@ -513,9 +512,9 @@ ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, ACE_CDR::ULong length) { if (length == 0) - return 1; + return true; char* buf; - size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? + const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? ACE_CDR::SHORT_ALIGN : ACE_CDR::OCTET_ALIGN; @@ -544,7 +543,7 @@ ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, } return this->good_bit_; } - return 0; + return false; } @@ -555,18 +554,18 @@ ACE_OutputCDR::write_array (const void *x, ACE_CDR::ULong length) { if (length == 0) - return 1; + return true; char *buf; if (this->adjust (size * length, align, buf) == 0) { #if !defined (ACE_ENABLE_SWAP_ON_WRITE) ACE_OS::memcpy (buf, x, size*length); - return 1; + return true; #else if (!this->do_byte_swap_ || size == 1) { ACE_OS::memcpy (buf, x, size*length); - return 1; + return true; } else { @@ -575,26 +574,26 @@ ACE_OutputCDR::write_array (const void *x, { case 2: ACE_CDR::swap_2_array (source, buf, length); - return 1; + return true; case 4: ACE_CDR::swap_4_array (source, buf, length); - return 1; + return true; case 8: ACE_CDR::swap_8_array (source, buf, length); - return 1; + return true; case 16: ACE_CDR::swap_16_array (source, buf, length); - return 1; + return true; default: // TODO: print something? - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } } #endif /* ACE_ENABLE_SWAP_ON_WRITE */ } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -726,7 +725,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); - size_t newpos = + const size_t newpos = (rhs.start_.rd_ptr() - incoming_start) + offset; if (newpos <= this->start_.space () @@ -736,7 +735,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, this->start_.wr_ptr (newpos + size); } else - this->good_bit_ = 0; + this->good_bit_ = false; } ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, @@ -756,7 +755,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); - size_t newpos = + const size_t newpos = rhs.start_.rd_ptr() - incoming_start; if (newpos <= this->start_.space () @@ -772,7 +771,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); } else - this->good_bit_ = 0; + this->good_bit_ = false; } ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) @@ -820,7 +819,7 @@ ACE_InputCDR::operator= (const ACE_InputCDR& rhs) this->start_.rd_ptr (rhs.start_.rd_ptr ()); this->start_.wr_ptr (rhs.start_.wr_ptr ()); this->do_byte_swap_ = rhs.do_byte_swap_; - this->good_bit_ = 1; + this->good_bit_ = true; this->char_translator_ = rhs.char_translator_; this->major_version_ = rhs.major_version_; this->minor_version_ = rhs.minor_version_; @@ -876,7 +875,7 @@ ACE_InputCDR::skip_wchar (void) return this->read_4 (ACE_reinterpret_cast (ACE_CDR::ULong *,&x)); } - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -890,7 +889,7 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) if (ACE_OutputCDR::wchar_maxbytes_ == 0) { errno = EACCES; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) @@ -905,7 +904,7 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) (ACE_reinterpret_cast (ACE_CDR::Octet*, &x), ACE_static_cast (ACE_CDR::ULong, len)); else - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } if (sizeof (ACE_CDR::WChar) == 2) @@ -929,7 +928,7 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) ACE_static_cast (ACE_CDR::ULong, len))) { x = ACE_static_cast(ACE_CDR::WChar, sx); - return 1; + return true; } } else @@ -940,7 +939,7 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) ACE_static_cast (ACE_CDR::ULong, len))) { x = ACE_static_cast(ACE_CDR::WChar, ox); - return 1; + return true; } } } @@ -953,7 +952,7 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) if (this->read_2 (ACE_reinterpret_cast (ACE_CDR::UShort *, &sx))) { x = ACE_static_cast(ACE_CDR::WChar, sx); - return 1; + return true; } } else @@ -962,12 +961,12 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) if (this->read_1 (&ox)) { x = ACE_static_cast(ACE_CDR::WChar, ox); - return 1; + return true; } } } - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -994,7 +993,7 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x) ACE_CDR::Char[len], 0); if (this->read_char_array (x, len)) - return 1; + return true; delete [] x; } @@ -1006,11 +1005,11 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x) ACE_CDR::Char[1], 0); ACE_OS::strcpy (ACE_const_cast (char *&, x), ""); - return 1; + return true; } x = 0; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -1021,11 +1020,11 @@ ACE_InputCDR::read_string (ACE_CString &x) { x = data; delete [] data; - return 1; + return true; } x = ""; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -1042,17 +1041,17 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) if (ACE_OutputCDR::wchar_maxbytes_ == 0) { errno = EACCES; - return (this->good_bit_ = 0); + return (this->good_bit_ = false); } ACE_CDR::ULong len; if (!this->read_ulong (len)) - return 0; + return false; // A check for the length being too great is done later in the // call to read_char_array but we want to have it done before // the memory is allocated. - if (len > 0 && len <= this->length()) + if (len > 0 && len <= this->length ()) { if (ACE_static_cast (ACE_CDR::Short, this->major_version_) == 1 @@ -1063,7 +1062,7 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) //allocating one extra for the null character needed by applications ACE_NEW_RETURN (x, ACE_CDR::WChar [len + 1], - 0); + false); if (this->read_wchar_array (x, len)) { @@ -1073,17 +1072,17 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) //Is this okay with the GIOP 1.2 spec?? x[len] = '\x00'; - return 1; + return true; } } else { ACE_NEW_RETURN (x, ACE_CDR::WChar [len], - 0); + false); if (this->read_wchar_array (x, len)) - return 1; + return true; } delete [] x; @@ -1094,14 +1093,14 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) // strings can cause crashes. (See bug 58.) ACE_NEW_RETURN (x, ACE_CDR::WChar[1], - 0); + false); x[0] = '\x00'; - return 1; + return true; } - this->good_bit_ = 0; + this->good_bit_ = false; x = 0; - return 0; + return false; } ACE_CDR::Boolean @@ -1111,7 +1110,7 @@ ACE_InputCDR::read_array (void* x, ACE_CDR::ULong length) { if (length == 0) - return 1; + return true; char* buf; if (this->adjust (size * length, align, buf) == 0) @@ -1140,14 +1139,14 @@ ACE_InputCDR::read_array (void* x, break; default: // TODO: print something? - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } } #endif /* ACE_DISABLE_SWAP_ON_READ */ return this->good_bit_; } - return 0; + return false; } ACE_CDR::Boolean @@ -1155,9 +1154,9 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, ACE_CDR::ULong length) { if (length == 0) - return 1; + return true; char* buf; - size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? + const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? ACE_CDR::SHORT_ALIGN : ACE_CDR::OCTET_ALIGN; @@ -1166,7 +1165,7 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, if (ACE_OutputCDR::wchar_maxbytes_ == 2) { ACE_CDR::UShort *sb = ACE_reinterpret_cast(ACE_CDR::UShort *, buf); - for (size_t i = 0; i < length; i++) + for (size_t i = 0; i < length; ++i) #if defined (ACE_DISABLE_SWAP_ON_READ) x[i] = ACE_static_cast (ACE_CDR::WChar, sb[i]); #else @@ -1182,12 +1181,12 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, } else { - for (size_t i = 0; i < length; i++) + for (size_t i = 0; i < length; ++i) x[i] = ACE_static_cast (ACE_CDR::Octet, buf[i]); } return this->good_bit_; } - return 0; + return false; } @@ -1197,10 +1196,10 @@ ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length > this->length()) + if (length > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } // It is hard to optimize this, the spec requires that on the wire @@ -1221,11 +1220,11 @@ ACE_InputCDR::read_1 (ACE_CDR::Octet *x) { *x = *ACE_reinterpret_cast (ACE_CDR::Octet*,this->rd_ptr ()); this->start_.rd_ptr (1); - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -1242,10 +1241,10 @@ ACE_InputCDR::read_2 (ACE_CDR::UShort *x) #else *x = *ACE_reinterpret_cast(ACE_CDR::UShort*,buf); #endif /* ACE_DISABLE_SWAP_ON_READ */ - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -1262,10 +1261,10 @@ ACE_InputCDR::read_4 (ACE_CDR::ULong *x) #else *x = *ACE_reinterpret_cast(ACE_CDR::ULong*,buf); #endif /* ACE_DISABLE_SWAP_ON_READ */ - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -1312,11 +1311,11 @@ ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) #else *x = *ACE_reinterpret_cast (ACE_CDR::ULongLong *, buf); #endif /* ACE_DISABLE_SWAP_ON_READ */ - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -1335,11 +1334,11 @@ ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x) #else *x = *ACE_reinterpret_cast(ACE_CDR::LongDouble*,buf); #endif /* ACE_DISABLE_SWAP_ON_READ */ - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } ACE_CDR::Boolean @@ -1351,17 +1350,17 @@ ACE_InputCDR::skip_string (void) if (this->rd_ptr () + len <= this->wr_ptr ()) { this->rd_ptr (len); - return 1; + return true; } - this->good_bit_ = 0; + this->good_bit_ = false; } - return 0; + return false; } ACE_CDR::Boolean ACE_InputCDR::skip_wstring (void) { - ACE_CDR::Boolean continue_skipping = 1; + ACE_CDR::Boolean continue_skipping = true; ACE_CDR::ULong len; continue_skipping = read_ulong (len); @@ -1384,10 +1383,10 @@ ACE_InputCDR::skip_bytes (size_t len) if (this->rd_ptr () + len <= this->wr_ptr ()) { this->rd_ptr (len); - return 1; + return true; } - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } int diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index 57052efeebc..b8806e7f679 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -142,25 +142,25 @@ public: struct ACE_Export from_boolean { - from_boolean (ACE_CDR::Boolean b); + ACE_EXPLICIT from_boolean (ACE_CDR::Boolean b); ACE_CDR::Boolean val_; }; struct ACE_Export from_octet { - from_octet (ACE_CDR::Octet o); + ACE_EXPLICIT from_octet (ACE_CDR::Octet o); ACE_CDR::Octet val_; }; struct ACE_Export from_char { - from_char (ACE_CDR::Char c); + ACE_EXPLICIT from_char (ACE_CDR::Char c); ACE_CDR::Char val_; }; struct ACE_Export from_wchar { - from_wchar (ACE_CDR::WChar wc); + ACE_EXPLICIT from_wchar (ACE_CDR::WChar wc); ACE_CDR::WChar val_; }; @@ -275,9 +275,11 @@ public: ACE_CDR::Boolean append_string (ACE_InputCDR &); //@} - /// Returns 0 if an error has ocurred, the only expected error is to - /// run out of memory. - int good_bit (void) const; + /// Returns @c false if an error has ocurred. + /** + * @note The only expected error is to run out of memory. + */ + bool good_bit (void) const; /// Reuse the CDR stream to write on the old buffer. void reset (void); @@ -360,7 +362,7 @@ public: /// If non-zero then this stream is writing in non-native byte order, /// this is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. - int do_byte_swap (void) const; + bool do_byte_swap (void) const; /// For use by a gateway, which creates the output stream for the /// reply to the client in its native byte order, but which must @@ -426,14 +428,6 @@ private: ACE_Message_Block *current_; /** - * Is the current block writable. When we steal a buffer from the - * user and just chain it into the message block we are not supposed - * to write on it, even if it is past the start and end of the - * buffer. - */ - int current_is_writable_; - - /** * The current alignment as measured from the start of the buffer. * Usually this coincides with the alignment of the buffer in * memory, but, when we chain another buffer this "quasi invariant" @@ -444,6 +438,14 @@ private: size_t current_alignment_; /** + * Is the current block writable. When we steal a buffer from the + * user and just chain it into the message block we are not supposed + * to write on it, even if it is past the start and end of the + * buffer. + */ + bool current_is_writable_; + + /** * If not zero swap bytes at writing so the created CDR stream byte * order does *not* match the machine byte order. The motivation * for such a beast is that in some setting a few (fast) machines @@ -452,10 +454,10 @@ private: * responsability in the writers. THIS IS NOT A STANDARD IN CORBA, * USE AT YOUR OWN RISK */ - int do_byte_swap_; + bool do_byte_swap_; /// Set to 0 when an error ocurrs. - int good_bit_; + bool good_bit_; /// Break-even point for copying. size_t memcpy_tradeoff_; @@ -617,25 +619,25 @@ public: struct ACE_Export to_boolean { - to_boolean (ACE_CDR::Boolean &b); + ACE_EXPLICIT to_boolean (ACE_CDR::Boolean &b); ACE_CDR::Boolean &ref_; }; struct ACE_Export to_char { - to_char (ACE_CDR::Char &c); + ACE_EXPLICIT to_char (ACE_CDR::Char &c); ACE_CDR::Char &ref_; }; struct ACE_Export to_wchar { - to_wchar (ACE_CDR::WChar &wc); + ACE_EXPLICIT to_wchar (ACE_CDR::WChar &wc); ACE_CDR::WChar &ref_; }; struct ACE_Export to_octet { - to_octet (ACE_CDR::Octet &o); + ACE_EXPLICIT to_octet (ACE_CDR::Octet &o); ACE_CDR::Octet &ref_; }; @@ -667,7 +669,7 @@ public: //@} /** - * Return 0 on failure and 1 on success. + * Return @c false on failure and @c true on success. */ //@{ @name Read basic IDL types ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x); @@ -690,9 +692,9 @@ public: //@} /** - * The buffer <x> must be large enough to contain <length> + * The buffer @a x must be large enough to contain @a length * elements. - * Return 0 on failure and 1 on success. + * Return @c false on failure and @c true on success. */ //@{ @name Read basic IDL types arrays ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x, @@ -724,7 +726,7 @@ public: //@} /** - * Return 0 on failure and 1 on success. + * Return @c false on failure and @c true on success. */ //@{ @name Skip elements ACE_CDR::Boolean skip_boolean (void); @@ -745,22 +747,26 @@ public: /** * The next field must be a string, this method skips it. It is * useful in parsing a TypeCode. - * Return 0 on failure and 1 on success. + * @return @c false on failure and @c true on success. */ ACE_CDR::Boolean skip_wstring (void); ACE_CDR::Boolean skip_string (void); - /// Skip <n> bytes in the CDR stream. - /// Return 0 on failure and 1 on success. + /// Skip @a n bytes in the CDR stream. + /** + * @return @c false on failure and @c true on success. + */ ACE_CDR::Boolean skip_bytes (size_t n); - /// returns zero if a problem has been detected. - int good_bit (void) const; + /// returns @c false if a problem has been detected. + bool good_bit (void) const; /** - * Return the start of the message block chain for this CDR stream. - * NOTE: In the current implementation the chain has length 1, but - * we are planning to change that. + * @return The start of the message block chain for this CDR + * stream. + * + * @note In the current implementation the chain has length 1, but + * we are planning to change that. */ const ACE_Message_Block* start (void) const; @@ -768,50 +774,55 @@ public: // CDR stream from a socket or file. /** - * Grow the internal buffer, reset <rd_ptr> to the first byte in the - * new buffer that is properly aligned, and set <wr_ptr> to <rd_ptr> - * + newsize + * Grow the internal buffer, reset @c rd_ptr to the first byte in + * the new buffer that is properly aligned, and set @c wr_ptr to @c + * rd_ptr @c + @c newsize */ int grow (size_t newsize); /** * After reading and partially parsing the contents the user can - * detect a change in the byte order, this method will let him + * detect a change in the byte order, this method will let him/her * change it. */ void reset_byte_order (int byte_order); /// Re-initialize the CDR stream, copying the contents of the chain - /// of message_blocks starting from <data>. + /// of message_blocks starting from @a data. void reset (const ACE_Message_Block *data, int byte_order); /// Steal the contents from the current CDR. ACE_Message_Block *steal_contents (void); - /// Steal the contents of <cdr> and make a shallow copy into this + /// Steal the contents of @a cdr and make a shallow copy into this /// stream. void steal_from (ACE_InputCDR &cdr); /// Exchange data blocks with the caller of this method. The read /// and write pointers are also exchanged. - /// Note: We now do only with the start_ message block. + /** + * @note We now do only with the start_ message block. + */ void exchange_data_blocks (ACE_InputCDR &cdr); - /// Copy the data portion from the <cdr> to this cdr and return the + /// Copy the data portion from the @c cdr to this cdr and return the /// data content (ie. the ACE_Data_Block) from this CDR to the - /// caller. The caller is responsible for managing the memory of the - /// returned ACE_Data_Block. + /// caller. + /** + * @note The caller is responsible for managing the memory of the + * returned ACE_Data_Block. + */ ACE_Data_Block* clone_from (ACE_InputCDR &cdr); /// Re-initialize the CDR stream, forgetting about the old contents /// of the stream and allocating a new buffer (from the allocators). void reset_contents (void); - /// Returns the current position for the rd_ptr.... + /// Returns the current position for the @c rd_ptr. char* rd_ptr (void); - /// Returns the current position for the wr_ptr.... + /// Returns the current position for the @c wr_ptr. char* wr_ptr (void); /// Return how many bytes are left in the stream. @@ -819,18 +830,19 @@ public: /** * Utility function to allow the user more flexibility. - * Skips up to the nearest <alignment>-byte boundary. + * Skips up to the nearest @a alignment-byte boundary. * Argument MUST be a power of 2. - * Returns 0 on success and -1 on failure. + * + * @return 0 on success and -1 on failure. */ int align_read_ptr (size_t alignment); - /// If non-zero then this stream is writing in non-native byte order, - /// this is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. - int do_byte_swap (void) const; + /// If @c true then this stream is writing in non-native byte order. + /// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. + bool do_byte_swap (void) const; - /// If <do_byte_swap> returns 0, this returns ACE_CDR_BYTE_ORDER else - /// it returns !ACE_CDR_BYTE_ORDER. + /// If @c do_byte_swap() returns @c false, this returns + /// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER. int byte_order (void) const; /// Access the codeset translators. They can be nil! @@ -842,10 +854,10 @@ public: void wchar_translator (ACE_WChar_Codeset_Translator *); /** - * Returns (in <buf>) the next position in the buffer aligned to - * <size>, it advances the Message_Block rd_ptr past the data - * (i.e., <buf> + <size>). Sets the good_bit to 0 and returns a -1 - * on failure. + * Returns (in @a buf) the next position in the buffer aligned to + * @a size. It advances the Message_Block @c rd_ptr past the data + * (i.e., @c buf @c + @c size). Sets the good_bit to @c false and + * returns a -1 on failure. */ int adjust (size_t size, char *&buf); @@ -863,17 +875,19 @@ public: /// Set the underlying GIOP version.. int get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); + protected: + /// The start of the chain of message blocks, even though in the /// current version the chain always has length 1. ACE_Message_Block start_; /// The CDR stream byte order does not match the one on the machine, /// swapping is needed while reading. - int do_byte_swap_; + bool do_byte_swap_; - /// set to 0 when an error occurs. - int good_bit_; + /// set to @c false when an error occurs. + bool good_bit_; /// The GIOP versions for this stream ACE_CDR::Octet major_version_; @@ -884,6 +898,7 @@ protected: ACE_WChar_Codeset_Translator *wchar_translator_; private: + ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x); ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x); ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x); @@ -1027,7 +1042,7 @@ protected: char *&buf); /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, int bit); + void good_bit (ACE_OutputCDR& out, bool bit); /// Obtain the CDR Stream's major & minor version values. ACE_CDR::Octet major_version (ACE_InputCDR& input); @@ -1120,7 +1135,7 @@ protected: char *&buf); /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, int bit); + void good_bit (ACE_OutputCDR& out, bool bit); /// Obtain the CDR Stream's major & minor version values. ACE_CDR::Octet major_version (ACE_InputCDR& input); diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index e3415b574c1..0e836c0ec58 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -151,7 +151,7 @@ ACE_INLINE void ACE_OutputCDR::reset (void) { this->current_ = &this->start_; - this->current_is_writable_ = 1; + this->current_is_writable_ = true; ACE_CDR::mb_align (&this->start_); this->current_alignment_ = 0; @@ -287,7 +287,7 @@ ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x, if (ACE_OutputCDR::wchar_maxbytes_ == 0) { errno = EACCES; - return (ACE_CDR::Boolean) (this->good_bit_ = 0); + return (ACE_CDR::Boolean) (this->good_bit_ = false); } if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) return this->write_array (x, @@ -400,7 +400,7 @@ ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, length); } -ACE_INLINE int +ACE_INLINE bool ACE_OutputCDR::good_bit (void) const { return this->good_bit_; @@ -414,7 +414,7 @@ ACE_OutputCDR::adjust (size_t size, if (!this->current_is_writable_) return this->grow_and_adjust (size, align, buf); - size_t offset = + const size_t offset = ACE_align_binary (this->current_alignment_, align) - this->current_alignment_; @@ -492,7 +492,7 @@ ACE_OutputCDR::length (void) const return this->start_.length (); } -ACE_INLINE int +ACE_INLINE bool ACE_OutputCDR::do_byte_swap (void) const { return this->do_byte_swap_; @@ -559,7 +559,7 @@ ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x) { ACE_CDR::Octet tmp; this->read_octet (tmp); - x = tmp ? (ACE_CDR::Boolean) 1 : (ACE_CDR::Boolean) 0; + x = tmp ? true : false; return (ACE_CDR::Boolean) this->good_bit_; } @@ -643,10 +643,10 @@ ACE_InputCDR::read_char_array (ACE_CDR::Char* x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length > this->length()) + if (length > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } if (this->char_translator_ == 0) @@ -663,10 +663,10 @@ ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length()) + if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } if (this->wchar_translator_ != 0) @@ -687,10 +687,10 @@ ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::OCTET_SIZE > this->length()) + if (length * ACE_CDR::OCTET_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -705,10 +705,10 @@ ACE_InputCDR::read_short_array (ACE_CDR::Short *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length()) + if (length * ACE_CDR::SHORT_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -723,10 +723,10 @@ ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length()) + if (length * ACE_CDR::SHORT_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -741,10 +741,10 @@ ACE_InputCDR::read_long_array (ACE_CDR::Long *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length()) + if (length * ACE_CDR::LONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -759,10 +759,10 @@ ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length()) + if (length * ACE_CDR::LONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -777,10 +777,10 @@ ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length()) + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -795,10 +795,10 @@ ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length()) + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -813,10 +813,10 @@ ACE_InputCDR::read_float_array (ACE_CDR::Float *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length()) + if (length * ACE_CDR::LONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -832,10 +832,10 @@ ACE_InputCDR::read_double_array (ACE_CDR::Double *x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length()) + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, @@ -850,10 +850,10 @@ ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x, { // Make sure the length of the array isn't greater than the length of // the stream. - if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length()) + if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ()) { - this->good_bit_ = 0; - return 0; + this->good_bit_ = false; + return false; } return this->read_array (x, ACE_CDR::LONGDOUBLE_SIZE, @@ -985,7 +985,7 @@ ACE_InputCDR::adjust (size_t size, return 0; } - this->good_bit_ = 0; + this->good_bit_ = false; return -1; } @@ -1002,7 +1002,7 @@ ACE_InputCDR::start (void) const return &this->start_; } -ACE_INLINE int +ACE_INLINE bool ACE_InputCDR::good_bit (void) const { return this->good_bit_; @@ -1299,99 +1299,99 @@ ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_boolean (ACE_InputCDR &stream) { ACE_CDR::Boolean x; - return stream.read_boolean (x) ? this->write_boolean (x) : (ACE_CDR::Boolean) 0; + return stream.read_boolean (x) ? this->write_boolean (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_char (ACE_InputCDR &stream) { ACE_CDR::Char x; - return stream.read_char (x) ? this->write_char (x) : (ACE_CDR::Boolean) 0; + return stream.read_char (x) ? this->write_char (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wchar (ACE_InputCDR &stream) { ACE_CDR::WChar x; - return stream.read_wchar (x) ? this->write_wchar (x) : (ACE_CDR::Boolean) 0; + return stream.read_wchar (x) ? this->write_wchar (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_octet (ACE_InputCDR &stream) { ACE_CDR::Octet x; - return stream.read_octet (x) ? this->write_octet (x) : (ACE_CDR::Boolean) 0; + return stream.read_octet (x) ? this->write_octet (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_short (ACE_InputCDR &stream) { ACE_CDR::Short x; - return stream.read_short (x) ? this->write_short (x) : (ACE_CDR::Boolean) 0; + return stream.read_short (x) ? this->write_short (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ushort (ACE_InputCDR &stream) { ACE_CDR::UShort x; - return stream.read_ushort (x) ? this->write_ushort (x) : (ACE_CDR::Boolean) 0; + return stream.read_ushort (x) ? this->write_ushort (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_long (ACE_InputCDR &stream) { ACE_CDR::Long x; - return stream.read_long (x) ? this->write_long (x) : (ACE_CDR::Boolean) 0; + return stream.read_long (x) ? this->write_long (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulong (ACE_InputCDR &stream) { ACE_CDR::ULong x; - return stream.read_ulong (x) ? this->write_ulong (x) : (ACE_CDR::Boolean) 0; + return stream.read_ulong (x) ? this->write_ulong (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longlong (ACE_InputCDR &stream) { ACE_CDR::LongLong x; - return stream.read_longlong (x) ? this->write_longlong (x) : (ACE_CDR::Boolean) 0; + return stream.read_longlong (x) ? this->write_longlong (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream) { ACE_CDR::ULongLong x; - return stream.read_ulonglong (x) ? this->write_ulonglong (x) : (ACE_CDR::Boolean) 0; + return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_float (ACE_InputCDR &stream) { ACE_CDR::Float x; - return stream.read_float (x) ? this->write_float (x) : (ACE_CDR::Boolean) 0; + return stream.read_float (x) ? this->write_float (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_double (ACE_InputCDR &stream) { ACE_CDR::Double x; - return stream.read_double (x) ? this->write_double (x) : (ACE_CDR::Boolean) 0; + return stream.read_double (x) ? this->write_double (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream) { ACE_CDR::LongDouble x; - return stream.read_longdouble (x) ? this->write_longdouble (x) : (ACE_CDR::Boolean) 0; + return stream.read_longdouble (x) ? this->write_longdouble (x) : false; } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_string (ACE_InputCDR &stream) { ACE_CDR::Char *x; - ACE_CDR::Boolean flag = - (stream.read_string (x) ? this->write_string (x) : (ACE_CDR::Boolean) 0); + const ACE_CDR::Boolean flag = + (stream.read_string (x) ? this->write_string (x) : false); delete [] x; return flag; } @@ -1400,8 +1400,8 @@ ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_wstring (ACE_InputCDR &stream) { ACE_CDR::WChar *x; - ACE_CDR::Boolean flag = - (stream.read_wstring (x) ? this->write_wstring (x) : (ACE_CDR::Boolean) 0); + const ACE_CDR::Boolean flag = + (stream.read_wstring (x) ? this->write_wstring (x) : false); delete [] x; return flag; } @@ -1412,7 +1412,7 @@ ACE_InputCDR::reset_byte_order (int byte_order) this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); } -ACE_INLINE int +ACE_INLINE bool ACE_InputCDR::do_byte_swap (void) const { return this->do_byte_swap_; @@ -1421,10 +1421,7 @@ ACE_InputCDR::do_byte_swap (void) const ACE_INLINE int ACE_InputCDR::byte_order (void) const { - if (this->do_byte_swap ()) - return !ACE_CDR_BYTE_ORDER; - else - return ACE_CDR_BYTE_ORDER; + return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER; } ACE_INLINE int @@ -1439,7 +1436,7 @@ ACE_InputCDR::align_read_ptr (size_t alignment) return 0; } - this->good_bit_ = 0; + this->good_bit_ = false; return -1; } @@ -1532,7 +1529,7 @@ ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out, } ACE_INLINE void -ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, int bit) +ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) { out.good_bit_ = bit; } @@ -1635,7 +1632,7 @@ ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out, } ACE_INLINE void -ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, int bit) +ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) { out.good_bit_ = bit; } |