Core/StackArray: Moved StackArray class to its own header
This commit is contained in:
parent
bb0456ffed
commit
2fcea6b79f
|
|
@ -119,6 +119,8 @@ Nazara Engine:
|
|||
- Added RigidBody2D::ClosestPointQuery
|
||||
- Fix Sprite copy constructor not copying corner colors
|
||||
- Added ObjectLibrary::Clear method
|
||||
- ⚠️ StackArray class and macro was moved from Core/MemoryHelper.hpp to Core/StackArray.hpp
|
||||
- ⚠️ Renamed NazaraStackAllocation[NoInit] macro to NazaraStackArray[NoInit]
|
||||
|
||||
Nazara Development Kit:
|
||||
- Added ImageWidget (#139)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#define NAZARA_ALLOCA_SUPPORT
|
||||
|
||||
#elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL)
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
// with Clang/GCC, using alloca with a size of zero does nothing good
|
||||
|
|
@ -24,16 +25,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef NAZARA_ALLOCA_SUPPORT
|
||||
#define NazaraStackAllocation(T, size) Nz::StackArray<T>(static_cast<T*>(NAZARA_ALLOCA((size) * sizeof(T))), size)
|
||||
#define NazaraStackAllocationNoInit(T, size) Nz::StackArray<T>(static_cast<T*>(NAZARA_ALLOCA((size) * sizeof(T))), size, Nz::NoInitTag())
|
||||
#else
|
||||
#define NazaraStackAllocation(T, size) Nz::StackArray<T>(static_cast<T*>(Nz::OperatorNew((size) * sizeof(T))), size)
|
||||
#define NazaraStackAllocationNoInit(T, size) Nz::StackArray<T>(static_cast<T*>(Nz::OperatorNew((size) * sizeof(T))), size, Nz::NoInitTag())
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -45,71 +37,6 @@ namespace Nz
|
|||
|
||||
template<typename T>
|
||||
void PlacementDestroy(T* ptr);
|
||||
|
||||
struct NoInitTag {};
|
||||
|
||||
template<typename T>
|
||||
class StackArray
|
||||
{
|
||||
public:
|
||||
using value_type = T;
|
||||
using const_iterator = const value_type*;
|
||||
using const_pointer = const value_type*;
|
||||
using const_reference = const value_type&;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using iterator = value_type*;
|
||||
using pointer = value_type*;
|
||||
using reference = value_type&;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using size_type = std::size_t;
|
||||
|
||||
StackArray(T* stackMemory, std::size_t size);
|
||||
StackArray(T* stackMemory, std::size_t size, NoInitTag);
|
||||
~StackArray();
|
||||
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
|
||||
bool empty() const noexcept;
|
||||
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
void fill(const T& value);
|
||||
|
||||
reference front() noexcept;
|
||||
const_reference front() const noexcept;
|
||||
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
size_type size() const noexcept;
|
||||
|
||||
reference operator[](size_type pos);
|
||||
const_reference operator[](size_type pos) const;
|
||||
|
||||
private:
|
||||
std::size_t m_size;
|
||||
T* m_ptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include <Nazara/Core/MemoryHelper.inl>
|
||||
|
|
|
|||
|
|
@ -11,10 +11,8 @@
|
|||
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -79,187 +77,6 @@ namespace Nz
|
|||
if (ptr)
|
||||
ptr->~T();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \class Nz::StackArray
|
||||
* \brief Core class that represents a stack-allocated (if alloca is present) array
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
StackArray<T>::StackArray(T* stackMemory, std::size_t size) :
|
||||
m_size(size),
|
||||
m_ptr(stackMemory)
|
||||
{
|
||||
for (std::size_t i = 0; i < m_size; ++i)
|
||||
PlacementNew(&m_ptr[i]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
StackArray<T>::StackArray(T* stackMemory, std::size_t size, NoInitTag) :
|
||||
m_size(size),
|
||||
m_ptr(stackMemory)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
StackArray<T>::~StackArray()
|
||||
{
|
||||
for (std::size_t i = 0; i < m_size; ++i)
|
||||
m_ptr[i].~T();
|
||||
|
||||
#ifndef NAZARA_ALLOCA_SUPPORT
|
||||
OperatorDelete(m_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::back()
|
||||
{
|
||||
assert(m_size != 0);
|
||||
return m_ptr[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::back() const
|
||||
{
|
||||
assert(m_size != 0);
|
||||
return m_ptr[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::iterator StackArray<T>::begin() noexcept
|
||||
{
|
||||
return iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::begin() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::cbegin() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::cend() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::crbegin() const noexcept
|
||||
{
|
||||
return const_reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::crend() const noexcept
|
||||
{
|
||||
return const_reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* StackArray<T>::data() noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* StackArray<T>::data() const noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool StackArray<T>::empty() const noexcept
|
||||
{
|
||||
return m_size == 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::iterator StackArray<T>::end() noexcept
|
||||
{
|
||||
return iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::end() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void StackArray<T>::fill(const T& value)
|
||||
{
|
||||
std::fill(begin(), end(), value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::front() noexcept
|
||||
{
|
||||
return m_ptr[0];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::front() const noexcept
|
||||
{
|
||||
return m_ptr[0];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::size_type StackArray<T>::max_size() const noexcept
|
||||
{
|
||||
return size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reverse_iterator StackArray<T>::rbegin() noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::rbegin() const noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reverse_iterator StackArray<T>::rend() noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::rend() const noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::size_type StackArray<T>::size() const noexcept
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::operator[](size_type pos)
|
||||
{
|
||||
assert(pos < m_size);
|
||||
return m_ptr[pos];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::operator[](size_type pos) const
|
||||
{
|
||||
assert(pos < m_size);
|
||||
return m_ptr[pos];
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_STACKARRAY_HPP
|
||||
#define NAZARA_STACKARRAY_HPP
|
||||
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
|
||||
#ifdef NAZARA_ALLOCA_SUPPORT
|
||||
#define NazaraStackArray(T, size) Nz::StackArray<T>(static_cast<T*>(NAZARA_ALLOCA((size) * sizeof(T))), size)
|
||||
#define NazaraStackArrayNoInit(T, size) Nz::StackArray<T>(static_cast<T*>(NAZARA_ALLOCA((size) * sizeof(T))), size, typename Nz::StackArray<T>::NoInitTag())
|
||||
#else
|
||||
#define NazaraStackArray(T, size) Nz::StackArray<T>(static_cast<T*>(Nz::OperatorNew((size) * sizeof(T))), size)
|
||||
#define NazaraStackArrayNoInit(T, size) Nz::StackArray<T>(static_cast<T*>(Nz::OperatorNew((size) * sizeof(T))), size, typename Nz::StackArray<T>::NoInitTag())
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename T>
|
||||
class StackArray
|
||||
{
|
||||
public:
|
||||
struct NoInitTag {};
|
||||
|
||||
using value_type = T;
|
||||
using const_iterator = const value_type*;
|
||||
using const_pointer = const value_type*;
|
||||
using const_reference = const value_type&;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using iterator = value_type*;
|
||||
using pointer = value_type*;
|
||||
using reference = value_type&;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using size_type = std::size_t;
|
||||
|
||||
StackArray(T* stackMemory, std::size_t size);
|
||||
StackArray(T* stackMemory, std::size_t size, NoInitTag);
|
||||
~StackArray();
|
||||
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
|
||||
bool empty() const noexcept;
|
||||
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
void fill(const T& value);
|
||||
|
||||
reference front() noexcept;
|
||||
const_reference front() const noexcept;
|
||||
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
size_type size() const noexcept;
|
||||
|
||||
reference operator[](size_type pos);
|
||||
const_reference operator[](size_type pos) const;
|
||||
|
||||
private:
|
||||
std::size_t m_size;
|
||||
T* m_ptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include <Nazara/Core/StackArray.inl>
|
||||
|
||||
#endif // NAZARA_STACKARRAY_HPP
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// I'm not proud of those five following lines but ti's hard to do with another way now
|
||||
#ifdef NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION_DEFINED
|
||||
#else
|
||||
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||
#endif
|
||||
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \class Nz::StackArray
|
||||
* \brief Core class that represents a stack-allocated (if alloca is present) array
|
||||
*/
|
||||
template<typename T>
|
||||
StackArray<T>::StackArray(T* stackMemory, std::size_t size) :
|
||||
m_size(size),
|
||||
m_ptr(stackMemory)
|
||||
{
|
||||
for (std::size_t i = 0; i < m_size; ++i)
|
||||
PlacementNew(&m_ptr[i]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
StackArray<T>::StackArray(T* stackMemory, std::size_t size, NoInitTag) :
|
||||
m_size(size),
|
||||
m_ptr(stackMemory)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
StackArray<T>::~StackArray()
|
||||
{
|
||||
for (std::size_t i = 0; i < m_size; ++i)
|
||||
PlacementDestroy(&m_ptr[i]);
|
||||
|
||||
#ifndef NAZARA_ALLOCA_SUPPORT
|
||||
OperatorDelete(m_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::back()
|
||||
{
|
||||
assert(m_size != 0);
|
||||
return m_ptr[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::back() const
|
||||
{
|
||||
assert(m_size != 0);
|
||||
return m_ptr[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::iterator StackArray<T>::begin() noexcept
|
||||
{
|
||||
return iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::begin() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::cbegin() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::cend() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::crbegin() const noexcept
|
||||
{
|
||||
return const_reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::crend() const noexcept
|
||||
{
|
||||
return const_reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* StackArray<T>::data() noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* StackArray<T>::data() const noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool StackArray<T>::empty() const noexcept
|
||||
{
|
||||
return m_size == 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::iterator StackArray<T>::end() noexcept
|
||||
{
|
||||
return iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_iterator StackArray<T>::end() const noexcept
|
||||
{
|
||||
return const_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void StackArray<T>::fill(const T& value)
|
||||
{
|
||||
std::fill(begin(), end(), value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::front() noexcept
|
||||
{
|
||||
return m_ptr[0];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::front() const noexcept
|
||||
{
|
||||
return m_ptr[0];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::size_type StackArray<T>::max_size() const noexcept
|
||||
{
|
||||
return size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reverse_iterator StackArray<T>::rbegin() noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::rbegin() const noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[m_size]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reverse_iterator StackArray<T>::rend() noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reverse_iterator StackArray<T>::rend() const noexcept
|
||||
{
|
||||
return reverse_iterator(&m_ptr[0]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::size_type StackArray<T>::size() const noexcept
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::reference StackArray<T>::operator[](size_type pos)
|
||||
{
|
||||
assert(pos < m_size);
|
||||
return m_ptr[pos];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename StackArray<T>::const_reference StackArray<T>::operator[](size_type pos) const
|
||||
{
|
||||
assert(pos < m_size);
|
||||
return m_ptr[pos];
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
// If we have defined the constant, then we have to undefine it (to avoid bloating in the engine)
|
||||
#ifndef NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION_DEFINED
|
||||
#undef NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include <Nazara/Core/Posix/DirectoryImpl.hpp>
|
||||
#include <Nazara/Core/Directory.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <cstring>
|
||||
#include <errno.h>
|
||||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
|||
std::size_t resultNameSize = std::strlen(m_result->d_name);
|
||||
|
||||
std::size_t fullNameSize = pathSize + 1 + resultNameSize;
|
||||
StackArray<char> fullName = NazaraStackAllocationNoInit(char, fullNameSize + 1);
|
||||
StackArray<char> fullName = NazaraStackArrayNoInit(char, fullNameSize + 1);
|
||||
std::memcpy(&fullName[0], path.GetConstBuffer(), pathSize * sizeof(char));
|
||||
fullName[pathSize] = '/';
|
||||
std::memcpy(&fullName[pathSize + 1], m_result->d_name, resultNameSize * sizeof(char));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Network/NetBuffer.hpp>
|
||||
#include <Nazara/Network/Posix/IpAddressImpl.hpp>
|
||||
#include <netinet/tcp.h>
|
||||
|
|
@ -574,7 +574,7 @@ namespace Nz
|
|||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
NazaraAssert(buffers && bufferCount > 0, "Invalid buffers");
|
||||
|
||||
StackArray<iovec> sysBuffers = NazaraStackAllocation(iovec, bufferCount);
|
||||
StackArray<iovec> sysBuffers = NazaraStackArray(iovec, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
sysBuffers[i].iov_base = buffers[i].data;
|
||||
|
|
@ -698,7 +698,7 @@ namespace Nz
|
|||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
NazaraAssert(buffers && bufferCount > 0, "Invalid buffers");
|
||||
|
||||
StackArray<iovec> sysBuffers = NazaraStackAllocation(iovec, bufferCount);
|
||||
StackArray<iovec> sysBuffers = NazaraStackArray(iovec, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
sysBuffers[i].iov_base = buffers[i].data;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <Nazara/Network/Win32/SocketImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Network/Win32/IpAddressImpl.hpp>
|
||||
|
||||
// Some compilers (older versions of MinGW) lack Mstcpip.h which defines some structs/defines
|
||||
|
|
@ -615,7 +615,7 @@ namespace Nz
|
|||
|
||||
IpAddress senderIp;
|
||||
|
||||
StackArray<WSABUF> winBuffers = NazaraStackAllocation(WSABUF, bufferCount);
|
||||
StackArray<WSABUF> winBuffers = NazaraStackArray(WSABUF, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
winBuffers[i].buf = static_cast<CHAR*>(buffers[i].data);
|
||||
|
|
@ -714,7 +714,7 @@ namespace Nz
|
|||
IpAddressImpl::SockAddrBuffer nameBuffer;
|
||||
int bufferLength = IpAddressImpl::ToSockAddr(to, nameBuffer.data());
|
||||
|
||||
StackArray<WSABUF> winBuffers = NazaraStackAllocation(WSABUF, bufferCount);
|
||||
StackArray<WSABUF> winBuffers = NazaraStackArray(WSABUF, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
winBuffers[i].buf = static_cast<CHAR*>(buffers[i].data);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics2D/PhysWorld2D.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <chipmunk/chipmunk.h>
|
||||
#include <Nazara/Physics2D/Debug.hpp>
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ namespace Nz
|
|||
{
|
||||
//TODO: constexpr if to prevent copy/cast if sizeof(cpVect) == sizeof(Vector2f)
|
||||
|
||||
StackArray<Vector2f> nVertices = NazaraStackAllocation(Vector2f, vertexCount);
|
||||
StackArray<Vector2f> nVertices = NazaraStackArray(Vector2f, vertexCount);
|
||||
for (int i = 0; i < vertexCount; ++i)
|
||||
nVertices[i].Set(float(vertices[i].x), float(vertices[i].y));
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Newton/Newton.h>
|
||||
#include <cassert>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
|
@ -173,7 +173,7 @@ namespace Nz
|
|||
using ContactJoint = void*;
|
||||
|
||||
// Query all joints first, to prevent removing a joint from the list while iterating on it
|
||||
StackArray<ContactJoint> contacts = NazaraStackAllocationNoInit(ContactJoint, NewtonContactJointGetContactCount(contactJoint));
|
||||
StackArray<ContactJoint> contacts = NazaraStackArray(ContactJoint, NewtonContactJointGetContactCount(contactJoint));
|
||||
std::size_t contactIndex = 0;
|
||||
for (ContactJoint contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/Context.hpp>
|
||||
#include <Nazara/Renderer/DebugDrawer.hpp>
|
||||
|
|
@ -1762,7 +1762,7 @@ namespace Nz
|
|||
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
|
||||
maxLength++;
|
||||
|
||||
StackArray<GLchar> nameBuffer = NazaraStackAllocation(GLchar, maxLength + 1);
|
||||
StackArray<GLchar> nameBuffer = NazaraStackArray(GLchar, maxLength + 1);
|
||||
for (GLint i = 0; i < count; i++)
|
||||
{
|
||||
GLint size;
|
||||
|
|
|
|||
Loading…
Reference in New Issue