Apply various clang-tidy checks for smartprs and modern C++ types

This commit is contained in:
Aaron Gokaslan
2022-11-08 11:03:55 -05:00
parent cfed74516b
commit ccfb175460
92 changed files with 542 additions and 541 deletions

View File

@@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/mesh.h>
#include <assimp/scene.h>
#include <memory>
#include <utility>
//#include <cctype>
//#include <memory>
@@ -121,11 +122,11 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
// check whether we can read from the file
if (stream.get() == NULL) {
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile);
}
if (stream == nullptr) {
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile);
}
// see if its compressed, if so uncompress it
// see if its compressed, if so uncompress it
if (GetExtension(pFile) == "zgl") {
#ifdef ASSIMP_BUILD_NO_COMPRESSED_XGL
ThrowException("Cannot read ZGL file since Assimp was built without compression support");
@@ -141,7 +142,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
compression.close();
}
// replace the input stream with a memory stream
stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t*>(uncompressed.data()), total));
stream = std::make_shared<MemoryIOStream>(reinterpret_cast<uint8_t *>(uncompressed.data()), total);
#endif
}