From 49865c2a4ffd91fff774b513f0d6c4f6a7ed4a72 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 16 Jun 2022 17:13:48 +0700 Subject: Fix PORTABLE build --- crypto/src/asn1/BEROctetStringGenerator.cs | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/crypto/src/asn1/BEROctetStringGenerator.cs b/crypto/src/asn1/BEROctetStringGenerator.cs index bed40b566..7893139d6 100644 --- a/crypto/src/asn1/BEROctetStringGenerator.cs +++ b/crypto/src/asn1/BEROctetStringGenerator.cs @@ -108,31 +108,29 @@ namespace Org.BouncyCastle.Asn1 { if (disposing) { - if (_off != 0) - { - DerOctetString.Encode(_derOut, true, _buf, 0, _off); - } - - _derOut.FlushInternal(); - - _gen.WriteBerEnd(); + ImplClose(); } base.Dispose(disposing); } #else - public override void Close() - { - if (_off != 0) - { - DerOctetString.Encode(_derOut, _buf, 0, _off); - } + public override void Close() + { + ImplClose(); + base.Close(); + } +#endif + + private void ImplClose() + { + if (_off != 0) + { + DerOctetString.Encode(_derOut, _buf, 0, _off); + } _derOut.FlushInternal(); _gen.WriteBerEnd(); - base.Close(); - } -#endif - } - } + } + } + } } -- cgit 1.4.1