Compare commits

..

22 Commits

Author SHA1 Message Date
Kim Kulling 65672a02b8
Update utIOStreamBuffer.cpp 2024-09-10 21:57:58 +02:00
Kim Kulling 3036de89d3
Update utIOStreamBuffer.cpp 2024-09-10 20:59:51 +02:00
Kim Kulling 26df0b50e5
Use correct warning switch off 2024-09-10 20:30:43 +02:00
Kim Kulling 8bd943abc6
Update CMakeLists.txt 2024-09-10 19:37:01 +02:00
Kim Kulling 3a39648358
Update gzclose.c
Fix compiler warning
2024-09-10 19:16:31 +02:00
Kim Kulling 7c81fa89e7
Update zutil.c
Disable warning.
2024-09-10 19:10:15 +02:00
Kim Kulling b65e84d759
Merge branch 'master' into kimkulling/add_windows_clang_issue-5519 2024-09-10 18:39:00 +02:00
Kim Kulling 709a8f2f79
Merge branch 'master' into kimkulling/add_windows_clang_issue-5519 2024-08-30 13:23:52 +02:00
Kim Kulling f499d947ff
Merge branch 'master' into kimkulling/add_windows_clang_issue-5519 2024-07-09 10:42:44 +02:00
Kim Kulling 718c517dcd
Update UnitTestFileGenerator.h 2024-04-18 14:54:25 +02:00
Kim Kulling 2beab55a4e
Merge branch 'master' into kimkulling/add_windows_clang_issue-5519 2024-04-18 10:44:44 +01:00
Kim Kulling a53bca85cb
Use save mktemp on windows 2024-04-18 11:44:33 +02:00
Kim Kulling 200e34f0ca
Update UnitTestFileGenerator.h 2024-04-09 21:15:15 +02:00
Kim Kulling f8b3023db3
Update UnitTestFileGenerator.h 2024-04-09 21:09:02 +02:00
Kim Kulling 0142bc35f7
Update UnitTestFileGenerator.h 2024-04-09 21:00:07 +02:00
Kim Kulling c740977594
Update UnitTestFileGenerator.h 2024-04-09 19:37:35 +01:00
Kim Kulling 1587c61ee7
Update UnitTestFileGenerator.h 2024-04-09 19:31:45 +01:00
Kim Kulling ecd144b63e
Update UnitTestFileGenerator.h 2024-04-09 19:13:25 +01:00
Kim Kulling efc046752c
Update ccpp.yml: Fix the filter 2024-04-09 14:56:23 +02:00
Kim Kulling b2437e5b59
Update ccpp.yml 2024-04-09 13:06:26 +02:00
Kim Kulling af31856221
Update ccpp.yml
- Build the viewer onl< with msvc
2024-04-09 11:14:55 +02:00
Kim Kulling a5d661e303
Update ccpp.yml
- Add windows clang build step
- Help to evaluate https://github.com/assimp/assimp/issues/5519
2024-04-09 11:03:12 +02:00
13 changed files with 43 additions and 52 deletions

View File

@ -16,9 +16,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++] name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, windows-latest-clang.exe, ubuntu-latest-clang++]
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
include: include:
- name: windows-latest-clang.exe
os: windows-latest
cxx: clang++.exe
cc: clang.exe
- name: windows-latest-cl.exe - name: windows-latest-cl.exe
os: windows-latest os: windows-latest
cxx: cl.exe cxx: cl.exe
@ -65,13 +69,13 @@ jobs:
${{ runner.os }}-DX_SDK ${{ runner.os }}-DX_SDK
- name: Download DXSetup - name: Download DXSetup
if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true' if: contains(matrix.name, 'windows-latest-cl.exe') && steps.dxcache.outputs.cache-hit != 'true'
run: | run: |
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK" cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
- name: Set Windows specific CMake arguments - name: Set Windows specific CMake arguments
if: contains(matrix.name, 'windows') if: contains(matrix.name, 'windows-latest-cl.exe')
id: windows_extra_cmake_args id: windows_extra_cmake_args
run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT

