summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-08 12:43:15 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-08 12:43:15 +0700
commit0ff97264a685fba438b81238f692a4cbb942011f (patch)
tree2f2527937d551aad5ce0abc9351450d515cb9c2a /crypto
parentDateTime portability changes for tests under PORTABLE (diff)
downloadBouncyCastle.NET-ed25519-0ff97264a685fba438b81238f692a4cbb942011f.tar.xz
Tighten up the correspondence b/w Close/Dispose
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bzip2/src/CBZip2OutputStream.cs6
-rw-r--r--crypto/src/asn1/util/FilterStream.cs1
-rw-r--r--crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs1
-rw-r--r--crypto/src/crypto/io/CipherStream.cs1
-rw-r--r--crypto/src/crypto/io/DigestStream.cs1
-rw-r--r--crypto/src/crypto/io/MacStream.cs1
-rw-r--r--crypto/src/crypto/io/SignerStream.cs1
-rw-r--r--crypto/src/crypto/operators/Asn1Signature.cs16
-rw-r--r--crypto/src/crypto/tls/ByteQueueStream.cs14
-rw-r--r--crypto/src/crypto/tls/TlsStream.cs1
-rw-r--r--crypto/src/openpgp/PgpCompressedDataGenerator.cs2
-rw-r--r--crypto/src/util/io/BaseInputStream.cs1
-rw-r--r--crypto/src/util/io/BaseOutputStream.cs1
-rw-r--r--crypto/src/util/io/FilterStream.cs1
-rw-r--r--crypto/src/util/io/TeeInputStream.cs1
-rw-r--r--crypto/src/util/io/TeeOutputStream.cs1
-rw-r--r--crypto/src/util/zlib/ZDeflaterOutputStream.cs1
-rw-r--r--crypto/src/util/zlib/ZInflaterInputStream.cs1
-rw-r--r--crypto/src/util/zlib/ZInputStream.cs21
-rw-r--r--crypto/src/util/zlib/ZOutputStream.cs5
20 files changed, 34 insertions, 44 deletions
diff --git a/crypto/bzip2/src/CBZip2OutputStream.cs b/crypto/bzip2/src/CBZip2OutputStream.cs
index 80b054c29..ffac073fb 100644
--- a/crypto/bzip2/src/CBZip2OutputStream.cs
+++ b/crypto/bzip2/src/CBZip2OutputStream.cs
@@ -402,15 +402,15 @@ namespace Org.BouncyCastle.Apache.Bzip2
         }
 #else
         public override void Close() {
-            if (closed) {
+            if (closed)
                 return;
-            }
 
             Finish();
 
             closed = true;
-            base.Close();
             Platform.Dispose(this.bsStream);
+
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/asn1/util/FilterStream.cs b/crypto/src/asn1/util/FilterStream.cs
index 79aa883d0..0c38c5b6e 100644
--- a/crypto/src/asn1/util/FilterStream.cs
+++ b/crypto/src/asn1/util/FilterStream.cs
@@ -47,6 +47,7 @@ namespace Org.BouncyCastle.Asn1.Utilities
         public override void Close()
         {
             Platform.Dispose(s);
+            base.Close();
         }
 #endif
         public override void Flush()
diff --git a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
index f2dc340df..a135cdd11 100644
--- a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
@@ -289,6 +289,7 @@ namespace Org.BouncyCastle.Cms
 
 				authGen.Close();
 				cGen.Close();
+                base.Close();
 			}
 #endif
 		}
diff --git a/crypto/src/crypto/io/CipherStream.cs b/crypto/src/crypto/io/CipherStream.cs
index 4128b70f2..bfce386a7 100644
--- a/crypto/src/crypto/io/CipherStream.cs
+++ b/crypto/src/crypto/io/CipherStream.cs
@@ -227,6 +227,7 @@ namespace Org.BouncyCastle.Crypto.IO
 				stream.Flush();
 			}
             Platform.Dispose(stream);
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/crypto/io/DigestStream.cs b/crypto/src/crypto/io/DigestStream.cs
index eadd7f684..dce875792 100644
--- a/crypto/src/crypto/io/DigestStream.cs
+++ b/crypto/src/crypto/io/DigestStream.cs
@@ -125,6 +125,7 @@ namespace Org.BouncyCastle.Crypto.IO
 		public override void Close()
 		{
             Platform.Dispose(stream);
+            base.Close();
 		}
 #endif
 
