From a74f8f2252e5ce725c9900efd6f5d498070baecd Mon Sep 17 00:00:00 2001 From: Afshin Arani Date: Mon, 14 Sep 2020 15:19:12 +0430 Subject: [PATCH] Removing constructor double write In "TLObject.Serialize() -> Serialize(BinaryWriter br) -> SerializeBody" code path, constructor get written two times instead of once, which since this code path is currently unused and it's only provided for completeness, It's undetectable while testing. --- src/TgSharp.TL/TLObject.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/TgSharp.TL/TLObject.cs b/src/TgSharp.TL/TLObject.cs index 27b478e..bc80506 100644 --- a/src/TgSharp.TL/TLObject.cs +++ b/src/TgSharp.TL/TLObject.cs @@ -27,17 +27,12 @@ namespace TgSharp.TL using (MemoryStream m = new MemoryStream()) using (BinaryWriter bw = new BinaryWriter(m)) { - Serialize(bw); + SerializeBody(bw); bw.Close(); m.Close(); return m.ToArray(); } } - public void Serialize(BinaryWriter writer) - { - writer.Write(Constructor); - SerializeBody(writer); - } public void Deserialize(BinaryReader reader) { int constructorId = reader.ReadInt32();