View File

@ -312,8 +312,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
child->mParent = last_parent; child->mParent = last_parent;
last_parent = child.mNode; last_parent = child.mNode;
new_abs_transform *= child->mTransformation;
} }
// attach geometry // attach geometry
@ -336,8 +334,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
postnode->mParent = last_parent; postnode->mParent = last_parent;
last_parent = postnode.mNode; last_parent = postnode.mNode;
new_abs_transform *= postnode->mTransformation;
} }
} else { } else {
// free the nodes we allocated as we don't need them // free the nodes we allocated as we don't need them

View File

@ -78,15 +78,7 @@ static constexpr aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Recursive parsing of LWS files // Recursive parsing of LWS files
namespace { void LWS::Element::Parse(const char *&buffer, const char *end) {
constexpr int MAX_DEPTH = 1000; // Define the maximum depth allowed
}
void LWS::Element::Parse(const char *&buffer, const char *end, int depth) {
if (depth > MAX_DEPTH) {
throw std::runtime_error("Maximum recursion depth exceeded in LWS::Element::Parse");
}
for (; SkipSpacesAndLineEnd(&buffer, end); SkipLine(&buffer, end)) { for (; SkipSpacesAndLineEnd(&buffer, end); SkipLine(&buffer, end)) {
// begin of a new element with children // begin of a new element with children
@ -129,7 +121,7 @@ void LWS::Element::Parse(const char *&buffer, const char *end, int depth) {
// parse more elements recursively // parse more elements recursively
if (sub) { if (sub) {
children.back().Parse(buffer, end, depth + 1); children.back().Parse(buffer, end);
} }
} }
} }

View File

@ -76,7 +76,7 @@ public:
std::list<Element> children; std::list<Element> children;
//! Recursive parsing function //! Recursive parsing function
void Parse(const char *&buffer, const char *end, int depth = 0); void Parse(const char *&buffer, const char *end);
}; };
#define AI_LWS_MASK (0xffffffff >> 4u) #define AI_LWS_MASK (0xffffffff >> 4u)

View File

