зеркало из https://github.com/mono/exiv2-sharp.git
2008-09-22 Stephane Delcroix <sdelcroix@novell.com>
* ImageFactory.custom: prevent exception on overread. svn path=/trunk/exiv2-sharp/; revision=113711
This commit is contained in:
Родитель
37cd466a7a
Коммит
cc49b58b44
|
@ -1,3 +1,7 @@
|
|||
2008-09-22 Stephane Delcroix <sdelcroix@novell.com>
|
||||
|
||||
* ImageFactory.custom: prevent exception on overread.
|
||||
|
||||
2008-09-22 Stephane Delcroix <sdelcroix@novell.com>
|
||||
|
||||
* ImageFactory.custom: OpenAsync (Stream)
|
||||
|
|
|
@ -77,9 +77,10 @@ public static void OpenAsync (System.IO.Stream stream, object userToken, OpenCom
|
|||
System.Threading.Thread async_thread = new System.Threading.Thread (delegate (object state) {
|
||||
object [] args = (object []) state;
|
||||
try {
|
||||
byte [] buffer = new byte [stream.Length];
|
||||
long length = stream.Length;
|
||||
byte [] buffer = new byte [length];
|
||||
int offset = 0, count;
|
||||
while ((count = stream.Read (buffer, offset, 1024)) > 0)
|
||||
while ((count = stream.Read (buffer, offset, length - offset > 1024 ? 1024 : (int)(length - offset))) > 0)
|
||||
offset+=count;
|
||||
Exiv2.Image data = Open (buffer);
|
||||
OnOpenCompleted (new OpenCompletedEventArgs (data, null, false, args [1]), completed_handler);
|
||||
|
|
Загрузка…
Ссылка в новой задаче