fixed uninitialized values

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@8834 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2014-07-10 20:12:14 +00:00
parent 8b6631a000
commit 96f839e181
2 changed files with 25 additions and 8 deletions

View File

@ -38,6 +38,7 @@ cxxNumKeyword(io)
this->n_user = this->n_user_end = l_n_user;
this->pitzer_exchange_gammas = true;
this->new_def = false;
this->n_solution = -999;
//
// Mix exchangers
//

View File

@ -36,7 +36,7 @@ read_transport(void)
*/
char *ptr;
int i, j, l;
int old_cells, max;
int old_cells, max, all_cells;
int count_length, count_disp, count_punch, count_print;
int count_length_alloc, count_disp_alloc;
char token[MAX_LENGTH];
@ -103,6 +103,8 @@ read_transport(void)
{
correct_disp = FALSE;
old_cells = 0;
max = 0;
all_cells = 0;
}
else
old_cells = count_cells;
@ -660,15 +662,29 @@ read_transport(void)
/*
* Allocate space for cell_data
*/
cell_data =
(struct cell_data *) PHRQ_realloc(cell_data,
(size_t) (max *
(1 +
stag_data->count_stag) +
1) *
sizeof(struct cell_data));
cell_data = (struct cell_data *) PHRQ_realloc(cell_data,
(size_t) (max * (1 + stag_data->count_stag) + 1) * sizeof(struct cell_data));
if (cell_data == NULL)
malloc_error();
// initialize new cells
int all_cells_now = max * (1 + stag_data->count_stag) + 1;
if (all_cells_now > all_cells)
{
for (int i = all_cells; i < all_cells_now; i++)
{
cell_data[i].length = 1.0;
cell_data[i].mid_cell_x = 1.0;
cell_data[i].disp = 1.0;
cell_data[i].temp = 25.0;
cell_data[i].por = 0.1;
cell_data[i].por_il = 0.01;
cell_data[i].punch = FALSE;
cell_data[i].print = FALSE;
}
all_cells = all_cells_now;
}
/*
* Fill in data for lengths
*/