[System] Fix build warnings
authorMiguel de Icaza <miguel@gnome.org>
Sun, 4 May 2014 21:14:54 +0000 (17:14 -0400)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 4 May 2014 21:15:18 +0000 (17:15 -0400)
mcs/class/System/System.Collections.Concurrent/BlockingCollection.cs
mcs/class/System/System.Diagnostics/TraceImpl.cs
mcs/class/System/System.Net.Mail/SmtpClient.cs
mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
mcs/class/System/System.Net/WebConnectionStream.cs

index cc7e04ecdd50b974268a6130728ba83dc3fbc55a..893cd8e3a46fff54dab7039200b2ddefd09c82a3 100644 (file)
@@ -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)
index dc45ae8d4ad7b0f08f717f26422a0457f9a24d0f..ed4db7e09e7f647266594ced35eeeb7f5738bbb6 100644 (file)
@@ -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;
index 75ca20f231e3fc77ca208f7aef0f1ce15a42647b..3011453e171a3405d9fcfa8aa00d5bf1051aa6ee 100644 (file)
@@ -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;
index 880b909fad16b0a93e3bc827676254f38cdc2a33..4ad2720909fd6c0ee99c6a6b767745d501638639 100644 (file)
@@ -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
                        }
                }
 
index 5a34a3d812440a647546ec0c26ff3a876834f376..268ee1dca5baa1ea6208b888030a2c72119edd8c 100644 (file)
@@ -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;