@ -724,7 +724,6 @@ void MD3Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::vector<unsigned char> mBuffer2(fileSize); std::vector<unsigned char> mBuffer2(fileSize);
file->Read(&mBuffer2[0], 1, fileSize); file->Read(&mBuffer2[0], 1, fileSize);
mBuffer = &mBuffer2[0]; mBuffer = &mBuffer2[0];
const unsigned char* bufferEnd = mBuffer + fileSize;
pcHeader = (BE_NCONST MD3::Header *)mBuffer; pcHeader = (BE_NCONST MD3::Header *)mBuffer;
@ -750,15 +749,9 @@ void MD3Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// Navigate to the list of surfaces // Navigate to the list of surfaces
BE_NCONST MD3::Surface *pcSurfaces = (BE_NCONST MD3::Surface *)(mBuffer + pcHeader->OFS_SURFACES); BE_NCONST MD3::Surface *pcSurfaces = (BE_NCONST MD3::Surface *)(mBuffer + pcHeader->OFS_SURFACES);
if ((const unsigned char*)pcSurfaces + sizeof(MD3::Surface) * pcHeader->NUM_SURFACES > bufferEnd) {
throw DeadlyImportError("MD3 surface headers are outside the file");
}
// Navigate to the list of tags // Navigate to the list of tags
BE_NCONST MD3::Tag *pcTags = (BE_NCONST MD3::Tag *)(mBuffer + pcHeader->OFS_TAGS); BE_NCONST MD3::Tag *pcTags = (BE_NCONST MD3::Tag *)(mBuffer + pcHeader->OFS_TAGS);
if ((const unsigned char*)pcTags + sizeof(MD3::Tag) * pcHeader->NUM_TAGS > bufferEnd) {
throw DeadlyImportError("MD3 tags are outside the file");
}
// Allocate output storage // Allocate output storage
pScene->mNumMeshes = pcHeader->NUM_SURFACES; pScene->mNumMeshes = pcHeader->NUM_SURFACES;
@ -1033,10 +1026,6 @@ void MD3Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
for (unsigned int i = 0; i < pcHeader->NUM_TAGS; ++i, ++pcTags) { for (unsigned int i = 0; i < pcHeader->NUM_TAGS; ++i, ++pcTags) {
aiNode *nd = pScene->mRootNode->mChildren[i] = new aiNode(); aiNode *nd = pScene->mRootNode->mChildren[i] = new aiNode();
if ((const unsigned char*)pcTags + sizeof(MD3::Tag) > bufferEnd) {
throw DeadlyImportError("MD3 tag is outside the file");
}
nd->mName.Set((const char *)pcTags->NAME); nd->mName.Set((const char *)pcTags->NAME);
nd->mParent = pScene->mRootNode; nd->mParent = pScene->mRootNode;

View File

@ -1346,7 +1346,6 @@ add_compile_options(
IF (ASSIMP_WARNINGS_AS_ERRORS) IF (ASSIMP_WARNINGS_AS_ERRORS)
MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)")
IF (MSVC) IF (MSVC)
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror
-Wno-microsoft-enum-value -Wno-microsoft-enum-value
@ -1397,6 +1396,7 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
-Wno-undefined-func-template -Wno-undefined-func-template
-Wno-declaration-after-statement -Wno-declaration-after-statement
-Wno-deprecated-declarations -Wno-deprecated-declarations
-Wno-deprecated-non-prototype
) )
ELSE() ELSE()
TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX)

View File

@ -848,7 +848,11 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) {
break; break;
} }
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
continue;
#endif // no validation
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step // If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
if (pimpl->bExtraVerbose) { if (pimpl->bExtraVerbose) {
ASSIMP_LOG_DEBUG("Verbose Import: re-validating data structures"); ASSIMP_LOG_DEBUG("Verbose Import: re-validating data structures");
@ -860,7 +864,6 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) {
break; break;
} }
} }
#endif // no validation
#endif // ! DEBUG #endif // ! DEBUG
} }
pimpl->mProgressHandler->UpdatePostProcess( static_cast<int>(pimpl->mPostProcessingSteps.size()), pimpl->mProgressHandler->UpdatePostProcess( static_cast<int>(pimpl->mPostProcessingSteps.size()),
@ -936,7 +939,6 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
profiler->EndRegion( "postprocess" ); profiler->EndRegion( "postprocess" );
} }
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step // If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
if ( pimpl->bExtraVerbose || requestValidation ) { if ( pimpl->bExtraVerbose || requestValidation ) {
ASSIMP_LOG_DEBUG( "Verbose Import: revalidating data structures" ); ASSIMP_LOG_DEBUG( "Verbose Import: revalidating data structures" );
@ -947,7 +949,6 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
ASSIMP_LOG_ERROR( "Verbose Import: failed to revalidate data structures" ); ASSIMP_LOG_ERROR( "Verbose Import: failed to revalidate data structures" );
} }
} }
#endif // no validation
// clear any data allocated by post-process steps // clear any data allocated by post-process steps
pimpl->mPPShared->Clean(); pimpl->mPPShared->Clean();

View File

@ -31,7 +31,7 @@
#pragma once #pragma once
#if defined(_MSC_VER) #if defined(_WIN32)
# pragma warning( disable: 4273) # pragma warning( disable: 4273)
# define P2T_COMPILER_DLLEXPORT __declspec(dllexport) # define P2T_COMPILER_DLLEXPORT __declspec(dllexport)
# define P2T_COMPILER_DLLIMPORT __declspec(dllimport) # define P2T_COMPILER_DLLIMPORT __declspec(dllimport)

View File

