ImfCheckFile.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: BSD-3-Clause
  2. // Copyright (c) Contributors to the OpenEXR Project.
  3. #ifndef INCLUDED_IMF_CHECKFILE_H
  4. #define INCLUDED_IMF_CHECKFILE_H
  5. #include "ImfUtilExport.h"
  6. #include "ImfNamespace.h"
  7. #include <cstddef>
  8. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  9. //
  10. // attempt to read the given file as an OpenEXR, using various OpenEXR read paths.
  11. // This can be used to validate correctness of the library, when running the library
  12. // with a sanitizer or memory checker, as well as checking that a file is a correct OpenEXR
  13. //
  14. // returns true if the file reads correctly using expected API calls, or false
  15. // if an exception was thrown that indicates the file is invalid
  16. //
  17. // if reduceMemory is true, will avoid tests or inputs that are known to
  18. // take large amounts of memory. This may hide errors within the file or library.
  19. //
  20. // if reduceTime is true and an error is found within the file, then future tests are reduced for speed.
  21. // This may hide errors within the library.
  22. //
  23. //
  24. IMFUTIL_EXPORT bool
  25. checkOpenEXRFile(const char* fileName,
  26. bool reduceMemory = false,
  27. bool reduceTime = false,
  28. bool enableCoreCheck = false
  29. );
  30. //
  31. // overloaded version of checkOpenEXRFile that takes a pointer to in-memory data
  32. //
  33. IMFUTIL_EXPORT bool
  34. checkOpenEXRFile(const char* data,
  35. size_t numBytes,
  36. bool reduceMemory = false,
  37. bool reduceTime = false,
  38. bool enableCoreCheck = false
  39. );
  40. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  41. #endif