aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2012-03-12 10:07:04 -0700
committerRobert Adams2012-03-12 10:07:04 -0700
commite0dd38f6722e891cfc91c8d795604b7b78c0bc81 (patch)
tree9e2b7f094df639c32ca0157944e78431c6982349 /OpenSim
parentChange OpenSim.ini.example to reflect how to actually enable prim limits, (diff)
downloadopensim-SC_OLD-e0dd38f6722e891cfc91c8d795604b7b78c0bc81.zip
opensim-SC_OLD-e0dd38f6722e891cfc91c8d795604b7b78c0bc81.tar.gz
opensim-SC_OLD-e0dd38f6722e891cfc91c8d795604b7b78c0bc81.tar.bz2
opensim-SC_OLD-e0dd38f6722e891cfc91c8d795604b7b78c0bc81.tar.xz
Rename the stream extension method WebUtil.CopyTo() to WebUtil.CopyStream().
.NET 4.0 added the method Stream.CopyTo(stream, bufferSize). For .NET 3.5 and before, WebUtil defined an extension method for Stream with the signature Stream.CopyTo(stream, maxBytesToCopy). The meaning of the second parameter is different in the two forms and depending on which compiler and/or runtime you use, you could get one form or the other. Crashes ensue. This change renames the WebUtil stream copy method to something that cannot be confused with the new CopyTo method defined in .NET 4.0.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs2
-rw-r--r--OpenSim/Framework/MultipartForm.cs2
-rw-r--r--OpenSim/Framework/WebUtil.cs7
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs2
4 files changed, 9 insertions, 4 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index 95ef72a..06fe55a 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Data.MySQL
162 using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) 162 using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
163 { 163 {
164 MemoryStream outputStream = new MemoryStream(); 164 MemoryStream outputStream = new MemoryStream();
165 WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); 165 WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
166 // int compressedLength = asset.Data.Length; 166 // int compressedLength = asset.Data.Length;
167 asset.Data = outputStream.ToArray(); 167 asset.Data = outputStream.ToArray();
168 168
diff --git a/OpenSim/Framework/MultipartForm.cs b/OpenSim/Framework/MultipartForm.cs
index 90c4007..7a13e8b 100644
--- a/OpenSim/Framework/MultipartForm.cs
+++ b/OpenSim/Framework/MultipartForm.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Framework
119 // Copy the temporary stream to the network stream 119 // Copy the temporary stream to the network stream
120 formDataStream.Seek(0, SeekOrigin.Begin); 120 formDataStream.Seek(0, SeekOrigin.Begin);
121 using (Stream requestStream = request.GetRequestStream()) 121 using (Stream requestStream = request.GetRequestStream())
122 formDataStream.CopyTo(requestStream, (int)formDataStream.Length); 122 formDataStream.CopyStream(requestStream, (int)formDataStream.Length);
123 } 123 }
124 124
125 #endregion Stream Writing 125 #endregion Stream Writing
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 77f3d9b..ead8f46 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -510,8 +510,13 @@ namespace OpenSim.Framework
510 /// <remarks> 510 /// <remarks>
511 /// Copying begins at the streams' current positions. The positions are 511 /// Copying begins at the streams' current positions. The positions are
512 /// NOT reset after copying is complete. 512 /// NOT reset after copying is complete.
513 /// NOTE!! .NET 4.0 adds the method 'Stream.CopyTo(stream, bufferSize)'.
514 /// This function could be replaced with that method once we move
515 /// totally to .NET 4.0. For versions before, this routine exists.
516 /// This routine used to be named 'CopyTo' but the int parameter has
517 /// a different meaning so this method was renamed to avoid any confusion.
513 /// </remarks> 518 /// </remarks>
514 public static int CopyTo(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) 519 public static int CopyStream(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy)
515 { 520 {
516 byte[] buffer = new byte[4096]; 521 byte[] buffer = new byte[4096];
517 int readBytes; 522 int readBytes;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 99523a1..6bfc5cc 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -477,7 +477,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
477 // Grab the asset data from the response stream 477 // Grab the asset data from the response stream
478 using (MemoryStream stream = new MemoryStream()) 478 using (MemoryStream stream = new MemoryStream())
479 { 479 {
480 responseStream.CopyTo(stream, 4096); 480 responseStream.CopyStream(stream, Int32.MaxValue);
481 asset.Data = stream.ToArray(); 481 asset.Data = stream.ToArray();
482 } 482 }
483 } 483 }