[hyena] cleanup: Remove NET_2_0 and NET_1_1 conditionals



commit 895b1d4cc5bc9b646bb263338f808c11db7b1d52
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Apr 30 10:38:52 2011 +0200

    cleanup: Remove NET_2_0 and NET_1_1 conditionals
    
    Keep the code that was used for NET_2_0. The build was only using the
    NET_2_0 bits anyway, for quite a while now.

 Hyena.Data.Sqlite/Hyena.Data.Sqlite.csproj |    3 --
 Hyena.Gui/Hyena.Gui.csproj                 |    3 --
 Hyena/Hyena.Collections/RangeCollection.cs |   54 ++--------------------------
 Hyena/Hyena.Collections/Selection.cs       |   23 +-----------
 Hyena/Hyena.csproj                         |    3 --
 Hyena/System.Web/HttpUtility.cs            |   54 +---------------------------
 build/build.rules.mk                       |    1 -
 7 files changed, 6 insertions(+), 135 deletions(-)
---
diff --git a/Hyena.Data.Sqlite/Hyena.Data.Sqlite.csproj b/Hyena.Data.Sqlite/Hyena.Data.Sqlite.csproj
index 6178684..c1d836e 100644
--- a/Hyena.Data.Sqlite/Hyena.Data.Sqlite.csproj
+++ b/Hyena.Data.Sqlite/Hyena.Data.Sqlite.csproj
@@ -23,7 +23,6 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <OutputPath>..\..\bin</OutputPath>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
@@ -32,7 +31,6 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Submodule|AnyCPU' ">
     <OutputPath>..\..\..\bin</OutputPath>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
@@ -41,7 +39,6 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SubmoduleWindows|AnyCPU' ">
     <OutputPath>..\..\..\bin\bin</OutputPath>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
diff --git a/Hyena.Gui/Hyena.Gui.csproj b/Hyena.Gui/Hyena.Gui.csproj
index aaeae83..1e59adb 100644
--- a/Hyena.Gui/Hyena.Gui.csproj
+++ b/Hyena.Gui/Hyena.Gui.csproj
@@ -24,7 +24,6 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <OutputPath>..\..\bin</OutputPath>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
@@ -34,7 +33,6 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Submodule|AnyCPU' ">
     <OutputPath>..\..\..\bin</OutputPath>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
@@ -42,7 +40,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SubmoduleWindows|AnyCPU' ">
-    <DefineConstants>NET_2_0</DefineConstants>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <OutputPath>..\..\..\bin\bin</OutputPath>
     <PlatformTarget>x86</PlatformTarget>
diff --git a/Hyena/Hyena.Collections/RangeCollection.cs b/Hyena/Hyena.Collections/RangeCollection.cs
index 7973e18..881377f 100644
--- a/Hyena/Hyena.Collections/RangeCollection.cs
+++ b/Hyena/Hyena.Collections/RangeCollection.cs
@@ -28,30 +28,13 @@
 
 using System;
 using System.Collections;
-
-#if NET_2_0
 using System.Collections.Generic;
-#endif
 
-#if NET_1_1
-namespace System.Collections
-#else
 namespace Hyena.Collections
-#endif
 {
-#if NET_1_1
-    internal
-#else
     public
-#endif
-
-    class RangeCollection :
-        ICloneable,
-#if NET_2_0
-        ICollection<int>
-#else
-        ICollection
-#endif
+
+    class RangeCollection : ICloneable, ICollection<int>
     {
         public struct Range
         {
@@ -121,13 +104,7 @@ namespace Hyena.Collections
                 new_capacity <<= 1;
             }
 
-#if NET_2_0
             Array.Resize (ref ranges, new_capacity);
-#else
-            Range [] new_ranges = new Range[new_capacity];
-            Array.Copy (ranges, 0, new_ranges, 0, ranges.Length);
-            ranges = new_ranges;
-#endif
         }
 
         private void Insert (int position, Range range)
@@ -275,9 +252,7 @@ namespace Hyena.Collections
             get { return range_count; }
         }
 
