Modified:
branches/5.1/Driver/Source/Types/MetaData.cs
branches/5.1/Driver/Source/Types/MySqlBinary.cs
branches/5.1/Driver/Source/Types/MySqlBit.cs
branches/5.1/Driver/Source/Types/MySqlConversionException.cs
branches/5.1/Driver/Source/Types/MySqlDateTime.cs
branches/5.1/Driver/Source/common/Cache.cs
branches/5.1/Driver/Source/common/ContextString.cs
branches/5.1/Driver/Source/common/NamedPipeStream.cs
branches/5.1/Driver/Source/common/SHA1.cs
branches/5.1/Driver/Source/common/SqlTokenizer.cs
branches/5.1/Driver/Source/common/StreamCreator.cs
branches/5.1/Driver/Source/common/Version.cs
Log:
merging conversion from spaces to tabs
Modified: branches/5.1/Driver/Source/Types/MetaData.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MetaData.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/Types/MetaData.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -26,28 +26,28 @@
{
internal class MetaData
{
- public static bool IsNumericType(string typename)
- {
- string lowerType = typename.ToLower(CultureInfo.InvariantCulture);
- switch (lowerType)
- {
- case "int":
- case "integer":
- case "numeric":
- case "decimal":
- case "dec":
- case "fixed":
- case "tinyint":
- case "mediumint":
- case "bigint":
- case "real":
- case "double":
- case "float":
- case "serial":
- case "smallint": return true;
- }
- return false;
- }
+ public static bool IsNumericType(string typename)
+ {
+ string lowerType = typename.ToLower(CultureInfo.InvariantCulture);
+ switch (lowerType)
+ {
+ case "int":
+ case "integer":
+ case "numeric":
+ case "decimal":
+ case "dec":
+ case "fixed":
+ case "tinyint":
+ case "mediumint":
+ case "bigint":
+ case "real":
+ case "double":
+ case "float":
+ case "serial":
+ case "smallint": return true;
+ }
+ return false;
+ }
public static MySqlDbType NameToType(string typeName, bool unsigned,
bool realAsFloat, MySqlConnection connection)
@@ -77,7 +77,7 @@
case "bit": return MySqlDbType.Bit;
case "tinyint":
- return unsigned ? MySqlDbType.UByte : MySqlDbType.Byte;
+ return unsigned ? MySqlDbType.UByte : MySqlDbType.Byte;
case "bool":
case "boolean":
return MySqlDbType.Byte;
@@ -96,26 +96,26 @@
case "double": return MySqlDbType.Double;
case "real": return
realAsFloat ? MySqlDbType.Float : MySqlDbType.Double;
- case "text":
- return MySqlDbType.Text;
- case "blob":
+ case "text":
+ return MySqlDbType.Text;
+ case "blob":
return MySqlDbType.Blob;
case "longblob":
- return MySqlDbType.LongBlob;
- case "longtext":
- return MySqlDbType.LongText;
+ return MySqlDbType.LongBlob;
+ case "longtext":
+ return MySqlDbType.LongText;
case "mediumblob":
- return MySqlDbType.MediumBlob;
- case "mediumtext":
- return MySqlDbType.MediumText;
+ return MySqlDbType.MediumBlob;
+ case "mediumtext":
+ return MySqlDbType.MediumText;
case "tinyblob":
- return MySqlDbType.TinyBlob;
+ return MySqlDbType.TinyBlob;
case "tinytext":
return MySqlDbType.TinyText;
- case "binary":
- return MySqlDbType.Binary;
- case "varbinary":
- return MySqlDbType.VarBinary;
+ case "binary":
+ return MySqlDbType.Binary;
+ case "varbinary":
+ return MySqlDbType.VarBinary;
}
throw new MySqlException("Unhandled type encountered");
}
Modified: branches/5.1/Driver/Source/Types/MySqlBinary.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlBinary.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/Types/MySqlBinary.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -183,7 +183,7 @@
{
string[] types = new string[] { "BLOB", "TINYBLOB", "MEDIUMBLOB", "LONGBLOB" };
MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.Blob,
- MySqlDbType.TinyBlob, MySqlDbType.MediumBlob, MySqlDbType.LongBlob };
+ MySqlDbType.TinyBlob, MySqlDbType.MediumBlob, MySqlDbType.LongBlob };
// we use name indexing because this method will only be called
// when GetSchema is called for the DataSourceInformation
Modified: branches/5.1/Driver/Source/Types/MySqlBit.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlBit.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/Types/MySqlBit.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -58,21 +58,21 @@
object IMySqlValue.Value
{
get
- {
- if (mValue == 0 || mValue == 1)
- return Convert.ToBoolean(mValue);
- return mValue;
- }
+ {
+ if (mValue == 0 || mValue == 1)
+ return Convert.ToBoolean(mValue);
+ return mValue;
+ }
}
Type IMySqlValue.SystemType
{
get
- {
- if (mValue == 0 || mValue == 1)
- return typeof(Boolean);
- return typeof(UInt64);
- }
+ {
+ if (mValue == 0 || mValue == 1)
+ return typeof(Boolean);
+ return typeof(UInt64);
+ }
}
string IMySqlValue.MySqlTypeName
Modified: branches/5.1/Driver/Source/Types/MySqlConversionException.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlConversionException.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/Types/MySqlConversionException.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -28,7 +28,7 @@
#if !CF
[Serializable]
#endif
- public class MySqlConversionException : Exception
+ public class MySqlConversionException : Exception
{
/// <summary>Ctor</summary>
public MySqlConversionException(string msg)
Modified: branches/5.1/Driver/Source/Types/MySqlDateTime.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlDateTime.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/Types/MySqlDateTime.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -417,13 +417,13 @@
return (type == MySqlDbType.Date) ? d.ToString("d") : d.ToString();
}
- if (type == MySqlDbType.Date)
- return String.Format(CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern,
- year, month, day);
+ if (type == MySqlDbType.Date)
+ return String.Format(CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern,
+ year, month, day);
- return String.Format(CultureInfo.CurrentUICulture.DateTimeFormat.FullDateTimePattern,
- year, month, day, hour, minute, second);
- }
+ return String.Format(CultureInfo.CurrentUICulture.DateTimeFormat.FullDateTimePattern,
+ year, month, day, hour, minute, second);
+ }
/// <summary></summary>
/// <param name="val"></param>
@@ -446,7 +446,7 @@
{
string[] types = new string[] { "DATE", "DATETIME", "TIMESTAMP" };
MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.Date,
- MySqlDbType.Datetime, MySqlDbType.Timestamp };
+ MySqlDbType.Datetime, MySqlDbType.Timestamp };
// we use name indexing because this method will only be called
// when GetSchema is called for the DataSourceInformation
Modified: branches/5.1/Driver/Source/common/Cache.cs
===================================================================
--- branches/5.1/Driver/Source/common/Cache.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/Cache.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -22,36 +22,36 @@
namespace MySql.Data.Common
{
- internal class Cache : NameObjectCollectionBase
- {
- private int capacity;
+ internal class Cache : NameObjectCollectionBase
+ {
+ private int capacity;
- public Cache(int initialCapacity, int capacity) : base(initialCapacity)
- {
- this.capacity = capacity;
- }
+ public Cache(int initialCapacity, int capacity) : base(initialCapacity)
+ {
+ this.capacity = capacity;
+ }
- public object this[string key]
- {
- get { return BaseGet(key); }
- set { InternalAdd(key, value); }
- }
+ public object this[string key]
+ {
+ get { return BaseGet(key); }
+ set { InternalAdd(key, value); }
+ }
- public void Add(string key, object value)
- {
- InternalAdd(key, value);
- }
+ public void Add(string key, object value)
+ {
+ InternalAdd(key, value);
+ }
- private void InternalAdd(string key, object value)
- {
- if (base.Count == capacity)
- RemoveOldestItem();
- BaseAdd(key, value);
- }
+ private void InternalAdd(string key, object value)
+ {
+ if (base.Count == capacity)
+ RemoveOldestItem();
+ BaseAdd(key, value);
+ }
- private void RemoveOldestItem()
- {
- BaseRemoveAt(0);
- }
- }
+ private void RemoveOldestItem()
+ {
+ BaseRemoveAt(0);
+ }
+ }
}
\ No newline at end of file
Modified: branches/5.1/Driver/Source/common/ContextString.cs
===================================================================
--- branches/5.1/Driver/Source/common/ContextString.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/ContextString.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -26,95 +26,95 @@
{
internal class ContextString
{
- string contextMarkers;
- bool escapeBackslash;
+ string contextMarkers;
+ bool escapeBackslash;
// Create a private ctor so the compiler doesn't give us a default one
public ContextString(string contextMarkers, bool escapeBackslash)
{
- this.contextMarkers = contextMarkers;
- this.escapeBackslash = escapeBackslash;
+ this.contextMarkers = contextMarkers;
+ this.escapeBackslash = escapeBackslash;
}
- public string ContextMarkers
- {
- get { return contextMarkers; }
- set { contextMarkers = value; }
- }
+ public string ContextMarkers
+ {
+ get { return contextMarkers; }
+ set { contextMarkers = value; }
+ }
- public int IndexOf(string src, string target)
- {
- return IndexOf(src, target, 0);
- }
+ public int IndexOf(string src, string target)
+ {
+ return IndexOf(src, target, 0);
+ }
- public int IndexOf(string src, string target, int startIndex)
- {
- int index = src.IndexOf(target, startIndex);
- while (index != -1)
- {
- if (!IndexInQuotes(src, index, startIndex)) break;
- index = src.IndexOf(target, index + 1);
- }
- return index;
- }
+ public int IndexOf(string src, string target, int startIndex)
+ {
+ int index = src.IndexOf(target, startIndex);
+ while (index != -1)
+ {
+ if (!IndexInQuotes(src, index, startIndex)) break;
+ index = src.IndexOf(target, index + 1);
+ }
+ return index;
+ }
- private bool IndexInQuotes(string src, int index, int startIndex)
- {
- char contextMarker = Char.MinValue;
- bool escaped = false;
+ private bool IndexInQuotes(string src, int index, int startIndex)
+ {
+ char contextMarker = Char.MinValue;
+ bool escaped = false;
- for (int i = startIndex; i < index; i++)
- {
- char c = src[i];
+ for (int i = startIndex; i < index; i++)
+ {
+ char c = src[i];
- int contextIndex = contextMarkers.IndexOf(c);
+ int contextIndex = contextMarkers.IndexOf(c);
- // if we have found the closing marker for our open marker, then close the context
- if (contextIndex > -1 && contextMarker == contextMarkers[contextIndex] && !escaped)
- contextMarker = Char.MinValue;
+ // if we have found the closing marker for our open marker, then close the context
+ if (contextIndex > -1 && contextMarker == contextMarkers[contextIndex] && !escaped)
+ contextMarker = Char.MinValue;
- // if we have found a context marker and we are not in a context yet, then start one
- else if (contextMarker == Char.MinValue && contextIndex > -1 && !escaped)
- contextMarker = c;
+ // if we have found a context marker and we are not in a context yet, then start one
+ else if (contextMarker == Char.MinValue && contextIndex > -1 && !escaped)
+ contextMarker = c;
- else if (c == '\\' && escapeBackslash)
- escaped = !escaped;
- }
- return contextMarker != Char.MinValue || escaped;
- }
+ else if (c == '\\' && escapeBackslash)
+ escaped = !escaped;
+ }
+ return contextMarker != Char.MinValue || escaped;
+ }
- public int IndexOf(string src, char target)
- {
- char contextMarker = Char.MinValue;
- bool escaped = false;
- int pos = 0;
+ public int IndexOf(string src, char target)
+ {
+ char contextMarker = Char.MinValue;
+ bool escaped = false;
+ int pos = 0;
- foreach (char c in src)
- {
- int contextIndex = contextMarkers.IndexOf(c);
+ foreach (char c in src)
+ {
+ int contextIndex = contextMarkers.IndexOf(c);
- // if we have found the closing marker for our open marker, then close the context
- if (contextIndex > -1 && contextMarker == contextMarkers[contextIndex] && !escaped)
- contextMarker = Char.MinValue;
+ // if we have found the closing marker for our open marker, then close the context
+ if (contextIndex > -1 && contextMarker == contextMarkers[contextIndex] && !escaped)
+ contextMarker = Char.MinValue;
- // if we have found a context marker and we are not in a context yet, then start one
- else if (contextMarker == Char.MinValue && contextIndex > -1 && !escaped)
- contextMarker = c;
+ // if we have found a context marker and we are not in a context yet, then start one
+ else if (contextMarker == Char.MinValue && contextIndex > -1 && !escaped)
+ contextMarker = c;
- else if (contextMarker == Char.MinValue && c == target)
- return pos;
- else if (c == '\\' && escapeBackslash)
- escaped = !escaped;
- pos++;
- }
- return -1;
- }
+ else if (contextMarker == Char.MinValue && c == target)
+ return pos;
+ else if (c == '\\' && escapeBackslash)
+ escaped = !escaped;
+ pos++;
+ }
+ return -1;
+ }
public string[] Split(string src, string delimiters)
{
ArrayList parts = new ArrayList();
StringBuilder sb = new StringBuilder();
- bool escaped = false;
+ bool escaped = false;
char contextMarker = Char.MinValue;
@@ -133,31 +133,31 @@
}
}
}
- else if (c == '\\' && escapeBackslash)
- escaped = !escaped;
+ else if (c == '\\' && escapeBackslash)
+ escaped = !escaped;
else
{
int contextIndex = contextMarkers.IndexOf(c);
- if (!escaped && contextIndex != -1)
- {
- // if we have found the closing marker for our open
- // marker, then close the context
- if ((contextIndex % 2) == 1)
- {
- if (contextMarker == contextMarkers[contextIndex - 1])
- contextMarker = Char.MinValue;
- }
- else
- {
- // if the opening and closing context markers are
- // the same then we will always find the opening
- // marker.
- if (contextMarker == contextMarkers[contextIndex + 1])
- contextMarker = Char.MinValue;
- else if (contextMarker == Char.MinValue)
- contextMarker = c;
- }
- }
+ if (!escaped && contextIndex != -1)
+ {
+ // if we have found the closing marker for our open
+ // marker, then close the context
+ if ((contextIndex % 2) == 1)
+ {
+ if (contextMarker == contextMarkers[contextIndex - 1])
+ contextMarker = Char.MinValue;
+ }
+ else
+ {
+ // if the opening and closing context markers are
+ // the same then we will always find the opening
+ // marker.
+ if (contextMarker == contextMarkers[contextIndex + 1])
+ contextMarker = Char.MinValue;
+ else if (contextMarker == Char.MinValue)
+ contextMarker = c;
+ }
+ }
sb.Append( c );
}
Modified: branches/5.1/Driver/Source/common/NamedPipeStream.cs
===================================================================
--- branches/5.1/Driver/Source/common/NamedPipeStream.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/NamedPipeStream.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -167,8 +167,8 @@
result = true;
while (count != 0 && result)
{
- uint thisWritten;
- int cnt = Math.Min(count, 65535);
+ uint thisWritten;
+ int cnt = Math.Min(count, 65535);
Array.Copy( buffer, offset, localBuf, 0, cnt );
result = NativeMethods.WriteFile((IntPtr)pipeHandle, localBuf, (uint)cnt, out thisWritten, IntPtr.Zero);
bytesWritten += thisWritten;
Modified: branches/5.1/Driver/Source/common/SHA1.cs
===================================================================
--- branches/5.1/Driver/Source/common/SHA1.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/SHA1.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -22,9 +22,9 @@
namespace MySql.Data.Common
{
- class SHA1Hash
- {
- private const int SHA1_HASH_SIZE = 20; // Hash size in bytes
+ class SHA1Hash
+ {
+ private const int SHA1_HASH_SIZE = 20; // Hash size in bytes
// Constants defined in SHA-1
private static uint[] K = new uint[4] {
@@ -33,22 +33,22 @@
private static uint[] sha_const_key = new uint[5] {
0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 };
- private ulong length; // Message length in bits
- private uint[] intermediateHash; // Message Digest
- private bool computed; // Is the digest computed?
+ private ulong length; // Message length in bits
+ private uint[] intermediateHash; // Message Digest
+ private bool computed; // Is the digest computed?
// private bool corrupted; // Is the message digest corrupted?
- private short messageBlockIndex; // Index into message block array
- private byte[] messageBlock; // 512-bit message blocks
+ private short messageBlockIndex; // Index into message block array
+ private byte[] messageBlock; // 512-bit message blocks
- public SHA1Hash()
- {
- intermediateHash = new uint[SHA1_HASH_SIZE/4];
- messageBlock = new byte[64];
+ public SHA1Hash()
+ {
+ intermediateHash = new uint[SHA1_HASH_SIZE/4];
+ messageBlock = new byte[64];
Reset();
- }
+ }
- public void Reset()
- {
+ public void Reset()
+ {
/*#ifndef DBUG_OFF
if (!context)
return SHA_NULL;
@@ -65,7 +65,7 @@
computed = false;
// corrupted = false;
- }
+ }
public byte[] ComputeHash(byte[] buffer)
{
@@ -74,16 +74,16 @@
return Result();
}
- public void Input(byte[] buffer, int index, int bufLen)
- {
- if (buffer == null || bufLen == 0) return;
+ public void Input(byte[] buffer, int index, int bufLen)
+ {
+ if (buffer == null || bufLen == 0) return;
- if (index < 0 || index > buffer.Length - 1)
- throw new ArgumentException("Index must be a value between 0 and buffer.Length-1", "index");
- if (bufLen < 0)
- throw new ArgumentException("Length must be a value > 0", "length");
- if ((bufLen+index) > buffer.Length)
- throw new ArgumentException("Length + index would extend past the end of buffer", "length");
+ if (index < 0 || index > buffer.Length - 1)
+ throw new ArgumentException("Index must be a value between 0 and buffer.Length-1", "index");
+ if (bufLen < 0)
+ throw new ArgumentException("Length must be a value > 0", "length");
+ if ((bufLen+index) > buffer.Length)
+ throw new ArgumentException("Length + index would extend past the end of buffer", "length");
/*#ifndef DBUG_OFF
// We assume client konows what it is doing in non-debug mode
@@ -95,10 +95,10 @@
return context->Corrupted;
#endif*/
- while (bufLen-- > 0)
- {
- messageBlock[messageBlockIndex++] = (byte)(buffer[index++] & 0xFF);
- length += 8; /* Length is in bits */
+ while (bufLen-- > 0)
+ {
+ messageBlock[messageBlockIndex++] = (byte)(buffer[index++] & 0xFF);
+ length += 8; /* Length is in bits */
/*#ifndef DBUG_OFF
@@ -109,143 +109,143 @@
return (context->Corrupted= 1); // Message is too long
#endif*/
- if (messageBlockIndex == 64)
- ProcessMessageBlock();
- }
- }
+ if (messageBlockIndex == 64)
+ ProcessMessageBlock();
+ }
+ }
- private void ProcessMessageBlock()
- {
- uint temp; // Temporary word value
- uint[] W; // Word sequence
- uint A, B, C, D, E; // Word buffers
+ private void ProcessMessageBlock()
+ {
+ uint temp; // Temporary word value
+ uint[] W; // Word sequence
+ uint A, B, C, D, E; // Word buffers
- W = new uint[80];
+ W = new uint[80];
- //Initialize the first 16 words in the array W
- for (int t = 0; t < 16; t++)
- {
- int index=t*4;
- W[t] = (uint)messageBlock[index] << 24;
- W[t] |= (uint)messageBlock[index + 1] << 16;
- W[t] |= (uint)messageBlock[index + 2] << 8;
- W[t] |= (uint)messageBlock[index + 3];
- }
+ //Initialize the first 16 words in the array W
+ for (int t = 0; t < 16; t++)
+ {
+ int index=t*4;
+ W[t] = (uint)messageBlock[index] << 24;
+ W[t] |= (uint)messageBlock[index + 1] << 16;
+ W[t] |= (uint)messageBlock[index + 2] << 8;
+ W[t] |= (uint)messageBlock[index + 3];
+ }
- for (int t = 16; t < 80; t++)
- {
- W[t] = CircularShift(1, W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
- }
+ for (int t = 16; t < 80; t++)
+ {
+ W[t] = CircularShift(1, W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
+ }
- A = intermediateHash[0];
- B = intermediateHash[1];
- C = intermediateHash[2];
- D = intermediateHash[3];
- E = intermediateHash[4];
+ A = intermediateHash[0];
+ B = intermediateHash[1];
+ C = intermediateHash[2];
+ D = intermediateHash[3];
+ E = intermediateHash[4];
- for (int t = 0; t < 20; t++)
- {
- temp= CircularShift(5, A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0];
- E = D;
- D = C;
- C = CircularShift(30, B);
- B = A;
- A = temp;
- }
+ for (int t = 0; t < 20; t++)
+ {
+ temp= CircularShift(5, A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0];
+ E = D;
+ D = C;
+ C = CircularShift(30, B);
+ B = A;
+ A = temp;
+ }
- for (int t = 20; t < 40; t++)
- {
- temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
- E = D;
- D = C;
- C = CircularShift(30,B);
- B = A;
- A = temp;
- }
+ for (int t = 20; t < 40; t++)
+ {
+ temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
+ E = D;
+ D = C;
+ C = CircularShift(30,B);
+ B = A;
+ A = temp;
+ }
- for (int t = 40; t < 60; t++)
- {
- temp= (CircularShift(5,A) + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]);
- E = D;
- D = C;
- C = CircularShift(30,B);
- B = A;
- A = temp;
- }
+ for (int t = 40; t < 60; t++)
+ {
+ temp= (CircularShift(5,A) + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]);
+ E = D;
+ D = C;
+ C = CircularShift(30,B);
+ B = A;
+ A = temp;
+ }
- for (int t = 60; t < 80; t++)
- {
- temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
- E = D;
- D = C;
- C = CircularShift(30,B);
- B = A;
- A = temp;
- }
+ for (int t = 60; t < 80; t++)
+ {
+ temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
+ E = D;
+ D = C;
+ C = CircularShift(30,B);
+ B = A;
+ A = temp;
+ }
- intermediateHash[0] += A;
- intermediateHash[1] += B;
- intermediateHash[2] += C;
- intermediateHash[3] += D;
- intermediateHash[4] += E;
+ intermediateHash[0] += A;
+ intermediateHash[1] += B;
+ intermediateHash[2] += C;
+ intermediateHash[3] += D;
+ intermediateHash[4] += E;
- messageBlockIndex = 0;
- }
+ messageBlockIndex = 0;
+ }
- private static uint CircularShift(int bits, uint word)
- {
+ private static uint CircularShift(int bits, uint word)
+ {
return (((word) << (bits)) | ((word) >> (32-(bits))));
- }
+ }
- private void PadMessage()
- {
- /*
- Check to see if the current message block is too small to hold
- the initial padding bits and length. If so, we will pad the
- block, process it, and then continue padding into a second
- block.
- */
+ private void PadMessage()
+ {
+ /*
+ Check to see if the current message block is too small to hold
+ the initial padding bits and length. If so, we will pad the
+ block, process it, and then continue padding into a second
+ block.
+ */
- int i = messageBlockIndex;
+ int i = messageBlockIndex;
- if (i > 55)
- {
- messageBlock[i++] = 0x80;
+ if (i > 55)
+ {
+ messageBlock[i++] = 0x80;
Array.Clear(messageBlock, i, 64-i);
- //bzero((char*) &context->Message_Block[i], sizeof(messageBlock[0])*(64-i));
- messageBlockIndex = 64;
+ //bzero((char*) &context->Message_Block[i], sizeof(messageBlock[0])*(64-i));
+ messageBlockIndex = 64;
- /* This function sets messageBlockIndex to zero */
- ProcessMessageBlock();
+ /* This function sets messageBlockIndex to zero */
+ ProcessMessageBlock();
Array.Clear(messageBlock, 0, 56);
- //bzero((char*) &context->Message_Block[0], sizeof(messageBlock[0])*56);
- messageBlockIndex = 56;
- }
- else
- {
- messageBlock[i++] = 0x80;
+ //bzero((char*) &context->Message_Block[0], sizeof(messageBlock[0])*56);
+ messageBlockIndex = 56;
+ }
+ else
+ {
+ messageBlock[i++] = 0x80;
Array.Clear(messageBlock, i, 56-i);
- //bzero((char*) &messageBlock[i], sizeof(messageBlock[0])*(56-i));
- messageBlockIndex = 56;
- }
+ //bzero((char*) &messageBlock[i], sizeof(messageBlock[0])*(56-i));
+ messageBlockIndex = 56;
+ }
- // Store the message length as the last 8 octets
- messageBlock[56] = (byte)(length >> 56);
- messageBlock[57] = (byte)(length >> 48);
- messageBlock[58] = (byte)(length >> 40);
- messageBlock[59] = (byte)(length >> 32);
- messageBlock[60] = (byte)(length >> 24);
- messageBlock[61] = (byte)(length >> 16);
- messageBlock[62] = (byte)(length >> 8);
- messageBlock[63] = (byte)length;
+ // Store the message length as the last 8 octets
+ messageBlock[56] = (byte)(length >> 56);
+ messageBlock[57] = (byte)(length >> 48);
+ messageBlock[58] = (byte)(length >> 40);
+ messageBlock[59] = (byte)(length >> 32);
+ messageBlock[60] = (byte)(length >> 24);
+ messageBlock[61] = (byte)(length >> 16);
+ messageBlock[62] = (byte)(length >> 8);
+ messageBlock[63] = (byte)length;
- ProcessMessageBlock();
- }
+ ProcessMessageBlock();
+ }
- public byte[] Result()
- {
+ public byte[] Result()
+ {
/*#ifndef DBUG_OFF
if (!context || !Message_Digest)
return SHA_NULL;
@@ -254,22 +254,22 @@
return context->Corrupted;
#endif*/
- if (!computed)
- {
- PadMessage();
+ if (!computed)
+ {
+ PadMessage();
- // message may be sensitive, clear it out
+ // message may be sensitive, clear it out
Array.Clear(messageBlock, 0, 64);
- //bzero((char*) messageBlock,64);
- length = 0; /* and clear length */
- computed = true;
- }
+ //bzero((char*) messageBlock,64);
+ length = 0; /* and clear length */
+ computed = true;
+ }
- byte[] messageDigest = new byte[SHA1_HASH_SIZE];
- for (int i = 0; i < SHA1_HASH_SIZE; i++)
- messageDigest[i] = (byte)((intermediateHash[i>>2] >> 8 * ( 3 - ( i & 0x03 ) )));
- return messageDigest;
- }
+ byte[] messageDigest = new byte[SHA1_HASH_SIZE];
+ for (int i = 0; i < SHA1_HASH_SIZE; i++)
+ messageDigest[i] = (byte)((intermediateHash[i>>2] >> 8 * ( 3 - ( i & 0x03 ) )));
+ return messageDigest;
+ }
- }
+ }
}
Modified: branches/5.1/Driver/Source/common/SqlTokenizer.cs
===================================================================
--- branches/5.1/Driver/Source/common/SqlTokenizer.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/SqlTokenizer.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -3,130 +3,130 @@
namespace MySql.Data.Common
{
- internal class SqlTokenizer
- {
- private string input;
- private int index;
- //private StringBuilder current;
- private bool ansiQuotes;
- private bool backslashEscapes;
- private bool inSize;
- private bool isSize;
- private bool quoted;
- private bool inParamters;
+ internal class SqlTokenizer
+ {
+ private string input;
+ private int index;
+ //private StringBuilder current;
+ private bool ansiQuotes;
+ private bool backslashEscapes;
+ private bool inSize;
+ private bool isSize;
+ private bool quoted;
+ private bool inParamters;
- public SqlTokenizer(string input)
- {
- this.input = input;
- index = -1;
- backslashEscapes = true;
- //current = new StringBuilder();
- }
+ public SqlTokenizer(string input)
+ {
+ this.input = input;
+ index = -1;
+ backslashEscapes = true;
+ //current = new StringBuilder();
+ }
- #region Properties
+ #region Properties
- public bool AnsiQuotes
- {
- get { return ansiQuotes; }
- set { ansiQuotes = value; }
- }
+ public bool AnsiQuotes
+ {
+ get { return ansiQuotes; }
+ set { ansiQuotes = value; }
+ }
- public bool BackslashEscapes
- {
- get { return backslashEscapes; }
- set { backslashEscapes = value; }
- }
+ public bool BackslashEscapes
+ {
+ get { return backslashEscapes; }
+ set { backslashEscapes = value; }
+ }
- public bool IsSize
- {
- get { return isSize; }
- }
+ public bool IsSize
+ {
+ get { return isSize; }
+ }
- public bool Quoted
- {
- get { return quoted; }
- }
+ public bool Quoted
+ {
+ get { return quoted; }
+ }
- #endregion
+ #endregion
- public string NextToken()
- {
- char lastChar = Char.MinValue;
- bool escaped = false;
- char quoteChar = Char.MinValue;
- StringBuilder current = new StringBuilder();
- bool inComment = false;
- bool inLineComment = false;
- quoted = isSize = false;
+ public string NextToken()
+ {
+ char lastChar = Char.MinValue;
+ bool escaped = false;
+ char quoteChar = Char.MinValue;
+ StringBuilder current = new StringBuilder();
+ bool inComment = false;
+ bool inLineComment = false;
+ quoted = isSize = false;
- while ((index+1) < input.Length)
- {
- char c = input[++index];
+ while ((index+1) < input.Length)
+ {
+ char c = input[++index];
- if (escaped)
- {
- current.Append(c);
- escaped = false;
- }
- else if (c == quoteChar)
- {
- quoted = true;
- return current.ToString();
- }
- else if (quoteChar != Char.MinValue)
- current.Append(c);
- else if (c == '`' || (c == '\"' && AnsiQuotes))
- quoteChar = c;
- else if (c == '/' && lastChar == '*' && inComment)
- inComment = false;
- else if (c == '*' && lastChar == '/')
- {
- inComment = true;
- current.Remove(current.Length - 1, 1);
- }
- else if (inComment || inLineComment)
- {
- if (inLineComment && c == '\n')
- inLineComment = false;
- }
- else if (c == '\\' && BackslashEscapes)
- {
- escaped = true;
- current.Append(c);
- }
- else if (c == '#')
- inLineComment = true;
- else if (c == '-' && lastChar == '-')
- {
- current.Remove(current.Length - 1, 1);
- inLineComment = true;
- }
- else if ((c == ',' || c == ')' || c == '(') && current.Length == 0)
- {
- inParamters = true;
- return c.ToString();
- }
- else if (Char.IsWhiteSpace(c) || c == '(' || c == ')' ||
- (c == ',' && !inSize))
- {
- if (c == ',' || (c == ')' && !inSize))
- index--;
- if (c == ')' && inSize)
- {
- isSize = true;
- inSize = false;
- }
- if (c == '(' && inParamters)
- inSize = true;
- if (current.Length > 0)
- return current.ToString();
- }
- else
- current.Append(c);
- lastChar = c;
- }
- return null;
- }
+ if (escaped)
+ {
+ current.Append(c);
+ escaped = false;
+ }
+ else if (c == quoteChar)
+ {
+ quoted = true;
+ return current.ToString();
+ }
+ else if (quoteChar != Char.MinValue)
+ current.Append(c);
+ else if (c == '`' || (c == '\"' && AnsiQuotes))
+ quoteChar = c;
+ else if (c == '/' && lastChar == '*' && inComment)
+ inComment = false;
+ else if (c == '*' && lastChar == '/')
+ {
+ inComment = true;
+ current.Remove(current.Length - 1, 1);
+ }
+ else if (inComment || inLineComment)
+ {
+ if (inLineComment && c == '\n')
+ inLineComment = false;
+ }
+ else if (c == '\\' && BackslashEscapes)
+ {
+ escaped = true;
+ current.Append(c);
+ }
+ else if (c == '#')
+ inLineComment = true;
+ else if (c == '-' && lastChar == '-')
+ {
+ current.Remove(current.Length - 1, 1);
+ inLineComment = true;
+ }
+ else if ((c == ',' || c == ')' || c == '(') && current.Length == 0)
+ {
+ inParamters = true;
+ return c.ToString();
+ }
+ else if (Char.IsWhiteSpace(c) || c == '(' || c == ')' ||
+ (c == ',' && !inSize))
+ {
+ if (c == ',' || (c == ')' && !inSize))
+ index--;
+ if (c == ')' && inSize)
+ {
+ isSize = true;
+ inSize = false;
+ }
+ if (c == '(' && inParamters)
+ inSize = true;
+ if (current.Length > 0)
+ return current.ToString();
+ }
+ else
+ current.Append(c);
+ lastChar = c;
+ }
+ return null;
+ }
- }
+ }
}
Modified: branches/5.1/Driver/Source/common/StreamCreator.cs
===================================================================
--- branches/5.1/Driver/Source/common/StreamCreator.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/StreamCreator.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -26,92 +26,92 @@
namespace MySql.Data.Common
{
- /// <summary>
- /// Summary description for StreamCreator.
- /// </summary>
- internal class StreamCreator
- {
- string hostList;
- uint port;
- string pipeName;
- uint timeOut;
+ /// <summary>
+ /// Summary description for StreamCreator.
+ /// </summary>
+ internal class StreamCreator
+ {
+ string hostList;
+ uint port;
+ string pipeName;
+ uint timeOut;
- public StreamCreator(string hosts, uint port, string pipeName)
- {
- hostList = hosts;
- if (hostList == null || hostList.Length == 0)
- hostList = "localhost";
- this.port = port;
- this.pipeName = pipeName;
- }
+ public StreamCreator(string hosts, uint port, string pipeName)
+ {
+ hostList = hosts;
+ if (hostList == null || hostList.Length == 0)
+ hostList = "localhost";
+ this.port = port;
+ this.pipeName = pipeName;
+ }
- public Stream GetStream(uint timeout)
- {
- timeOut = timeout;
+ public Stream GetStream(uint timeout)
+ {
+ timeOut = timeout;
- if (hostList.StartsWith("/"))
- return CreateSocketStream(null, true);
+ if (hostList.StartsWith("/"))
+ return CreateSocketStream(null, true);
- string[] dnsHosts = hostList.Split('&');
+ string[] dnsHosts = hostList.Split('&');
- Random random = new Random((int)DateTime.Now.Ticks);
- int index = random.Next(dnsHosts.Length);
- int pos = 0;
- bool usePipe = (pipeName != null && pipeName.Length != 0);
- Stream stream = null;
+ Random random = new Random((int)DateTime.Now.Ticks);
+ int index = random.Next(dnsHosts.Length);
+ int pos = 0;
+ bool usePipe = (pipeName != null && pipeName.Length != 0);
+ Stream stream = null;
- while (pos < dnsHosts.Length)
- {
+ while (pos < dnsHosts.Length)
+ {
#if !CF
if (usePipe)
stream = CreateNamedPipeStream(dnsHosts[index]);
else
#endif
- {
+ {
#if NET20
- IPHostEntry ipHE = GetHostEntry(dnsHosts[index]);
+ IPHostEntry ipHE = GetHostEntry(dnsHosts[index]);
#else
IPHostEntry ipHE = Dns.GetHostByName(dnsHosts[index]);
#endif
- foreach (IPAddress address in ipHE.AddressList)
- {
- // MySQL doesn't currently support IPv6 addresses
- if (address.AddressFamily == AddressFamily.InterNetworkV6)
- continue;
+ foreach (IPAddress address in ipHE.AddressList)
+ {
+ // MySQL doesn't currently support IPv6 addresses
+ if (address.AddressFamily == AddressFamily.InterNetworkV6)
+ continue;
- stream = CreateSocketStream(address, false);
- if (stream != null)
- break;
- }
- }
- if (stream != null)
- break;
- index++;
- if (index == dnsHosts.Length)
- index = 0;
- pos++;
- }
+ stream = CreateSocketStream(address, false);
+ if (stream != null)
+ break;
+ }
+ }
+ if (stream != null)
+ break;
+ index++;
+ if (index == dnsHosts.Length)
+ index = 0;
+ pos++;
+ }
- return stream;
- }
+ return stream;
+ }
- private IPHostEntry GetHostEntry(string hostname)
- {
- IPHostEntry ipHE;
+ private IPHostEntry GetHostEntry(string hostname)
+ {
+ IPHostEntry ipHE;
#if !CF
- IPAddress addr;
- if (IPAddress.TryParse(hostname, out addr))
- {
- ipHE = new IPHostEntry();
- ipHE.AddressList = new IPAddress[1];
- ipHE.AddressList[0] = addr;
- }
- else
+ IPAddress addr;
+ if (IPAddress.TryParse(hostname, out addr))
+ {
+ ipHE = new IPHostEntry();
+ ipHE.AddressList = new IPAddress[1];
+ ipHE.AddressList[0] = addr;
+ }
+ else
#endif
- ipHE = Dns.GetHostEntry(hostname);
- return ipHE;
- }
+ ipHE = Dns.GetHostEntry(hostname);
+ return ipHE;
+ }
#if !CF
private Stream CreateNamedPipeStream(string hostname)
@@ -141,15 +141,15 @@
}
#endif
- private Stream CreateSocketStream(IPAddress ip, bool unix)
- {
- EndPoint endPoint;
+ private Stream CreateSocketStream(IPAddress ip, bool unix)
+ {
+ EndPoint endPoint;
#if !CF
if (!Platform.IsWindows() && unix)
endPoint = CreateUnixEndPoint(hostList);
else
#endif
- endPoint = new IPEndPoint(ip, (int)port);
+ endPoint = new IPEndPoint(ip, (int)port);
Socket socket = unix ?
new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP) :
@@ -169,11 +169,11 @@
socket.Close();
return null;
}
- NetworkStream stream = new NetworkStream(socket, true);
- GC.SuppressFinalize(socket);
- GC.SuppressFinalize(stream);
- return stream;
+ NetworkStream stream = new NetworkStream(socket, true);
+ GC.SuppressFinalize(socket);
+ GC.SuppressFinalize(stream);
+ return stream;
}
- }
+ }
}
Modified: branches/5.1/Driver/Source/common/Version.cs
===================================================================
--- branches/5.1/Driver/Source/common/Version.cs 2007-08-10 17:09:10 UTC (rev 854)
+++ branches/5.1/Driver/Source/common/Version.cs 2007-08-10 17:10:53 UTC (rev 855)
@@ -41,20 +41,20 @@
srcString = s;
}
- public int Major
- {
- get { return major; }
- }
+ public int Major
+ {
+ get { return major; }
+ }
- public int Minor
- {
- get { return minor; }
- }
+ public int Minor
+ {
+ get { return minor; }
+ }
- public int Build
- {
- get { return build; }
- }
+ public int Build
+ {
+ get { return build; }
+ }
public static DBVersion Parse( string versionString )
{
| Thread |
|---|
| • Connector/NET commit: r855 - in branches/5.1/Driver/Source: Types common | rburnett | 10 Aug |