commit x64 compilation from lulu cause the other branch dont seems to compile properly at home

This commit is contained in:
2026-07-17 16:08:20 +02:00
parent c0f3eeb00d
commit 0efa4ee6f7
625 changed files with 117283 additions and 4426 deletions

View File

@ -0,0 +1,80 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "filesystem/io_handle_segment.h"
using namespace GS::IO;
//------------------------------------------------------------------------------
size_t HandleSegment::GetSize()
{ return size; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
size_t HandleSegment::Tell()
{ return cursor; }
size_t HandleSegment::Seek(ptrdiff_t offset, Base::SeekRef ref)
{
switch (ref)
{
case Base::SeekStart:
cursor = offset;
break;
case Base::SeekCurrent:
cursor += offset;
break;
case Base::SeekEnd:
cursor = size - offset;
break;
}
if (cursor > size)
{
cursor = 0;
return (size_t)-1;
}
return 0;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/*
IO segment must always restore the original handle position and act as
transparently as possible.
*/
size_t HandleSegment::Read(void *b, size_t s)
{
size_t o = 0;
size_t t = handle->Tell();
if (!handle->Seek(offset + cursor, Base::SeekStart))
{
if (s > (size - cursor))
s = size - cursor;
o = handle->Read(b, s);
cursor += o;
}
handle->Seek(t, Base::SeekStart);
return o;
}
size_t HandleSegment::Write(const void *b, size_t s)
{
size_t o = 0;
size_t t = handle->Tell();
if (!handle->Seek(offset + cursor, Base::SeekStart))
{
o = handle->Write(b, s);
cursor += o;
}
handle->Seek(t, Base::SeekStart);
return o;
}
//------------------------------------------------------------------------------