beagle r4779 - in trunk/beagle: BeagleClient Filters Util beagled beagled/NetworkServicesQueryable
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4779 - in trunk/beagle: BeagleClient Filters Util beagled beagled/NetworkServicesQueryable
- Date: Wed, 11 Jun 2008 05:22:43 +0000 (UTC)
Author: dbera
Date: Wed Jun 11 05:22:43 2008
New Revision: 4779
URL: http://svn.gnome.org/viewvc/beagle?rev=4779&view=rev
Log:
Remove our temporary implementations of Array.IndexOfTYPE methods. We now use the Array.IndexOf generics method.
Modified:
trunk/beagle/BeagleClient/UnixTransport.cs
trunk/beagle/Filters/FilterExternal.cs
trunk/beagle/Filters/FilterSvg.cs
trunk/beagle/Util/ArrayFu.cs
trunk/beagle/Util/StringFu.cs
trunk/beagle/beagled/LuceneCommon.cs
trunk/beagle/beagled/NetworkServicesQueryable/HttpTransport.cs
trunk/beagle/beagled/Server.cs
Modified: trunk/beagle/BeagleClient/UnixTransport.cs
==============================================================================
--- trunk/beagle/BeagleClient/UnixTransport.cs (original)
+++ trunk/beagle/BeagleClient/UnixTransport.cs Wed Jun 11 05:22:43 2008
@@ -193,7 +193,7 @@
break;
int end_index;
- end_index = ArrayFu.IndexOfByte (buffer, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (buffer, (byte) 0xff);
if (end_index == -1) {
deserialize_stream.Write (buffer, 0, bytes_read);
@@ -256,7 +256,7 @@
if (bytes_read > 0) {
// 0xff signifies end of message
- end_index = ArrayFu.IndexOfByte (this.network_data, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (this.network_data, (byte) 0xff);
this.BufferStream.Write (this.network_data, 0,
end_index == -1 ? bytes_read : end_index);
Modified: trunk/beagle/Filters/FilterExternal.cs
==============================================================================
--- trunk/beagle/Filters/FilterExternal.cs (original)
+++ trunk/beagle/Filters/FilterExternal.cs Wed Jun 11 05:22:43 2008
@@ -133,7 +133,7 @@
if (efi.Extensions == null)
continue;
- if (ArrayFu.IndexOfString (efi.Extensions, extension) != -1)
+ if (Array.IndexOf<string> (efi.Extensions, extension) != -1)
return efi;
}
}
@@ -143,7 +143,7 @@
if (efi.MimeTypes == null)
continue;
- if (ArrayFu.IndexOfString (efi.MimeTypes, mime_type) != -1)
+ if (Array.IndexOf<string> (efi.MimeTypes, mime_type) != -1)
return efi;
}
}
Modified: trunk/beagle/Filters/FilterSvg.cs
==============================================================================
--- trunk/beagle/Filters/FilterSvg.cs (original)
+++ trunk/beagle/Filters/FilterSvg.cs Wed Jun 11 05:22:43 2008
@@ -85,7 +85,7 @@
if (reader.IsEmptyElement)
break;
- if (ArrayFu.IndexOfString (ignore_strings, reader.LocalName) != -1)
+ if (Array.IndexOf<string> (ignore_strings, reader.LocalName) != -1)
break;
else if (reader.LocalName == "title") {
grab_property = true;
@@ -165,7 +165,7 @@
break;
}
- if (ArrayFu.IndexOfString (ignore_strings, reader.LocalName) != -1)
+ if (Array.IndexOf<string> (ignore_strings, reader.LocalName) != -1)
break;
else if (reader.NamespaceURI == dcnamespace) {
if (reader.LocalName == "date")
Modified: trunk/beagle/Util/ArrayFu.cs
==============================================================================
--- trunk/beagle/Util/ArrayFu.cs (original)
+++ trunk/beagle/Util/ArrayFu.cs Wed Jun 11 05:22:43 2008
@@ -72,62 +72,5 @@
return true;
}
-
- // FIXME: These can all go away when we switch to generics.
-
- // This is designed to be used instead of Array.IndexOf as it reduces
- // boxing and is therefore more efficient.
- public static int IndexOfByte (byte [] array, byte target, int start)
- {
- for (int i = start; i < array.Length; ++i)
- if (array [i] == target)
- return i;
- return -1;
- }
-
- public static int IndexOfByte (byte [] array, byte target)
- {
- return IndexOfByte (array, target, 0);
- }
-
- public static int IndexOfString (string [] array, string target, int start)
- {
- for (int i = start; i < array.Length; ++i)
- if (array [i] == target)
- return i;
- return -1;
- }
-
- public static int IndexOfString (string [] array, string target)
- {
- return IndexOfString (array, target, 0);
- }
-
- public static int IndexOfChar (string str, char target, int start)
- {
- for (int i = start; i < str.Length; ++i)
- if (str [i] == target)
- return i;
- return -1;
- }
-
- public static int IndexOfChar (string str, char target)
- {
- return IndexOfChar (str, target, 0);
- }
-
- public static int IndexOfChar (char [] array, char target, int start)
- {
- for (int i = start; i < array.Length; ++i)
- if (array [i] == target)
- return i;
-
- return -1;
- }
-
- public static int IndexOfChar (char [] array, char target)
- {
- return IndexOfChar (array, target, 0);
- }
}
}
Modified: trunk/beagle/Util/StringFu.cs
==============================================================================
--- trunk/beagle/Util/StringFu.cs (original)
+++ trunk/beagle/Util/StringFu.cs Wed Jun 11 05:22:43 2008
@@ -469,7 +469,7 @@
for (; index < str.Length; ++ index) {
char c = str [index];
- if (ArrayFu.IndexOfChar (CharsToQuote, c) != -1)
+ if (Array.IndexOf<char> (CharsToQuote, c) != -1)
builder.Append (Uri.HexEscape (c));
else if (c < 128)
builder.Append (c);
Modified: trunk/beagle/beagled/LuceneCommon.cs
==============================================================================
--- trunk/beagle/beagled/LuceneCommon.cs (original)
+++ trunk/beagle/beagled/LuceneCommon.cs Wed Jun 11 05:22:43 2008
@@ -1203,7 +1203,7 @@
public static bool IsStopWord (string stemmed_word)
{
- return ArrayFu.IndexOfString (StopAnalyzer.ENGLISH_STOP_WORDS, stemmed_word) != -1;
+ return Array.IndexOf<string> (StopAnalyzer.ENGLISH_STOP_WORDS, stemmed_word) != -1;
}
//////////////////////////////////////////////////////////////////////////////
Modified: trunk/beagle/beagled/NetworkServicesQueryable/HttpTransport.cs
==============================================================================
--- trunk/beagle/beagled/NetworkServicesQueryable/HttpTransport.cs (original)
+++ trunk/beagle/beagled/NetworkServicesQueryable/HttpTransport.cs Wed Jun 11 05:22:43 2008
@@ -100,7 +100,7 @@
if (bytes_read > 0) {
// 0xff signifies end of message
- end_index = ArrayFu.IndexOfByte (network_data, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (network_data, (byte) 0xff);
this.BufferStream.Write (network_data, 0, end_index == -1 ? bytes_read : end_index);
}
} while (bytes_read > 0 && end_index == -1);
@@ -192,7 +192,7 @@
do {
// 0xff signifies end of message
- end_index = ArrayFu.IndexOfByte (network_data, (byte) 0xff, prev_index);
+ end_index = Array.IndexOf<byte> (network_data, (byte) 0xff, prev_index);
if (end_index > bytes_read) {
// I'm not sure how this ever comes to be true, but it does,
@@ -271,7 +271,7 @@
break;
int end_index;
- end_index = ArrayFu.IndexOfByte (buffer, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (buffer, (byte) 0xff);
if (end_index == -1) {
deserialize_stream.Write (buffer, 0, bytes_read);
Modified: trunk/beagle/beagled/Server.cs
==============================================================================
--- trunk/beagle/beagled/Server.cs (original)
+++ trunk/beagle/beagled/Server.cs Wed Jun 11 05:22:43 2008
@@ -172,7 +172,7 @@
if (bytes_read > 0) {
// 0xff signifies end of message
- end_index = ArrayFu.IndexOfByte (network_data, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (network_data, (byte) 0xff);
buffer_stream.Write (network_data, 0,
end_index == -1 ? bytes_read : end_index);
@@ -404,7 +404,7 @@
if (bytes_read > 0) {
// 0xff signifies end of message
- end_index = ArrayFu.IndexOfByte (network_data, (byte) 0xff);
+ end_index = Array.IndexOf<byte> (network_data, (byte) 0xff);
buffer_stream.Write (network_data, 0,
end_index == -1 ? bytes_read : end_index);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]