Merge branch 'master' of ssh://github.com/mono/mono
authorNeale Ferguson <neale@sinenomine.net>
Tue, 8 Nov 2011 19:50:34 +0000 (14:50 -0500)
committerNeale Ferguson <neale@sinenomine.net>
Tue, 8 Nov 2011 19:50:34 +0000 (14:50 -0500)
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs

index cd2c597de8b715f0b7f619d137c2b73db946535e..2f5eb561e5cdf6aecd5e0fb7fdc8676f8c953eee 100644 (file)
@@ -391,28 +391,9 @@ namespace Mono.Data.Tds.Protocol {
                        if (tdsVersion < TdsVersion.tds70) { 
                                Append (encoder.GetBytes (s));
                        } else {
-                               int cindex = 0, index;
-                               int ssize = sizeof (short);
-                               int lenToWrite = s.Length * ssize;
-                               // if nextOutBufferLength points to the last buffer in outBuffer, 
-                               // we would get a DivisionByZero while calculating remBufLen
-                               if (outBufferLength - nextOutBufferIndex < ssize)
-                                       SendIfFull (ssize);
-                               
-                               int remBufLen = outBufferLength - nextOutBufferIndex;
-                               int count = lenToWrite/remBufLen;
-                               
-                               if (lenToWrite % remBufLen > 0)
-                                       count++;
-                       
-                               for (int i = 0; i < count; i++) {
-                                       index = System.Math.Min (remBufLen/ssize, lenToWrite/ssize);
-                                       for (int j = 0; j < index*ssize; j+=2, cindex++)
-                                               AppendInternal ((short)s[cindex]);
-                                       
-                                       lenToWrite -= index*ssize;
-                                       // Just make sure to flush the buffer
-                                       SendIfFull ((lenToWrite+1)*ssize);
+                               for (int i = 0; i < s.Length; i++) {
+                                       SendIfFull (sizeof(short));
+                                       AppendInternal ((short)s[i]);
                                }
                        }
                }