diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-22 14:12:44 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-22 14:12:44 +0300 |
commit | 97ee7f8609bed555ff4bd371b7e25d13b2d6a0d6 (patch) | |
tree | 0aadae430c5c7d84c820fd567d815c455227d13d /source/blender/makesdna/intern | |
parent | 48c58bd9138ad88d8aaa24ad9d6d67e1303e7905 (diff) | |
parent | 493c6b622fe3fb80243dfeac29f9399ac6fc4a8c (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/blenloader/intern/readfile.c
source/blender/editors/physics/particle_edit.c
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r-- | source/blender/makesdna/intern/CMakeLists.txt | 5 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 50 |
2 files changed, 10 insertions, 45 deletions
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 52487edfd2b..b4ada7ffbf1 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -94,10 +94,11 @@ set(INC_SYS ) set(SRC - ../../blenlib/intern/BLI_mempool.c - ../../blenlib/intern/listbase.c ../../blenlib/intern/BLI_ghash.c + ../../blenlib/intern/BLI_mempool.c + ../../blenlib/intern/endian_switch.c ../../blenlib/intern/hash_mm2a.c + ../../blenlib/intern/listbase.c ) blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index b8783da73ca..99ab29fbdcc 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -43,6 +43,7 @@ #include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN #include "BLI_utildefines.h" +#include "BLI_endian_switch.h" #ifdef WITH_DNA_GHASH # include "BLI_ghash.h" @@ -1126,7 +1127,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) */ int a, mul, elemcount, elen, elena, firststructtypenr; const short *spo, *spc; - char *cpo, *cur, cval; + char *cur; const char *type, *name; if (oldSDNAnr == -1) return; @@ -1150,7 +1151,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) if (spc[0] >= firststructtypenr && !ispointer(name)) { /* struct field type */ /* where does the old data start (is there one?) */ - cpo = find_elem(oldsdna, type, name, spo, data, NULL); + char *cpo = find_elem(oldsdna, type, name, spo, data, NULL); if (cpo) { oldSDNAnr = DNA_struct_find_nr(oldsdna, type); @@ -1167,18 +1168,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) /* non-struct field type */ if (ispointer(name)) { if (oldsdna->pointerlen == 8) { - - mul = DNA_elem_array_size(name); - cpo = cur; - while (mul--) { - cval = cpo[0]; cpo[0] = cpo[7]; cpo[7] = cval; - cval = cpo[1]; cpo[1] = cpo[6]; cpo[6] = cval; - cval = cpo[2]; cpo[2] = cpo[5]; cpo[5] = cval; - cval = cpo[3]; cpo[3] = cpo[4]; cpo[4] = cval; - - cpo += 8; - } - + BLI_endian_switch_int64_array((int64_t *)cur, DNA_elem_array_size(name)); } } else { @@ -1191,14 +1181,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } if (skip == false) { - mul = DNA_elem_array_size(name); - cpo = cur; - while (mul--) { - cval = cpo[0]; - cpo[0] = cpo[1]; - cpo[1] = cval; - cpo += 2; - } + BLI_endian_switch_int16_array((int16_t *)cur, DNA_elem_array_size(name)); } } else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT)) { @@ -1206,29 +1189,10 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) * but turns out we only used for runtime vars and * only once for a struct type thats no longer used. */ - mul = DNA_elem_array_size(name); - cpo = cur; - while (mul--) { - cval = cpo[0]; - cpo[0] = cpo[3]; - cpo[3] = cval; - cval = cpo[1]; - cpo[1] = cpo[2]; - cpo[2] = cval; - cpo += 4; - } + BLI_endian_switch_int32_array((int32_t *)cur, DNA_elem_array_size(name)); } else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) { - mul = DNA_elem_array_size(name); - cpo = cur; - while (mul--) { - cval = cpo[0]; cpo[0] = cpo[7]; cpo[7] = cval; - cval = cpo[1]; cpo[1] = cpo[6]; cpo[6] = cval; - cval = cpo[2]; cpo[2] = cpo[5]; cpo[5] = cval; - cval = cpo[3]; cpo[3] = cpo[4]; cpo[4] = cval; - - cpo += 8; - } + BLI_endian_switch_int64_array((int64_t *)cur, DNA_elem_array_size(name)); } } } |