diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-05 13:54:30 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-05 13:54:30 +0300 |
commit | 7ec87612504f25fc2f1873ce19d138edafb14d7a (patch) | |
tree | dd6e5fbbdddccd2186f09429b0df2ba231f4792b /source/blender/makesdna/intern | |
parent | 64c3ea272e7be85c0f589a6f28eae28d7e7d0a9e (diff) |
Fixing bugs in future:
DNA reconstruct now terminates strings, when the new string
in a file is longer than in current definition. This will
enable a safer ID and other name lengthening, keeping at
least some forward compitability.
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 068336a1717..cd14acd520c 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -869,6 +869,10 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const cha mul= len/oldsize; mul*= (cursize < oldsize)? cursize: oldsize; memcpy(curdata, olddata, mul); + + /* terminate strings */ + if(oldsize > cursize && strcmp(type, "char")==0) + curdata[mul-1]= 0; } else { if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); |