Rebuilt the data file, and fixed the handling of name aliases.

This commit is contained in:
GoldenCrystal
2014-11-21 17:04:55 +01:00
parent b148e69ca0
commit 2324d2c272
5 changed files with 10 additions and 13 deletions
@@ -57,11 +57,8 @@ namespace System.Unicode.Builder
/// <param name="nameAlias">The name alias value to write.</param>
public static void WriteNameAliasToFile(this BinaryWriter writer, UnicodeNameAlias nameAlias)
{
// This method will stuff two extra bits together with the byte count, provided that this one doesn't exceed 64.
var bytes = Encoding.UTF8.GetBytes(nameAlias.Name);
if (bytes.Length > 64) throw new InvalidOperationException("Did not expect UTF-8 encoded name aliases to be longer than 64 bytes.");
writer.WritePackedLength((byte)(nameAlias.Kind - 1), nameAlias.Name.Length);
writer.Write(bytes);
writer.Write(nameAlias.Name);
writer.Write((byte)nameAlias.Kind);
}
/// <summary>Writes a character name, packing two information bits along with the length.</summary>