@@ -131,10 +131,10 @@ public virtual void AddBackend(OdbBackend backend, int priority)
131
131
private class Processor
132
132
{
133
133
private readonly Stream stream ;
134
- private readonly int ? numberOfBytesToConsume ;
134
+ private readonly long ? numberOfBytesToConsume ;
135
135
private int totalNumberOfReadBytes ;
136
136
137
- public Processor ( Stream stream , int ? numberOfBytesToConsume )
137
+ public Processor ( Stream stream , long ? numberOfBytesToConsume )
138
138
{
139
139
this . stream = stream ;
140
140
this . numberOfBytesToConsume = numberOfBytesToConsume ;
@@ -148,11 +148,11 @@ public int Provider(IntPtr content, int max_length, IntPtr data)
148
148
149
149
if ( numberOfBytesToConsume . HasValue )
150
150
{
151
- int totalRemainingBytesToRead = numberOfBytesToConsume . Value - totalNumberOfReadBytes ;
151
+ long totalRemainingBytesToRead = numberOfBytesToConsume . Value - totalNumberOfReadBytes ;
152
152
153
153
if ( totalRemainingBytesToRead < max_length )
154
154
{
155
- bytesToRead = totalRemainingBytesToRead ;
155
+ bytesToRead = totalRemainingBytesToRead > int . MaxValue ? int . MaxValue : ( int ) totalRemainingBytesToRead ;
156
156
}
157
157
}
158
158
@@ -208,12 +208,12 @@ public virtual Blob CreateBlob(Stream stream, string hintpath)
208
208
/// <param name="hintpath">The hintpath is used to determine what git filters should be applied to the object before it can be placed to the object database.</param>
209
209
/// <param name="numberOfBytesToConsume">The number of bytes to consume from the stream.</param>
210
210
/// <returns>The created <see cref="Blob"/>.</returns>
211
- public virtual Blob CreateBlob ( Stream stream , string hintpath , int numberOfBytesToConsume )
211
+ public virtual Blob CreateBlob ( Stream stream , string hintpath , long numberOfBytesToConsume )
212
212
{
213
- return CreateBlob ( stream , hintpath , ( int ? ) numberOfBytesToConsume ) ;
213
+ return CreateBlob ( stream , hintpath , ( long ? ) numberOfBytesToConsume ) ;
214
214
}
215
215
216
- internal Blob CreateBlob ( Stream stream , string hintpath , int ? numberOfBytesToConsume )
216
+ private Blob CreateBlob ( Stream stream , string hintpath , long ? numberOfBytesToConsume )
217
217
{
218
218
Ensure . ArgumentNotNull ( stream , "stream" ) ;
219
219
@@ -234,18 +234,6 @@ internal Blob CreateBlob(Stream stream, string hintpath, int? numberOfBytesToCon
234
234
return repo . Lookup < Blob > ( id ) ;
235
235
}
236
236
237
- /// <summary>
238
- /// Inserts a <see cref="Blob"/> into the object database created from the content of the stream.
239
- /// </summary>
240
- /// <param name="stream">The stream from which will be read the content of the blob to be created.</param>
241
- /// <param name="numberOfBytesToConsume">Number of bytes to consume from the stream.</param>
242
- /// <returns>The created <see cref="Blob"/>.</returns>
243
- [ Obsolete ( "This method will be removed in the next release. Please use CreateBlob(Stream stream, long) instead." ) ]
244
- public virtual Blob CreateBlob ( Stream stream , int numberOfBytesToConsume )
245
- {
246
- return CreateBlob ( stream , ( long ) numberOfBytesToConsume ) ;
247
- }
248
-
249
237
/// <summary>
250
238
/// Inserts a <see cref="Blob"/> into the object database created from the content of the stream.
251
239
/// </summary>
@@ -254,7 +242,6 @@ public virtual Blob CreateBlob(Stream stream, int numberOfBytesToConsume)
254
242
/// <returns>The created <see cref="Blob"/>.</returns>
255
243
public virtual Blob CreateBlob ( Stream stream , long numberOfBytesToConsume )
256
244
{
257
-
258
245
Ensure . ArgumentNotNull ( stream , "stream" ) ;
259
246
260
247
if ( ! stream . CanRead )
0 commit comments