diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-05-23 22:44:57 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-05-23 22:44:57 +0700 |
commit | 98b3ce6512812cd1d91c60ca0e69d69c32838d8e (patch) | |
tree | 8af69c097b389fe494e97401f7808590314a5b6b /crypto/src/bcpg/ArmoredOutputStream.cs | |
parent | Add ValidateBufferArguments (diff) | |
download | BouncyCastle.NET-ed25519-98b3ce6512812cd1d91c60ca0e69d69c32838d8e.tar.xz |
Work on Stream classes
- consistent naming, ordering - CanRead/Seek/Write fixes - argument validation - some cases of blocking zero-byte Read calls
Diffstat (limited to 'crypto/src/bcpg/ArmoredOutputStream.cs')
-rw-r--r-- | crypto/src/bcpg/ArmoredOutputStream.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/crypto/src/bcpg/ArmoredOutputStream.cs b/crypto/src/bcpg/ArmoredOutputStream.cs index 0df5d1141..97bcbde51 100644 --- a/crypto/src/bcpg/ArmoredOutputStream.cs +++ b/crypto/src/bcpg/ArmoredOutputStream.cs @@ -239,45 +239,44 @@ namespace Org.BouncyCastle.Bcpg clearText = false; } - public override void WriteByte( - byte b) + public override void WriteByte(byte value) { if (clearText) { - outStream.WriteByte(b); + outStream.WriteByte(value); if (newLine) { - if (!(b == '\n' && lastb == '\r')) + if (!(value == '\n' && lastb == '\r')) { newLine = false; } - if (b == '-') + if (value == '-') { outStream.WriteByte((byte)' '); outStream.WriteByte((byte)'-'); // dash escape } } - if (b == '\r' || (b == '\n' && lastb != '\r')) + if (value == '\r' || (value == '\n' && lastb != '\r')) { newLine = true; } - lastb = b; + lastb = value; return; } if (start) { - bool newPacket = (b & 0x40) != 0; + bool newPacket = (value & 0x40) != 0; int tag; if (newPacket) { - tag = b & 0x3f; + tag = value & 0x3f; } else { - tag = (b & 0x3f) >> 2; + tag = (value & 0x3f) >> 2; } switch ((PacketTag)tag) @@ -334,8 +333,8 @@ namespace Org.BouncyCastle.Bcpg } } - crc.Update(b); - buf[bufPtr++] = b & 0xff; + crc.Update(value); + buf[bufPtr++] = value & 0xff; } /** |