Commit ddedfa23 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Fixed off by one error in DPA handling, added some warnings.

parent dbb61c0f
...@@ -1336,10 +1336,14 @@ DPA_GetPtr (const HDPA hdpa, INT i) ...@@ -1336,10 +1336,14 @@ DPA_GetPtr (const HDPA hdpa, INT i)
if (!hdpa) if (!hdpa)
return NULL; return NULL;
if (!hdpa->ptrs) if (!hdpa->ptrs) {
WARN("no pointer array.\n");
return NULL; return NULL;
if ((i < 0) || (i >= hdpa->nItemCount)) }
if ((i < 0) || (i >= hdpa->nItemCount)) {
WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount);
return NULL; return NULL;
}
TRACE("-- %p\n", hdpa->ptrs[i]); TRACE("-- %p\n", hdpa->ptrs[i]);
...@@ -1480,7 +1484,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) ...@@ -1480,7 +1484,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
/* within the old array */ /* within the old array */
if (hdpa->nMaxCount > i) { if (hdpa->nMaxCount > i) {
/* within the allocated space, set a new boundary */ /* within the allocated space, set a new boundary */
hdpa->nItemCount = i; hdpa->nItemCount = i+1;
} }
else { else {
/* resize the block of memory */ /* resize the block of memory */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment