summaryrefslogtreecommitdiff
path: root/src/classlibnative/bcltype/stringnative.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/classlibnative/bcltype/stringnative.cpp')
-rw-r--r--src/classlibnative/bcltype/stringnative.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/classlibnative/bcltype/stringnative.cpp b/src/classlibnative/bcltype/stringnative.cpp
index 46be714ed3..1e6b132b17 100644
--- a/src/classlibnative/bcltype/stringnative.cpp
+++ b/src/classlibnative/bcltype/stringnative.cpp
@@ -285,7 +285,7 @@ FCIMPLEND
STRINGREF value; INT32 thisOffset;} _compareOrdinalArgsEx;
==============================================================================*/
-FCIMPL5(INT32, COMString::CompareOrdinalEx, StringObject* strA, INT32 indexA, StringObject* strB, INT32 indexB, INT32 count)
+FCIMPL6(INT32, COMString::CompareOrdinalEx, StringObject* strA, INT32 indexA, INT32 countA, StringObject* strB, INT32 indexB, INT32 countB)
{
FCALL_CONTRACT;
@@ -294,41 +294,16 @@ FCIMPL5(INT32, COMString::CompareOrdinalEx, StringObject* strA, INT32 indexA, St
DWORD *strAChars, *strBChars;
int strALength, strBLength;
- // This runtime test is handled in the managed wrapper.
+ // These runtime tests are handled in the managed wrapper.
_ASSERTE(strA != NULL && strB != NULL);
-
- //If any of our indices are negative throw an exception.
- if (count<0)
- {
- FCThrowArgumentOutOfRange(W("count"), W("ArgumentOutOfRange_NegativeCount"));
- }
- if (indexA < 0)
- {
- FCThrowArgumentOutOfRange(W("indexA"), W("ArgumentOutOfRange_Index"));
- }
- if (indexB < 0)
- {
- FCThrowArgumentOutOfRange(W("indexB"), W("ArgumentOutOfRange_Index"));
- }
+ _ASSERTE(indexA >= 0 && indexB >= 0);
+ _ASSERTE(countA >= 0 && countB >= 0);
strA->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strAChars, &strALength);
strB->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strBChars, &strBLength);
- int countA = count;
- int countB = count;
-
- //Do a lot of range checking to make sure that everything is kosher and legit.
- if (count > (strALength - indexA)) {
- countA = strALength - indexA;
- if (countA < 0)
- FCThrowArgumentOutOfRange(W("indexA"), W("ArgumentOutOfRange_Index"));
- }
-
- if (count > (strBLength - indexB)) {
- countB = strBLength - indexB;
- if (countB < 0)
- FCThrowArgumentOutOfRange(W("indexB"), W("ArgumentOutOfRange_Index"));
- }
+ _ASSERTE(countA <= strALength - indexA);
+ _ASSERTE(countB <= strBLength - indexB);
// Set up the loop variables.
strAChars = (DWORD *) ((WCHAR *) strAChars + indexA);