Compare commits
4 Commits
master
...
kimkulling
Author | SHA1 | Date |
---|---|---|
Kim Kulling | c25b13e692 | |
Kim Kulling | 8cb0a59f95 | |
Kim Kulling | 8030a3264a | |
Kim Kulling | 1eb2c124a0 |
|
@ -2,8 +2,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -66,11 +65,7 @@ namespace Assimp {
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
class MemoryIOStream : public IOStream {
|
class MemoryIOStream : public IOStream {
|
||||||
public:
|
public:
|
||||||
MemoryIOStream (const uint8_t* buff, size_t len, bool own = false)
|
MemoryIOStream (const uint8_t* buff, size_t len, bool own = false) : buffer (buff), length(len), pos((size_t)0), own(own) {
|
||||||
: buffer (buff)
|
|
||||||
, length(len)
|
|
||||||
, pos((size_t)0)
|
|
||||||
, own(own) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +157,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~MemoryIOSystem() = default;
|
~MemoryIOSystem() {
|
||||||
|
for (auto &it : created_streams) {
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Tests for the existence of a file at the given path. */
|
/** Tests for the existence of a file at the given path. */
|
||||||
|
@ -176,18 +175,22 @@ public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns the directory separator. */
|
/** Returns the directory separator. */
|
||||||
char getOsSeparator() const override {
|
char getOsSeparator() const override {
|
||||||
return existing_io ? existing_io->getOsSeparator()
|
return existing_io ? existing_io->getOsSeparator() : '/';
|
||||||
: '/'; // why not? it doesn't care
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Open a new file with a given path. */
|
/// Open a new file with a given path.
|
||||||
IOStream* Open(const char* pFile, const char* pMode = "rb") override {
|
IOStream* Open(const char* pFile, const char* pMode = "rb") override {
|
||||||
|
if (pFile == nullptr) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if ( 0 == strncmp( pFile, AI_MEMORYIO_MAGIC_FILENAME, AI_MEMORYIO_MAGIC_FILENAME_LENGTH ) ) {
|
if ( 0 == strncmp( pFile, AI_MEMORYIO_MAGIC_FILENAME, AI_MEMORYIO_MAGIC_FILENAME_LENGTH ) ) {
|
||||||
created_streams.emplace_back(new MemoryIOStream(buffer, length));
|
created_streams.emplace_back(new MemoryIOStream(buffer, length));
|
||||||
return created_streams.back();
|
return created_streams.back();
|
||||||
}
|
}
|
||||||
return existing_io ? existing_io->Open(pFile, pMode) : NULL;
|
|
||||||
|
return existing_io ? existing_io->Open(pFile, pMode) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue