Prechádzať zdrojové kódy

[System] Fix build warnings

Miguel de Icaza 11 rokov pred
rodič
commit
705da187cf

+ 0 - 5
mcs/class/System/System.Collections.Concurrent/BlockingCollection.cs

@@ -372,7 +372,6 @@ namespace System.Collections.Concurrent
 			CheckArray (collections);
 			WaitHandle[] wait_table = null;
 			while (true) {
-				int index = 0;
 				for (int i = 0; i < collections.Length; ++i) {
 					if (collections [i].TryTake (out item))
 						return i;
@@ -384,7 +383,6 @@ namespace System.Collections.Concurrent
 				}
 				WaitHandle.WaitAny (wait_table);
 			}
-			return -1;
 		}
 
 		public static int TakeFromAny (BlockingCollection<T>[] collections, out T item, CancellationToken cancellationToken)
@@ -393,7 +391,6 @@ namespace System.Collections.Concurrent
 			CheckArray (collections);
 			WaitHandle[] wait_table = null;
 			while (true) {
-				int index = 0;
 				for (int i = 0; i < collections.Length; ++i) {
 					if (collections [i].TryTake (out item))
 						return i;
@@ -408,8 +405,6 @@ namespace System.Collections.Concurrent
 				WaitHandle.WaitAny (wait_table);
 				cancellationToken.ThrowIfCancellationRequested ();
 			}
-
-			return -1;
 		}
 
 		public static int TryTakeFromAny (BlockingCollection<T>[] collections, out T item)

+ 1 - 27
mcs/class/System/System.Diagnostics/TraceImpl.cs

@@ -41,7 +41,6 @@ namespace System.Diagnostics {
 	internal class TraceImplSettings {
 		public const string Key = ".__TraceInfoSettingsKey__.";
 
-		public bool AutoFlush;
 		//public int IndentLevel;
 		public int IndentSize = 4;
 		public TraceListenerCollection Listeners = new TraceListenerCollection (false);
@@ -61,36 +60,11 @@ namespace System.Diagnostics {
 
 		private static bool autoFlush;
 
-#if TARGET_JVM
-		static readonly LocalDataStoreSlot _indentLevelStore = System.Threading.Thread.AllocateDataSlot ();
-		static readonly LocalDataStoreSlot _indentSizeStore = System.Threading.Thread.AllocateDataSlot ();
-
-		private static int indentLevel {
-			get {
-				object o = System.Threading.Thread.GetData (_indentLevelStore);
-				if (o == null)
-					return 0;
-				return (int) o;
-			}
-			set { System.Threading.Thread.SetData (_indentLevelStore, value); }
-		}
-
-		private static int indentSize {
-			get {
-				object o = System.Threading.Thread.GetData (_indentSizeStore);
-				if (o == null)
-					return 0;
-				return (int) o;
-			}
-			set { System.Threading.Thread.SetData (_indentSizeStore, value); }
-		}
-#else
 		[ThreadStatic]
 		private static int indentLevel;
 
 		[ThreadStatic]
 		private static int indentSize;
-#endif
 
 #if MOBILE
 		static TraceListenerCollection listeners = new TraceListenerCollection (true);
@@ -205,7 +179,7 @@ namespace System.Diagnostics {
 
 						d.Remove (TraceImplSettings.Key);
 
-						autoFlush   = s.AutoFlush;
+//						autoFlush   = s.AutoFlush;
 //						indentLevel = s.IndentLevel;
 						indentSize  = s.IndentSize;
 						listeners   = s.Listeners;

+ 1 - 1
mcs/class/System/System.Net.Mail/SmtpClient.cs

@@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates;
 #else
 extern alias PrebuiltSystem;
 using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using System.Security.Cryptography.X509Certificates;
 #endif
 
 #endif
@@ -47,7 +48,6 @@ using System.IO;
 using System.Net;
 using System.Net.Mime;
 using System.Net.Sockets;
-using System.Security.Cryptography.X509Certificates;
 using System.Text;
 using System.Threading;
 using System.Reflection;

+ 3 - 0
mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs

@@ -93,6 +93,8 @@ namespace System.Net.NetworkInformation {
 		[MonoTODO("Only works on Linux. Returns 0 on other systems.")]
 		public static int LoopbackInterfaceIndex {
 			get {
+				// Disable warning for code not reachable, due to runningOnUnix being always true on Monotouch
+#pragma warning disable 162
 				if (runningOnUnix) {
 					try {
 						return UnixNetworkInterface.IfNameToIndex ("lo");
@@ -101,6 +103,7 @@ namespace System.Net.NetworkInformation {
 					}
 				} else
 					return 0;
+#pragma warning restore 162
 			}
 		}
 

+ 2 - 1
mcs/class/System/System.Net/WebConnectionStream.cs

@@ -699,7 +699,8 @@ namespace System.Net
 			if (!allowBuffering || writeBuffer == null)
 				return null;
 
-			byte[] bytes = writeBuffer.GetBuffer ();
+			// Keep the call for a potential side-effect of GetBuffer
+			writeBuffer.GetBuffer ();
 			int length = (int)writeBuffer.Length;
 			if (request.ContentLength != -1 && request.ContentLength < length) {
 				nextReadCalled = true;