use time-tested RoundUp function and calculate table size minus length of '@UTF' signature (maybe this is wrong)

This commit is contained in:
Michael Becker 2019-11-23 21:16:32 -05:00
parent 0e0e176111
commit 3bedeaaa5a
No known key found for this signature in database
GPG Key ID: 389DFF5D73781A12

View File

@ -387,7 +387,7 @@ namespace UniversalEditor.Plugins.CRI.DataFormats.Database.UTF
}
}
int tableSize = 32; // size of entire file
int tableSize = 28; // size of entire file minus "@UTF" signature
tableSize += (5 * dt.Fields.Count);
tableSize += (dt.Name.Length + 1);
@ -432,8 +432,7 @@ namespace UniversalEditor.Plugins.CRI.DataFormats.Database.UTF
}
}
tableSize += ((8 - (tableSize % 8)) % 8);
tableSize -= 8;
tableSize = tableSize.RoundUp(8);
bw.WriteInt32(tableSize);
bw.WriteInt32(rowsOffset);