@ -5,6 +5,9 @@
#include "gzguts.h" #include "gzguts.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
/* gzclose() is in a separate file so that it is linked in only if it is used. /* gzclose() is in a separate file so that it is linked in only if it is used.
That way the other gzclose functions can be used instead to avoid linking in That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */ unneeded compression or decompression routines. */
@ -23,3 +26,6 @@ int ZEXPORT gzclose(file)
return gzclose_r(file); return gzclose_r(file);
#endif #endif
} }
#pragma clang diagnostic pop

View File

@ -23,6 +23,8 @@ z_const char * const z_errmsg[10] = {
(z_const char *)"" (z_const char *)""
}; };
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
const char * ZEXPORT zlibVersion() const char * ZEXPORT zlibVersion()
{ {
@ -321,6 +323,7 @@ void ZLIB_INTERNAL zcfree(opaque, ptr)
(void)opaque; (void)opaque;
free(ptr); free(ptr);
} }
#pragma clang diagnostic pop
#endif /* MY_ZCALLOC */ #endif /* MY_ZCALLOC */

View File

@ -701,7 +701,7 @@ struct aiMaterialProperty {
* Material data is stored using a key-value structure. A single key-value * Material data is stored using a key-value structure. A single key-value
* pair is called a 'material property'. C++ users should use the provided * pair is called a 'material property'. C++ users should use the provided
* member functions of aiMaterial to process material properties, C users * member functions of aiMaterial to process material properties, C users
* have to stick with the aiGetMaterialXXX family of unbound functions. * have to stick with the aiMaterialGetXXX family of unbound functions.
* The library defines a set of standard keys (AI_MATKEY_XXX). * The library defines a set of standard keys (AI_MATKEY_XXX).
*/ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -45,32 +45,34 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
#define TMP_PATH "./" # define TMP_PATH "./"
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/" # define TMP_PATH "/tmp/"
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
# ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
# endif
#include <io.h> #include <io.h>
inline FILE* MakeTmpFile(char* tmplate) inline FILE* MakeTmpFile(char* tmplate) {
{ char *pathtemplate = tmplate;
auto pathtemplate = _mktemp(tmplate); int err = _mktemp_s(pathtemplate, std::strlen(pathtemplate));
EXPECT_EQ(err, 0);
EXPECT_NE(pathtemplate, nullptr); EXPECT_NE(pathtemplate, nullptr);
if(pathtemplate == nullptr) if(pathtemplate == nullptr) {
{
return nullptr; return nullptr;
} }
auto* fs = std::fopen(pathtemplate, "w+"); auto* fs = std::fopen(pathtemplate, "w+");
EXPECT_NE(fs, nullptr); EXPECT_NE(fs, nullptr); return fs;
return fs; return fs;
} }
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
inline FILE* MakeTmpFile(char* tmplate) inline FILE* MakeTmpFile(char* tmplate) {
{
auto fd = mkstemp(tmplate); auto fd = mkstemp(tmplate);
EXPECT_NE(-1, fd); EXPECT_NE(-1, fd);
if(fd == -1) if(fd == -1) {
{
return nullptr; return nullptr;
} }
auto fs = fdopen(fd, "w+"); auto fs = fdopen(fd, "w+");

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2024, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -89,7 +87,7 @@ TEST_F( IOStreamBufferTest, open_close_Test ) {
auto* fs = MakeTmpFile(fname); auto* fs = MakeTmpFile(fname);
ASSERT_NE(nullptr, fs); ASSERT_NE(nullptr, fs);
auto written = std::fwrite( data, sizeof(*data), dataCount, fs ); auto written = std::fwrite(data, sizeof(*data), dataCount, fs);
EXPECT_NE( 0U, written ); EXPECT_NE( 0U, written );
auto flushResult = std::fflush( fs ); auto flushResult = std::fflush( fs );
ASSERT_EQ(0, flushResult); ASSERT_EQ(0, flushResult);