Former-commit-id: d6270f2f36e4b83124f8d6525954db304e0bb32a
This commit is contained in:
Lynix
2015-11-30 12:51:01 +01:00
27 changed files with 594 additions and 324 deletions

View File

@@ -154,7 +154,7 @@ namespace Nz
bool bestFlipped;
std::size_t bestFreeRect;
std::size_t bestRect;
std::size_t bestScore = std::numeric_limits<std::size_t>::max();
int bestScore = std::numeric_limits<int>::max();
for (std::size_t i = 0; i < m_freeRectangles.size(); ++i)
{
@@ -170,7 +170,7 @@ namespace Nz
bestFreeRect = i;
bestRect = j;
bestFlipped = false;
bestScore = std::numeric_limits<std::size_t>::min();
bestScore = std::numeric_limits<int>::min();
i = m_freeRectangles.size(); // Force a jump out of the outer loop as well - we got an instant fit.
break;
}
@@ -180,7 +180,7 @@ namespace Nz
bestFreeRect = i;
bestRect = j;
bestFlipped = true;
bestScore = std::numeric_limits<std::size_t>::min();
bestScore = std::numeric_limits<int>::min();
i = m_freeRectangles.size(); // Force a jump out of the outer loop as well - we got an instant fit.
break;
}
@@ -212,7 +212,7 @@ namespace Nz
}
// If we didn't manage to find any rectangle to pack, abort.
if (bestScore == std::numeric_limits<std::size_t>::max())
if (bestScore == std::numeric_limits<int>::max())
{
// Si nous le pouvons, on marque les rectangles n'ayant pas pu être insérés
if (inserted)

View File

@@ -18,8 +18,8 @@ namespace Nz
void FileImpl::Close()
{
if (m_fileDescriptor != -1)
close(m_fileDescriptor);
if (m_fileDescriptor != -1)
close(m_fileDescriptor);
}
bool FileImpl::EndOfFile() const
@@ -54,30 +54,20 @@ namespace Nz
int flags;
mode_t permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
if (mode & OpenMode_ReadOnly)
flags = O_RDONLY;
else if (mode & OpenMode_ReadWrite)
{
if (mode & OpenMode_ReadWrite)
flags = O_CREAT | O_RDWR;
if (mode & OpenMode_Append)
flags |= O_APPEND;
if (mode & OpenMode_Truncate)
flags |= O_TRUNC;
}
else if (mode & OpenMode_ReadOnly)
flags = O_RDONLY;
else if (mode & OpenMode_WriteOnly)
{
flags = O_CREAT | O_WRONLY;
if (mode & OpenMode_Append)
flags |= O_APPEND;
if (mode & OpenMode_Truncate)
flags |= O_TRUNC;
}
else
return false;
if (mode & OpenMode_Append)
flags |= O_APPEND;
if (mode & OpenMode_Truncate)
flags |= O_TRUNC;
///TODO: lock
// if ((mode & OpenMode_Lock) == 0)

View File

@@ -6,6 +6,7 @@
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/String.hpp>
#include <cstring>
#include <Nazara/Core/Debug.hpp>
namespace Nz