revert entry 2008-09-01 - C# Insert and InsertRange bounds checking

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10875 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-09-18 23:17:52 +00:00
commit 90a4d04d85
2 changed files with 3 additions and 7 deletions

View file

@ -1,7 +1,7 @@
Version 1.3.37 (in progress) Version 1.3.37 (in progress)
============================= =============================
2008-09-17: wsfulton 2008-09-18: wsfulton
[C#] Added C# array typemaps provided by Antti Karanta. [C#] Added C# array typemaps provided by Antti Karanta.
The arrays provide a way to use MarshalAs(UnmanagedType.LPArray) The arrays provide a way to use MarshalAs(UnmanagedType.LPArray)
and pinning the array using 'fixed'. See arrays_csharp.i library file and pinning the array using 'fixed'. See arrays_csharp.i library file
@ -110,10 +110,6 @@ Version 1.3.37 (in progress)
[CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into [CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into
no-eval context in DEFCENUM no-eval context in DEFCENUM
2008-09-01: wsfulton
[C#] Correct array bounds checking in std::vector typemaps - Insert and InsertRange
methods.
2008-08-02: wuzzeb 2008-08-02: wuzzeb
[Chicken,Allegro] Commit Patch 2019314 [Chicken,Allegro] Commit Patch 2019314
Fixes a build error in chicken, and several build errors and other errors Fixes a build error in chicken, and several build errors and other errors

View file

@ -231,14 +231,14 @@
return new std::vector<CTYPE >(self->begin()+index, self->begin()+index+count); return new std::vector<CTYPE >(self->begin()+index, self->begin()+index+count);
} }
void Insert(int index, const value_type& x) throw (std::out_of_range) { void Insert(int index, const value_type& x) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size()) if (index>=0 && index<(int)self->size()+1)
self->insert(self->begin()+index, x); self->insert(self->begin()+index, x);
else else
throw std::out_of_range("index"); throw std::out_of_range("index");
} }
// Takes a deep copy of the elements unlike ArrayList.InsertRange // Takes a deep copy of the elements unlike ArrayList.InsertRange
void InsertRange(int index, const std::vector<CTYPE >& values) throw (std::out_of_range) { void InsertRange(int index, const std::vector<CTYPE >& values) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size()) if (index>=0 && index<(int)self->size()+1)
self->insert(self->begin()+index, values.begin(), values.end()); self->insert(self->begin()+index, values.begin(), values.end());
else else
throw std::out_of_range("index"); throw std::out_of_range("index");