[*] Update iconv

[*] nt queue
[-] Remove misplaced pragma once
This commit is contained in:
Reece Wilson 2022-04-12 20:16:49 +01:00
parent a1a46e5324
commit b0b9931586
6 changed files with 20 additions and 12 deletions

View File

@ -5,7 +5,6 @@
Date: 2022-3-31
Author: Reece
***/
#pragma once
#include <Source/RuntimeInternal.hpp>
#include "Debug.hpp"

View File

@ -94,16 +94,21 @@ namespace Aurora::Locale::Encoding
#if defined(AURORA_IS_POSIX_DERIVED)
auto originalLength = length;
size_t canReadLength = length;
size_t canReadLength = length;
size_t canWriteLength = outLen;
char * inPtr = (char *)in;
char * outPtr = (char *)out;
char *inPtr = (char *)in;
char *outPtr = (char *)out;
AuByteBuffer buffer;
if (!out)
{
buffer.resize(length);
if (!AuTryResize(buffer, length))
{
return {};
}
outPtr = (char *)buffer.base;
canWriteLength = outLen = buffer.length;
}
@ -111,7 +116,6 @@ namespace Aurora::Locale::Encoding
AuUInt32 a {}, b{};
while (iconv(handle, &inPtr, &canReadLength, &outPtr, &canWriteLength) == (size_t) -1)
{
a += length - canReadLength;
b += outLen - canWriteLength;
length = canReadLength;
@ -120,7 +124,11 @@ namespace Aurora::Locale::Encoding
{
if (errno == E2BIG)
{
buffer.resize(AuMax(originalLength, buffer.length) * 2);
if (!AuTryResize(buffer, AuMax(originalLength, buffer.length) * 2))
{
return {a, b};
}
outPtr = (char *)buffer.base;
canWriteLength = outLen = buffer.length;
continue;
@ -128,7 +136,7 @@ namespace Aurora::Locale::Encoding
}
SysPushErrorGen();
return {};
return {a, b};
}
a += length - canReadLength;
@ -152,9 +160,8 @@ namespace Aurora::Locale::Encoding
{
return {};
}
auto handle = handleItr->second;
return IConvWork(handle, in, length, utf8, utf8Max);
return IConvWork(handleItr->second, in, length, utf8, utf8Max);
#else
@ -172,9 +179,8 @@ namespace Aurora::Locale::Encoding
{
return {};
}
auto handle = handleItr->second;
return IConvWork(handle, utf8, utf8Length, cp, cpLen);
return IConvWork(handleItr->second, utf8, utf8Length, cp, cpLen);
#else

0
Source/Loop/LSEvent.Linux.cpp Executable file → Normal file
View File

0
Source/Loop/LSEvent.Linux.hpp Executable file → Normal file
View File

View File

@ -371,6 +371,8 @@ namespace Aurora::Loop
return active == 1;
}
// This could be implemented more like a possible BSD implementation
// if we were to implement based on io_submit poll
bool LoopQueue::WaitAll(AuUInt32 timeoutIn)
{
AnEpoll epollReference;

View File

@ -35,6 +35,7 @@ namespace Aurora::Loop
LoopQueue::~LoopQueue()
{
AuWin32CloseHandle(this->hEvent_);
AuWin32CloseHandle(this->hDummy_);
}
bool LoopQueue::IsValid()