diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-05-24 17:48:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-05-24 17:48:10 +0300 |
commit | faec4309147988fbab7b7d7ec661f5130358d169 (patch) | |
tree | 0c839f8f88fe80f4a3762980adb5efe729ce1b44 /source/blender/makesdna/intern | |
parent | f85745b17bfe68673bf5f799e98c617d9471ddf1 (diff) | |
parent | e1dd83b399d46d81ea51f6c41725eec5c1a1db7a (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/cycles/blender/blender_curves.cpp
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/transform/transform_snap_object.c
source/blender/editors/util/undo.c
source/blender/makesrna/intern/rna_object_force.c
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index a714518c32f..d714587d7ab 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -718,6 +718,28 @@ static int arraysize(const char *str) return mul; } +static bool check_field_alignment(int firststruct, int structtype, int type, int len, + const char *name, const char *detail) +{ + bool result = true; + if (type < firststruct && typelens_native[type] > 4 && (len % 8)) { + fprintf(stderr, "Align 8 error (%s) in struct: %s %s (add %d padding bytes)\n", + detail, types[structtype], name, len % 8); + result = false; + } + if (typelens_native[type] > 3 && (len % 4) ) { + fprintf(stderr, "Align 4 error (%s) in struct: %s %s (add %d padding bytes)\n", + detail, types[structtype], name, len % 4); + result = false; + } + if (typelens_native[type] == 2 && (len % 2) ) { + fprintf(stderr, "Align 2 error (%s) in struct: %s %s (add %d padding bytes)\n", + detail, types[structtype], name, len % 2); + result = false; + } + return result; +} + static int calculate_structlens(int firststruct) { int unknown = nr_structs, lastunknown; @@ -813,20 +835,11 @@ static int calculate_structlens(int firststruct) } } - /* 2-4-8 aligned/ */ - if (type < firststruct && typelens_native[type] > 4 && (len_native % 8)) { - fprintf(stderr, "Align 8 error in struct: %s %s (add %d padding bytes)\n", - types[structtype], cp, len_native % 8); - dna_error = 1; - } - if (typelens_native[type] > 3 && (len_native % 4) ) { - fprintf(stderr, "Align 4 error in struct: %s %s (add %d padding bytes)\n", - types[structtype], cp, len_native % 4); + /* Check 2-4-8 aligned. */ + if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) { dna_error = 1; } - else if (typelens_native[type] == 2 && (len_native % 2) ) { - fprintf(stderr, "Align 2 error in struct: %s %s (add %d padding bytes)\n", - types[structtype], cp, len_native % 2); + if (!check_field_alignment(firststruct, structtype, type, len_64, cp, "64 bit")) { dna_error = 1; } |