Corrected small differences

This commit is contained in:
MaxXor 2015-03-17 22:05:04 +01:00
parent 1bed14532c
commit 1b00c9d9ec
2 changed files with 5 additions and 13 deletions

View File

@ -21,11 +21,10 @@ namespace ProtoBuf
/// </summary>
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;
/// <summary>
/// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).
/// </summary>
@ -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)
/// </summary>
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()

View File

@ -24,7 +24,7 @@ public sealed class ProtoWriter : IDisposable
private Stream dest;
TypeModel model;
private bool disposed = false;
/// <summary>
/// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).
/// </summary>
@ -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)
{