dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] CVS: pnet/engine lib_string.c,1.24,1.25


From: Jonathan Springer <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_string.c,1.24,1.25
Date: Mon, 11 Nov 2002 17:26:08 -0500

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv12468/engine

Modified Files:
        lib_string.c 
Log Message:


Change lib_string.c to follow ECMA exception rules more closely.


Index: lib_string.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_string.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** lib_string.c        10 Nov 2002 14:26:37 -0000      1.24
--- lib_string.c        11 Nov 2002 22:26:05 -0000      1.25
***************
*** 896,900 ****
  
        /* Validate the parameters */
!       if(startIndex < 0 || startIndex >= _this->length)
        {
                ILExecThreadThrowArgRange(thread, "startIndex",
--- 896,900 ----
  
        /* Validate the parameters */
!       if(startIndex < 0)
        {
                ILExecThreadThrowArgRange(thread, "startIndex",
***************
*** 909,912 ****
--- 909,919 ----
        }
  
+       /* Adjust for overflow */
+       if (startIndex >= _this->length)
+       {
+               count -= startIndex - (_this->length - 1);
+               startIndex = _this->length - 1;
+       }
+ 
        /* Search for the value */
        buf = StringToBuffer(_this) + startIndex;
***************
*** 943,947 ****
                return -1;
        }
!       if(startIndex < 0 || startIndex >= _this->length)
        {
                ILExecThreadThrowArgRange(thread, "startIndex",
--- 950,954 ----
                return -1;
        }
!       if(startIndex < 0)
        {
                ILExecThreadThrowArgRange(thread, "startIndex",
***************
*** 965,968 ****
--- 972,982 ----
        }
  
+       /* Adjust for overflow */
+       if (startIndex >= _this->length)
+       {
+               count -= startIndex - (_this->length - 1);
+               startIndex = _this->length - 1;
+       }
+ 
        /* Search for the value */
        buf = StringToBuffer(_this) + startIndex;
***************
*** 1128,1132 ****
        else
        {
!               return str;
        }
  }
--- 1142,1147 ----
        else
        {
!               ILExecThreadThrowArgNull(thread, "str");
!               return 0;
        }
  }
***************
*** 1143,1147 ****
        else
        {
!               return str;
        }
  }
--- 1158,1163 ----
        else
        {
!               ILExecThreadThrowArgNull(thread, "str");
!               return 0;
        }
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]