-#if NET_2_0
         [Obsolete ("Do not use the Indexes property in 2.0 profiles if enumerating only; Indexes allocates an array to avoid boxing in the 1.1 profile")]
-#endif
         public int [] Indexes {
             get {
                 if (indexes_cache != null && generation == indexes_cache_generation) {
@@ -340,13 +315,7 @@ namespace Hyena.Collections
             return false;
         }
 
-        void
-#if NET_2_0
-        ICollection<int>.
-#else
-        ICollection.
-#endif
-        Add (int value)
+        void ICollection<int>.Add (int value)
         {
             Add (value);
         }
@@ -388,16 +357,6 @@ namespace Hyena.Collections
             get { return false; }
         }
 
-#if !NET_2_0
-        public bool IsSynchronized {
-            get { return false; }
-        }
-
-        public object SyncRoot {
-            get { return this; }
-        }
-#endif
-
 #endregion
 
 #region ICloneable Implementation
@@ -411,7 +370,6 @@ namespace Hyena.Collections
 
 #region IEnumerable Implementation
 
-#if NET_2_0
         public IEnumerator<int> GetEnumerator ()
         {
             for (int i = 0; i < range_count; i++) {
@@ -425,12 +383,6 @@ namespace Hyena.Collections
         {
             return GetEnumerator ();
         }
-#else
-        public IEnumerator GetEnumerator ()
-        {
-            return Indexes.GetEnumerator ();
-        }
-#endif
 
 #endregion
 
diff --git a/Hyena/Hyena.Collections/Selection.cs b/Hyena/Hyena.Collections/Selection.cs
index 32fb7f2..4fbfcf2 100644
--- a/Hyena/Hyena.Collections/Selection.cs
+++ b/Hyena/Hyena.Collections/Selection.cs
@@ -31,25 +31,13 @@
 
 using System;
 using System.Collections;
-
-#if NET_2_0
 using System.Collections.Generic;
-#endif
 
 namespace Hyena.Collections
 {
-#if NET_1_1
-    internal
-#else
     public
-#endif
-
-    class Selection :
-#if NET_2_0
-        IEnumerable<int>
-#else
-        IEnumerable
-#endif
+
+    class Selection : IEnumerable<int>
     {
         RangeCollection ranges = new RangeCollection ();
         private int max_index;
@@ -254,7 +242,6 @@ namespace Hyena.Collections
             get { return Count > 0 ? ranges[Count - 1]: -1; }
         }
 
-#if NET_2_0
         public IEnumerator<int> GetEnumerator ()
         {
             return ranges.GetEnumerator ();
@@ -264,12 +251,6 @@ namespace Hyena.Collections
         {
             return GetEnumerator ();
         }
-#else
-        public IEnumerator GetEnumerator ()
-        {
-            return ranges.GetEnumerator ();
-        }
-#endif
 
         public override string ToString ()
         {
diff --git a/Hyena/Hyena.csproj b/Hyena/Hyena.csproj
index 9121ecc..95bfcee 100644
--- a/Hyena/Hyena.csproj
+++ b/Hyena/Hyena.csproj
@@ -22,7 +22,6 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <OutputPath>..\..\bin</OutputPath>
-    <DefineConstants>NET_2_0</DefineConstants>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
@@ -30,7 +29,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Submodule|AnyCPU' ">
-    <DefineConstants>NET_2_0</DefineConstants>
     <OutputPath>..\..\..\bin</OutputPath>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
@@ -39,7 +37,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SubmoduleWindows|AnyCPU' ">
-    <DefineConstants>NET_2_0</DefineConstants>
     <OutputPath>..\..\..\bin\bin</OutputPath>
     <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
diff --git a/Hyena/System.Web/HttpUtility.cs b/Hyena/System.Web/HttpUtility.cs
index 4ffdc1d..205f699 100644
--- a/Hyena/System.Web/HttpUtility.cs
+++ b/Hyena/System.Web/HttpUtility.cs
@@ -30,6 +30,7 @@
 //
 
 using System.Collections;
+using System.Collections.Generic;
 using System.Collections.Specialized;
 using System.Globalization;
 using System.IO;
@@ -37,10 +38,6 @@ using System.Security.Permissions;
 using System.Text;
 using System.Web.Util;
 
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
 namespace System.Web {
 
 #if !MONOTOUCH
@@ -409,11 +406,7 @@ namespace System.Web {
 				e = Encoding.UTF8;
 
 			long len = s.Length;
-#if NET_2_0
 			var bytes = new List <byte> ();
-#else
-			ArrayList bytes = new ArrayList ();
-#endif
 			int xchar;
 			char ch;
 			
@@ -443,11 +436,7 @@ namespace System.Web {
 					WriteCharBytes (bytes, ch, e);
 			}
 			
-#if NET_2_0
 			byte[] buf = bytes.ToArray ();
-#else
-			byte[] buf = (byte[])bytes.ToArray (typeof (byte));
-#endif
 			bytes = null;
 			return e.GetString (buf);
 			
@@ -1005,46 +994,6 @@ namespace System.Web {
 				output.Write (HtmlEncode (s));
 		}
 
-#if NET_1_1
-		public static string UrlPathEncode (string s)
-		{
-			if (s == null || s.Length == 0)
-				return s;
-
-			MemoryStream result = new MemoryStream ();
-			int length = s.Length;
-            for (int i = 0; i < length; i++) {
-				UrlPathEncodeChar (s [i], result);
-			}
-			return Encoding.ASCII.GetString (result.ToArray ());
-		}
-		
-		static void UrlPathEncodeChar (char c, Stream result) {
-#if NET_2_0
-			if (c < 33 || c > 126) {
-#else
-			if (c > 127) {
-#endif
-				byte [] bIn = Encoding.UTF8.GetBytes (c.ToString ());
-				for (int i = 0; i < bIn.Length; i++) {
-					result.WriteByte ((byte) '%');
-					int idx = ((int) bIn [i]) >> 4;
-					result.WriteByte ((byte) hexChars [idx]);
-					idx = ((int) bIn [i]) & 0x0F;
-					result.WriteByte ((byte) hexChars [idx]);
-				}
-			}
-			else if (c == ' ') {
-				result.WriteByte ((byte) '%');
-				result.WriteByte ((byte) '2');
-				result.WriteByte ((byte) '0');
-			}
-			else
-				result.WriteByte ((byte) c);
-		}
-#endif
-
-#if NET_2_0
 		class HttpQSCollection : NameValueCollection {
 			public override string ToString ()
 			{
@@ -1082,7 +1031,6 @@ namespace System.Web {
 			ParseQueryString (query, encoding, result);
 			return result;
 		} 				
-#endif
 
 		internal static void ParseQueryString (string query, Encoding encoding, NameValueCollection result)
 		{
diff --git a/build/build.rules.mk b/build/build.rules.mk
index 009916f..56ea3ff 100644
--- a/build/build.rules.mk
+++ b/build/build.rules.mk
@@ -58,7 +58,6 @@ $(ASSEMBLY_FILE): $(SOURCES_BUILD) $(RESOURCES_EXPANDED) $(DEP_LINK)
 		$(GMCS_FLAGS) \
 		$(ASSEMBLY_BUILD_FLAGS) \
 		-nowarn:0278 -nowarn:0078 $$warn \
-		-define:NET_2_0 \
 		-debug -target:$(TARGET) -out:$@ \
 		$(BUILD_DEFINES) $(ENABLE_TESTS_FLAG) \
 		$(FILTERED_LINK) $(RESOURCES_BUILD) $(SOURCES_BUILD)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]