diff --git a/crypto/src/crypto/io/MacStream.cs b/crypto/src/crypto/io/MacStream.cs
index 6d306f9c5..d9b8323b5 100644
--- a/crypto/src/crypto/io/MacStream.cs
+++ b/crypto/src/crypto/io/MacStream.cs
@@ -124,6 +124,7 @@ namespace Org.BouncyCastle.Crypto.IO
         public override void Close()
         {
             Platform.Dispose(stream);
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/crypto/io/SignerStream.cs b/crypto/src/crypto/io/SignerStream.cs
index 754846076..1e37c8d34 100644
--- a/crypto/src/crypto/io/SignerStream.cs
+++ b/crypto/src/crypto/io/SignerStream.cs
@@ -125,6 +125,7 @@ namespace Org.BouncyCastle.Crypto.IO
         public override void Close()
         {
             Platform.Dispose(stream);
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs
index fb1168475..3a20e4bff 100644
--- a/crypto/src/crypto/operators/Asn1Signature.cs
+++ b/crypto/src/crypto/operators/Asn1Signature.cs
@@ -303,21 +303,7 @@ namespace Org.BouncyCastle.Crypto.Operators
 			set { throw new NotImplementedException (); }
 		}
 
-#if PORTABLE
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing)
-                return;
-
-            base.Dispose(disposing);
-        }
-#else
-        public override void Close()
-		{
-		}
-#endif
-
-		public override void Flush()
+        public override void Flush()
 		{
 		}
 
diff --git a/crypto/src/crypto/tls/ByteQueueStream.cs b/crypto/src/crypto/tls/ByteQueueStream.cs
index 1fc8a5d29..249e6099b 100644
--- a/crypto/src/crypto/tls/ByteQueueStream.cs
+++ b/crypto/src/crypto/tls/ByteQueueStream.cs
@@ -33,20 +33,6 @@ namespace Org.BouncyCastle.Crypto.Tls
             get { return true; }
         }
 
-#if PORTABLE
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing)
-                return;
-
-            base.Dispose(disposing);
-        }
-#else
-        public override void Close()
-        {
-        }
-#endif
-
         public override void Flush()
         {
         }
diff --git a/crypto/src/crypto/tls/TlsStream.cs b/crypto/src/crypto/tls/TlsStream.cs
index e11091c85..bfd80edf2 100644
--- a/crypto/src/crypto/tls/TlsStream.cs
+++ b/crypto/src/crypto/tls/TlsStream.cs
@@ -41,6 +41,7 @@ namespace Org.BouncyCastle.Crypto.Tls
         public override void Close()
         {
             handler.Close();
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/openpgp/PgpCompressedDataGenerator.cs b/crypto/src/openpgp/PgpCompressedDataGenerator.cs
index 2d20601f0..51b645279 100644
--- a/crypto/src/openpgp/PgpCompressedDataGenerator.cs
+++ b/crypto/src/openpgp/PgpCompressedDataGenerator.cs
@@ -179,6 +179,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
                 if (disposing)
                 {
 				    Finish();
+                    return;
                 }
                 base.Dispose(disposing);
             }
@@ -204,6 +205,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
                 {
 				    Finish();
 				    End();
+                    return;
                 }
                 base.Dispose(disposing);
             }
