Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-11-11 19:35:26 +0300
committerJulian Eisel <julian@blender.org>2020-11-11 19:35:26 +0300
commitca7079a44e773a26d6f6aa6730f53a16e7de6cd5 (patch)
treeb58ff6ccca5e2afd18da8365705f47112eac0a38 /source/blender/imbuf/intern/oiio/openimageio_api.cpp
parentfdd9cb713e2e96e430eb022f034bfa9973afc75c (diff)
parent5b5ec0a2e910a42d7c02774a47fd9c70b6f16f06 (diff)
Merge branch 'master' into outliner-cpp-refactoroutliner-cpp-refactor
Diffstat (limited to 'source/blender/imbuf/intern/oiio/openimageio_api.cpp')
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 9d8c5d50a89..1e8c3c25778 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -163,16 +163,13 @@ static ImBuf *imb_oiio_load_image_float(
extern "C" {
-int imb_is_a_filepath_photoshop(const char *filename)
+bool imb_is_a_photoshop(const unsigned char *mem, size_t size)
{
- const char *photoshop_extension[] = {
- ".psd",
- ".pdd",
- ".psb",
- nullptr,
- };
-
- return BLI_path_extension_check_array(filename, photoshop_extension);
+ const unsigned char magic[4] = {'8', 'B', 'P', 'S'};
+ if (size < sizeof(magic)) {
+ return false;
+ }
+ return memcmp(magic, mem, sizeof(magic)) == 0;
}
int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags)
@@ -198,7 +195,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
const bool is_colorspace_manually_set = (colorspace[0] != '\0');
/* load image from file through OIIO */
- if (imb_is_a_filepath_photoshop(filename) == 0) {
+ if (IMB_ispic_type_matches(filename, IMB_FTYPE_PSD) == 0) {
return nullptr;
}