summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-02-20 14:58:40 +0000
committerBenny Prijono <bennylp@teluu.com>2007-02-20 14:58:40 +0000
commite288aba10e7bd0ba89ea24c4a267bd40a3a4d38d (patch)
tree571e88d072eaa1f751ec10167d3f4389f38fb002 /pjlib
parent6bfdf650518b480b495f6f720a4fd6e6b4fd4f51 (diff)
Fixed ticket #117: Bug in pj_array_insert() when position is equal to count-1
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@986 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-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);