Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1996 uninitialized variables #2004

Merged
merged 10 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion met/src/basic/vx_config/threshold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ else {
// adjust PT by the requested frequency bias amount
//

double PT_new;
double PT_new = 0.;

if ( fbias_fcst ) {
if ( op == thresh_le || op == thresh_lt ) PT_new = PT * fbias_val;
Expand Down
21 changes: 0 additions & 21 deletions met/src/basic/vx_log/concat_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ ConcatString::ConcatString()

init_from_scratch();

set_alloc_inc(default_cs_alloc_inc);

}


Expand All @@ -64,8 +62,6 @@ ConcatString::ConcatString(int _alloc_inc)

init_from_scratch();

set_alloc_inc(_alloc_inc);

}


Expand Down Expand Up @@ -237,23 +233,6 @@ void ConcatString::assign(const ConcatString & c)

memcpy(FloatFormat, c.FloatFormat, sizeof(FloatFormat));
Precision = c.Precision;
AllocInc = c.AllocInc;
}


////////////////////////////////////////////////////////////////////////


void ConcatString::set_alloc_inc(int _alloc_inc)

{

if ( _alloc_inc < min_cs_alloc_inc ) _alloc_inc = min_cs_alloc_inc;

AllocInc = _alloc_inc;

return;

}


Expand Down
8 changes: 0 additions & 8 deletions met/src/basic/vx_log/concat_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ class ConcatString {

void assign(const ConcatString &);

void extend(int);

int AllocInc;

int Precision;

char FloatFormat[16];
Expand Down Expand Up @@ -102,8 +98,6 @@ class ConcatString {
// set stuff
//

void set_alloc_inc(int);

void set_precision(int);

//
Expand Down Expand Up @@ -207,8 +201,6 @@ inline int ConcatString::precision() const { return ( Precision ); }

inline const char * ConcatString::float_format() const { return ( FloatFormat ); }

inline int ConcatString::alloc_inc() const { return ( AllocInc ); }

inline bool ConcatString::empty() const { return ( s ? s->empty() : true ); }
inline bool ConcatString::nonempty() const { return ( s ? !s->empty() : false ); }

Expand Down
1 change: 1 addition & 0 deletions met/src/basic/vx_log/string_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ void StringArray::init_from_scratch()
{

IgnoreCase = 0;
MaxLength = 0;

clear();

Expand Down
2 changes: 0 additions & 2 deletions met/src/basic/vx_log/string_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class StringArray {

std::vector<std::string> s;

int Nalloc;

int MaxLength;

bool IgnoreCase;
Expand Down
9 changes: 7 additions & 2 deletions met/src/libcode/vx_nc_util/nc_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ bool get_att_value(const NcAtt *att, double &att_val) {
int get_att_value_int(const NcAtt *att) {
int value = bad_data_int;
static const char *method_name = "get_att_value_int(NcAtt) -> ";

if (IS_INVALID_NC_P(att)) return value;

switch (att->getType().getId()) {
case NC_BYTE:
ncbyte b_value;
Expand Down Expand Up @@ -221,15 +224,15 @@ bool get_att_value_chars(const NcAtt *att, ConcatString &value) {

long long get_att_value_llong(const NcAtt *att) {
long long value = bad_data_int;
att->getValues(&value);
if (IS_VALID_NC_P(att)) att->getValues(&value);
return value;
}

////////////////////////////////////////////////////////////////////////

double get_att_value_double(const NcAtt *att) {
double value = bad_data_double;
att->getValues(&value);
if (IS_VALID_NC_P(att)) att->getValues(&value);
return value;
}

Expand Down Expand Up @@ -1658,6 +1661,8 @@ bool get_nc_data(NcVar *var, float *data) {
fill_value = get_att_value_char(att_fill_value);
}

var->getVar(packed_data);

if (unsigned_value) {
int value;
int positive_cnt = 0;
Expand Down
1 change: 1 addition & 0 deletions met/src/libcode/vx_statistics/pair_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void PairBase::clear() {
msg_typ.clear();
msg_typ_vals.clear();

interp_wdth = 0;
interp_mthd = InterpMthd_None;
interp_shape = GridTemplateFactory::GridTemplate_None;

Expand Down
1 change: 1 addition & 0 deletions met/src/libcode/vx_tc_util/vx_tc_nc_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid,
data_azi_mean = new double[grid.range_n()];

for(int ir = 0; ir < grid.range_n(); ir++) {
data_azi_mean[ir] = 0.;
for(int ia = 0; ia < grid.azimuth_n(); ia++) {
int i = ir * grid.azimuth_n() + ia;
int i_rev = (grid.range_n() - ir - 1) * grid.azimuth_n() + ia;
Expand Down
35 changes: 19 additions & 16 deletions met/src/tools/tc_utils/tc_stat/tc_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void process_jobs() {
ConcatString jobstring;
int i, n_jobs;
TCLineCounts n;
const char *method_name = "process_jobs() -> ";

// Open the output file
open_out_file();
Expand Down Expand Up @@ -193,27 +194,29 @@ void process_jobs() {

// Allocate a new job
cur_job = factory.new_tc_stat_job(jobstring.c_str());
if (cur_job) {
// Set the job output file stream
cur_job->JobOut = tc_stat_out;

// Set the job output file stream
cur_job->JobOut = tc_stat_out;
// Set the output precision
cur_job->set_precision(conf_info.Conf.output_precision());

// Set the output precision
cur_job->set_precision(conf_info.Conf.output_precision());
// Serialize the current job
mlog << Debug(2)
<< "\nProcessing Job " << i+1 << ": "
<< cur_job->serialize() << "\n";

// Serialize the current job
mlog << Debug(2)
<< "\nProcessing Job " << i+1 << ": "
<< cur_job->serialize() << "\n";
// Initialize counts
memset(&n, 0, sizeof(TCLineCounts));

// Initialize counts
memset(&n, 0, sizeof(TCLineCounts));
// Do the job
cur_job->do_job(tcst_files, n);

// Do the job
cur_job->do_job(tcst_files, n);

mlog << Debug(2)
<< "Job " << i+1 << " used " << n.NKeep << " out of "
<< n.NRead << " lines read.\n";
mlog << Debug(2) << method_name
<< "Job " << i+1 << " used " << n.NKeep << " out of "
<< n.NRead << " lines read.\n";
}
else mlog << Debug(1) << method_name << "job is missing\n";

mlog << Debug(3)
<< "Total lines read = " << n.NRead << "\n"
Expand Down