Skip to content

Commit

Permalink
3.14.02 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Sep 6, 2019
1 parent 2feb6d5 commit 20284b7
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 70 deletions.
6 changes: 5 additions & 1 deletion include/EASTL/core_allocator_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ namespace EA
~CoreDeleterAdapter() EA_NOEXCEPT {}

template <typename T>
void operator()(T* p) { mpCoreAllocator->Free(p); }
void operator()(T* p)
{
p->~T();
mpCoreAllocator->Free(p);
}

CoreDeleterAdapter(const CoreDeleterAdapter& in) { mpCoreAllocator = in.mpCoreAllocator; }

Expand Down
108 changes: 54 additions & 54 deletions include/EASTL/internal/char_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(pSrcEnd), pDest, pDestEnd);
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(reinterpret_cast<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(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<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(pSrcEnd), pDest, pDestEnd);
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(reinterpret_cast<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(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<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(pSrcEnd), pDest, pDestEnd);
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(reinterpret_cast<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), pDest, pDestEnd);
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(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<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(pDestEnd));
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(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<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(pDestEnd));
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(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<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(pDestEnd));
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char16_t*&>(pDest), reinterpret_cast<char16_t*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(pSrc, pSrcEnd, reinterpret_cast<char32_t*&>(pDest), reinterpret_cast<char32_t*>(pDestEnd));
#endif
}
#endif

Expand Down Expand Up @@ -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<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), reinterpret_cast<char*&>(pDest), reinterpret_cast<char*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(pSrcEnd), reinterpret_cast<char*&>(pDest), reinterpret_cast<char*>(pDestEnd));
#endif
#if (EA_WCHAR_SIZE == 2)
return DecodePart(reinterpret_cast<const char16_t*&>(pSrc), reinterpret_cast<const char16_t*>(pSrcEnd), reinterpret_cast<char*&>(pDest), reinterpret_cast<char*>(pDestEnd));
#elif (EA_WCHAR_SIZE == 4)
return DecodePart(reinterpret_cast<const char32_t*&>(pSrc), reinterpret_cast<const char32_t*>(pSrcEnd), reinterpret_cast<char*&>(pDest), reinterpret_cast<char*>(pDestEnd));
#endif
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/EASTL/internal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions include/EASTL/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_type>(count, mnCount - pos);
auto* pResult = CharStringUninitializedCopy(mpBegin + pos, mpBegin + pos + count, pDestination);
// *pResult = 0; // don't write the null-terminator
return pResult - pDestination;
Expand All @@ -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<size_type>(count, mnCount - pos);
return this_type(mpBegin + pos, count);
}

Expand Down
8 changes: 4 additions & 4 deletions source/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,15 +73,15 @@ 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);
}


// 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.

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/packages/EABase
2 changes: 1 addition & 1 deletion test/packages/EAStdC
8 changes: 3 additions & 5 deletions test/source/TestSmartPtr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<A> 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
}

Expand Down

0 comments on commit 20284b7

Please sign in to comment.