diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-06-26 18:42:33 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-06-26 18:42:33 +0300 |
commit | b4c01aca30faa16900084c081faff6fbaf130872 (patch) | |
tree | 51e66b197e1706b22fd6b832c4a223ebdfb1b375 /source | |
parent | d5a42bce38fd6548728b47a4ec76afdd75668341 (diff) | |
parent | 599e979d90327c1e10031f992cb2be2cda414825 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 4 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 41 |
2 files changed, 39 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 13c033523fa..a52ae75e87b 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -40,9 +40,6 @@ #include <algorithm> #include <iostream> - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-register" #include <half.h> #include <Iex.h> #include <ImfVersion.h> @@ -67,7 +64,6 @@ #include <ImfTiledOutputPart.h> #include <ImfPartType.h> #include <ImfPartHelper.h> -#pragma clang diagnostic pop #include "DNA_scene_types.h" /* For OpenEXR compression constants */ diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 257c57e5a9a..cf059c08cd5 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -977,10 +977,47 @@ static int elem_strcmp(const char *name, const char *oname) } /** + * Returns whether the specified field exists according to the struct format + * pointed to by old. + * + * \param sdna Old SDNA + * \param type Current field type name + * \param name Current field name + * \param old Pointer to struct information in sdna + * \return true when existsing, false otherwise. + */ +static bool elem_exists( + const SDNA *sdna, + const char *type, + const char *name, + const short *old) +{ + int a, elemcount; + const char *otype, *oname; + + /* in old is the old struct */ + elemcount = old[1]; + old += 2; + for (a = 0; a < elemcount; a++, old += 2) { + otype = sdna->types[old[0]]; + oname = sdna->names[old[1]]; + + if (elem_strcmp(name, oname) == 0) { /* name equal */ + return strcmp(type, otype) == 0; /* type equal */ + } + } + return false; +} + +/** * Returns the address of the data for the specified field within olddata * according to the struct format pointed to by old, or NULL if no such * field can be found. * + * Passing olddata=NULL doesn't work reliably for existence checks; it will + * return NULL both when the field is found at offset 0 and when it is not + * found at all. For field existence checks, use elem_exists() instead. + * * \param sdna Old SDNA * \param type Current field type name * \param name Current field name @@ -1390,9 +1427,9 @@ bool DNA_struct_elem_find(const SDNA *sdna, const char *stype, const char *varty if (SDNAnr != -1) { const short * const spo = sdna->structs[SDNAnr]; - const char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); + const bool found = elem_exists(sdna, vartype, name, spo); - if (cp) { + if (found) { return true; } } |