diff --git a/crypto/src/util/io/BaseInputStream.cs b/crypto/src/util/io/BaseInputStream.cs
index 0a6e19307..a5613d801 100644
--- a/crypto/src/util/io/BaseInputStream.cs
+++ b/crypto/src/util/io/BaseInputStream.cs
@@ -25,6 +25,7 @@ namespace Org.BouncyCastle.Utilities.IO
 		public override void Close()
         {
             closed = true;
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/util/io/BaseOutputStream.cs b/crypto/src/util/io/BaseOutputStream.cs
index 0b6daa6a5..a0608d111 100644
--- a/crypto/src/util/io/BaseOutputStream.cs
+++ b/crypto/src/util/io/BaseOutputStream.cs
@@ -25,6 +25,7 @@ namespace Org.BouncyCastle.Utilities.IO
         public override void Close()
         {
             closed = true;
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/util/io/FilterStream.cs b/crypto/src/util/io/FilterStream.cs
index fe359de90..a92dee3e5 100644
--- a/crypto/src/util/io/FilterStream.cs
+++ b/crypto/src/util/io/FilterStream.cs
@@ -42,6 +42,7 @@ namespace Org.BouncyCastle.Utilities.IO
         public override void Close()
         {
             Platform.Dispose(s);
+            base.Close();
         }
 #endif
         public override void Flush()
diff --git a/crypto/src/util/io/TeeInputStream.cs b/crypto/src/util/io/TeeInputStream.cs
index e5fc10157..6996f3fbb 100644
--- a/crypto/src/util/io/TeeInputStream.cs
+++ b/crypto/src/util/io/TeeInputStream.cs
@@ -33,6 +33,7 @@ namespace Org.BouncyCastle.Utilities.IO
 		{
             Platform.Dispose(input);
             Platform.Dispose(tee);
+            base.Close();
 		}
 #endif
 
diff --git a/crypto/src/util/io/TeeOutputStream.cs b/crypto/src/util/io/TeeOutputStream.cs
index 82407d9fa..a6c7fd5b5 100644
--- a/crypto/src/util/io/TeeOutputStream.cs
+++ b/crypto/src/util/io/TeeOutputStream.cs
@@ -33,6 +33,7 @@ namespace Org.BouncyCastle.Utilities.IO
 		{
             Platform.Dispose(output);
             Platform.Dispose(tee);
+            base.Close();
 		}
 #endif
 
diff --git a/crypto/src/util/zlib/ZDeflaterOutputStream.cs b/crypto/src/util/zlib/ZDeflaterOutputStream.cs
index 99a4ebfbe..d0f0bcb8d 100644
--- a/crypto/src/util/zlib/ZDeflaterOutputStream.cs
+++ b/crypto/src/util/zlib/ZDeflaterOutputStream.cs
@@ -164,6 +164,7 @@ namespace Org.BouncyCastle.Utilities.Zlib {
                 Platform.Dispose(outp);
                 outp=null;
             }
+            base.Close();
         }
 #endif
     }
diff --git a/crypto/src/util/zlib/ZInflaterInputStream.cs b/crypto/src/util/zlib/ZInflaterInputStream.cs
index 0f0999e86..ef742bb00 100644
--- a/crypto/src/util/zlib/ZInflaterInputStream.cs
+++ b/crypto/src/util/zlib/ZInflaterInputStream.cs
@@ -127,6 +127,7 @@ namespace Org.BouncyCastle.Utilities.Zlib {
         public override void Close()
         {
             Platform.Dispose(inp);
+            base.Close();
         }
 #endif
 
diff --git a/crypto/src/util/zlib/ZInputStream.cs b/crypto/src/util/zlib/ZInputStream.cs
index ee19af587..4b7351555 100644
--- a/crypto/src/util/zlib/ZInputStream.cs
+++ b/crypto/src/util/zlib/ZInputStream.cs
@@ -98,22 +98,23 @@ namespace Org.BouncyCastle.Utilities.Zlib
         {
             if (disposing)
             {
-			    if (!closed)
-			    {
-				    closed = true;
-                    Platform.Dispose(input);
-			    }
+			    if (closed)
+                    return;
+
+                closed = true;
+                Platform.Dispose(input);
             }
             base.Dispose(disposing);
         }
 #else
         public override void Close()
 		{
-			if (!closed)
-			{
-				closed = true;
-                Platform.Dispose(input);
-			}
+            if (closed)
+                return;
+
+            closed = true;
+            Platform.Dispose(input);
+            base.Close();
 		}
 #endif
 
diff --git a/crypto/src/util/zlib/ZOutputStream.cs b/crypto/src/util/zlib/ZOutputStream.cs
index ede557135..d9f005f69 100644
--- a/crypto/src/util/zlib/ZOutputStream.cs
+++ b/crypto/src/util/zlib/ZOutputStream.cs
@@ -100,7 +100,7 @@ namespace Org.BouncyCastle.Utilities.Zlib
         {
             if (disposing)
             {
-			    if (this.closed)
+			    if (closed)
 				    return;
 
                 DoClose();
@@ -110,10 +110,11 @@ namespace Org.BouncyCastle.Utilities.Zlib
 #else
 		public override void Close()
 		{
-			if (this.closed)
+			if (closed)
 				return;
 
             DoClose();
+            base.Close();
 		}
 #endif