mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Finish clearing out std::vector from PortabilityLayer
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#include "BinHex4.h"
|
#include "BinHex4.h"
|
||||||
#include "GpIOStream.h"
|
#include "GpIOStream.h"
|
||||||
|
#include "GpVector.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <vector>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// See: https://files.stairways.com/other/binhex-40-specs-info.txt
|
// See: https://files.stairways.com/other/binhex-40-specs-info.txt
|
||||||
@@ -59,7 +59,7 @@ namespace
|
|||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
MacFileMem *BinHex4::LoadHQX(GpIOStream *stream)
|
MacFileMem *BinHex4::LoadHQX(GpIOStream *stream, IGpAllocator *alloc)
|
||||||
{
|
{
|
||||||
const uint8_t errCodeChar = 64;
|
const uint8_t errCodeChar = 64;
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ namespace PortabilityLayer
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> bytesAfter6To8;
|
GpVector<uint8_t> bytesAfter6To8(alloc);
|
||||||
|
|
||||||
if (stream->IsSeekable())
|
if (stream->IsSeekable())
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,10 @@ namespace PortabilityLayer
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (endPos > filePos && (endPos - filePos) < SIZE_MAX / 6)
|
if (endPos > filePos && (endPos - filePos) < SIZE_MAX / 6)
|
||||||
bytesAfter6To8.reserve(static_cast<size_t>(endPos - filePos) * 6 / 8);
|
{
|
||||||
|
if (!bytesAfter6To8.Reserve(static_cast<size_t>(endPos - filePos) * 6 / 8))
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,19 +173,22 @@ namespace PortabilityLayer
|
|||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
decodedByte |= value6Bit;
|
decodedByte |= value6Bit;
|
||||||
bytesAfter6To8.push_back(decodedByte);
|
if (!bytesAfter6To8.Append(decodedByte))
|
||||||
|
return nullptr;
|
||||||
decodedByte = 0;
|
decodedByte = 0;
|
||||||
decodedByteBitPos = 8;
|
decodedByteBitPos = 8;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
decodedByte |= (value6Bit >> 2);
|
decodedByte |= (value6Bit >> 2);
|
||||||
bytesAfter6To8.push_back(decodedByte);
|
if (!bytesAfter6To8.Append(decodedByte))
|
||||||
|
return nullptr;
|
||||||
decodedByte = (value6Bit << 6) & 0xff;
|
decodedByte = (value6Bit << 6) & 0xff;
|
||||||
decodedByteBitPos = 6;
|
decodedByteBitPos = 6;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
decodedByte |= (value6Bit >> 4);
|
decodedByte |= (value6Bit >> 4);
|
||||||
bytesAfter6To8.push_back(decodedByte);
|
if (!bytesAfter6To8.Append(decodedByte))
|
||||||
|
return nullptr;
|
||||||
decodedByte = (value6Bit << 4) & 0xff;
|
decodedByte = (value6Bit << 4) & 0xff;
|
||||||
decodedByteBitPos = 4;
|
decodedByteBitPos = 4;
|
||||||
break;
|
break;
|
||||||
@@ -191,7 +197,7 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t bytesBeforeRLEDec = bytesAfter6To8.size();
|
const size_t bytesBeforeRLEDec = bytesAfter6To8.Count();
|
||||||
size_t decodedDataSize = 0;
|
size_t decodedDataSize = 0;
|
||||||
for (size_t i = 0; i < bytesBeforeRLEDec; i++)
|
for (size_t i = 0; i < bytesBeforeRLEDec; i++)
|
||||||
{
|
{
|
||||||
@@ -212,8 +218,9 @@ namespace PortabilityLayer
|
|||||||
decodedDataSize++;
|
decodedDataSize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> decodedBytes;
|
GpVector<uint8_t> decodedBytes(alloc);
|
||||||
decodedBytes.reserve(decodedDataSize);
|
if (!decodedBytes.Reserve(decodedDataSize))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
for (size_t i = 0; i < bytesBeforeRLEDec; i++)
|
for (size_t i = 0; i < bytesBeforeRLEDec; i++)
|
||||||
{
|
{
|
||||||
@@ -224,28 +231,37 @@ namespace PortabilityLayer
|
|||||||
const uint8_t runLength = bytesAfter6To8[++i];
|
const uint8_t runLength = bytesAfter6To8[++i];
|
||||||
|
|
||||||
if (runLength == 0)
|
if (runLength == 0)
|
||||||
decodedBytes.push_back(0x90);
|
{
|
||||||
|
if (!decodedBytes.Append(0x90))
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (decodedBytes.size() == 0)
|
if (decodedBytes.Count() == 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const uint8_t lastByte = *(decodedBytes.end() - 1);
|
const uint8_t lastByte = decodedBytes[decodedBytes.Count() - 1];
|
||||||
for (size_t r = 1; r < runLength; r++)
|
for (size_t r = 1; r < runLength; r++)
|
||||||
decodedBytes.push_back(lastByte);
|
{
|
||||||
|
if (!decodedBytes.Append(lastByte))
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
decodedBytes.push_back(b);
|
{
|
||||||
|
if (!decodedBytes.Append(b))
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(decodedBytes.size() == decodedDataSize);
|
assert(decodedBytes.size() == decodedDataSize);
|
||||||
|
|
||||||
if (decodedBytes.size() == 0)
|
if (decodedBytes.Count() == 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const uint8_t nameLength = decodedBytes[0];
|
const uint8_t nameLength = decodedBytes[0];
|
||||||
if (decodedBytes.size() < 22 + nameLength || nameLength > 63)
|
if (decodedBytes.Count() < 22 + nameLength || nameLength > 63)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Header format:
|
// Header format:
|
||||||
@@ -272,7 +288,7 @@ namespace PortabilityLayer
|
|||||||
mfi.m_dataForkSize = ByteUnpack::BigUInt32(&decodedBytes[headerStartLoc + 10]);
|
mfi.m_dataForkSize = ByteUnpack::BigUInt32(&decodedBytes[headerStartLoc + 10]);
|
||||||
mfi.m_resourceForkSize = ByteUnpack::BigUInt32(&decodedBytes[headerStartLoc + 14]);
|
mfi.m_resourceForkSize = ByteUnpack::BigUInt32(&decodedBytes[headerStartLoc + 14]);
|
||||||
|
|
||||||
const size_t availableDataSize = decodedBytes.size() - 26 - nameLength; // +4 bytes for CRCs
|
const size_t availableDataSize = decodedBytes.Count() - 26 - nameLength; // +4 bytes for CRCs
|
||||||
|
|
||||||
if (mfi.m_dataForkSize > availableDataSize || availableDataSize - mfi.m_dataForkSize < mfi.m_resourceForkSize)
|
if (mfi.m_dataForkSize > availableDataSize || availableDataSize - mfi.m_dataForkSize < mfi.m_resourceForkSize)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -297,6 +313,6 @@ namespace PortabilityLayer
|
|||||||
if (expectedResCRC != BinHexCRC(&decodedBytes[resourceForkStart], mfi.m_resourceForkSize))
|
if (expectedResCRC != BinHexCRC(&decodedBytes[resourceForkStart], mfi.m_resourceForkSize))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return new MacFileMem(&decodedBytes[dataForkStart], &decodedBytes[resourceForkStart], nullptr, mfi);
|
return MacFileMem::Create(alloc, &decodedBytes[dataForkStart], &decodedBytes[resourceForkStart], nullptr, mfi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __PL_BINHEX4_H__
|
|
||||||
#define __PL_BINHEX4_H__
|
|
||||||
|
|
||||||
class GpIOStream;
|
class GpIOStream;
|
||||||
|
struct IGpAllocator;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
@@ -11,8 +9,6 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
namespace BinHex4
|
namespace BinHex4
|
||||||
{
|
{
|
||||||
MacFileMem *LoadHQX(GpIOStream *stream);
|
MacFileMem *LoadHQX(GpIOStream *stream, IGpAllocator *alloc);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -106,7 +106,7 @@ namespace PortabilityLayer
|
|||||||
stream->Write(padding, resourceForkPadding);
|
stream->Write(padding, resourceForkPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacFileMem *MacBinary2::ReadBin(GpIOStream *stream)
|
MacFileMem *MacBinary2::ReadBin(GpIOStream *stream, IGpAllocator *alloc)
|
||||||
{
|
{
|
||||||
MacFileInfo fileInfo;
|
MacFileInfo fileInfo;
|
||||||
|
|
||||||
@@ -153,37 +153,35 @@ namespace PortabilityLayer
|
|||||||
if (fileInfo.m_resourceForkSize > SIZE_MAX)
|
if (fileInfo.m_resourceForkSize > SIZE_MAX)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
uint8_t *dataBuffer = nullptr;
|
GpVector<uint8_t> dataBuffer(alloc);
|
||||||
uint8_t *rsrcBuffer = nullptr;
|
GpVector<uint8_t> rsrcBuffer(alloc);
|
||||||
|
|
||||||
if (fileInfo.m_dataForkSize != 0)
|
if (fileInfo.m_dataForkSize != 0)
|
||||||
dataBuffer = new uint8_t[fileInfo.m_dataForkSize];
|
dataBuffer.Resize(fileInfo.m_dataForkSize);
|
||||||
|
|
||||||
if (fileInfo.m_resourceForkSize != 0)
|
if (fileInfo.m_resourceForkSize != 0)
|
||||||
rsrcBuffer = new uint8_t[fileInfo.m_resourceForkSize];
|
rsrcBuffer.Resize(fileInfo.m_resourceForkSize);
|
||||||
|
|
||||||
ScopedArray<uint8_t> dataContents(dataBuffer);
|
|
||||||
ScopedArray<uint8_t> rsrcContents(rsrcBuffer);
|
|
||||||
|
|
||||||
uint8_t *padding = mb2Header;
|
uint8_t *padding = mb2Header;
|
||||||
|
|
||||||
const size_t dataForkPadding = 127 - ((fileInfo.m_dataForkSize + 127) % 128);
|
const size_t dataForkPadding = 127 - ((fileInfo.m_dataForkSize + 127) % 128);
|
||||||
const size_t resourceForkPadding = 127 - ((fileInfo.m_resourceForkSize + 127) % 128);
|
const size_t resourceForkPadding = 127 - ((fileInfo.m_resourceForkSize + 127) % 128);
|
||||||
|
|
||||||
if (stream->Read(dataBuffer, fileInfo.m_dataForkSize) != fileInfo.m_dataForkSize)
|
if (stream->Read(dataBuffer.Buffer(), fileInfo.m_dataForkSize) != fileInfo.m_dataForkSize)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (stream->Read(padding, dataForkPadding) != dataForkPadding)
|
if (stream->Read(padding, dataForkPadding) != dataForkPadding)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (stream->Read(rsrcBuffer, fileInfo.m_resourceForkSize) != fileInfo.m_resourceForkSize)
|
if (stream->Read(rsrcBuffer.Buffer(), fileInfo.m_resourceForkSize) != fileInfo.m_resourceForkSize)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (stream->Read(padding, resourceForkPadding) != resourceForkPadding)
|
if (stream->Read(padding, resourceForkPadding) != resourceForkPadding)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Ignore comment for now
|
// Ignore comment for now
|
||||||
return new MacFileMem(dataBuffer, rsrcBuffer, nullptr, fileInfo);
|
return MacFileMem::Create(alloc, dataBuffer.Buffer(), rsrcBuffer.Buffer(), nullptr, fileInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class GpIOStream;
|
class GpIOStream;
|
||||||
|
struct IGpAllocator;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
@@ -14,6 +15,6 @@ namespace PortabilityLayer
|
|||||||
void SerializeHeader(unsigned char *headerBytes, const MacFileInfo &macFileInfo);
|
void SerializeHeader(unsigned char *headerBytes, const MacFileInfo &macFileInfo);
|
||||||
|
|
||||||
void WriteBin(const MacFileMem *file, GpIOStream *stream);
|
void WriteBin(const MacFileMem *file, GpIOStream *stream);
|
||||||
MacFileMem *ReadBin(GpIOStream *stream);
|
MacFileMem *ReadBin(GpIOStream *stream, IGpAllocator *alloc);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,59 @@
|
|||||||
#include "MacFileMem.h"
|
#include "MacFileMem.h"
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
MacFileMem::MacFileMem(const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment, const MacFileInfo &fileInfo)
|
MacFileMem::MacFileMem(IGpAllocator *alloc, const MacFileInfo &fileInfo)
|
||||||
: m_info(fileInfo)
|
: m_alloc(alloc)
|
||||||
|
, m_info(fileInfo)
|
||||||
|
, m_data(alloc)
|
||||||
{
|
{
|
||||||
uint8_t *buffer = new uint8_t[fileInfo.m_dataForkSize + fileInfo.m_resourceForkSize + fileInfo.m_commentSize + 1];
|
}
|
||||||
m_data.Set(buffer);
|
|
||||||
|
|
||||||
memcpy(buffer, dataFork, fileInfo.m_dataForkSize);
|
bool MacFileMem::Init(const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment)
|
||||||
buffer += fileInfo.m_dataForkSize;
|
{
|
||||||
|
const size_t combinedSize = m_info.m_dataForkSize + m_info.m_resourceForkSize + m_info.m_commentSize + 1;
|
||||||
|
if (!m_data.Resize(combinedSize))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint8_t *buffer = m_data.Buffer();
|
||||||
|
memcpy(buffer, dataFork, m_info.m_dataForkSize);
|
||||||
|
buffer += m_info.m_dataForkSize;
|
||||||
|
|
||||||
memcpy(buffer, resourceFork, fileInfo.m_resourceForkSize);
|
memcpy(buffer, resourceFork, m_info.m_resourceForkSize);
|
||||||
buffer += fileInfo.m_resourceForkSize;
|
buffer += m_info.m_resourceForkSize;
|
||||||
|
|
||||||
memcpy(buffer, comment, fileInfo.m_commentSize);
|
memcpy(buffer, comment, m_info.m_commentSize);
|
||||||
buffer += fileInfo.m_commentSize;
|
buffer += m_info.m_commentSize;
|
||||||
|
|
||||||
*buffer = 0;
|
*buffer = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacFileMem::~MacFileMem()
|
MacFileMem::~MacFileMem()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MacFileMem *MacFileMem::Create(IGpAllocator *alloc, const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment, const MacFileInfo &fileInfo)
|
||||||
|
{
|
||||||
|
void *storage = alloc->Alloc(sizeof(MacFileMem));
|
||||||
|
if (!storage)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
MacFileMem *result = new (storage) MacFileMem(alloc, fileInfo);
|
||||||
|
if (!result->Init(dataFork, resourceFork, comment))
|
||||||
|
{
|
||||||
|
result->Destroy();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacFileMem::Destroy()
|
||||||
|
{
|
||||||
|
IGpAllocator *alloc = m_alloc;
|
||||||
|
this->~MacFileMem();
|
||||||
|
alloc->Release(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,28 +1,33 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __PL_MACFILEMEM_H__
|
|
||||||
#define __PL_MACFILEMEM_H__
|
|
||||||
|
|
||||||
#include "DataTypes.h"
|
#include "DataTypes.h"
|
||||||
#include "MacFileInfo.h"
|
#include "MacFileInfo.h"
|
||||||
#include "ScopedArray.h"
|
#include "GpVector.h"
|
||||||
|
|
||||||
|
struct IGpAllocator;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
class MacFileMem
|
class MacFileMem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MacFileMem(const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment, const MacFileInfo &fileInfo);
|
|
||||||
~MacFileMem();
|
|
||||||
|
|
||||||
const MacFileInfo &FileInfo() const;
|
const MacFileInfo &FileInfo() const;
|
||||||
const uint8_t *DataFork() const;
|
const uint8_t *DataFork() const;
|
||||||
const uint8_t *ResourceFork() const;
|
const uint8_t *ResourceFork() const;
|
||||||
const char *Comment() const;
|
const char *Comment() const;
|
||||||
|
|
||||||
|
static MacFileMem *Create(IGpAllocator *alloc, const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment, const MacFileInfo &fileInfo);
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScopedArray<uint8_t> m_data;
|
MacFileMem(IGpAllocator *alloc, const MacFileInfo &fileInfo);
|
||||||
MacFileInfo m_info;
|
~MacFileMem();
|
||||||
|
|
||||||
|
bool Init(const uint8_t *dataFork, const uint8_t *resourceFork, const char* comment);
|
||||||
|
|
||||||
|
GpVector<uint8_t> m_data;
|
||||||
|
MacFileInfo m_info;
|
||||||
|
IGpAllocator *m_alloc;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,18 +40,16 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
inline const uint8_t *MacFileMem::DataFork() const
|
inline const uint8_t *MacFileMem::DataFork() const
|
||||||
{
|
{
|
||||||
return m_data;
|
return m_data.Buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const uint8_t *MacFileMem::ResourceFork() const
|
inline const uint8_t *MacFileMem::ResourceFork() const
|
||||||
{
|
{
|
||||||
return m_data + m_info.m_dataForkSize;
|
return m_data.Buffer() + m_info.m_dataForkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char *MacFileMem::Comment() const
|
inline const char *MacFileMem::Comment() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<const char*>(m_data + m_info.m_dataForkSize + m_info.m_resourceForkSize);
|
return reinterpret_cast<const char*>(m_data.Buffer() + m_info.m_dataForkSize + m_info.m_resourceForkSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -209,7 +209,6 @@
|
|||||||
<ClInclude Include="VirtualDirectory.h" />
|
<ClInclude Include="VirtualDirectory.h" />
|
||||||
<ClInclude Include="RCPtr.h" />
|
<ClInclude Include="RCPtr.h" />
|
||||||
<ClInclude Include="RefCounted.h" />
|
<ClInclude Include="RefCounted.h" />
|
||||||
<ClInclude Include="ScopedArray.h" />
|
|
||||||
<ClInclude Include="ScopedPtr.h" />
|
<ClInclude Include="ScopedPtr.h" />
|
||||||
<ClInclude Include="SmallestInt.h" />
|
<ClInclude Include="SmallestInt.h" />
|
||||||
<ClInclude Include="UnsafePascalStr.h" />
|
<ClInclude Include="UnsafePascalStr.h" />
|
||||||
|
@@ -42,9 +42,6 @@
|
|||||||
<ClInclude Include="ScopedPtr.h">
|
<ClInclude Include="ScopedPtr.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="ScopedArray.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="PascalStr.h">
|
<ClInclude Include="PascalStr.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@@ -1,83 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef __PL_SCOPEDARRAY_H__
|
|
||||||
#define __PL_SCOPEDARRAY_H__
|
|
||||||
|
|
||||||
#include "CoreDefs.h"
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
template<class T>
|
|
||||||
class ScopedArray
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ScopedArray();
|
|
||||||
ScopedArray(T *ref);
|
|
||||||
~ScopedArray();
|
|
||||||
|
|
||||||
void Swap(ScopedArray<T> &other);
|
|
||||||
|
|
||||||
operator T*();
|
|
||||||
operator const T*() const;
|
|
||||||
|
|
||||||
void Set(T *ref);
|
|
||||||
|
|
||||||
private:
|
|
||||||
ScopedArray(const ScopedArray<T> &other) GP_DELETED;
|
|
||||||
void operator=(const ScopedArray<T> &other) GP_DELETED;
|
|
||||||
T *m_ref;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
template<class T>
|
|
||||||
inline ScopedArray<T>::ScopedArray()
|
|
||||||
: m_ref(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline ScopedArray<T>::ScopedArray(T *ref)
|
|
||||||
: m_ref(ref)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline ScopedArray<T>::~ScopedArray()
|
|
||||||
{
|
|
||||||
if (m_ref)
|
|
||||||
delete[] m_ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline void ScopedArray<T>::Swap(ScopedArray<T> &other)
|
|
||||||
{
|
|
||||||
T *temp = m_ref;
|
|
||||||
m_ref = other.m_ref;
|
|
||||||
other.m_ref = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline ScopedArray<T>::operator T*()
|
|
||||||
{
|
|
||||||
return m_ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline ScopedArray<T>::operator const T*() const
|
|
||||||
{
|
|
||||||
return m_ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline void ScopedArray<T>::Set(T *ref)
|
|
||||||
{
|
|
||||||
if (m_ref && m_ref != ref)
|
|
||||||
delete m_ref;
|
|
||||||
|
|
||||||
m_ref = ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __PL_SCOPEDPTR_H__
|
|
||||||
#define __PL_SCOPEDPTR_H__
|
|
||||||
|
|
||||||
#include "CoreDefs.h"
|
#include "CoreDefs.h"
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
@@ -49,7 +46,7 @@ namespace PortabilityLayer
|
|||||||
inline ScopedPtr<T>::~ScopedPtr()
|
inline ScopedPtr<T>::~ScopedPtr()
|
||||||
{
|
{
|
||||||
if (m_ref)
|
if (m_ref)
|
||||||
delete m_ref;
|
m_ref->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -87,11 +84,9 @@ namespace PortabilityLayer
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void ScopedPtr<T>::Set(T *ref)
|
inline void ScopedPtr<T>::Set(T *ref)
|
||||||
{
|
{
|
||||||
if (m_ref && m_ref != ref)
|
if (m_ref && m_ref != ref)
|
||||||
delete m_ref;
|
m_ref->Destroy();
|
||||||
|
|
||||||
m_ref = ref;
|
m_ref = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -1,146 +1,147 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 Eric Lasota
|
Copyright 2019 Eric Lasota
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
the Software without restriction, including without limitation the rights to
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
so, subject to the following conditions:
|
so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CFileStream.h"
|
#include "CFileStream.h"
|
||||||
#include "CombinedTimestamp.h"
|
#include "CombinedTimestamp.h"
|
||||||
#include "ScopedPtr.h"
|
#include "ScopedPtr.h"
|
||||||
#include "MacBinary2.h"
|
#include "MacBinary2.h"
|
||||||
#include "MacFileMem.h"
|
#include "MacFileMem.h"
|
||||||
|
#include "GpAllocator_C.h"
|
||||||
#include <string>
|
|
||||||
|
#include <string>
|
||||||
using namespace PortabilityLayer;
|
|
||||||
|
using namespace PortabilityLayer;
|
||||||
int main(int argc, const char **argv)
|
|
||||||
{
|
int main(int argc, const char **argv)
|
||||||
if (argc != 4)
|
{
|
||||||
{
|
if (argc != 4)
|
||||||
fprintf(stderr, "Usage: bin2gp <input.bin> <input.ts> <output>");
|
{
|
||||||
return -1;
|
fprintf(stderr, "Usage: bin2gp <input.bin> <input.ts> <output>");
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
|
||||||
FILE *f = nullptr;
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
if (fopen_s(&f, argv[1], "rb"))
|
FILE *f = nullptr;
|
||||||
f = nullptr;
|
if (fopen_s(&f, argv[1], "rb"))
|
||||||
#else
|
f = nullptr;
|
||||||
FILE *f = fopen(argv[1], "rb");
|
#else
|
||||||
#endif
|
FILE *f = fopen(argv[1], "rb");
|
||||||
|
#endif
|
||||||
if (!f)
|
|
||||||
{
|
if (!f)
|
||||||
fprintf(stderr, "Could not open input file");
|
{
|
||||||
return -1;
|
fprintf(stderr, "Could not open input file");
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
|
||||||
FILE *tsF = nullptr;
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
if (fopen_s(&tsF, argv[2], "rb"))
|
FILE *tsF = nullptr;
|
||||||
tsF = nullptr;
|
if (fopen_s(&tsF, argv[2], "rb"))
|
||||||
#else
|
tsF = nullptr;
|
||||||
FILE *tsF = fopen(argv[2], "rb");
|
#else
|
||||||
#endif
|
FILE *tsF = fopen(argv[2], "rb");
|
||||||
|
#endif
|
||||||
if (!tsF)
|
|
||||||
{
|
if (!tsF)
|
||||||
fprintf(stderr, "Could not open timestamp file");
|
{
|
||||||
return -1;
|
fprintf(stderr, "Could not open timestamp file");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PortabilityLayer::CombinedTimestamp ts;
|
PortabilityLayer::CombinedTimestamp ts;
|
||||||
if (!fread(&ts, sizeof(ts), 1, tsF))
|
if (!fread(&ts, sizeof(ts), 1, tsF))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not read timestamp");
|
fprintf(stderr, "Could not read timestamp");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileStream fs(f, true, false, true);
|
CFileStream fs(f, true, false, true);
|
||||||
|
|
||||||
ScopedPtr<MacFileMem> memFile = MacBinary2::ReadBin(&fs);
|
ScopedPtr<MacFileMem> memFile = MacBinary2::ReadBin(&fs, GpAllocator_C::GetInstance());
|
||||||
|
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
std::string fname = argv[3];
|
std::string fname = argv[3];
|
||||||
|
|
||||||
const char* extensions[] = { ".gpf", ".gpr", ".gpd", ".gpc" };
|
const char* extensions[] = { ".gpf", ".gpr", ".gpd", ".gpc" };
|
||||||
|
|
||||||
MacFilePropertiesSerialized sp;
|
MacFilePropertiesSerialized sp;
|
||||||
sp.Serialize(memFile->FileInfo().m_properties);
|
sp.Serialize(memFile->FileInfo().m_properties);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
const void *bufferToWrite = nullptr;
|
const void *bufferToWrite = nullptr;
|
||||||
size_t sizeToWrite = 0;
|
size_t sizeToWrite = 0;
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
bufferToWrite = sp.m_data;
|
bufferToWrite = sp.m_data;
|
||||||
sizeToWrite = sp.kSize;
|
sizeToWrite = sp.kSize;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
bufferToWrite = memFile->ResourceFork();
|
bufferToWrite = memFile->ResourceFork();
|
||||||
sizeToWrite = memFile->FileInfo().m_resourceForkSize;
|
sizeToWrite = memFile->FileInfo().m_resourceForkSize;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bufferToWrite = memFile->DataFork();
|
bufferToWrite = memFile->DataFork();
|
||||||
sizeToWrite = memFile->FileInfo().m_dataForkSize;
|
sizeToWrite = memFile->FileInfo().m_dataForkSize;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
bufferToWrite = memFile->Comment();
|
bufferToWrite = memFile->Comment();
|
||||||
sizeToWrite = memFile->FileInfo().m_commentSize;
|
sizeToWrite = memFile->FileInfo().m_commentSize;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sizeToWrite == 0)
|
if (sizeToWrite == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string path = fname + extensions[i];
|
std::string path = fname + extensions[i];
|
||||||
|
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
FILE *outF = nullptr;
|
FILE *outF = nullptr;
|
||||||
if (fopen_s(&outF, path.c_str(), "wb"))
|
if (fopen_s(&outF, path.c_str(), "wb"))
|
||||||
outF = nullptr;
|
outF = nullptr;
|
||||||
#else
|
#else
|
||||||
FILE *outF = fopen(path.c_str(), "wb");
|
FILE *outF = fopen(path.c_str(), "wb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!outF)
|
if (!outF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
CFileStream stream(outF);
|
CFileStream stream(outF);
|
||||||
sp.WriteAsPackage(stream, ts);
|
sp.WriteAsPackage(stream, ts);
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fwrite(bufferToWrite, 1, sizeToWrite, outF);
|
fwrite(bufferToWrite, 1, sizeToWrite, outF);
|
||||||
fclose(outF);
|
fclose(outF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Debug.props" />
|
<Import Project="..\Debug.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Release.props" />
|
<Import Project="..\Release.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp" />
|
||||||
<ClCompile Include="bin2gp.cpp" />
|
<ClCompile Include="bin2gp.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -18,5 +18,8 @@
|
|||||||
<ClCompile Include="bin2gp.cpp">
|
<ClCompile Include="bin2gp.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -4,6 +4,8 @@
|
|||||||
#include "MemReaderStream.h"
|
#include "MemReaderStream.h"
|
||||||
#include "ResourceCompiledTypeList.h"
|
#include "ResourceCompiledTypeList.h"
|
||||||
#include "ResourceFile.h"
|
#include "ResourceFile.h"
|
||||||
|
#include "ScopedPtr.h"
|
||||||
|
#include "GpAllocator_C.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -48,15 +50,15 @@ int main(int argc, const char **argv)
|
|||||||
mfi.m_resourceForkSize = resSize;
|
mfi.m_resourceForkSize = resSize;
|
||||||
mfi.m_commentSize = 0;
|
mfi.m_commentSize = 0;
|
||||||
|
|
||||||
PortabilityLayer::MacFileMem memFile(dataFork, resFork, nullptr, mfi);
|
PortabilityLayer::ScopedPtr<PortabilityLayer::MacFileMem> memFile = PortabilityLayer::MacFileMem::Create(GpAllocator_C::GetInstance(), dataFork, resFork, nullptr, mfi);
|
||||||
|
|
||||||
delete[] dataFork;
|
delete[] dataFork;
|
||||||
delete[] resFork;
|
delete[] resFork;
|
||||||
|
|
||||||
const uint8_t *dataBytes = memFile.DataFork();
|
const uint8_t *dataBytes = memFile->DataFork();
|
||||||
if (dataBytes[0] == 0 && dataBytes[1] == 0 && dataBytes[2] == 0 && dataBytes[3] == 0)
|
if (dataBytes[0] == 0 && dataBytes[1] == 0 && dataBytes[2] == 0 && dataBytes[3] == 0)
|
||||||
{
|
{
|
||||||
uint32_t mdatSize = memFile.FileInfo().m_dataForkSize;
|
uint32_t mdatSize = memFile->FileInfo().m_dataForkSize;
|
||||||
uint8_t mdatSizeEncoded[4];
|
uint8_t mdatSizeEncoded[4];
|
||||||
mdatSizeEncoded[0] = ((mdatSize >> 24) & 0xff);
|
mdatSizeEncoded[0] = ((mdatSize >> 24) & 0xff);
|
||||||
mdatSizeEncoded[1] = ((mdatSize >> 16) & 0xff);
|
mdatSizeEncoded[1] = ((mdatSize >> 16) & 0xff);
|
||||||
@@ -65,7 +67,7 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
PortabilityLayer::ResourceFile *rf = PortabilityLayer::ResourceFile::Create();
|
PortabilityLayer::ResourceFile *rf = PortabilityLayer::ResourceFile::Create();
|
||||||
|
|
||||||
PortabilityLayer::MemReaderStream resStream(memFile.ResourceFork(), memFile.FileInfo().m_resourceForkSize);
|
PortabilityLayer::MemReaderStream resStream(memFile->ResourceFork(), memFile->FileInfo().m_resourceForkSize);
|
||||||
rf->Load(&resStream);
|
rf->Load(&resStream);
|
||||||
|
|
||||||
const PortabilityLayer::ResourceCompiledTypeList *typeList = rf->GetResourceTypeList(PortabilityLayer::ResTypeID('moov'));
|
const PortabilityLayer::ResourceCompiledTypeList *typeList = rf->GetResourceTypeList(PortabilityLayer::ResTypeID('moov'));
|
||||||
@@ -102,7 +104,7 @@ int main(int argc, const char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(dataBytes, 1, memFile.FileInfo().m_dataForkSize, outF);
|
fwrite(dataBytes, 1, memFile->FileInfo().m_dataForkSize, outF);
|
||||||
fclose(outF);
|
fclose(outF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Debug.props" />
|
<Import Project="..\Debug.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Release.props" />
|
<Import Project="..\Release.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp" />
|
||||||
<ClCompile Include="flattenmov.cpp" />
|
<ClCompile Include="flattenmov.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -18,5 +18,8 @@
|
|||||||
<ClCompile Include="flattenmov.cpp">
|
<ClCompile Include="flattenmov.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -26,7 +26,8 @@ SOFTWARE.
|
|||||||
#include "ScopedPtr.h"
|
#include "ScopedPtr.h"
|
||||||
#include "BinHex4.h"
|
#include "BinHex4.h"
|
||||||
#include "MacBinary2.h"
|
#include "MacBinary2.h"
|
||||||
#include "MacFileMem.h"
|
#include "MacFileMem.h"
|
||||||
|
#include "GpAllocator_C.h"
|
||||||
|
|
||||||
using namespace PortabilityLayer;
|
using namespace PortabilityLayer;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
CFileStream fs(f, true, false, true);
|
CFileStream fs(f, true, false, true);
|
||||||
|
|
||||||
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs);
|
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs, GpAllocator_C::GetInstance());
|
||||||
|
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Debug.props" />
|
<Import Project="..\Debug.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Release.props" />
|
<Import Project="..\Release.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp" />
|
||||||
<ClCompile Include="hqx2bin.cpp" />
|
<ClCompile Include="hqx2bin.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -18,5 +18,8 @@
|
|||||||
<ClCompile Include="hqx2bin.cpp">
|
<ClCompile Include="hqx2bin.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -25,6 +25,7 @@ SOFTWARE.
|
|||||||
#include "CFileStream.h"
|
#include "CFileStream.h"
|
||||||
#include "CombinedTimestamp.h"
|
#include "CombinedTimestamp.h"
|
||||||
#include "DeflateCodec.h"
|
#include "DeflateCodec.h"
|
||||||
|
#include "GpAllocator_C.h"
|
||||||
#include "ScopedPtr.h"
|
#include "ScopedPtr.h"
|
||||||
#include "BinHex4.h"
|
#include "BinHex4.h"
|
||||||
#include "MacBinary2.h"
|
#include "MacBinary2.h"
|
||||||
@@ -75,7 +76,7 @@ int toolMain(int argc, const char **argv)
|
|||||||
|
|
||||||
CFileStream fs(f, true, false, true);
|
CFileStream fs(f, true, false, true);
|
||||||
|
|
||||||
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs);
|
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs, GpAllocator_C::GetInstance());
|
||||||
|
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Debug.props" />
|
<Import Project="..\Debug.props" />
|
||||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
<Import Project="..\Release.props" />
|
<Import Project="..\Release.props" />
|
||||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||||
|
<Import Project="..\AerofoilPortable.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -76,6 +78,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp" />
|
||||||
<ClCompile Include="hqx2gp.cpp" />
|
<ClCompile Include="hqx2gp.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -18,5 +18,8 @@
|
|||||||
<ClCompile Include="hqx2gp.cpp">
|
<ClCompile Include="hqx2gp.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\AerofoilPortable\GpAllocator_C.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user