diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-09 20:53:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-09 20:53:59 +0300 |
commit | 8a924899a9e95e33ccdf1568a7b38d355bb91a38 (patch) | |
tree | 71eda63ea023940cef6c7725609c500596953e3a /source/blender/makesdna | |
parent | 296d125e2596ecd11be32617b32d29b085b26863 (diff) |
Byte swap doubles on file read
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 16fbcbebe50..cea61656abb 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -1168,10 +1168,10 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } } else { - /* non-struct field type */ + /* non-struct field type */ if (ispointer(name)) { if (oldsdna->pointerlen == 8) { - + mul = DNA_elem_array_size(name); cpo = cur; while (mul--) { @@ -1186,20 +1186,14 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } } else { - - if (spc[0] == SDNA_TYPE_SHORT || - spc[0] == SDNA_TYPE_USHORT) - { - - /* exception: variable called blocktype/ipowin: derived from ID_ */ + if (ELEM(spc[0], SDNA_TYPE_SHORT, SDNA_TYPE_USHORT)) { + + /* exception: variable called blocktype: derived from ID_ */ bool skip = false; if (name[0] == 'b' && name[1] == 'l') { if (strcmp(name, "blocktype") == 0) skip = true; } - else if (name[0] == 'i' && name[1] == 'p') { - if (strcmp(name, "ipowin") == 0) skip = true; - } - + if (skip == false) { mul = DNA_elem_array_size(name); cpo = cur; @@ -1211,11 +1205,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } } } - else if ( (spc[0] == SDNA_TYPE_INT || - spc[0] == SDNA_TYPE_LONG || - spc[0] == SDNA_TYPE_ULONG || - spc[0] == SDNA_TYPE_FLOAT)) - { + else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT, SDNA_TYPE_LONG, SDNA_TYPE_ULONG)) { mul = DNA_elem_array_size(name); cpo = cur; @@ -1229,9 +1219,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) cpo += 4; } } - else if ( (spc[0] == SDNA_TYPE_INT64) || - (spc[0] == SDNA_TYPE_UINT64)) - { + else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) { mul = DNA_elem_array_size(name); cpo = cur; while (mul--) { @@ -1243,7 +1231,6 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) cpo += 8; } } - /* FIXME: no conversion for SDNA_TYPE_DOUBLE? */ } } cur += elen; |