R problem for ex16.

memcpy was overwriting the same space if i = row.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@8703 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2014-05-05 21:49:38 +00:00
parent c343330920
commit 8b2c1a8d07

View File

@ -2790,9 +2790,18 @@ shrink(struct inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out,
memcpy(&(array_out[row * max_column_count]), &(array_out[i * max_column_count]),
(size_t) max_column_count * sizeof(LDBLE));
*/
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
if (i > row)
{
if ((row*max_column_count + (*n + 1)) >= (i * max_column_count))
{
assert(false);
}
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
}
row_back_l[row] = i;
row++;
k1++;
@ -2826,9 +2835,17 @@ shrink(struct inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out,
memcpy(&(array_out[row * max_column_count]), &(array_out[i * max_column_count]),
(size_t) max_column_count * sizeof(LDBLE));
*/
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
if (i > row)
{
if ((row*max_column_count + (*n + 1)) >= (i * max_column_count))
{
assert(false);
}
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
}
row_back_l[row] = i;
row++;
l1++;
@ -2861,9 +2878,17 @@ shrink(struct inverse *inv_ptr, LDBLE * array_in, LDBLE * array_out,
memcpy(&(array_out[row * max_column_count]), &(array_out[i * max_column_count]),
(size_t) max_column_count * sizeof(LDBLE));
*/
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
if (i > row)
{
if ((row*max_column_count + (*n + 1)) >= (i * max_column_count))
{
assert(false);
}
memcpy(&(array_out[row * max_column_count]),
&(array_out[i * max_column_count]),
(size_t) (*n + 1) * sizeof(LDBLE));
}
row_back_l[row] = i;
row++;
m1++;