Linux/GCC fixes.

This commit is contained in:
Adam Ierymenko 2020-07-31 16:18:06 -07:00
parent 9ef780e05c
commit 4273d89373
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
4 changed files with 7 additions and 9 deletions

View file

@ -264,7 +264,6 @@ public:
{ return ZT_IDENTITY_MARSHAL_SIZE_MAX; }
int marshal(uint8_t data[ZT_IDENTITY_MARSHAL_SIZE_MAX], bool includePrivate = false) const noexcept;
int unmarshal(const uint8_t *data, int len) noexcept;
private:

View file

@ -635,8 +635,7 @@ bool Network::filterOutgoingPacket(
Member *membership;
if (ztDest) {
Map<Address, Member>::iterator mm(m_memberships.find(ztDest));
if (mm != m_memberships.end())
membership = &(mm->second);
membership = (mm == m_memberships.end()) ? nullptr : &(mm->second);
} else {
membership = nullptr;
}

View file

@ -802,7 +802,7 @@ extern "C" const char *ZTT_general()
return "Identity test failed: v0 unmarshal";
}
if (id != id2) {
ZT_T_PRINTF("FAILED (v0 unmarshal !=)" ZT_EOL_S);
ZT_T_PRINTF("FAILED (v0 unmarshal %s != %s)" ZT_EOL_S, id.toString(true).c_str(), id2.toString(true).c_str());
return "Identity test failed: v0 unmarshal !=";
}
ms = id.marshal(idm, false);

View file

@ -672,7 +672,7 @@ static ZT_INLINE void copy(void *dest, const void *src) noexcept
{
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
uintptr_t l = L;
asm volatile ("cld ; rep movsb" : "+c"(l), "+S"(src), "+D"(dest));
__asm__ __volatile__ ("cld ; rep movsb" : "+c"(l), "+S"(src), "+D"(dest) :: "memory");
#else
memcpy(dest, src, L);
#endif
@ -688,7 +688,7 @@ static ZT_INLINE void copy(void *dest, const void *src) noexcept
static ZT_INLINE void copy(void *dest, const void *src, unsigned long len) noexcept
{
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
asm volatile ("cld ; rep movsb" : "+c"(len), "+S"(src), "+D"(dest));
__asm__ __volatile__ ("cld ; rep movsb" : "+c"(len), "+S"(src), "+D"(dest) :: "memory");
#else
memcpy(dest, src, len);
#endif
@ -705,7 +705,7 @@ static ZT_INLINE void zero(void *dest) noexcept
{
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
uintptr_t l = L;
asm volatile ("cld ; rep stosb" :"+c" (l), "+D" (dest) : "a" (0));
__asm__ __volatile__ ("cld ; rep stosb" :"+c" (l), "+D" (dest) : "a" (0) : "memory");
#else
memset(dest, 0, L);
#endif
@ -720,7 +720,7 @@ static ZT_INLINE void zero(void *dest) noexcept
static ZT_INLINE void zero(void *dest, unsigned long len) noexcept
{
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
asm volatile ("cld ; rep stosb" :"+c" (len), "+D" (dest) : "a" (0));
__asm__ __volatile__ ("cld ; rep stosb" :"+c" (len), "+D" (dest) : "a" (0) : "memory");
#else
memset(dest, 0, len);
#endif
@ -735,7 +735,7 @@ static ZT_INLINE void zero(void *dest, unsigned long len) noexcept
* @param len Length of data
* @return FNV1a checksum
*/
uint32_t fnv1a32(const void *const data, const unsigned int len) noexcept;
uint32_t fnv1a32(const void *data, unsigned int len) noexcept;
/**
* Mix bits in a 64-bit integer (non-cryptographic, for hash tables)