Author: gnorton
Date: 2008-02-15 14:36:37 -0500 (Fri, 15 Feb 2008)
New Revision: 95802
Modified:
trunk/monodevelop/main/src/addins/WelcomePage/ChangeLog
trunk/monodevelop/main/src/addins/WelcomePage/WelcomePageView.cs
Log:
In .:
2008-02-14 Geoff Norton <[EMAIL PROTECTED]>
* WelcomePageView.cs: Ensure that we dont try to read more bytes
than available from the stream. Avoides a IndexOutOfRangeException
on other runtimes.
Modified: trunk/monodevelop/main/src/addins/WelcomePage/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/WelcomePage/ChangeLog 2008-02-15
19:36:21 UTC (rev 95801)
+++ trunk/monodevelop/main/src/addins/WelcomePage/ChangeLog 2008-02-15
19:36:37 UTC (rev 95802)
@@ -1,3 +1,9 @@
+2008-02-14 Geoff Norton <[EMAIL PROTECTED]>
+
+ * WelcomePageView.cs: Ensure that we dont try to read more bytes
+ than available from the stream. Avoides a IndexOutOfRangeException
+ on other runtimes.
+
2008-02-05 Mike Krüger <[EMAIL PROTECTED]>
* WelcomePageFallbackWidget.cs: Fixed translation bug.
Modified: trunk/monodevelop/main/src/addins/WelcomePage/WelcomePageView.cs
===================================================================
--- trunk/monodevelop/main/src/addins/WelcomePage/WelcomePageView.cs
2008-02-15 19:36:21 UTC (rev 95801)
+++ trunk/monodevelop/main/src/addins/WelcomePage/WelcomePageView.cs
2008-02-15 19:36:37 UTC (rev 95802)
@@ -116,12 +116,14 @@
if (response.StatusCode == HttpStatusCode.OK) {
Stream responseStream =
response.GetResponseStream ();
using (FileStream fs = File.Create
(localCachedNewsFile)) {
+ long avail =
response.ContentLength;
int position = 0;
int readBytes = -1;
byte[] buffer = new byte[2048];
while (readBytes != 0) {
- readBytes =
responseStream.Read (buffer, position, 2048);
+ readBytes =
responseStream.Read (buffer, position, (int) (avail > 2048 ? 2048 : avail));
position += readBytes;
+ avail -= readBytes;
fs.Write (buffer, 0,
readBytes);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches