From 19fade216418888061142c3c51bf90ea47954987 Mon Sep 17 00:00:00 2001 From: CwTCwT Date: Sat, 9 Jun 2018 20:57:32 +0200 Subject: [PATCH] travis changes according clang 5.0 --- code/BlenderCustomData.cpp | 15 ++++++++++----- code/BlenderDNA.h | 4 ++-- code/BlenderDNA.inl | 2 +- code/BlenderScene.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/code/BlenderCustomData.cpp b/code/BlenderCustomData.cpp index 566dd8edf..22604b918 100644 --- a/code/BlenderCustomData.cpp +++ b/code/BlenderCustomData.cpp @@ -24,7 +24,7 @@ namespace Assimp { /** * @brief pointer to function read memory for cnt CustomData types */ - typedef void *(*PAlloc)(const size_t cnt); + typedef uint8_t *(*PAlloc)(const size_t cnt); /** * @brief helper macro to define Structure specific read function @@ -56,7 +56,7 @@ namespace Assimp { * } */ #define IMPL_STRUCT_ALLOC(ty) \ - void *alloc##ty(const size_t cnt) { \ + uint8_t *alloc##ty(const size_t cnt) { \ return new uint8_t[cnt * sizeof(ty)]; \ } @@ -84,6 +84,11 @@ namespace Assimp { struct CustomDataTypeDescription { PRead Read; ///< function to read one CustomData type element PAlloc Alloc; ///< function to allocate n type elements + + CustomDataTypeDescription(PRead read, PAlloc alloc) + : Read(read) + , Alloc(alloc) + {} }; /** @@ -96,13 +101,13 @@ namespace Assimp { * @note IMPL_STRUCT_READ for same ty must be used earlier to implement the typespecific read function */ #define DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(ty) \ - CustomDataTypeDescription{ &read##ty, &alloc##ty } + CustomDataTypeDescription(&read##ty, &alloc##ty) /** * @brief helper macro to define CustomDataTypeDescription for UNSUPPORTED type */ #define DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION \ - CustomDataTypeDescription{ nullptr, nullptr } + CustomDataTypeDescription(nullptr, nullptr) /** * @brief descriptors for data pointed to from CustomDataLayer.data @@ -164,7 +169,7 @@ namespace Assimp { return cdtype >= 0 && cdtype < CD_NUMTYPES; } - bool readCustomData(std::shared_ptr &out, const int cdtype, const size_t cnt, const FileDatabase &db) { + bool readCustomData(std::shared_ptr &out, const int cdtype, const size_t cnt, const FileDatabase &db) { if (!isValidCustomDataType(cdtype)) { throw Error((Formatter::format(), "CustomData.type ", cdtype, " out of index")); } diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index 85441f6e2..1c60ceef8 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -329,7 +329,7 @@ public: * @return true when read was successful */ template - bool ReadCustomDataPtr(std::shared_ptr&out, int cdtype, const char* name, const FileDatabase& db) const; + bool ReadCustomDataPtr(std::shared_ptr&out, int cdtype, const char* name, const FileDatabase& db) const; private: @@ -833,7 +833,7 @@ private: * @param[in] db to read elements from * @return true when ok */ -bool readCustomData(std::shared_ptr &out, int cdtype, size_t cnt, const FileDatabase &db); +bool readCustomData(std::shared_ptr &out, int cdtype, size_t cnt, const FileDatabase &db); } // end Blend diff --git a/code/BlenderDNA.inl b/code/BlenderDNA.inl index 6a34ac18c..e10d86d30 100644 --- a/code/BlenderDNA.inl +++ b/code/BlenderDNA.inl @@ -310,7 +310,7 @@ void Structure :: ReadField(T& out, const char* name, const FileDatabase& db) co //-------------------------------------------------------------------------------- // field parsing for raw untyped data (like CustomDataLayer.data) template -bool Structure::ReadCustomDataPtr(std::shared_ptr&out, int cdtype, const char* name, const FileDatabase& db) const { +bool Structure::ReadCustomDataPtr(std::shared_ptr&out, int cdtype, const char* name, const FileDatabase& db) const { const StreamReaderAny::pos old = db.reader->GetCurrentPos(); diff --git a/code/BlenderScene.h b/code/BlenderScene.h index 35bc5cf1c..1405570a7 100644 --- a/code/BlenderScene.h +++ b/code/BlenderScene.h @@ -399,7 +399,7 @@ struct CustomDataLayer : ElemBase { int active_mask; int uid; char name[64]; - std::shared_ptr data; // must be converted to real type according type member + std::shared_ptr data; // must be converted to real type according type member, usage of uint8_t since CustomDataLayer() : ElemBase()