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> /// </summary>
public sealed class ProtoWriter : IDisposable public sealed class ProtoWriter : IDisposable
{ {
// Indicates whether the object has been disposed of.
bool disposed = false;
private Stream dest; private Stream dest;
TypeModel model; TypeModel model;
private bool disposed = false;
/// <summary> /// <summary>
/// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type). /// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).
/// </summary> /// </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; // at this point the stream still has data, but buffer is full;
if (writer.flushLock == 0) if (writer.flushLock == 0)
{ {
// flush the buffer and write to the underlying stream instead
Flush(writer); Flush(writer);
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)
{ {
@ -505,7 +503,6 @@ public void Dispose(bool disposing)
if (disposing) if (disposing)
{ {
// Flush, then terminate the underlying stream.
if (dest != null) if (dest != null)
{ {
try try
@ -558,12 +555,8 @@ private static void DemandSpace(int required, ProtoWriter writer)
/// </summary> /// </summary>
public void Close() public void Close()
{ {
if (depth != 0 || flushLock != 0) if (depth != 0 || flushLock != 0) throw new InvalidOperationException("Unable to close stream in an incomplete state");
{ Dispose();
throw new InvalidOperationException("Unable to close stream in an incomplete state");
}
Dispose(false);
} }
internal void CheckDepthFlushlock() internal void CheckDepthFlushlock()

View File

@ -24,7 +24,7 @@ public sealed class ProtoWriter : IDisposable
private Stream dest; private Stream dest;
TypeModel model; TypeModel model;
private bool disposed = false; private bool disposed = false;
/// <summary> /// <summary>
/// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type). /// Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).
/// </summary> /// </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; // at this point the stream still has data, but buffer is full;
if (writer.flushLock == 0) if (writer.flushLock == 0)
{ {
// flush the buffer and write to the underlying stream instead
Flush(writer); Flush(writer);
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)
{ {