You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Default is dynamic which is not backwards compatible and can cause problems
3792
3811
// with XP's built in compression which cant read Zip64 archives.
@@ -4156,16 +4175,14 @@ public PartialInputStream(ZipFile zipFile, long start, long length)
4156
4175
// uses reader here....
4157
4176
zipFile_=zipFile;
4158
4177
baseStream_=zipFile_.baseStream_;
4178
+
this.semaphore=zipFile.baseStreamSemaphore;
4159
4179
readPos_=start;
4160
4180
end_=start+length;
4161
4181
}
4162
4182
4163
4183
#endregion Constructors
4164
4184
4165
-
/// <summary>
4166
-
/// Read a byte from this stream.
4167
-
/// </summary>
4168
-
/// <returns>Returns the byte read or -1 on end of stream.</returns>
4185
+
/// <inheritdoc/>
4169
4186
publicoverrideintReadByte()
4170
4187
{
4171
4188
if(readPos_>=end_)
@@ -4174,32 +4191,40 @@ public override int ReadByte()
4174
4191
return-1;
4175
4192
}
4176
4193
4177
-
lock(baseStream_)
4194
+
try
4178
4195
{
4196
+
this.semaphore.Wait();
4197
+
4179
4198
baseStream_.Seek(readPos_++,SeekOrigin.Begin);
4180
4199
returnbaseStream_.ReadByte();
4181
4200
}
4201
+
finally
4202
+
{
4203
+
this.semaphore.Release();
4204
+
}
4182
4205
}
4183
4206
4184
-
/// <summary>
4185
-
/// Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
4186
-
/// </summary>
4187
-
/// <param name="buffer">An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.</param>
4188
-
/// <param name="offset">The zero-based byte offset in buffer at which to begin storing the data read from the current stream.</param>
4189
-
/// <param name="count">The maximum number of bytes to be read from the current stream.</param>
4190
-
/// <returns>
4191
-
/// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
4192
-
/// </returns>
4193
-
/// <exception cref="System.ArgumentException">The sum of offset and count is larger than the buffer length. </exception>
4194
-
/// <exception cref="System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
4195
-
/// <exception cref="System.NotSupportedException">The stream does not support reading. </exception>
4196
-
/// <exception cref="System.ArgumentNullException">buffer is null. </exception>
0 commit comments