From 1b00c9d9ec71497ad7d5fc83bcd2e4cfb2385f4d Mon Sep 17 00:00:00 2001 From: MaxXor Date: Tue, 17 Mar 2015 22:05:04 +0100 Subject: [PATCH] Corrected small differences --- Client/Core/ProtoBuf/ProtoWriter.cs | 15 ++++----------- Server/Core/ProtoBuf/ProtoWriter.cs | 3 +-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Client/Core/ProtoBuf/ProtoWriter.cs b/Client/Core/ProtoBuf/ProtoWriter.cs index 013df802..5b0ea59b 100644 --- a/Client/Core/ProtoBuf/ProtoWriter.cs +++ b/Client/Core/ProtoBuf/ProtoWriter.cs @@ -21,11 +21,10 @@ namespace ProtoBuf /// public sealed class ProtoWriter : IDisposable { - // Indicates whether the object has been disposed of. - bool disposed = false; - private Stream dest; TypeModel model; + private bool disposed = false; + /// /// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type). /// @@ -253,7 +252,6 @@ private static void CopyRawFromStream(Stream source, ProtoWriter writer) // at this point the stream still has data, but buffer is full; if (writer.flushLock == 0) { - // flush the buffer and write to the underlying stream instead Flush(writer); while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) { @@ -505,7 +503,6 @@ public void Dispose(bool disposing) if (disposing) { - // Flush, then terminate the underlying stream. if (dest != null) { try @@ -558,12 +555,8 @@ private static void DemandSpace(int required, ProtoWriter writer) /// public void Close() { - if (depth != 0 || flushLock != 0) - { - throw new InvalidOperationException("Unable to close stream in an incomplete state"); - } - - Dispose(false); + if (depth != 0 || flushLock != 0) throw new InvalidOperationException("Unable to close stream in an incomplete state"); + Dispose(); } internal void CheckDepthFlushlock() diff --git a/Server/Core/ProtoBuf/ProtoWriter.cs b/Server/Core/ProtoBuf/ProtoWriter.cs index 5492b76b..5b0ea59b 100644 --- a/Server/Core/ProtoBuf/ProtoWriter.cs +++ b/Server/Core/ProtoBuf/ProtoWriter.cs @@ -24,7 +24,7 @@ public sealed class ProtoWriter : IDisposable private Stream dest; TypeModel model; private bool disposed = false; - + /// /// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type). /// @@ -252,7 +252,6 @@ private static void CopyRawFromStream(Stream source, ProtoWriter writer) // at this point the stream still has data, but buffer is full; if (writer.flushLock == 0) { - // flush the buffer and write to the underlying stream instead Flush(writer); while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) {