From 20284b7a5c4f5a6ea5515e0435f11c4915483a65 Mon Sep 17 00:00:00 2001 From: Rob Parolin Date: Fri, 6 Sep 2019 11:29:27 -0700 Subject: [PATCH] 3.14.02 release --- include/EASTL/core_allocator_adapter.h | 6 +- include/EASTL/internal/char_traits.h | 108 ++++++++++++------------- include/EASTL/internal/config.h | 4 +- include/EASTL/string_view.h | 4 +- source/string.cpp | 8 +- test/packages/EABase | 2 +- test/packages/EAStdC | 2 +- test/source/TestSmartPtr.cpp | 8 +- 8 files changed, 72 insertions(+), 70 deletions(-) diff --git a/include/EASTL/core_allocator_adapter.h b/include/EASTL/core_allocator_adapter.h index e0e8adc8..d6f18275 100644 --- a/include/EASTL/core_allocator_adapter.h +++ b/include/EASTL/core_allocator_adapter.h @@ -161,7 +161,11 @@ namespace EA ~CoreDeleterAdapter() EA_NOEXCEPT {} template - void operator()(T* p) { mpCoreAllocator->Free(p); } + void operator()(T* p) + { + p->~T(); + mpCoreAllocator->Free(p); + } CoreDeleterAdapter(const CoreDeleterAdapter& in) { mpCoreAllocator = in.mpCoreAllocator; } diff --git a/include/EASTL/internal/char_traits.h b/include/EASTL/internal/char_traits.h index 0140db81..dfc78be1 100644 --- a/include/EASTL/internal/char_traits.h +++ b/include/EASTL/internal/char_traits.h @@ -33,97 +33,97 @@ namespace eastl /// /// These implement UTF8/UCS2/UCS4 encoding/decoding. /// - EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char*& pDest, char* pDestEnd); - EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); - EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); + EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char*& pDest, char* pDestEnd); + EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); + EASTL_API bool DecodePart(const char*& pSrc, const char* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); - EASTL_API bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, char*& pDest, char* pDestEnd); + EASTL_API bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, char*& pDest, char* pDestEnd); EASTL_API bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); EASTL_API bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); - EASTL_API bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, char*& pDest, char* pDestEnd); + EASTL_API bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, char*& pDest, char* pDestEnd); EASTL_API bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); EASTL_API bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); - EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char*& pDest, char* pDestEnd); - EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); - EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); + EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char*& pDest, char* pDestEnd); + EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); + EASTL_API bool DecodePart(const int*& pSrc, const int* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); #if EA_CHAR8_UNIQUE - bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char*& pDest, char* pDestEnd); - bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); - bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); + bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char*& pDest, char* pDestEnd); + bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); + bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); #endif #if EA_WCHAR_UNIQUE - bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char*& pDest, char* pDestEnd); - bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); - bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); + bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char*& pDest, char* pDestEnd); + bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd); + bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd); - bool DecodePart(const char*& pSrc, const char* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); - bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); - bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); + bool DecodePart(const char*& pSrc, const char* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); + bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); + bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); #endif #if EA_CHAR8_UNIQUE && EA_WCHAR_UNIQUE - bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); - bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char8_t*& pDest, char8_t* pDestEnd); + bool DecodePart(const char8_t*& pSrc, const char8_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd); + bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char8_t*& pDest, char8_t* pDestEnd); #endif #if EA_WCHAR_UNIQUE inline bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char*& pDest, char* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #endif } inline bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char16_t*& pDest, char16_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #endif } inline bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char32_t*& pDest, char32_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), pDest, pDestEnd); + #endif } inline bool DecodePart(const char*& pSrc, const char* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #endif } inline bool DecodePart(const char16_t*& pSrc, const char16_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #endif } inline bool DecodePart(const char32_t*& pSrc, const char32_t* pSrcEnd, wchar_t*& pDest, wchar_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(pSrc, pSrcEnd, reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #endif } #endif @@ -156,11 +156,11 @@ namespace eastl inline bool DecodePart(const wchar_t*& pSrc, const wchar_t* pSrcEnd, char8_t*& pDest, char8_t* pDestEnd) { - #if (EA_WCHAR_SIZE == 2) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #elif (EA_WCHAR_SIZE == 4) - return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); - #endif + #if (EA_WCHAR_SIZE == 2) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #elif (EA_WCHAR_SIZE == 4) + return DecodePart(reinterpret_cast(pSrc), reinterpret_cast(pSrcEnd), reinterpret_cast(pDest), reinterpret_cast(pDestEnd)); + #endif } #endif diff --git a/include/EASTL/internal/config.h b/include/EASTL/internal/config.h index 69ce225e..30d1c422 100644 --- a/include/EASTL/internal/config.h +++ b/include/EASTL/internal/config.h @@ -89,8 +89,8 @@ /////////////////////////////////////////////////////////////////////////////// #ifndef EASTL_VERSION - #define EASTL_VERSION "3.14.01" - #define EASTL_VERSION_N 31401 + #define EASTL_VERSION "3.14.02" + #define EASTL_VERSION_N 31402 #endif diff --git a/include/EASTL/string_view.h b/include/EASTL/string_view.h index 23dd133d..c58c39ef 100644 --- a/include/EASTL/string_view.h +++ b/include/EASTL/string_view.h @@ -148,7 +148,7 @@ namespace eastl EASTL_FAIL_MSG("string_view::copy -- out of range"); #endif - count = eastl::min(count, mnCount - pos); + count = eastl::min(count, mnCount - pos); auto* pResult = CharStringUninitializedCopy(mpBegin + pos, mpBegin + pos + count, pDestination); // *pResult = 0; // don't write the null-terminator return pResult - pDestination; @@ -164,7 +164,7 @@ namespace eastl EASTL_FAIL_MSG("string_view::substr -- out of range"); #endif - count = eastl::min(count, mnCount - pos); + count = eastl::min(count, mnCount - pos); return this_type(mpBegin + pos, count); } diff --git a/source/string.cpp b/source/string.cpp index 7ffae5f2..ae73f114 100644 --- a/source/string.cpp +++ b/source/string.cpp @@ -21,7 +21,7 @@ namespace eastl // Requires that pDest have a capacity of at least 6 chars. // Sets pResult to '\1' in the case that c is an invalid UCS4 char. - bool UCS4ToUTF8(uint32_t c, char*& pResult) + inline bool UCS4ToUTF8(uint32_t c, char*& pResult) { if(c < 0x00000080) *pResult++ = (char)(uint8_t)c; @@ -73,7 +73,7 @@ namespace eastl // Requires that pResult have a capacity of at least 3 chars. // Sets pResult to '\1' in the case that c is an invalid UCS4 char. - bool UCS2ToUTF8(uint16_t c, char*& pResult) + inline bool UCS2ToUTF8(uint16_t c, char*& pResult) { return UCS4ToUTF8(c, pResult); } @@ -81,7 +81,7 @@ namespace eastl // Sets result to 0xffff in the case that the input UTF8 sequence is bad. // 32 bit 0xffffffff is an invalid UCS4 code point, so we can't use that as an error return value. - bool UTF8ToUCS4(const char*& p, const char* pEnd, uint32_t& result) + inline bool UTF8ToUCS4(const char*& p, const char* pEnd, uint32_t& result) { // This could likely be implemented in a faster-executing way that uses tables. @@ -257,7 +257,7 @@ namespace eastl // such codepoints to 0xffff. EASTL doesn't have a concept of setting or maintaining // error state for string conversions, though it does have a policy of converting // impossible values to something without generating invalid strings or throwing exceptions. - bool UTF8ToUCS2(const char*& p, const char* pEnd, uint16_t& result) + inline bool UTF8ToUCS2(const char*& p, const char* pEnd, uint16_t& result) { uint32_t u32; diff --git a/test/packages/EABase b/test/packages/EABase index 035b4d06..d9b7808e 160000 --- a/test/packages/EABase +++ b/test/packages/EABase @@ -1 +1 @@ -Subproject commit 035b4d0664ef0dd863d462293e5349ba8b24da39 +Subproject commit d9b7808e21432874f2cef91e066711b64d61e019 diff --git a/test/packages/EAStdC b/test/packages/EAStdC index 7d25ccda..2bad24e6 160000 --- a/test/packages/EAStdC +++ b/test/packages/EAStdC @@ -1 +1 @@ -Subproject commit 7d25ccda9903f42965f73145d2cf394bf25c66dc +Subproject commit 2bad24e6bd504f2b8eb7ef4129cab56a91712d30 diff --git a/test/source/TestSmartPtr.cpp b/test/source/TestSmartPtr.cpp index 3aa3a48d..d29b06e9 100644 --- a/test/source/TestSmartPtr.cpp +++ b/test/source/TestSmartPtr.cpp @@ -554,19 +554,17 @@ static int Test_unique_ptr() using namespace EA::Allocator; - EASTLCoreAllocatorAdapter ta; - + EASTLCoreAllocatorAdapter ta; void* pMem = ta.allocate(sizeof(A)); + EATEST_VERIFY(pMem != nullptr); EATEST_VERIFY(gEASTLTest_AllocationCount > cacheAllocationCount); { A* pA = new (pMem) A(); eastl::shared_ptr foo(pA, EASTLCoreDeleterAdapter()); // Not standards complaint code. Update EASTL implementation to provide the type of the deleter. - pA->~A(); } - EATEST_VERIFY(gEASTLTest_AllocationCount == cacheAllocationCount); - EATEST_VERIFY(A::mCount == 0); + EATEST_VERIFY(A::mCount == 0); #endif }