chore(Deps/Acelite): Update to 6.5.10 (#3450)

This commit is contained in:
Kargatum
2020-11-11 22:09:02 +07:00
committed by GitHub
parent a93565b6da
commit e27201cee2
921 changed files with 18238 additions and 33164 deletions

View File

@@ -1520,9 +1520,15 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x)
// the memory is allocated.
if (len > 0 && len <= this->length())
{
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (x,
static_cast<ACE_CDR::Char*> (ACE_Allocator::instance()->malloc(sizeof (ACE_CDR::Char) * (len))),
0);
#else
ACE_NEW_RETURN (x,
ACE_CDR::Char[len],
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
ACE_Auto_Basic_Array_Ptr<ACE_CDR::Char> safe_data (x);
@@ -1536,9 +1542,16 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x)
{
// Convert any null strings to empty strings since empty
// strings can cause crashes. (See bug 58.)
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (x,
static_cast<ACE_CDR::Char*> (ACE_Allocator::instance()->malloc(sizeof (ACE_CDR::Char) * (1))),
0);
#else
ACE_NEW_RETURN (x,
ACE_CDR::Char[1],
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
ACE_OS::strcpy (const_cast<char *&> (x), "");
return true;
}
@@ -1601,9 +1614,15 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
ACE_OutputCDR::wchar_maxbytes_);
//allocating one extra for the null character needed by applications
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (x,
static_cast<ACE_CDR::WChar*> (ACE_Allocator::instance()->malloc(sizeof (ACE_CDR::WChar) * (len + 1))),
0);
#else
ACE_NEW_RETURN (x,
ACE_CDR::WChar [len + 1],
false);
#endif /* ACE_HAS_ALLOC_HOOKS */
ACE_auto_ptr_reset (safe_data, x);
@@ -1622,9 +1641,15 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
}
else
{
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (x,
static_cast<ACE_CDR::WChar*> (ACE_Allocator::instance()->malloc(sizeof (ACE_CDR::WChar) * (len))),
0);
#else
ACE_NEW_RETURN (x,
ACE_CDR::WChar [len],
false);
#endif /* ACE_HAS_ALLOC_HOOKS */
ACE_auto_ptr_reset (safe_data, x);
@@ -1640,9 +1665,16 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
{
// Convert any null strings to empty strings since empty
// strings can cause crashes. (See bug 58.)
ACE_NEW_RETURN (x,
ACE_CDR::WChar[1],
false);
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (x,
static_cast<ACE_CDR::WChar*> (ACE_Allocator::instance()->malloc(sizeof (ACE_CDR::WChar) * (1))),
0);
#else
ACE_NEW_RETURN (x,
ACE_CDR::WChar [1],
false);
#endif /* ACE_HAS_ALLOC_HOOKS */
x[0] = '\x00';
return true;
}
@@ -1652,6 +1684,146 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
return false;
}
// As of C++11 std::string guarantees contiguous memory storage.
// That provides the opportunity to optimize CDR streaming.
ACE_CDR::Boolean
ACE_InputCDR::read_string (std::string& x)
{
#if defined (ACE_HAS_CPP11)
// @@ This is a slight violation of "Optimize for the common case",
// i.e. normally the translator will be 0, but OTOH the code is
// smaller and should be better for the cache ;-) ;-)
if (this->char_translator_ != 0)
{
this->good_bit_ = this->char_translator_->read_string (*this, x);
return this->good_bit_;
}
ACE_CDR::ULong len = 0;
if (!this->read_ulong (len))
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())
{
try
{
x.resize (len-1); // no need to include the terminating '\0' here
}
catch (const std::bad_alloc&)
{
return false;
}
if (len == 0 || this->read_char_array (&x[0], len-1))
{
return this->skip_char (); // skip the terminating '\0'
}
}
this->good_bit_ = false;
x.clear ();
return false;
#else
ACE_CDR::Char *buf = 0;
ACE_CDR::Boolean const marshal_flag = this->read_string (buf);
x.assign (buf);
ACE::strdelete (buf);
return marshal_flag;
#endif
}
#if !defined(ACE_LACKS_STD_WSTRING)
ACE_CDR::Boolean
ACE_InputCDR::read_wstring (std::wstring& x)
{
#if defined (ACE_HAS_CPP11)
// @@ This is a slight violation of "Optimize for the common case",
// i.e. normally the translator will be 0, but OTOH the code is
// smaller and should be better for the cache ;-) ;-)
if (this->wchar_translator_ != 0)
{
this->good_bit_ = this->wchar_translator_->read_wstring (*this, x);
return this->good_bit_;
}
if (ACE_OutputCDR::wchar_maxbytes_ == 0)
{
errno = EACCES;
return (this->good_bit_ = false);
}
ACE_CDR::ULong len = 0;
if (!this->read_ulong (len))
{
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 (static_cast<ACE_CDR::Short> (this->major_version_) == 1
&& static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
{
len /=
ACE_Utils::truncate_cast<ACE_CDR::ULong> (
ACE_OutputCDR::wchar_maxbytes_);
try
{
x.resize (len);
}
catch (const std::bad_alloc&)
{
return false;
}
if (this->read_wchar_array (&x[0], len))
{
return true;
}
}
else
{
try
{
x.resize (len-1); // no need to include the terminating '\0' here
}
catch (const std::bad_alloc&)
{
return false;
}
if (len == 1 || this->read_wchar_array (&x[0], len-1))
{
return this->skip_wchar (); // skip the terminating '\0'
}
}
}
else if (len == 0)
{
x.clear ();
return true;
}
this->good_bit_ = false;
x.clear ();
return false;
#else
ACE_CDR::WChar *buf = 0;
ACE_CDR::Boolean const marshal_flag = this->read_wstring (buf);
x.assign (buf);
ACE::strdelete (buf);
return marshal_flag;
#endif
}
#endif
ACE_CDR::Boolean
ACE_InputCDR::read_array (void* x,
size_t size,
@@ -2195,12 +2367,36 @@ ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void)
{
}
ACE_CDR::Boolean
ACE_Char_Codeset_Translator::read_string (ACE_InputCDR &cdr,
std::string &x)
{
ACE_CDR::Char *buf = 0;
ACE_CDR::Boolean const marshal_flag = this->read_string (cdr, buf);
x.assign (buf);
ACE::strdelete (buf);
return marshal_flag;
}
// --------------------------------------------------------------
ACE_WChar_Codeset_Translator::~ACE_WChar_Codeset_Translator (void)
{
}
#if !defined(ACE_LACKS_STD_WSTRING)
ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::read_wstring (ACE_InputCDR &cdr,
std::wstring &x)
{
ACE_CDR::WChar *buf = 0;
ACE_CDR::Boolean const marshal_flag = this->read_wstring (cdr, buf);
x.assign (buf);
ACE::strdelete (buf);
return marshal_flag;
}
#endif
// --------------------------------------------------------------
ACE_CDR::Boolean