Skip to content

Commit

Permalink
Merge branch 'master' into 1-4489
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling authored Mar 10, 2023
2 parents 02a4276 + e308474 commit c9539f6
Show file tree
Hide file tree
Showing 315 changed files with 31,196 additions and 2,701 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,13 @@ jobs:
- name: test
run: cd build/bin && ./unit
shell: bash

job3:
name: printf-sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: run scan_printf script
run: ./scripts/scan_printf.sh
shell: bash
4 changes: 4 additions & 0 deletions code/AssetLib/FBX/FBXConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,12 @@ void FBXConverter::SetupNodeMetadata(const Model &model, aiNode &nd) {
data->Set(index++, prop.first, interpretedBool->Value());
} else if (const TypedProperty<int> *interpretedInt = prop.second->As<TypedProperty<int>>()) {
data->Set(index++, prop.first, interpretedInt->Value());
} else if (const TypedProperty<uint32_t> *interpretedUInt = prop.second->As<TypedProperty<uint32_t>>()) {
data->Set(index++, prop.first, interpretedUInt->Value());
} else if (const TypedProperty<uint64_t> *interpretedUint64 = prop.second->As<TypedProperty<uint64_t>>()) {
data->Set(index++, prop.first, interpretedUint64->Value());
} else if (const TypedProperty<int64_t> *interpretedint64 = prop.second->As<TypedProperty<int64_t>>()) {
data->Set(index++, prop.first, interpretedint64->Value());
} else if (const TypedProperty<float> *interpretedFloat = prop.second->As<TypedProperty<float>>()) {
data->Set(index++, prop.first, interpretedFloat->Value());
} else if (const TypedProperty<std::string> *interpretedString = prop.second->As<TypedProperty<std::string>>()) {
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Ogre/OgreXmlSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ bool OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *me
OgreXmlSerializer serializer(xmlParser.get());
XmlNode root = xmlParser->getRootNode();
if (std::string(root.name()) != nnSkeleton) {
printf("\nSkeleton is not a valid root: %s\n", root.name());
ASSIMP_LOG_VERBOSE_DEBUG("nSkeleton is not a valid root: ", root.name(), ".");
for (auto &a : root.children()) {
if (std::string(a.name()) == nnSkeleton) {
root = a;
Expand Down
2 changes: 0 additions & 2 deletions code/CApi/AssimpCExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
Expand Down
20 changes: 10 additions & 10 deletions code/CApi/CInterfaceIOWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
Expand Down Expand Up @@ -47,46 +45,48 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

namespace Assimp {

// ------------------------------------------------------------------------------------------------
CIOStreamWrapper::~CIOStreamWrapper() {
/* Various places depend on this destructor to close the file */
if (mFile) {
// Various places depend on this destructor to close the file
if (mFile != nullptr) {

mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile);
}
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
size_t CIOStreamWrapper::Read(void *pvBuffer,
size_t pSize,
size_t pCount) {
// need to typecast here as C has no void*
return mFile->ReadProc(mFile, (char *)pvBuffer, pSize, pCount);
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
size_t CIOStreamWrapper::Write(const void *pvBuffer,
size_t pSize,
size_t pCount) {
// need to typecast here as C has no void*
return mFile->WriteProc(mFile, (const char *)pvBuffer, pSize, pCount);
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
aiReturn CIOStreamWrapper::Seek(size_t pOffset,
aiOrigin pOrigin) {
return mFile->SeekProc(mFile, pOffset, pOrigin);
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
size_t CIOStreamWrapper::Tell() const {
return mFile->TellProc(mFile);
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
size_t CIOStreamWrapper::FileSize() const {
return mFile->FileSizeProc(mFile);
}

// ...................................................................
// ------------------------------------------------------------------------------------------------
void CIOStreamWrapper::Flush() {
return mFile->FlushProc(mFile);
}
Expand Down
55 changes: 33 additions & 22 deletions code/CApi/CInterfaceIOWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,48 +47,59 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/cfileio.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/ai_assert.h>

namespace Assimp {

class CIOSystemWrapper;

// ------------------------------------------------------------------------------------------------
// Custom IOStream implementation for the C-API
class CIOStreamWrapper : public IOStream {
/// @brief Custom IOStream implementation for the C-API-
// ------------------------------------------------------------------------------------------------
class CIOStreamWrapper final : public IOStream {
public:
explicit CIOStreamWrapper(aiFile *pFile, CIOSystemWrapper *io) :
mFile(pFile),
mIO(io) {}
~CIOStreamWrapper(void);

size_t Read(void *pvBuffer, size_t pSize, size_t pCount);
size_t Write(const void *pvBuffer, size_t pSize, size_t pCount);
aiReturn Seek(size_t pOffset, aiOrigin pOrigin);
size_t Tell(void) const;
size_t FileSize() const;
void Flush();
explicit CIOStreamWrapper(aiFile *pFile, CIOSystemWrapper *io);
~CIOStreamWrapper() override;
size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override;
size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) override;
aiReturn Seek(size_t pOffset, aiOrigin pOrigin) override;
size_t Tell(void) const override;
size_t FileSize() const override;
void Flush() override;

private:
aiFile *mFile;
CIOSystemWrapper *mIO;
};

class CIOSystemWrapper : public IOSystem {
inline CIOStreamWrapper::CIOStreamWrapper(aiFile *pFile, CIOSystemWrapper *io) :
mFile(pFile),
mIO(io) {
ai_assert(io != nullptr);
}

// ------------------------------------------------------------------------------------------------
/// @brief Custom IO-System wrapper implementation for the C-API.
// ------------------------------------------------------------------------------------------------
class CIOSystemWrapper final : public IOSystem {
friend class CIOStreamWrapper;

public:
explicit CIOSystemWrapper(aiFileIO *pFile) :
mFileSystem(pFile) {}

bool Exists(const char *pFile) const;
char getOsSeparator() const;
IOStream *Open(const char *pFile, const char *pMode = "rb");
void Close(IOStream *pFile);
explicit CIOSystemWrapper(aiFileIO *pFile);
~CIOSystemWrapper() override = default;
bool Exists(const char *pFile) const override;
char getOsSeparator() const override;
IOStream *Open(const char *pFile, const char *pMode = "rb") override;
void Close(IOStream *pFile) override;

private:
aiFileIO *mFileSystem;
};

inline CIOSystemWrapper::CIOSystemWrapper(aiFileIO *pFile) : mFileSystem(pFile) {
ai_assert(pFile != nullptr);
}

} // namespace Assimp

#endif
#endif // AI_CIOSYSTEM_H_INCLUDED
4 changes: 3 additions & 1 deletion code/Common/Subdivision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <stdio.h>

#include <unordered_map>

using namespace Assimp;
void mydummy() {}

Expand Down Expand Up @@ -78,7 +80,7 @@ class CatmullClarkSubdivider : public Subdivider {
};

typedef std::vector<unsigned int> UIntVector;
typedef std::map<uint64_t, Edge> EdgeMap;
typedef std::unordered_map<uint64_t, Edge> EdgeMap;

// ---------------------------------------------------------------------------
// Hashing function to derive an index into an #EdgeMap from two given
Expand Down
Loading

0 comments on commit c9539f6

Please sign in to comment.