summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-02-20 15:26:55 +0000
committerBenny Prijono <bennylp@teluu.com>2007-02-20 15:26:55 +0000
commit743547b8cef1835797dc8c052a938f8ee0527a53 (patch)
tree45002e3910bb1aecf8415c4beb8a8b9a5ed9c63a
parentc532c8e2c16d3ae00419376938273ea4cf2dde3b (diff)
Fixed ticket #118: Bug in pj_array_insert() when position is equal to count-1
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/pjproject-0.5-stable@987 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/include/pj/array.h2
-rw-r--r--pjlib/src/pj/array.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/pjlib/include/pj/array.h b/pjlib/include/pj/array.h
index ed234f96..f37fa75b 100644
--- a/pjlib/include/pj/array.h
+++ b/pjlib/include/pj/array.h
@@ -42,7 +42,7 @@ PJ_BEGIN_DECL
*
* @param array the array.
* @param elem_size the size of the individual element.
- * @param count the current number of elements in the array.
+ * @param count the CURRENT number of elements in the array.
* @param pos the position where the new element is put.
* @param value the value to copy to the new element.
*/
diff --git a/pjlib/src/pj/array.c b/pjlib/src/pj/array.c
index 0075214e..8d63868f 100644
--- a/pjlib/src/pj/array.c
+++ b/pjlib/src/pj/array.c
@@ -27,7 +27,7 @@ PJ_DEF(void) pj_array_insert( void *array,
unsigned pos,
const void *value)
{
- if (count && pos < count-1) {
+ if (count && pos < count) {
pj_memmove( (char*)array + (pos+1)*elem_size,
(char*)array + pos*elem_size,
(count-pos)*elem_size);