From 7f513ebb270578e3958f61c2a3c9113161360bce Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 27 Feb 2024 15:58:51 +0000 Subject: [PATCH 1/5] #2673 Change 0 to nullptr --- src/basic/enum_to_string/enum_to_string.cc | 6 ++-- src/basic/enum_to_string/scope.cc | 12 ++++---- src/basic/vx_config/celltype_to_string.cc | 2 +- src/basic/vx_config/grdfiletype_to_string.cc | 2 +- src/basic/vx_config/icode.cc | 14 ++++----- src/basic/vx_config/idstack.cc | 12 ++++---- src/basic/vx_config/number_stack.cc | 6 ++-- src/basic/vx_config/threshold.cc | 28 ++++++++--------- src/basic/vx_log/logger.cc | 4 +-- src/basic/vx_log/str_wrappers.cc | 2 +- src/basic/vx_math/hist.cc | 6 ++-- src/basic/vx_math/legendre.cc | 4 +-- src/basic/vx_math/ptile.cc | 8 ++--- src/basic/vx_math/viewgravity_to_string.cc | 2 +- src/basic/vx_util/ascii_table.cc | 4 +-- src/basic/vx_util/asciitablejust_to_string.cc | 2 +- src/basic/vx_util/command_line.cc | 10 +++---- src/basic/vx_util/crr_array.h | 8 ++--- src/basic/vx_util/data_line.cc | 10 +++---- src/basic/vx_util/data_plane.cc | 30 +++++++++---------- src/basic/vx_util/get_filenames.cc | 6 ++-- src/basic/vx_util/interp_util.cc | 10 +++---- src/basic/vx_util/is_number.cc | 4 +-- src/basic/vx_util/long_array.cc | 10 +++---- src/basic/vx_util/make_path.cc | 4 +-- src/basic/vx_util/ncrr_array.h | 14 ++++----- src/basic/vx_util/num_array.cc | 12 ++++---- src/basic/vx_util/ordinal.cc | 2 +- src/basic/vx_util/polyline.cc | 18 +++++------ src/basic/vx_util/thresh_array.cc | 10 +++---- src/basic/vx_util/two_d_array.h | 4 +-- 31 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/basic/enum_to_string/enum_to_string.cc b/src/basic/enum_to_string/enum_to_string.cc index 7760d47c26..1eb8fb1ae6 100644 --- a/src/basic/enum_to_string/enum_to_string.cc +++ b/src/basic/enum_to_string/enum_to_string.cc @@ -47,10 +47,10 @@ using namespace std; extern int yyparse(); // extern FILE * yyin; -FILE * yyin = 0; +FILE * yyin = nullptr; // extern char * yytext; -char * yytext = 0; +char * yytext = nullptr; extern int yydebug; @@ -90,7 +90,7 @@ bool do_reverse = false; bool verbose = true; -const char * program_name = (const char *) 0; +const char * program_name = (const char *) nullptr; //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/enum_to_string/scope.cc b/src/basic/enum_to_string/scope.cc index fc69bddf92..0d3f4ad5dd 100644 --- a/src/basic/enum_to_string/scope.cc +++ b/src/basic/enum_to_string/scope.cc @@ -38,7 +38,7 @@ ScopeStackElement::ScopeStackElement() { -Name = (const char *) 0; +Name = (const char *) nullptr; clear(); @@ -64,7 +64,7 @@ ScopeStackElement::ScopeStackElement(const ScopeStackElement & e) { -Name = (const char *) 0; +Name = (const char *) nullptr; assign(e); @@ -116,7 +116,7 @@ void ScopeStackElement::clear() Level = 0; -if ( Name ) { delete [] Name; Name = (const char *) 0; } +if ( Name ) { delete [] Name; Name = (const char *) nullptr; } return; @@ -131,12 +131,12 @@ void ScopeStackElement::set_name(const char * text) { const char *method_name = "void ScopeStackElement::set_name(const char *) -> "; -if ( Name ) { delete [] Name; Name = (const char *) 0; } +if ( Name ) { delete [] Name; Name = (const char *) nullptr; } if ( !text ) return; int k; -char * c = (char *) 0; +char * c = (char *) nullptr; k = m_strlen(text); @@ -154,7 +154,7 @@ m_strncpy(c, text, k, method_name); c[k] = (char) 0; // just to make sure -Name = (const char *) c; c = (char *) 0; +Name = (const char *) c; c = (char *) nullptr; return; diff --git a/src/basic/vx_config/celltype_to_string.cc b/src/basic/vx_config/celltype_to_string.cc index 226f8c50c7..32476474c2 100644 --- a/src/basic/vx_config/celltype_to_string.cc +++ b/src/basic/vx_config/celltype_to_string.cc @@ -39,7 +39,7 @@ ConcatString celltype_to_string(const CellType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_config/grdfiletype_to_string.cc b/src/basic/vx_config/grdfiletype_to_string.cc index e6f5b11b89..3a95b3eb1b 100644 --- a/src/basic/vx_config/grdfiletype_to_string.cc +++ b/src/basic/vx_config/grdfiletype_to_string.cc @@ -39,7 +39,7 @@ ConcatString grdfiletype_to_string(const GrdFileType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_config/icode.cc b/src/basic/vx_config/icode.cc index 0b5dfa631d..26aa274458 100644 --- a/src/basic/vx_config/icode.cc +++ b/src/basic/vx_config/icode.cc @@ -114,9 +114,9 @@ d = 0.0; type = no_cell_type; -name = (char *) 0; +name = (char *) nullptr; -text = (char *) 0; +text = (char *) nullptr; e = 0; @@ -596,7 +596,7 @@ void IcodeVector::init_from_scratch() { -Cell = (IcodeCell *) 0; +Cell = (IcodeCell *) nullptr; Ncells = Nalloc = 0; @@ -1155,7 +1155,7 @@ ICVStack::ICVStack() { -for (int j=0; j n ) return; int k; -Identifier * inew = (Identifier *) 0; +Identifier * inew = (Identifier *) nullptr; k = n/id_array_jump; @@ -507,9 +507,9 @@ if ( !inew ) { for (int j=0; jabbr_s << thresh_abbr_str[ind] << t; node = a; -a = 0; +a = nullptr; return; @@ -1527,7 +1527,7 @@ a->abbr_s << thresh_abbr_str[ind] << cs; node = a; -a = 0; +a = nullptr; return; @@ -1565,7 +1565,7 @@ a->set_na(); node = a; -a = 0; +a = nullptr; return; diff --git a/src/basic/vx_log/logger.cc b/src/basic/vx_log/logger.cc index 50199434c6..281d13cb47 100644 --- a/src/basic/vx_log/logger.cc +++ b/src/basic/vx_log/logger.cc @@ -438,7 +438,7 @@ Logger & Logger::operator=(const Logger & l) void Logger::init_from_scratch() { - out = (ofstream *) 0; + out = (ofstream *) nullptr; clear(); @@ -458,7 +458,7 @@ void Logger::clear() delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } diff --git a/src/basic/vx_log/str_wrappers.cc b/src/basic/vx_log/str_wrappers.cc index 0f58d0ab86..d0eb8b5922 100644 --- a/src/basic/vx_log/str_wrappers.cc +++ b/src/basic/vx_log/str_wrappers.cc @@ -49,7 +49,7 @@ void m_strcpy(char *to_str, const char *from_str, const char *method_name, // to_string should not allocated. This allocates and return to_str after copying char *m_strcpy2(const char *from_str, const char *method_name, const char *extra_msg) { - char *to_str = (char *) 0; + char *to_str = (char *) nullptr; if (from_str) { int str_len = m_strlen(from_str); diff --git a/src/basic/vx_math/hist.cc b/src/basic/vx_math/hist.cc index fb3cfa52c6..067a848013 100644 --- a/src/basic/vx_math/hist.cc +++ b/src/basic/vx_math/hist.cc @@ -52,7 +52,7 @@ Histogram::~Histogram() { -if ( Count ) { delete [] Count; Count = (int *) 0; } +if ( Count ) { delete [] Count; Count = (int *) nullptr; } } @@ -94,7 +94,7 @@ void Histogram::init_from_scratch() { -Count = (int *) 0; +Count = (int *) nullptr; Nbins = 0; @@ -143,7 +143,7 @@ void Histogram::set_nbd(int n, double b, double d) { -if ( Count ) { delete [] Count; Count = (int *) 0; } +if ( Count ) { delete [] Count; Count = (int *) nullptr; } Nbins = n; diff --git a/src/basic/vx_math/legendre.cc b/src/basic/vx_math/legendre.cc index 6d1b87317c..7ba2c696e6 100644 --- a/src/basic/vx_math/legendre.cc +++ b/src/basic/vx_math/legendre.cc @@ -139,9 +139,9 @@ void Legendre::clear() { -if ( P ) { delete [] P; P = 0; } +if ( P ) { delete [] P; P = nullptr; } -if ( PP ) { delete [] PP; PP = 0; } +if ( PP ) { delete [] PP; PP = nullptr; } X = 0.0; diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 31d3152284..c80051ac79 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -215,8 +215,8 @@ if ( n <= 1 ) return(0); int i, j, ties_current, ties_total, tie_rank_start = 0, tie_rank_end; double tie_rank_mean; -RankInfo *rank_info = (RankInfo *) 0; -double *ordered_array = (double *) 0; +RankInfo *rank_info = (RankInfo *) nullptr; +double *ordered_array = (double *) nullptr; double prev_v, v; rank_info = new RankInfo [n]; @@ -296,8 +296,8 @@ if(ties_current != 0) { } } -if(rank_info) { delete [] rank_info; rank_info = (RankInfo *) 0; } -if(ordered_array) { delete [] ordered_array; ordered_array = (double *) 0; } +if(rank_info) { delete [] rank_info; rank_info = (RankInfo *) nullptr; } +if(ordered_array) { delete [] ordered_array; ordered_array = (double *) nullptr; } return(ties_total); diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc index 9a7034fbcf..1363a26679 100644 --- a/src/basic/vx_math/viewgravity_to_string.cc +++ b/src/basic/vx_math/viewgravity_to_string.cc @@ -39,7 +39,7 @@ ConcatString viewgravity_to_string(const ViewGravity t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_util/ascii_table.cc b/src/basic/vx_util/ascii_table.cc index ff70dff926..db58781ba1 100644 --- a/src/basic/vx_util/ascii_table.cc +++ b/src/basic/vx_util/ascii_table.cc @@ -1022,7 +1022,7 @@ fix_float(str); if ( DoCommaString ) { char junk[256]; m_strncpy(junk, str.c_str(), str.length(), method_name); - char * p = (char *) 0; + char * p = (char *) nullptr; long X; ConcatString s; ConcatString j2; @@ -1248,7 +1248,7 @@ s = out; // done // -if ( out ) { delete [] out; out = (char *) 0; } +if ( out ) { delete [] out; out = (char *) nullptr; } return ( s ); diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc index 50fbf4387e..6c378d863e 100644 --- a/src/basic/vx_util/asciitablejust_to_string.cc +++ b/src/basic/vx_util/asciitablejust_to_string.cc @@ -39,7 +39,7 @@ ConcatString asciitablejust_to_string(const AsciiTableJust t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_util/command_line.cc b/src/basic/vx_util/command_line.cc index 2063d37d51..7911439c79 100644 --- a/src/basic/vx_util/command_line.cc +++ b/src/basic/vx_util/command_line.cc @@ -234,7 +234,7 @@ void CLOptionInfoArray::init_from_scratch() { -e = (CLOptionInfo *) 0; +e = (CLOptionInfo *) nullptr; AllocInc = 16; // default value @@ -252,7 +252,7 @@ void CLOptionInfoArray::clear() { -if ( e ) { delete [] e; e = (CLOptionInfo *) 0; } +if ( e ) { delete [] e; e = (CLOptionInfo *) nullptr; } @@ -298,7 +298,7 @@ if ( n <= Nalloc ) return; n = AllocInc*( (n + AllocInc - 1)/AllocInc ); int j; -CLOptionInfo * u = (CLOptionInfo *) 0; +CLOptionInfo * u = (CLOptionInfo *) nullptr; u = new CLOptionInfo [n]; @@ -317,11 +317,11 @@ for(j=0; j::init_from_scratch() { -e = (T *) 0; +e = (T *) nullptr; AllocInc = 25; // default value @@ -130,7 +130,7 @@ void CRR_Array::clear() { -if ( e ) { delete [] e; e = (T *) 0; } +if ( e ) { delete [] e; e = (T *) nullptr; } @@ -201,11 +201,11 @@ for(j=0; jclose(); - delete in; in = (ifstream *) 0; + delete in; in = (ifstream *) nullptr; } diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index a46cb4664d..d9977f7a92 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -1303,10 +1303,10 @@ void DataPlaneArray::init_from_scratch() { -Lower = (double *) 0; -Upper = (double *) 0; +Lower = (double *) nullptr; +Upper = (double *) nullptr; -Plane = (DataPlane **) 0; +Plane = (DataPlane **) nullptr; Nplanes = 0; @@ -1330,11 +1330,11 @@ if ( Nplanes > 0 ) { for (j=0; j= n ) return; int j, k; -DataPlane ** p = (DataPlane **) 0; -double * b = (double *) 0; -double * t = (double *) 0; +DataPlane ** p = (DataPlane **) nullptr; +double * b = (double *) nullptr; +double * t = (double *) nullptr; if ( ! exact ) { @@ -1411,7 +1411,7 @@ t = new double [n]; for (j=0; j::init_from_scratch() { -e = (T **) 0; +e = (T **) nullptr; AllocInc = ncrr_default_alloc_inc; @@ -158,11 +158,11 @@ if ( e ) { for (j=0; j::bubble_sort_decreasing(ncrr_cmp_func _cmp) if ( Nelements < 2 ) return; int j, k; -T * temp = 0; +T * temp = nullptr; for (j=0; j<(Nelements - 1); ++j) { diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index 20632a8978..c4d16f078a 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -642,9 +642,9 @@ int NumArray::rank_array(int &ties) int n_vld, i; - double *data = (double *) 0; - int *data_loc = (int *) 0; - double *data_rank = (double *) 0; + double *data = (double *) nullptr; + int *data_loc = (int *) nullptr; + double *data_rank = (double *) nullptr; // // Arrays to store the raw data values to be ranked, their locations, @@ -690,9 +690,9 @@ int NumArray::rank_array(int &ties) // // Deallocate memory // - if(data) { delete [] data; data = (double *) 0; } - if(data_loc) { delete [] data_loc; data_loc = (int *) 0; } - if(data_rank) { delete [] data_rank; data_rank = (double *) 0; } + if(data) { delete [] data; data = (double *) nullptr; } + if(data_loc) { delete [] data_loc; data_loc = (int *) nullptr; } + if(data_rank) { delete [] data_rank; data_rank = (double *) nullptr; } Sorted = false; diff --git a/src/basic/vx_util/ordinal.cc b/src/basic/vx_util/ordinal.cc index ef8bf4ab1e..66d8417952 100644 --- a/src/basic/vx_util/ordinal.cc +++ b/src/basic/vx_util/ordinal.cc @@ -74,7 +74,7 @@ if ( (n >= 10) && (n <= 20) ) { m_strcpy(out, th, method_name, "out1"); retur n %= 10; -const char * ans = (const char *) 0; +const char * ans = (const char *) nullptr; switch ( n ) { diff --git a/src/basic/vx_util/polyline.cc b/src/basic/vx_util/polyline.cc index 3ae48006f8..aa75ecda94 100644 --- a/src/basic/vx_util/polyline.cc +++ b/src/basic/vx_util/polyline.cc @@ -40,7 +40,7 @@ using namespace std; /////////////////////////////////////////////////////////////////////////////// Polyline::Polyline() { - u = v = (double *) 0; + u = v = (double *) nullptr; clear(); } @@ -55,7 +55,7 @@ Polyline::~Polyline() { /////////////////////////////////////////////////////////////////////////////// Polyline::Polyline(const Polyline &c) { - u = v = (double *) 0; + u = v = (double *) nullptr; assign(c); } @@ -75,8 +75,8 @@ Polyline & Polyline::operator=(const Polyline &c) { void Polyline::clear() { - if(u) { delete [] u; u = (double *) 0; } - if(v) { delete [] v; v = (double *) 0; } + if(u) { delete [] u; u = (double *) nullptr; } + if(v) { delete [] v; v = (double *) nullptr; } n_points = n_alloc = 0; @@ -203,8 +203,8 @@ void Polyline::extend_points(int n) { } int i; - double *uu = (double *) 0; - double *vv = (double *) 0; + double *uu = (double *) nullptr; + double *vv = (double *) nullptr; uu = new double [n]; vv = new double [n]; @@ -222,13 +222,13 @@ void Polyline::extend_points(int n) { vv[i] = v[i]; } - delete [] u; u = (double *) 0; - delete [] v; v = (double *) 0; + delete [] u; u = (double *) nullptr; + delete [] v; v = (double *) nullptr; u = uu; v = vv; - uu = vv = (double *) 0; + uu = vv = (double *) nullptr; return; } diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index eae780063f..2eb7f07e67 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -65,7 +65,7 @@ ThreshArray & ThreshArray::operator=(const ThreshArray & a) { void ThreshArray::init_from_scratch() { - t = (SingleThresh *) 0; + t = (SingleThresh *) nullptr; clear(); @@ -76,7 +76,7 @@ void ThreshArray::init_from_scratch() { void ThreshArray::clear() { - if(t) { delete [] t; t = (SingleThresh *) 0; } + if(t) { delete [] t; t = (SingleThresh *) nullptr; } Nelements = Nalloc = 0; @@ -134,17 +134,17 @@ void ThreshArray::extend(int n, bool exact) { n = k*thresharray_alloc_inc; } - SingleThresh *u = (SingleThresh *) 0; + SingleThresh *u = (SingleThresh *) nullptr; u = new SingleThresh [n]; if(t) { for(j=0; j::init_from_scratch() { -E = (T *) 0; +E = (T *) nullptr; clear(); @@ -133,7 +133,7 @@ void TwoD_Array::clear() { -if ( E ) { delete [] E; E = (T *) 0; } +if ( E ) { delete [] E; E = (T *) nullptr; } Nx = Ny = 0; From 7483636985decd60e028e9bd79d26da2710a6299 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 27 Feb 2024 16:52:00 +0000 Subject: [PATCH 2/5] #2673 Change 0 to nullptr --- src/libcode/vx_afm/afm.cc | 84 +++++++++---------- src/libcode/vx_afm/afmkeyword_to_string.cc | 2 +- src/libcode/vx_afm/afmtokentype_to_string.cc | 2 +- .../vx_analysis_util/analysis_utils.cc | 2 +- src/libcode/vx_analysis_util/mode_atts.cc | 8 +- src/libcode/vx_analysis_util/mode_job.cc | 20 ++--- src/libcode/vx_analysis_util/mode_line.cc | 8 +- src/libcode/vx_analysis_util/stat_job.cc | 42 +++++----- src/libcode/vx_analysis_util/stat_line.cc | 2 +- src/libcode/vx_analysis_util/time_series.cc | 4 +- src/libcode/vx_bool_calc/bool_calc.cc | 8 +- src/libcode/vx_bool_calc/token_stack.cc | 8 +- src/libcode/vx_bool_calc/tokenizer.cc | 4 +- src/libcode/vx_color/color_list.cc | 10 +-- src/libcode/vx_color/color_table.cc | 22 ++--- src/libcode/vx_data2d/data_class.cc | 12 +-- src/libcode/vx_data2d/leveltype_to_string.cc | 2 +- .../vx_data2d_factory/data2d_factory.cc | 8 +- src/libcode/vx_data2d_grib/data2d_grib.cc | 4 +- .../vx_data2d_grib/data2d_grib_utils.cc | 2 +- src/libcode/vx_data2d_grib/grib_classes.cc | 50 +++++------ src/libcode/vx_data2d_grib/grib_strings.cc | 4 +- src/libcode/vx_data2d_grib2/data2d_grib2.cc | 4 +- src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc | 4 +- src/libcode/vx_data2d_nc_met/data2d_nc_met.cc | 6 +- src/libcode/vx_data2d_nc_met/get_met_grid.cc | 2 +- src/libcode/vx_data2d_nc_met/met_file.cc | 16 ++-- .../vx_data2d_nc_met/var_info_nc_met.cc | 5 +- src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc | 8 +- .../vx_data2d_nc_wrf/var_info_nc_wrf.cc | 5 +- src/libcode/vx_data2d_nc_wrf/wrf_file.cc | 22 ++--- src/libcode/vx_data2d_python/data2d_python.cc | 6 +- .../vx_data2d_python/grid_from_python_dict.cc | 14 ++-- src/libcode/vx_gis/shapetype_to_string.cc | 2 +- src/libcode/vx_gis/shp_array.h | 8 +- src/libcode/vx_grid/find_grid_by_name.cc | 28 +++---- src/libcode/vx_grid/lc_grid.cc | 8 +- src/libcode/vx_grid/merc_grid.cc | 8 +- src/libcode/vx_grid/semilatlon_grid.cc | 4 +- src/libcode/vx_grid/st_grid.cc | 8 +- src/libcode/vx_gsl_prob/gsl_randist.cc | 20 ++--- src/libcode/vx_gsl_prob/gsl_statistics.cc | 4 +- src/libcode/vx_gsl_prob/gsl_wavelet2d.cc | 8 +- 43 files changed, 252 insertions(+), 246 deletions(-) diff --git a/src/libcode/vx_afm/afm.cc b/src/libcode/vx_afm/afm.cc index e40ac65256..97ff1e20d9 100644 --- a/src/libcode/vx_afm/afm.cc +++ b/src/libcode/vx_afm/afm.cc @@ -253,9 +253,9 @@ void LigatureInfo::init_from_scratch() { -successor_name = (char *) 0; +successor_name = (char *) nullptr; -ligature_name = (char *) 0; +ligature_name = (char *) nullptr; clear(); @@ -273,9 +273,9 @@ void LigatureInfo::clear() { -if ( successor_name ) { delete [] successor_name; successor_name = (char *) 0; } +if ( successor_name ) { delete [] successor_name; successor_name = (char *) nullptr; } -if ( ligature_name ) { delete [] ligature_name; ligature_name = (char *) 0; } +if ( ligature_name ) { delete [] ligature_name; ligature_name = (char *) nullptr; } successor_index = ligature_index = -1; @@ -424,9 +424,9 @@ void AfmCharMetrics::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; -linfo = (LigatureInfo *) 0; +linfo = (LigatureInfo *) nullptr; clear(); @@ -443,9 +443,9 @@ void AfmCharMetrics::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( linfo ) { delete [] linfo; linfo = (LigatureInfo *) 0; } +if ( linfo ) { delete [] linfo; linfo = (LigatureInfo *) nullptr; } ascii_code = -1; @@ -622,7 +622,7 @@ void PCC::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; clear(); @@ -638,7 +638,7 @@ void PCC::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } delta_x = 0; @@ -762,9 +762,9 @@ void AfmCompositeInfo::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; -pcc = (PCC *) 0; +pcc = (PCC *) nullptr; clear(); @@ -780,9 +780,9 @@ void AfmCompositeInfo::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( pcc ) { delete [] pcc; pcc = (PCC *) 0; } +if ( pcc ) { delete [] pcc; pcc = (PCC *) nullptr; } n_parts = 0; @@ -926,9 +926,9 @@ void KPX::init_from_scratch() { -name1 = (char *) 0; +name1 = (char *) nullptr; -name2 = (char *) 0; +name2 = (char *) nullptr; clear(); @@ -946,8 +946,8 @@ void KPX::clear() { -if ( name1 ) { delete [] name1; name1 = (char *) 0; } -if ( name2 ) { delete [] name2; name2 = (char *) 0; } +if ( name1 ) { delete [] name1; name1 = (char *) nullptr; } +if ( name2 ) { delete [] name2; name2 = (char *) nullptr; } dx = 0.0; @@ -1069,22 +1069,22 @@ void Afm::init_from_scratch() { -in = (ifstream *) 0; +in = (ifstream *) nullptr; -cm = (AfmCharMetrics *) 0; +cm = (AfmCharMetrics *) nullptr; -FontName = (char *) 0; -FullName = (char *) 0; -FamilyName = (char *) 0; -Weight = (char *) 0; -Version = (char *) 0; -EncodingScheme = (char *) 0; +FontName = (char *) nullptr; +FullName = (char *) nullptr; +FamilyName = (char *) nullptr; +Weight = (char *) nullptr; +Version = (char *) nullptr; +EncodingScheme = (char *) nullptr; -compinfo = (AfmCompositeInfo *) 0; +compinfo = (AfmCompositeInfo *) nullptr; -kpx = (KPX *) 0; +kpx = (KPX *) nullptr; @@ -1104,28 +1104,28 @@ void Afm::clear() { -if ( in ) { delete in; in = (ifstream *) 0; } +if ( in ) { delete in; in = (ifstream *) nullptr; } line_number = 0; -if ( FontName ) { delete [] FontName; FontName = (char *) 0; } -if ( FullName ) { delete [] FullName; FullName = (char *) 0; } -if ( FamilyName ) { delete [] FamilyName; FamilyName = (char *) 0; } -if ( Weight ) { delete [] Weight; Weight = (char *) 0; } -if ( Version ) { delete [] Version; Version = (char *) 0; } -if ( EncodingScheme ) { delete [] EncodingScheme; EncodingScheme = (char *) 0; } +if ( FontName ) { delete [] FontName; FontName = (char *) nullptr; } +if ( FullName ) { delete [] FullName; FullName = (char *) nullptr; } +if ( FamilyName ) { delete [] FamilyName; FamilyName = (char *) nullptr; } +if ( Weight ) { delete [] Weight; Weight = (char *) nullptr; } +if ( Version ) { delete [] Version; Version = (char *) nullptr; } +if ( EncodingScheme ) { delete [] EncodingScheme; EncodingScheme = (char *) nullptr; } -if ( cm ) { delete [] cm; cm = (AfmCharMetrics *) 0; } +if ( cm ) { delete [] cm; cm = (AfmCharMetrics *) nullptr; } n_cms = 0; -if ( compinfo ) { delete [] compinfo; compinfo = (AfmCompositeInfo *) 0; } +if ( compinfo ) { delete [] compinfo; compinfo = (AfmCompositeInfo *) nullptr; } n_composites = 0; -if ( kpx ) { delete [] kpx; kpx = (KPX *) 0; } +if ( kpx ) { delete [] kpx; kpx = (KPX *) nullptr; } n_kern_pairs = 0; @@ -1443,7 +1443,7 @@ for (j=0; jclose(); -delete in; in = (ifstream *) 0; +delete in; in = (ifstream *) nullptr; line_number = 0; @@ -2231,8 +2231,8 @@ if ( ascii_code_2 < 0 ) ascii_code_2 += 256; int j; int cm_index_1, cm_index_2; -const char * n1 = (const char *) 0; -const char * n2 = (const char *) 0; +const char * n1 = (const char *) nullptr; +const char * n2 = (const char *) nullptr; cm_index_1 = lookup_cm(ascii_code_1); cm_index_2 = lookup_cm(ascii_code_2); @@ -2279,7 +2279,7 @@ void set_string(char * & s, const char * text) { -if ( s ) { delete [] s; s = (char *) 0; } +if ( s ) { delete [] s; s = (char *) nullptr; } if ( !text ) return; diff --git a/src/libcode/vx_afm/afmkeyword_to_string.cc b/src/libcode/vx_afm/afmkeyword_to_string.cc index 2f0bc4ebeb..f2e6d2be89 100644 --- a/src/libcode/vx_afm/afmkeyword_to_string.cc +++ b/src/libcode/vx_afm/afmkeyword_to_string.cc @@ -39,7 +39,7 @@ ConcatString afmkeyword_to_string(const AfmKeyword t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_afm/afmtokentype_to_string.cc b/src/libcode/vx_afm/afmtokentype_to_string.cc index c08fb62f19..02023ee560 100644 --- a/src/libcode/vx_afm/afmtokentype_to_string.cc +++ b/src/libcode/vx_afm/afmtokentype_to_string.cc @@ -39,7 +39,7 @@ ConcatString afmtokentype_to_string(const AfmTokenType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_analysis_util/analysis_utils.cc b/src/libcode/vx_analysis_util/analysis_utils.cc index c0c079cec3..be09c352c2 100644 --- a/src/libcode/vx_analysis_util/analysis_utils.cc +++ b/src/libcode/vx_analysis_util/analysis_utils.cc @@ -56,7 +56,7 @@ while((c = strtok_r(L, delim, &temp_ptr)) != nullptr) { // done // -if ( L ) { delete [] L; L = (char *) 0; } +if ( L ) { delete [] L; L = (char *) nullptr; } return ( a ); diff --git a/src/libcode/vx_analysis_util/mode_atts.cc b/src/libcode/vx_analysis_util/mode_atts.cc index e63d661549..622a167d37 100644 --- a/src/libcode/vx_analysis_util/mode_atts.cc +++ b/src/libcode/vx_analysis_util/mode_atts.cc @@ -97,7 +97,7 @@ void ModeAttributes::init_from_scratch() { -poly = (MaskPoly *) 0; +poly = (MaskPoly *) nullptr; clear(); @@ -408,7 +408,7 @@ interest_max_set = 0; interest_max = 0.0; -if ( poly ) { delete poly; poly =(MaskPoly *) 0; } +if ( poly ) { delete poly; poly =(MaskPoly *) nullptr; } return; @@ -1356,7 +1356,7 @@ int ModeAttributes::is_keeper(const ModeLine & L) const int i; double x; unixtime t; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; // @@ -1923,7 +1923,7 @@ void ModeAttributes::parse_command_line(StringArray & a) { int j; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; j = 0; diff --git a/src/libcode/vx_analysis_util/mode_job.cc b/src/libcode/vx_analysis_util/mode_job.cc index b2e0b1339f..736379d6c9 100644 --- a/src/libcode/vx_analysis_util/mode_job.cc +++ b/src/libcode/vx_analysis_util/mode_job.cc @@ -107,11 +107,11 @@ void BasicModeAnalysisJob::init_from_scratch() { -accums = (NumArray *) 0; +accums = (NumArray *) nullptr; -dumpfile = (ostream *) 0; // don't delete +dumpfile = (ostream *) nullptr; // don't delete -outfile = (ostream *) 0; // don't delete +outfile = (ostream *) nullptr; // don't delete clear(); @@ -133,16 +133,16 @@ atts.clear(); columns.clear(); -if ( accums ) { delete [] accums; accums = (NumArray *) 0; } +if ( accums ) { delete [] accums; accums = (NumArray *) nullptr; } n_lines_read = n_lines_kept = 0; // Write any remaning lines to the dump file if ( dumpfile ) *(dumpfile) << dump_at; -dumpfile = (ostream *) 0; // don't delete +dumpfile = (ostream *) nullptr; // don't delete -outfile = (ostream *) 0; // don't delete +outfile = (ostream *) nullptr; // don't delete n_dump = 0; @@ -756,7 +756,7 @@ void ByCaseJob::init_from_scratch() { -info = (ByCaseInfo *) 0; +info = (ByCaseInfo *) nullptr; BasicModeAnalysisJob::init_from_scratch(); @@ -774,7 +774,7 @@ void ByCaseJob::clear() BasicModeAnalysisJob::clear(); -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } valid_times.clear(); @@ -995,7 +995,7 @@ valid_times.sort_increasing(); n_valid_times = valid_times.n_elements(); -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } info = new ByCaseInfo [n_valid_times + 1]; // in case n_valid_times is zero @@ -1030,7 +1030,7 @@ else do_output(cout); // done // -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } return; diff --git a/src/libcode/vx_analysis_util/mode_line.cc b/src/libcode/vx_analysis_util/mode_line.cc index 5a7319565f..3d565c1f5d 100644 --- a/src/libcode/vx_analysis_util/mode_line.cc +++ b/src/libcode/vx_analysis_util/mode_line.cc @@ -139,7 +139,7 @@ void ModeLine::clear() DataLine::clear(); HdrFlag = false; -HdrLine = (AsciiHeaderLine *) 0; +HdrLine = (AsciiHeaderLine *) nullptr; return; @@ -426,7 +426,7 @@ unixtime ModeLine::fcst_init() const unixtime v, l; -const char * c = (char *) 0; +const char * c = (char *) nullptr; c = get_item("FCST_VALID"); @@ -528,7 +528,7 @@ unixtime ModeLine::obs_init() const unixtime v, l; -const char * c = (char *) 0; +const char * c = (char *) nullptr; c = get_item("OBS_VALID"); @@ -999,7 +999,7 @@ nfcst = nobs = -1; if ( is_single() ) return ( false ); const char * c = object_id(); -const char * u = (const char *) 0; +const char * u = (const char *) nullptr; // // skip leading F, O, CF or CO diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 963271d905..6f09f1779c 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -75,13 +75,13 @@ STATAnalysisJob & STATAnalysisJob::operator=( void STATAnalysisJob::init_from_scratch() { - dump_row = (char *) 0; - dr_out = (ofstream *) 0; + dump_row = (char *) nullptr; + dr_out = (ofstream *) nullptr; n_dump = 0; - stat_file = (char *) 0; - stat_out = (ofstream *) 0; - boot_rng = (char *) 0; - boot_seed = (char *) 0; + stat_file = (char *) nullptr; + stat_out = (ofstream *) nullptr; + boot_rng = (char *) nullptr; + boot_seed = (char *) nullptr; model.set_ignore_case(1); desc.set_ignore_case(1); @@ -183,8 +183,8 @@ void STATAnalysisJob::clear() { close_dump_row_file(); close_stat_file(); - if(dump_row) { delete [] dump_row; dump_row = (char *) 0; } - if(stat_file) { delete [] stat_file; stat_file = (char *) 0; } + if(dump_row) { delete [] dump_row; dump_row = (char *) nullptr; } + if(stat_file) { delete [] stat_file; stat_file = (char *) nullptr; } stat_row = 0; @@ -1102,7 +1102,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { jc_array.add(c); - lp = (char *) 0; + lp = (char *) nullptr; } // @@ -1210,11 +1210,11 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { if(jc_array[i] == "-job") { if(set_job_type(jc_array[i+1].c_str()) != 0) { - delete [] line; line = 0; lp = 0; + lp = nullptr; mlog << Error << "\nSTATAnalysisJob::STATAnalysisJob::parse_job_command() -> " << "unrecognized job type specified \"" << jc_array[i] << "\" in job command line: " << jobstring << "\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } i++; @@ -1636,7 +1636,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "unrecognized switch \"" << jc_array[i] << "\" in job command line: " << jobstring << "\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } // end if @@ -1658,7 +1658,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "no match found for " << (line_type.n() == 1 ? line_type[0] : "header") << " column named \"" << hdr_name[i] << "\"\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } } // end for @@ -1672,8 +1672,8 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { // // Deallocate memory // - if(line) { delete [] line; line = (char *) 0; } - lp = (char *) 0; + if(line) { delete [] line; line = (char *) nullptr; } + lp = (char *) nullptr; return; } @@ -1712,7 +1712,7 @@ int STATAnalysisJob::set_job_type(const char *c) { void STATAnalysisJob::set_dump_row(const char *c) { - if(dump_row) { delete [] dump_row; dump_row = (char *) 0; } + if(dump_row) { delete [] dump_row; dump_row = (char *) nullptr; } if(!c) return; @@ -1727,7 +1727,7 @@ void STATAnalysisJob::set_dump_row(const char *c) { void STATAnalysisJob::set_stat_file(const char *c) { - if(stat_file) { delete [] stat_file; stat_file = (char *) 0; } + if(stat_file) { delete [] stat_file; stat_file = (char *) nullptr; } if(!c) return; @@ -1823,7 +1823,7 @@ void STATAnalysisJob::set_mask_sid(const char *c) { void STATAnalysisJob::set_boot_rng(const char *c) { - if(boot_rng) { delete [] boot_rng; boot_rng = (char *) 0; } + if(boot_rng) { delete [] boot_rng; boot_rng = (char *) nullptr; } if(!c) return; @@ -1838,7 +1838,7 @@ void STATAnalysisJob::set_boot_rng(const char *c) { void STATAnalysisJob::set_boot_seed(const char *c) { - if(boot_seed) { delete [] boot_seed; boot_seed = (char *) 0; } + if(boot_seed) { delete [] boot_seed; boot_seed = (char *) nullptr; } if(!c) return; @@ -1915,7 +1915,7 @@ void STATAnalysisJob::close_dump_row_file() { dr_out->close(); delete dr_out; - dr_out = (ofstream *) 0; + dr_out = (ofstream *) nullptr; n_dump = 0; } @@ -2136,7 +2136,7 @@ void STATAnalysisJob::close_stat_file() { stat_out->close(); delete stat_out; - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; } return; diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index faf5c409f3..d229712943 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -141,7 +141,7 @@ void STATLine::clear() DataLine::clear(); Type = no_stat_line_type; -HdrLine = (AsciiHeaderLine *) 0; +HdrLine = (AsciiHeaderLine *) nullptr; return; diff --git a/src/libcode/vx_analysis_util/time_series.cc b/src/libcode/vx_analysis_util/time_series.cc index a07c07debd..dd284f35ad 100644 --- a/src/libcode/vx_analysis_util/time_series.cc +++ b/src/libcode/vx_analysis_util/time_series.cc @@ -94,7 +94,7 @@ void TimeSeries::init_from_scratch() { -Value = (double *) 0; +Value = (double *) nullptr; clear(); @@ -110,7 +110,7 @@ void TimeSeries::clear() { -if ( Value ) { delete [] Value; Value = (double *) 0; } +if ( Value ) { delete [] Value; Value = (double *) nullptr; } Nelements = 0; diff --git a/src/libcode/vx_bool_calc/bool_calc.cc b/src/libcode/vx_bool_calc/bool_calc.cc index 21ccd83921..d0582e3478 100644 --- a/src/libcode/vx_bool_calc/bool_calc.cc +++ b/src/libcode/vx_bool_calc/bool_calc.cc @@ -53,9 +53,9 @@ void BoolCalc::init_from_scratch() { -s = 0; +s = nullptr; -program = 0; +program = nullptr; clear(); @@ -71,9 +71,9 @@ void BoolCalc::clear() { -if ( s ) { delete s; s = 0; } +if ( s ) { delete s; s = nullptr; } -if ( program ) { delete program; program = 0; } +if ( program ) { delete program; program = nullptr; } Max_depth = Max_local = 0; diff --git a/src/libcode/vx_bool_calc/token_stack.cc b/src/libcode/vx_bool_calc/token_stack.cc index cdcdb2f039..41e27122fa 100644 --- a/src/libcode/vx_bool_calc/token_stack.cc +++ b/src/libcode/vx_bool_calc/token_stack.cc @@ -99,7 +99,7 @@ void TokenStack::init_from_scratch() { -e = (Token *) 0; +e = (Token *) nullptr; AllocInc = 50; // default value @@ -117,7 +117,7 @@ void TokenStack::clear() { -if ( e ) { delete [] e; e = (Token *) 0; } +if ( e ) { delete [] e; e = (Token *) nullptr; } @@ -189,11 +189,11 @@ for(j=0; j= n ) return; int k; -ClistEntry * u = (ClistEntry *) 0; +ClistEntry * u = (ClistEntry *) nullptr; k = n/colorlist_alloc_inc; @@ -348,11 +348,11 @@ if ( e ) { for (k=0; k failed to read colortable file \"" << input_filename << "\"\n\n"; @@ -593,11 +593,11 @@ sort(); // done // -fclose(colorin); colorin = (FILE *) 0; +fclose(colorin); colorin = (FILE *) nullptr; -input_filename = (const char *) 0; +input_filename = (const char *) nullptr; -the_table = (ColorTable *) 0; +the_table = (ColorTable *) nullptr; clist.clear(); @@ -802,7 +802,7 @@ void ColorTable::extend(int n) if ( Nalloc >= n ) return; int j; -CtableEntry * u = (CtableEntry *) 0; +CtableEntry * u = (CtableEntry *) nullptr; j = n/ctable_alloc_inc; @@ -828,11 +828,11 @@ if ( Entry ) { } - delete [] Entry; Entry = (CtableEntry *) 0; + delete [] Entry; Entry = (CtableEntry *) nullptr; } -Entry = u; u = (CtableEntry *) 0; +Entry = u; u = (CtableEntry *) nullptr; // diff --git a/src/libcode/vx_data2d/data_class.cc b/src/libcode/vx_data2d/data_class.cc index 1d95284e38..8f6fb7cda3 100644 --- a/src/libcode/vx_data2d/data_class.cc +++ b/src/libcode/vx_data2d/data_class.cc @@ -106,8 +106,8 @@ void Met2dDataFile::mtddf_init_from_scratch() { -Raw_Grid = (Grid *) 0; -Dest_Grid = (Grid *) 0; +Raw_Grid = (Grid *) nullptr; +Dest_Grid = (Grid *) nullptr; ShiftRight = 0; @@ -123,8 +123,8 @@ void Met2dDataFile::mtddf_clear() { -if ( Raw_Grid ) { delete Raw_Grid; Raw_Grid = (Grid *) 0; } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = (Grid *) 0; } +if ( Raw_Grid ) { delete Raw_Grid; Raw_Grid = (Grid *) nullptr; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = (Grid *) nullptr; } Filename.clear(); @@ -268,7 +268,7 @@ mlog << Debug(3) << "Resetting grid definition from \"" } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = 0; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = nullptr; } Dest_Grid = new Grid; @@ -295,7 +295,7 @@ if ( ! Raw_Grid ) { } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = 0; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = nullptr; } Dest_Grid = new Grid; diff --git a/src/libcode/vx_data2d/leveltype_to_string.cc b/src/libcode/vx_data2d/leveltype_to_string.cc index 1c7d52b24e..8c119b8b45 100644 --- a/src/libcode/vx_data2d/leveltype_to_string.cc +++ b/src/libcode/vx_data2d/leveltype_to_string.cc @@ -39,7 +39,7 @@ ConcatString leveltype_to_string(const LevelType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_data2d_factory/data2d_factory.cc b/src/libcode/vx_data2d_factory/data2d_factory.cc index 7d188c2080..39fcc7f786 100644 --- a/src/libcode/vx_data2d_factory/data2d_factory.cc +++ b/src/libcode/vx_data2d_factory/data2d_factory.cc @@ -161,7 +161,7 @@ MetPythonDataFile * p = nullptr; Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename) { GrdFileType type; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // // Determine the file type @@ -195,7 +195,7 @@ Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename, { - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // // Use the file type, if valid @@ -246,7 +246,7 @@ Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename, bool is_2d_data_file(const ConcatString &filename, const ConcatString &config_str) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; GrdFileType type = FileType_None; // Check for a requested file type @@ -260,7 +260,7 @@ bool is_2d_data_file(const ConcatString &filename, mtddf = mtddf_factory.new_met_2d_data_file(filename.c_str(), type); bool status = (mtddf != 0); - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(status); } diff --git a/src/libcode/vx_data2d_grib/data2d_grib.cc b/src/libcode/vx_data2d_grib/data2d_grib.cc index 09dc80815a..a436d725a4 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib.cc @@ -103,7 +103,7 @@ void MetGrib1DataFile::grib1_init_from_scratch() { -GF = (GribFile *) 0; +GF = (GribFile *) nullptr; Plane.clear(); @@ -121,7 +121,7 @@ void MetGrib1DataFile::close() { -if ( GF ) { delete GF; GF = (GribFile *) 0; } +if ( GF ) { delete GF; GF = (GribFile *) nullptr; } CurrentRecord.reset(); diff --git a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc index 2f1f66385b..2f8f61dfe0 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc @@ -577,7 +577,7 @@ void read_pds(const GribRecord &r, int &bms_flag, unixtime &init_ut, unixtime &valid_ut, int &accum) { double sec_per_fcst_unit = 0.0; unsigned char pp1[2]; - Section1_Header *pds = (Section1_Header *) 0; + Section1_Header *pds = (Section1_Header *) nullptr; pds = (Section1_Header *) r.pds; diff --git a/src/libcode/vx_data2d_grib/grib_classes.cc b/src/libcode/vx_data2d_grib/grib_classes.cc index 5954a6ed7d..03817a9790 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.cc +++ b/src/libcode/vx_data2d_grib/grib_classes.cc @@ -63,7 +63,7 @@ GribRecord::GribRecord() { is = new Section0_Header; -pds = (unsigned char *) 0; +pds = (unsigned char *) nullptr; gds = new Section2_Header; bms = new Section3_Header; bds = new Section4_Header; @@ -102,8 +102,8 @@ word_size = 0; data_lseek_offset = record_lseek_offset = (off_t) 0; -// data = (unsigned char *) 0; -// bitmap = (unsigned char *) 0; +// data = (unsigned char *) nullptr; +// bitmap = (unsigned char *) nullptr; // //data_size = data_alloc = 0; //bitmap_size = bitmap_alloc = 0; @@ -135,13 +135,13 @@ GribRecord::~GribRecord() { -if ( is ) { delete is; is = (Section0_Header *) 0; } -if ( pds ) { delete [] pds; pds = (unsigned char *) 0; } -if ( gds ) { delete gds; gds = (Section2_Header *) 0; } -if ( bms ) { delete bms; bms = (Section3_Header *) 0; } -if ( bds ) { delete bds; bds = (Section4_Header *) 0; } -//if ( data ) { delete data; data = (vector *) 0; } -//if ( bitmap ) { delete bitmap; bitmap = (vector *) 0; } +if ( is ) { delete is; is = (Section0_Header *) nullptr; } +if ( pds ) { delete [] pds; pds = (unsigned char *) nullptr; } +if ( gds ) { delete gds; gds = (Section2_Header *) nullptr; } +if ( bms ) { delete bms; bms = (Section3_Header *) nullptr; } +if ( bds ) { delete bds; bds = (Section4_Header *) nullptr; } +//if ( data ) { delete data; data = (vector *) nullptr; } +//if ( bitmap ) { delete bitmap; bitmap = (vector *) nullptr; } } @@ -316,8 +316,8 @@ uint4 GribRecord::long_data_value(int n) const int k, byte, shift; uint4 value, u; -unsigned char *c1 = (unsigned char *) 0; -const unsigned char *c2 = (unsigned char *) 0; +unsigned char *c1 = (unsigned char *) nullptr; +const unsigned char *c2 = (unsigned char *) nullptr; k = n*word_size; @@ -522,7 +522,7 @@ fd = -1; file_start = (long) -1; -name = (char *) 0; +name = (char *) nullptr; referenceCount = n_alloc = issue = lead = 0; @@ -530,9 +530,9 @@ buf_size = (size_t) 0; n_records = (unsigned int) 0; -buf = (unsigned char *) 0; +buf = (unsigned char *) nullptr; -record_info = (RecordInfo *) 0; +record_info = (RecordInfo *) nullptr; } @@ -546,11 +546,11 @@ GribFileRep::~GribFileRep() if ( fd >= 0 ) { ::close(fd); fd = -1; } -if ( buf ) { delete [] buf; buf = (unsigned char *) 0; } +if ( buf ) { delete [] buf; buf = (unsigned char *) nullptr; } -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( n_alloc ) { delete [] record_info; record_info = (RecordInfo *) 0; } +if ( n_alloc ) { delete [] record_info; record_info = (RecordInfo *) nullptr; } } @@ -565,7 +565,7 @@ void GribFileRep::record_extend(int n) if ( n_alloc > n ) return; int j; -RecordInfo *r = (RecordInfo *) 0; +RecordInfo *r = (RecordInfo *) nullptr; ++n; @@ -600,9 +600,9 @@ for (j=n_records; jrecord_extend(1); diff --git a/src/libcode/vx_data2d_grib/grib_strings.cc b/src/libcode/vx_data2d_grib/grib_strings.cc index f9b3edcdac..31d5428c1e 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.cc +++ b/src/libcode/vx_data2d_grib/grib_strings.cc @@ -266,7 +266,7 @@ int str_to_grib_code(const char *c, int &pcode, int gc = bad_data_int; const int buf_len = 512; char tmp_str[buf_len + 1]; - char *ptr = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr, *save_ptr = (char *) nullptr; const char *method_name = "str_to_grib_code() -> "; // Parse out strings of the form: @@ -308,7 +308,7 @@ int str_to_prob_info(const char *c, double &pthresh_lo, double &pthresh_hi, int gc = bad_data_int, i, n_lt, n_gt; const int buf_len = 512; char tmp_str[buf_len + 1]; - char *ptr = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr, *save_ptr = (char *) nullptr; SingleThresh st; const char *method_name = "str_to_prob_info()"; diff --git a/src/libcode/vx_data2d_grib2/data2d_grib2.cc b/src/libcode/vx_data2d_grib2/data2d_grib2.cc index 5ea279fb96..401d226f8e 100644 --- a/src/libcode/vx_data2d_grib2/data2d_grib2.cc +++ b/src/libcode/vx_data2d_grib2/data2d_grib2.cc @@ -1583,7 +1583,7 @@ long MetGrib2DataFile::read_grib2_record(long offset, g2int unpack, fread(cgrib, sizeof(unsigned char), lgrib, FileGrib2); if(g2_info(cgrib, listsec0, listsec1, &numfields, &numlocal)) { - if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) 0; } + if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) nullptr; } return -1; } @@ -1591,7 +1591,7 @@ long MetGrib2DataFile::read_grib2_record(long offset, g2int unpack, g2_getfld(cgrib, ifld, unpack, 1, &gfld); // cleanup - if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) 0; } + if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) nullptr; } // reset to default out of memory handler set_new_handler(oom); diff --git a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc index 72275ecd9f..fcece7b021 100644 --- a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc @@ -110,7 +110,7 @@ NcVarInfo *MetNcCFDataFile::find_first_data_var() { void MetNcCFDataFile::close() { - if(_file) { delete _file; _file = (NcCfFile *) 0; } + if(_file) { delete _file; _file = (NcCfFile *) nullptr; } return; } @@ -260,7 +260,7 @@ bool MetNcCFDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) } // Read the data - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; bool status = _file->getData(vinfo_nc->req_name().c_str(), dimension, diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc index 40caecba95..fa2dad9289 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc @@ -63,7 +63,7 @@ MetNcMetDataFile & MetNcMetDataFile::operator=(const MetNcMetDataFile &) { void MetNcMetDataFile::nc_met_init_from_scratch() { - MetNc = (MetNcFile *) 0; + MetNc = (MetNcFile *) nullptr; close(); @@ -74,7 +74,7 @@ void MetNcMetDataFile::nc_met_init_from_scratch() { void MetNcMetDataFile::close() { - if(MetNc) { delete MetNc; MetNc = (MetNcFile *) 0; } + if(MetNc) { delete MetNc; MetNc = (MetNcFile *) nullptr; } return; } @@ -123,7 +123,7 @@ bool MetNcMetDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { bool status = false; ConcatString req_time_str, data_time_str; VarInfoNcMet * vinfo_nc = (VarInfoNcMet *) &vinfo; - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; int i; // Initialize the data plane diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index 7ae924bd34..0f4331b811 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -700,7 +700,7 @@ void get_semilatlon_var(NcFile *ncfile, const char * var_name, NumArray &out_na) double * data_values = new double[ count ]; get_nc_data(&nc_var, data_values); for(int i=0; i= max_met_args ) { int j, count; bool found = false; -NcVarInfo * var = (NcVarInfo *) 0; +NcVarInfo * var = (NcVarInfo *) nullptr; const int Nx = grid.nx(); const int Ny = grid.ny(); LongArray b = a; diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc index 338d83e8f4..3512727c8d 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc @@ -148,7 +148,10 @@ void VarInfoNcMet::add_dimension(int dim) { void VarInfoNcMet::set_magic(const ConcatString &nstr, const ConcatString &lstr) { ConcatString tmp_str; - char *ptr = (char *) 0, *ptr2 = (char *) 0, *ptr3 = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr; + char *ptr2 = (char *) nullptr; + char *ptr3 = (char *) nullptr; + char *save_ptr = (char *) nullptr; // Store the magic string VarInfo::set_magic(nstr, lstr); diff --git a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc index e249856a7a..2ff9592e9a 100644 --- a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc @@ -64,7 +64,7 @@ MetNcWrfDataFile & MetNcWrfDataFile::operator=(const MetNcWrfDataFile &) { void MetNcWrfDataFile::nc_wrf_init_from_scratch() { - WrfNc = (WrfFile *) 0; + WrfNc = (WrfFile *) nullptr; close(); @@ -75,7 +75,7 @@ void MetNcWrfDataFile::nc_wrf_init_from_scratch() { void MetNcWrfDataFile::close() { - if(WrfNc) { delete WrfNc; WrfNc = (WrfFile *) 0; } + if(WrfNc) { delete WrfNc; WrfNc = (WrfFile *) nullptr; } return; } @@ -125,7 +125,7 @@ bool MetNcWrfDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { double pressure; ConcatString level_str; VarInfoNcWrf * vinfo_nc = (VarInfoNcWrf *) &vinfo; - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; // Initialize the data plane plane.clear(); @@ -204,7 +204,7 @@ int MetNcWrfDataFile::data_plane_array(VarInfo &vinfo, bool found = false; VarInfoNcWrf *vinfo_nc = (VarInfoNcWrf *) &vinfo; LongArray dim = vinfo_nc->dimension(); - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; LongArray cur_dim; DataPlane cur_plane; diff --git a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc index 62c1d9c834..1edc5a102f 100644 --- a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc @@ -160,7 +160,10 @@ void VarInfoNcWrf::set_dimension(int i_dim, int dim) { void VarInfoNcWrf::set_magic(const ConcatString &nstr, const ConcatString &lstr) { ConcatString tmp_str; - char *ptr = (char *) 0, *ptr2 = (char *) 0, *ptr3 = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr; + char *ptr2 = (char *) nullptr; + char *ptr3 = (char *) nullptr; + char *save_ptr = (char *) nullptr; const char *method_name = "VarInfoNcWrf::set_magic() -> "; // Store the magic string diff --git a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc index 19c99b6de8..79e277bef6 100644 --- a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc +++ b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc @@ -124,13 +124,13 @@ void WrfFile::init_from_scratch() { -Nc = (NcFile *) 0; +Nc = (NcFile *) nullptr; -Dim = (NcDim **) 0; +Dim = (NcDim **) nullptr; -Var = (NcVarInfo *) 0; +Var = (NcVarInfo *) nullptr; -Time = (unixtime *) 0; +Time = (unixtime *) nullptr; close(); @@ -146,21 +146,21 @@ void WrfFile::close() { -if ( Nc ) { delete Nc; Nc = (NcFile *) 0; } +if ( Nc ) { delete Nc; Nc = (NcFile *) nullptr; } -if ( Dim ) { delete [] Dim; Dim = (NcDim **) 0; } +if ( Dim ) { delete [] Dim; Dim = (NcDim **) nullptr; } -if ( Time ) { delete [] Time; Time = (unixtime *) 0; } +if ( Time ) { delete [] Time; Time = (unixtime *) nullptr; } Ndims = 0; DimNames.clear(); -Tdim = (NcDim *) 0; +Tdim = (NcDim *) nullptr; Nvars = 0; -if ( Var ) { delete [] Var; Var = (NcVarInfo *) 0; } +if ( Var ) { delete [] Var; Var = (NcVarInfo *) nullptr; } InitTime = (unixtime) 0; @@ -605,8 +605,8 @@ int j, k, count; int x, y; double value; bool found = false; -NcVarInfo * var = (NcVarInfo *) 0; -NcVarInfo * P = (NcVarInfo *) 0; +NcVarInfo * var = (NcVarInfo *) nullptr; +NcVarInfo * P = (NcVarInfo *) nullptr; LongArray b = a; pressure = bad_data_double; diff --git a/src/libcode/vx_data2d_python/data2d_python.cc b/src/libcode/vx_data2d_python/data2d_python.cc index 3b146f45f7..546a68514d 100644 --- a/src/libcode/vx_data2d_python/data2d_python.cc +++ b/src/libcode/vx_data2d_python/data2d_python.cc @@ -153,7 +153,7 @@ close(); ConcatString full_path, file_name; int i, file_argc; -char **file_argv = (char **) 0; // allocated +char **file_argv = (char **) nullptr; // allocated StringArray sa; const char *method_name = "MetPythonDataFile::open() "; @@ -231,9 +231,9 @@ if ( ShiftRight != 0 ) Plane.shift_right(ShiftRight); if ( file_argv ) { for ( i=1; i::init_from_scratch() { -E = (T *) 0; +E = (T *) nullptr; AllocInc = 25; // default value @@ -143,7 +143,7 @@ void Shp_Array::clear() { -if ( E ) { delete [] E; E = (T *) 0; } +if ( E ) { delete [] E; E = (T *) nullptr; } @@ -214,11 +214,11 @@ for(j=0; j Date: Tue, 27 Feb 2024 16:52:10 +0000 Subject: [PATCH 3/5] #2673 Change 0 to nullptr --- src/libcode/vx_nc_obs/met_point_data.cc | 16 ++-- src/libcode/vx_nc_obs/nc_point_obs.cc | 4 +- src/libcode/vx_nc_util/grid_output.cc | 2 +- src/libcode/vx_nc_util/nc_utils.cc | 8 +- src/libcode/vx_nc_util/nc_var_info.cc | 6 +- src/libcode/vx_pb_util/do_blocking.cc | 2 +- src/libcode/vx_pb_util/do_unblocking.cc | 2 +- src/libcode/vx_plot_util/vx_plot_util.cc | 2 +- .../vx_pointdata_python/pointdata_python.cc | 2 +- src/libcode/vx_ps/documentmedia_to_string.cc | 2 +- .../vx_ps/documentorientation_to_string.cc | 2 +- src/libcode/vx_ps/fontfamily_to_string.cc | 2 +- src/libcode/vx_ps/ps_text.cc | 18 ++-- src/libcode/vx_ps/table_helper.cc | 10 +- src/libcode/vx_ps/vx_ps.cc | 8 +- src/libcode/vx_pxm/pcm.cc | 10 +- src/libcode/vx_pxm/pgm.cc | 2 +- src/libcode/vx_pxm/ppm.cc | 8 +- src/libcode/vx_pxm/pxm_base.cc | 10 +- src/libcode/vx_render/flate_filter.cc | 6 +- src/libcode/vx_render/ps_filter.cc | 4 +- src/libcode/vx_render/psout_filter.cc | 6 +- src/libcode/vx_render/render_pbm.cc | 6 +- src/libcode/vx_render/render_pcm.cc | 6 +- src/libcode/vx_render/render_pgm.cc | 6 +- src/libcode/vx_render/render_ppm.cc | 6 +- src/libcode/vx_series_data/series_data.cc | 8 +- src/libcode/vx_shapedata/engine.cc | 38 ++++---- src/libcode/vx_shapedata/interest.cc | 22 ++--- src/libcode/vx_shapedata/mode_conf_info.cc | 38 ++++---- src/libcode/vx_shapedata/node.cc | 37 +++---- src/libcode/vx_shapedata/shapedata.cc | 2 +- src/libcode/vx_stat_out/stat_columns.cc | 4 +- src/libcode/vx_statistics/apply_mask.cc | 22 ++--- src/libcode/vx_statistics/compute_ci.cc | 96 ++++++++++--------- src/libcode/vx_statistics/contable_nx2.cc | 6 +- src/libcode/vx_statistics/contable_stats.cc | 20 ++-- src/libcode/vx_statistics/met_stats.cc | 62 ++++++------ src/libcode/vx_statistics/obs_error.cc | 20 ++-- src/libcode/vx_statistics/pair_base.cc | 18 ++-- .../vx_statistics/pair_data_ensemble.cc | 32 +++---- src/libcode/vx_statistics/pair_data_point.cc | 36 +++---- src/libcode/vx_statistics/read_climo.cc | 8 +- src/libcode/vx_tc_util/atcf_line_base.cc | 10 +- src/libcode/vx_tc_util/atcf_track_line.cc | 10 +- src/libcode/vx_tc_util/diag_file.cc | 8 +- src/libcode/vx_tc_util/pair_data_genesis.cc | 2 +- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 4 +- src/libcode/vx_tc_util/tc_columns.cc | 2 +- src/libcode/vx_tc_util/tc_stat_line.cc | 4 +- src/libcode/vx_tc_util/track_info.cc | 10 +- src/libcode/vx_tc_util/track_pair_info.cc | 12 +-- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 6 +- .../vx_time_series/time_series_util.cc | 2 +- 54 files changed, 351 insertions(+), 344 deletions(-) diff --git a/src/libcode/vx_nc_obs/met_point_data.cc b/src/libcode/vx_nc_obs/met_point_data.cc index 0312f97800..ad30186dbe 100644 --- a/src/libcode/vx_nc_obs/met_point_data.cc +++ b/src/libcode/vx_nc_obs/met_point_data.cc @@ -38,7 +38,7 @@ using namespace std; MetPointData::MetPointData() { // Derived class should set obs_data - obs_data = (MetPointObsData *)0; + obs_data = (MetPointObsData *) nullptr; init_from_scratch(); } @@ -267,31 +267,31 @@ void MetPointObsData::clear() { void MetPointObsData::clear_numbers() { if (0 != obs_ids) { delete [] obs_ids; - obs_ids = (int *)0; + obs_ids = (int *) nullptr; } if (0 != obs_hids) { delete [] obs_hids; - obs_hids = (int *)0; + obs_hids = (int *) nullptr; } if (0 != obs_qids) { delete [] obs_qids; - obs_qids = (int *)0; + obs_qids = (int *) nullptr; } if (0 != obs_lvls) { delete [] obs_lvls; - obs_lvls = (float *)0; + obs_lvls = (float *) nullptr; } if (0 != obs_hgts) { delete [] obs_hgts; - obs_hgts = (float *)0; + obs_hgts = (float *) nullptr; } if (0 != obs_vals) { delete [] obs_vals; - obs_vals = (float *)0; + obs_vals = (float *) nullptr; } if (0 != obs_arr) { delete [] obs_arr; - obs_arr = (float *)0; + obs_arr = (float *) nullptr; } } diff --git a/src/libcode/vx_nc_obs/nc_point_obs.cc b/src/libcode/vx_nc_obs/nc_point_obs.cc index 33e1dfa85b..ea60b62834 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs.cc @@ -55,7 +55,7 @@ void MetNcPointObs::init_from_scratch() { MetPointData::init_from_scratch(); keep_nc = false; - obs_nc = (NcFile *) 0; + obs_nc = (NcFile *) nullptr; } //////////////////////////////////////////////////////////////////////// @@ -65,7 +65,7 @@ void MetNcPointObs::close() { if ( !keep_nc && obs_nc ) { delete obs_nc; - obs_nc = (NcFile *) 0; + obs_nc = (NcFile *) nullptr; } } diff --git a/src/libcode/vx_nc_util/grid_output.cc b/src/libcode/vx_nc_util/grid_output.cc index 079d376844..67ddbd22f6 100644 --- a/src/libcode/vx_nc_util/grid_output.cc +++ b/src/libcode/vx_nc_util/grid_output.cc @@ -882,7 +882,7 @@ if ( standard_name_str ) add_att(&nc_var, standard_name_att_name, standard_name put_nc_data(&nc_var, &var_data[0], nc_dim->getSize(), 0); -if ( var_data ) { delete [] var_data; var_data = (float *) 0; } +if ( var_data ) { delete [] var_data; var_data = (float *) nullptr; } // // done diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index dcd24b59b1..b1140d4d47 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -418,7 +418,7 @@ ConcatString get_log_msg_for_att(const NcVarAtt *att, string var_name, //////////////////////////////////////////////////////////////////////// NcVarAtt *get_nc_att(const NcVar * var, const ConcatString &att_name, bool exit_on_error) { - NcVarAtt *att = (NcVarAtt *)0; + NcVarAtt *att = (NcVarAtt *) nullptr; static const char *method_name = "get_nc_att(NcVar) -> "; // @@ -453,7 +453,7 @@ NcVarAtt *get_nc_att(const NcVar * var, const ConcatString &att_name, bool exit_ //////////////////////////////////////////////////////////////////////// NcGroupAtt *get_nc_att(const NcFile * nc, const ConcatString &att_name, bool exit_on_error) { - NcGroupAtt *att = (NcGroupAtt *)0; + NcGroupAtt *att = (NcGroupAtt *) nullptr; static const char *method_name = "get_nc_att(NcFile) -> "; // @@ -491,7 +491,7 @@ NcGroupAtt *get_nc_att(const NcFile * nc, const ConcatString &att_name, bool exi bool get_nc_att_value(const NcVar *var, const ConcatString &att_name, ConcatString &att_val, int grp_id, bool exit_on_error) { bool status = false; - NcVarAtt *att = (NcVarAtt *) 0; + NcVarAtt *att = (NcVarAtt *) nullptr; // Initialize att_val.clear(); @@ -3456,7 +3456,7 @@ NcVar get_nc_var_time(const NcFile *nc) { //////////////////////////////////////////////////////////////////////// NcFile *open_ncfile(const char * nc_name, bool write) { - NcFile *nc = (NcFile *)0; + NcFile *nc = (NcFile *) nullptr; try { if (write) { diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4d23e8e65b..6804e65592 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -113,7 +113,7 @@ return ( * this ); void NcVarInfo::init_from_scratch() { -Dims = (NcDim **) 0; +Dims = (NcDim **) nullptr; clear(); @@ -127,7 +127,7 @@ return; void NcVarInfo::clear() { -var = (NcVar *) 0; // don't delete +var = (NcVar *) nullptr; // don't delete name.clear(); @@ -147,7 +147,7 @@ AccumTime = 0; Ndims = 0; -if ( Dims ) { delete [] Dims; Dims = (NcDim **) 0; } +if ( Dims ) { delete [] Dims; Dims = (NcDim **) nullptr; } x_slot = y_slot = z_slot = t_slot = -1; diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc index a43b33a768..8672f2bf05 100644 --- a/src/libcode/vx_pb_util/do_blocking.cc +++ b/src/libcode/vx_pb_util/do_blocking.cc @@ -110,7 +110,7 @@ void write_pad(int fd, unsigned int value, PadSize padsize) int n_written, bytes; unsigned int I; unsigned long long L; -unsigned char * b = (unsigned char *) 0; +unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc index 31e07e2631..195b1a8dda 100644 --- a/src/libcode/vx_pb_util/do_unblocking.cc +++ b/src/libcode/vx_pb_util/do_unblocking.cc @@ -80,7 +80,7 @@ int n_read, bytes; int value; unsigned int I; unsigned long long L; -unsigned char * b = (unsigned char *) 0; +unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { diff --git a/src/libcode/vx_plot_util/vx_plot_util.cc b/src/libcode/vx_plot_util/vx_plot_util.cc index abf4e4be7c..83bc4ddf76 100644 --- a/src/libcode/vx_plot_util/vx_plot_util.cc +++ b/src/libcode/vx_plot_util/vx_plot_util.cc @@ -45,7 +45,7 @@ void draw_map(const Grid &gr, const Box &gr_bb, PSfile &p, const Box &dim, } int i; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; ConcatString file_name, line_dash; NumArray line_color; double line_width; diff --git a/src/libcode/vx_pointdata_python/pointdata_python.cc b/src/libcode/vx_pointdata_python/pointdata_python.cc index fdb1cb34a3..e5ec4865bd 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.cc +++ b/src/libcode/vx_pointdata_python/pointdata_python.cc @@ -133,7 +133,7 @@ close(); ConcatString full_path, file_name; int i, file_argc; -char **file_argv = (char **) 0; // allocated +char **file_argv = (char **) nullptr; // allocated StringArray sa; const char *method_name = "MetPythonPointDataFile::open() "; diff --git a/src/libcode/vx_ps/documentmedia_to_string.cc b/src/libcode/vx_ps/documentmedia_to_string.cc index d64d6b9123..78be40f3a3 100644 --- a/src/libcode/vx_ps/documentmedia_to_string.cc +++ b/src/libcode/vx_ps/documentmedia_to_string.cc @@ -39,7 +39,7 @@ ConcatString documentmedia_to_string(const DocumentMedia t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/documentorientation_to_string.cc b/src/libcode/vx_ps/documentorientation_to_string.cc index e98342f078..2ad6baa576 100644 --- a/src/libcode/vx_ps/documentorientation_to_string.cc +++ b/src/libcode/vx_ps/documentorientation_to_string.cc @@ -39,7 +39,7 @@ ConcatString documentorientation_to_string(const DocumentOrientation t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/fontfamily_to_string.cc b/src/libcode/vx_ps/fontfamily_to_string.cc index 4540a5afc9..5d427f1049 100644 --- a/src/libcode/vx_ps/fontfamily_to_string.cc +++ b/src/libcode/vx_ps/fontfamily_to_string.cc @@ -39,7 +39,7 @@ ConcatString fontfamily_to_string(const FontFamily t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/ps_text.cc b/src/libcode/vx_ps/ps_text.cc index f4438e208b..f8effa1a87 100644 --- a/src/libcode/vx_ps/ps_text.cc +++ b/src/libcode/vx_ps/ps_text.cc @@ -105,9 +105,9 @@ void VxpsTextNode::init_from_scratch() { -Text = (char *) 0; +Text = (char *) nullptr; -next = (VxpsTextNode *) 0; +next = (VxpsTextNode *) nullptr; clear(); @@ -127,7 +127,7 @@ void VxpsTextNode::clear() // clear out this node // -if ( Text ) { delete [] Text; Text = (char *) 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; } Nchars = Nalloc = 0; @@ -144,7 +144,7 @@ Width = 0.0; // send "clear" message down the chain // -if ( next ) { delete next; next = (VxpsTextNode *) 0; } +if ( next ) { delete next; next = (VxpsTextNode *) nullptr; } // // done @@ -287,7 +287,7 @@ void VxpsTextNode::extend(int n) if ( n < Nalloc ) return; int k; -char * u = (char *) 0; +char * u = (char *) nullptr; const char *method_name = "VxpsTextNode::extend"; // @@ -328,11 +328,11 @@ if ( Text ) m_strncpy(u, Text, (n-1), method_name, "Text"); // toss old, grab new // -if ( Text ) { delete [] Text; Text = (char *) 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; } Text = u; -u = (char *) 0; +u = (char *) nullptr; // // done @@ -351,7 +351,7 @@ void VxpsTextNode::set_text(const char * s) { const char *method_name = "VxpsTextNode::set_text"; -if ( Text ) { delete [] Text; Text = (char *) 0; Nalloc = 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; Nalloc = 0; } Nchars = m_strlen(s); @@ -627,7 +627,7 @@ if ( (k < 0) || (k > 255) ) { int j; char junk[16]; -char * c = (char *) 0; +char * c = (char *) nullptr; c = junk + (sizeof(junk) - 1); diff --git a/src/libcode/vx_ps/table_helper.cc b/src/libcode/vx_ps/table_helper.cc index 9e1eee2f87..d951a1e220 100644 --- a/src/libcode/vx_ps/table_helper.cc +++ b/src/libcode/vx_ps/table_helper.cc @@ -100,9 +100,9 @@ void TableHelper::init_from_scratch() { -ColWidth = (double *) 0; +ColWidth = (double *) nullptr; -RowHeight = (double *) 0; +RowHeight = (double *) nullptr; clear(); @@ -118,11 +118,11 @@ void TableHelper::clear() { -Plot = (PSfile *) 0; // not allocated, so don't delete +Plot = (PSfile *) nullptr; // not allocated, so don't delete -if ( ColWidth ) { delete [] ColWidth; ColWidth = (double *) 0; } +if ( ColWidth ) { delete [] ColWidth; ColWidth = (double *) nullptr; } -if ( RowHeight ) { delete [] RowHeight; RowHeight = (double *) 0; } +if ( RowHeight ) { delete [] RowHeight; RowHeight = (double *) nullptr; } Xpin = Ypin = Upin = Vpin = 0.0; diff --git a/src/libcode/vx_ps/vx_ps.cc b/src/libcode/vx_ps/vx_ps.cc index 5462b63737..04afccc98c 100644 --- a/src/libcode/vx_ps/vx_ps.cc +++ b/src/libcode/vx_ps/vx_ps.cc @@ -159,7 +159,7 @@ PSfile::~PSfile() close(); -delete afm; afm = (Afm *) 0; +delete afm; afm = (Afm *) nullptr; } @@ -171,7 +171,7 @@ void PSfile::init_from_scratch() { -File = (ofstream *) 0; +File = (ofstream *) nullptr; psout.ignore_columns = true; @@ -399,7 +399,7 @@ if ( File ) { File->close(); - delete File; File = (ofstream *) 0; + delete File; File = (ofstream *) nullptr; } @@ -572,7 +572,7 @@ const double scale = 0.001*font_size; double x_cur, y_cur; double dx, dy; VxpsTextNode node; -VxpsTextNode * n = (VxpsTextNode *) 0; +VxpsTextNode * n = (VxpsTextNode *) nullptr; make_list(current_font, font_size, *afm, node, s); diff --git a/src/libcode/vx_pxm/pcm.cc b/src/libcode/vx_pxm/pcm.cc index f1107ccf20..cf10e9fcaa 100644 --- a/src/libcode/vx_pxm/pcm.cc +++ b/src/libcode/vx_pxm/pcm.cc @@ -122,7 +122,7 @@ void Pcm::clear() clear_common(); -if ( Colormap ) { delete [] Colormap; Colormap = (Color *) 0; } +if ( Colormap ) { delete [] Colormap; Colormap = (Color *) nullptr; } Ncolors = 0; @@ -142,9 +142,9 @@ void Pcm::init_from_scratch() // PxmBase::init_from_scratch(); -Colormap = (Color *) 0; +Colormap = (Color *) nullptr; -Name = (char *) 0; +Name = (char *) nullptr; Ncolors = 0; @@ -753,7 +753,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { @@ -870,7 +870,7 @@ void Pcm::set_colormap(const Color * c, int n) { -if ( Colormap ) { delete [] Colormap; Colormap = (Color *) 0; } +if ( Colormap ) { delete [] Colormap; Colormap = (Color *) nullptr; } Colormap = new Color [n]; diff --git a/src/libcode/vx_pxm/pgm.cc b/src/libcode/vx_pxm/pgm.cc index a38d4fd4e1..06e5294d14 100644 --- a/src/libcode/vx_pxm/pgm.cc +++ b/src/libcode/vx_pxm/pgm.cc @@ -610,7 +610,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { // a == 0 has already been checked for diff --git a/src/libcode/vx_pxm/ppm.cc b/src/libcode/vx_pxm/ppm.cc index 27cf265eb3..033c25a6a5 100644 --- a/src/libcode/vx_pxm/ppm.cc +++ b/src/libcode/vx_pxm/ppm.cc @@ -165,7 +165,7 @@ Color Ppm::getrc(int r, int c) const { int n; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; Color color; @@ -206,7 +206,7 @@ void Ppm::putrc(const Color & color, int r, int c) { int n; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; n = rc_to_n(r, c); @@ -605,7 +605,7 @@ void Ppm::make_gray() int j, n; Color c; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; n = Nrows*Ncols; @@ -644,7 +644,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { diff --git a/src/libcode/vx_pxm/pxm_base.cc b/src/libcode/vx_pxm/pxm_base.cc index bc52724b35..e4db7a82e6 100644 --- a/src/libcode/vx_pxm/pxm_base.cc +++ b/src/libcode/vx_pxm/pxm_base.cc @@ -65,9 +65,9 @@ void PxmBase::init_from_scratch() { -data = (unsigned char *) 0; +data = (unsigned char *) nullptr; -Name = (char *) 0; +Name = (char *) nullptr; clear_common(); @@ -85,11 +85,11 @@ void PxmBase::clear_common() { -if ( data ) { delete [] data; data = (unsigned char *) 0; } +if ( data ) { delete [] data; data = (unsigned char *) nullptr; } Nalloc = 0; -if ( Name ) { delete [] Name; Name = (char *) 0; } +if ( Name ) { delete [] Name; Name = (char *) nullptr; } Nrows = Ncols = 0; @@ -291,7 +291,7 @@ for (j=0; jignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -194,7 +194,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_pcm.cc b/src/libcode/vx_render/render_pcm.cc index 04e99f0414..6fbb3a283f 100644 --- a/src/libcode/vx_render/render_pcm.cc +++ b/src/libcode/vx_render/render_pcm.cc @@ -49,7 +49,7 @@ int nx, ny; double w, h; unsigned char u; Color color; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; @@ -105,7 +105,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; set_up_colortable(plot.file(), pcm, info); @@ -173,7 +173,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_pgm.cc b/src/libcode/vx_render/render_pgm.cc index 11d0d6801e..df72e6f85b 100644 --- a/src/libcode/vx_render/render_pgm.cc +++ b/src/libcode/vx_render/render_pgm.cc @@ -45,7 +45,7 @@ int nx, ny; double w, h; unsigned char u; Color color; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; @@ -101,7 +101,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -173,7 +173,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_ppm.cc b/src/libcode/vx_render/render_ppm.cc index 15d4c2200f..cf7e51f97e 100644 --- a/src/libcode/vx_render/render_ppm.cc +++ b/src/libcode/vx_render/render_ppm.cc @@ -34,7 +34,7 @@ plot.gsave(); int j, r, c; double w, h; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; Color color; @@ -92,7 +92,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -164,7 +164,7 @@ for (r=0; r<(image.nrows()); ++r) { out->eod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_series_data/series_data.cc b/src/libcode/vx_series_data/series_data.cc index 03b227b0f2..1417e785f2 100644 --- a/src/libcode/vx_series_data/series_data.cc +++ b/src/libcode/vx_series_data/series_data.cc @@ -83,7 +83,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, const GrdFileType type, DataPlane& dp, Grid& grid) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile* mtddf = (Met2dDataFile*) 0; + Met2dDataFile* mtddf = (Met2dDataFile*) nullptr; // Check that file exists if(!file_exists(filename.c_str())) { @@ -102,7 +102,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, if(found) grid = mtddf->grid(); // Cleanup - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(found); } @@ -165,7 +165,7 @@ bool read_all_entries(vector &vi_list, const ConcatString &filename, const GrdFileType type, vector &dp_list, Grid &grid) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile* mtddf = (Met2dDataFile*) 0; + Met2dDataFile* mtddf = (Met2dDataFile*) nullptr; // Check that file exists if(!file_exists(filename.c_str())) { @@ -184,7 +184,7 @@ bool read_all_entries(vector &vi_list, const ConcatString &filename, if(n_valid > 0) grid = mtddf->grid(); // Cleanup - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(n_valid > 0); } diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index c393610c2f..dd7ab216c0 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -53,27 +53,27 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(fcst_raw) { delete fcst_raw; - fcst_raw = (ShapeData *) 0; + fcst_raw = (ShapeData *) nullptr; } if(fcst_thresh) { delete fcst_thresh; - fcst_thresh = (ShapeData *) 0; + fcst_thresh = (ShapeData *) nullptr; } if(fcst_conv) { delete fcst_conv; - fcst_conv = (ShapeData *) 0; + fcst_conv = (ShapeData *) nullptr; } if(fcst_mask) { delete fcst_mask; - fcst_mask = (ShapeData *) 0; + fcst_mask = (ShapeData *) nullptr; } if(fcst_split) { delete fcst_split; - fcst_split = (ShapeData *) 0; + fcst_split = (ShapeData *) nullptr; } if(fcst_clus_split) { delete fcst_clus_split; - fcst_clus_split = (ShapeData *) 0; + fcst_clus_split = (ShapeData *) nullptr; } // @@ -81,27 +81,27 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(obs_raw) { delete obs_raw; - obs_raw = (ShapeData *) 0; + obs_raw = (ShapeData *) nullptr; } if(obs_thresh) { delete obs_thresh; - obs_thresh = (ShapeData *) 0; + obs_thresh = (ShapeData *) nullptr; } if(obs_conv) { delete obs_conv; - obs_conv = (ShapeData *) 0; + obs_conv = (ShapeData *) nullptr; } if(obs_mask) { delete obs_mask; - obs_mask = (ShapeData *) 0; + obs_mask = (ShapeData *) nullptr; } if(obs_split) { delete obs_split; - obs_split = (ShapeData *) 0; + obs_split = (ShapeData *) nullptr; } if(obs_clus_split) { delete obs_clus_split; - obs_clus_split = (ShapeData *) 0; + obs_clus_split = (ShapeData *) nullptr; } // @@ -109,11 +109,11 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(fcst_engine) { delete fcst_engine; - fcst_engine = (ModeFuzzyEngine *) 0; + fcst_engine = (ModeFuzzyEngine *) nullptr; } if(obs_engine) { delete obs_engine; - obs_engine = (ModeFuzzyEngine *) 0; + obs_engine = (ModeFuzzyEngine *) nullptr; } } @@ -139,7 +139,7 @@ ModeFuzzyEngine & ModeFuzzyEngine::operator=(const ModeFuzzyEngine & eng) { void ModeFuzzyEngine::init_from_scratch() { - grid = (Grid *) 0; + grid = (Grid *) nullptr; // // Reset all fcst and obs processing flags to initial state @@ -178,8 +178,8 @@ void ModeFuzzyEngine::init_from_scratch() { obs_split = new ShapeData; obs_clus_split = new ShapeData; - fcst_engine = (ModeFuzzyEngine *) 0; - obs_engine = (ModeFuzzyEngine *) 0; + fcst_engine = (ModeFuzzyEngine *) nullptr; + obs_engine = (ModeFuzzyEngine *) nullptr; n_fcst = 0; n_obs = 0; @@ -2925,7 +2925,7 @@ double total_interest(ModeConfInfo &mc, const PairFeature &p, double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) { int i, fcst_i, obs_i, n_values; double interest, ptile; - double *v = (double *) 0; + double *v = (double *) nullptr; NumArray fcst_na, obs_na; if(eng.conf_info.match_flag == 0 || @@ -2993,7 +2993,7 @@ double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) // Done // - if(v) { delete [] v; v = (double *) 0; } + if(v) { delete [] v; v = (double *) nullptr; } return(ptile); } diff --git a/src/libcode/vx_shapedata/interest.cc b/src/libcode/vx_shapedata/interest.cc index d33d32e426..d89ce2a0ff 100644 --- a/src/libcode/vx_shapedata/interest.cc +++ b/src/libcode/vx_shapedata/interest.cc @@ -92,7 +92,7 @@ void SingleFeature::init_from_scratch() { -boundary = (Polyline *) 0; +boundary = (Polyline *) nullptr; clear(); @@ -126,16 +126,16 @@ void SingleFeature::clear() intensity_ptile.sum = 0.0; user_ptile = 0.0; - Raw = (const ShapeData *) 0; - Thresh = (const ShapeData *) 0; - Split = (const ShapeData *) 0; + Raw = (const ShapeData *) nullptr; + Thresh = (const ShapeData *) nullptr; + Split = (const ShapeData *) nullptr; convex_hull.clear(); // // Deallocate memory // - if(boundary) { delete [] boundary; boundary = (Polyline *) 0; } + if(boundary) { delete [] boundary; boundary = (Polyline *) nullptr; } n_bdy = 0; return; @@ -358,8 +358,8 @@ void PairFeature::clear() complexity_ratio = 0.0; percentile_intensity_ratio = 0.0; - Obs = (const SingleFeature *) 0; // DON'T delete - Fcst = (const SingleFeature *) 0; // DON'T delete + Obs = (const SingleFeature *) nullptr; // DON'T delete + Fcst = (const SingleFeature *) nullptr; // DON'T delete return; } @@ -600,8 +600,8 @@ void get_percentiles(DistributionPercentiles &ptile, { int i, x, y, n_values; int nx, ny; - double *v = (double *) 0; - double *v_tmp = (double *) 0; + double *v = (double *) nullptr; + double *v_tmp = (double *) nullptr; const char *method_name = "get_percentiles() -> "; nx = raw.data.nx(); @@ -682,8 +682,8 @@ void get_percentiles(DistributionPercentiles &ptile, // // Free memory // - if(v_tmp) { delete [] v_tmp; v_tmp = (double *) 0; } - if(v) { delete [] v; v = (double *) 0; } + if(v_tmp) { delete [] v_tmp; v_tmp = (double *) nullptr; } + if(v) { delete [] v; v = (double *) nullptr; } // // Done diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index 5852d9f51e..2a5b84514f 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -137,7 +137,7 @@ void ModeConfInfo::assign( const ModeConfInfo &m) } // need to be recomputed, maybe, so do so just in case - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; dict = conf.lookup_dictionary(conf_key_interest_function); centroid_dist_if = parse_interest_function(dict, conf_key_centroid_dist); boundary_dist_if = parse_interest_function(dict, conf_key_boundary_dist); @@ -226,16 +226,16 @@ void ModeConfInfo::clear() inten_perc_value = bad_data_int; - centroid_dist_if = (PiecewiseLinear *) 0; - boundary_dist_if = (PiecewiseLinear *) 0; - convex_hull_dist_if = (PiecewiseLinear *) 0; - angle_diff_if = (PiecewiseLinear *) 0; - aspect_diff_if = (PiecewiseLinear *) 0; - area_ratio_if = (PiecewiseLinear *) 0; - int_area_ratio_if = (PiecewiseLinear *) 0; - curvature_ratio_if = (PiecewiseLinear *) 0; - complexity_ratio_if = (PiecewiseLinear *) 0; - inten_perc_ratio_if = (PiecewiseLinear *) 0; + centroid_dist_if = (PiecewiseLinear *) nullptr; + boundary_dist_if = (PiecewiseLinear *) nullptr; + convex_hull_dist_if = (PiecewiseLinear *) nullptr; + angle_diff_if = (PiecewiseLinear *) nullptr; + aspect_diff_if = (PiecewiseLinear *) nullptr; + area_ratio_if = (PiecewiseLinear *) nullptr; + int_area_ratio_if = (PiecewiseLinear *) nullptr; + curvature_ratio_if = (PiecewiseLinear *) nullptr; + complexity_ratio_if = (PiecewiseLinear *) nullptr; + inten_perc_ratio_if = (PiecewiseLinear *) nullptr; total_interest_thresh = bad_data_double; @@ -308,7 +308,7 @@ void ModeConfInfo::process_config_traditional(GrdFileType ftype, GrdFileType oty void ModeConfInfo::process_config_except_fields() { - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; // Dump the contents of the config file @@ -536,8 +536,8 @@ void ModeConfInfo::process_config_both(GrdFileType ftype, GrdFileType otype, int j, k, n; - Dictionary * fcst_dict = (Dictionary *) 0; - Dictionary * obs_dict = (Dictionary *) 0; + Dictionary * fcst_dict = (Dictionary *) nullptr; + Dictionary * obs_dict = (Dictionary *) nullptr; // Conf: fcst and obs @@ -608,7 +608,7 @@ void ModeConfInfo::process_config_fcst(GrdFileType ftype, int field_index) { int j, k, n; - Dictionary * fcst_dict = (Dictionary *) 0; + Dictionary * fcst_dict = (Dictionary *) nullptr; fcst_dict = conf.lookup_dictionary(conf_key_fcst); shift_right = fcst_dict->lookup_int(conf_key_shift_right); @@ -645,7 +645,7 @@ void ModeConfInfo::process_config_obs(GrdFileType otype, int field_index) { int j, k, n; - Dictionary * obs_dict = (Dictionary *) 0; + Dictionary * obs_dict = (Dictionary *) nullptr; obs_dict = conf.lookup_dictionary(conf_key_obs); shift_right = obs_dict->lookup_int(conf_key_shift_right); @@ -1270,7 +1270,7 @@ void ModeConfInfo::parse_nc_info() { -const DictionaryEntry * e = (const DictionaryEntry *) 0; +const DictionaryEntry * e = (const DictionaryEntry *) nullptr; e = conf.lookup(conf_key_nc_pairs_flag); @@ -1587,7 +1587,7 @@ GrdFileType ModeConfInfo::file_type_for_field(bool isFcst, int field_index) // look at the dictionary for the obs or forecast at index, with // parents - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; if (isFcst) { dict = conf.lookup_dictionary(conf_key_fcst); } else { @@ -1682,7 +1682,7 @@ void ModeConfInfo::get_multivar_programs() { -Dictionary * dict = (Dictionary *) 0; +Dictionary * dict = (Dictionary *) nullptr; fcst_multivar_logic.clear(); obs_multivar_logic.clear(); diff --git a/src/libcode/vx_shapedata/node.cc b/src/libcode/vx_shapedata/node.cc index d344322bd5..c687148522 100644 --- a/src/libcode/vx_shapedata/node.cc +++ b/src/libcode/vx_shapedata/node.cc @@ -38,9 +38,9 @@ using namespace std; Node::Node() { - child = (Node *) 0; + child = (Node *) nullptr; - sibling = (Node *) 0; + sibling = (Node *) nullptr; clear(); } @@ -76,12 +76,12 @@ void Node::clear() { if(child) { child->clear(); - delete child; child = (Node *) 0; + delete child; child = (Node *) nullptr; } if(sibling) { sibling->clear(); - delete sibling; sibling = (Node *) 0; + delete sibling; sibling = (Node *) nullptr; } p.clear(); @@ -127,7 +127,7 @@ void Node::assign_tree(const Node *n_ptr) { /////////////////////////////////////////////////////////////////////////////// void Node::add_child(const Polyline * poly) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Check for first child if(child == nullptr) { @@ -183,7 +183,7 @@ void Node::add_child(const Polyline * poly) { int Node::n_children() const { int count; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; count = 0; @@ -207,7 +207,7 @@ int Node::n_children() const { Node *Node::get_child(int n) const { int children_count, i; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; if( n >= (children_count = n_children()) ) { @@ -229,7 +229,7 @@ Node *Node::get_child(int n) const { int Node::is_closed() const { int closed; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Check if the current polyline is closed closed = p.is_closed(); @@ -269,7 +269,7 @@ void Node::centroid(double &ubar, double &vbar) const { /////////////////////////////////////////////////////////////////////////////// void Node::translate(double du, double dv) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Translate each point of the current polyline p.translate(du, dv); @@ -339,7 +339,7 @@ void Node::rotate(double deg) { /////////////////////////////////////////////////////////////////////////////// void Node::rotate(double deg, double ubar, double vbar) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.rotate(deg, ubar, vbar); @@ -359,7 +359,7 @@ void Node::rotate(double deg, double ubar, double vbar) { double Node::uv_signed_area() const { double sum; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; sum = p.uv_signed_area(); @@ -379,7 +379,7 @@ double Node::uv_signed_area() const { int Node::is_inside(double u_test, double v_test) const { int count; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; if(p.is_inside(u_test, v_test)) { @@ -411,7 +411,7 @@ int Node::is_inside(double u_test, double v_test) const { int Node::is_polyline_point(double u_test, double v_test) const { int poly_point; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; poly_point = p.is_polyline_point(u_test, v_test); @@ -431,7 +431,7 @@ int Node::is_polyline_point(double u_test, double v_test) const { /////////////////////////////////////////////////////////////////////////////// void Node::bounding_box(Box &bb) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.bounding_box(bb); @@ -455,7 +455,7 @@ void Node::bounding_box(Box &bb) const { /////////////////////////////////////////////////////////////////////////////// void Node::sum_first_moments(double &sum_x, double &sum_y) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.sum_first_moments(sum_x, sum_y); @@ -475,7 +475,7 @@ void Node::sum_first_moments(double &sum_x, double &sum_y) const { void Node::sum_second_moments(double x_bar, double y_bar, double &Ixx, double &Ixy, double &Iyy) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.sum_second_moments(x_bar, y_bar, Ixx, Ixy, Iyy); @@ -500,7 +500,8 @@ void Node::sum_second_moments(double x_bar, double y_bar, double node_dist(const Node &a, const Node &b) { double min_dist, dist; int i_a, i_b, num_a, num_b; - Node *a_ptr = (Node *) 0, *b_ptr = (Node *) 0; + Node *a_ptr = (Node *) nullptr; + Node *b_ptr = (Node *) nullptr; num_a = a.n_children(); num_b = b.n_children(); @@ -538,7 +539,7 @@ double node_dist(const Node &a, const Node &b) { double node_polyline_dist(const Node &a, const Polyline &b) { double min_dist, dist; int i_a, num_a; - Node *a_ptr = (Node *) 0; + Node *a_ptr = (Node *) nullptr; num_a = a.n_children(); diff --git a/src/libcode/vx_shapedata/shapedata.cc b/src/libcode/vx_shapedata/shapedata.cc index bc7332bc94..4fa554cea2 100644 --- a/src/libcode/vx_shapedata/shapedata.cc +++ b/src/libcode/vx_shapedata/shapedata.cc @@ -1253,7 +1253,7 @@ void Cell::clear() { -if ( e ) { delete [] e; e = (int *) 0; } +if ( e ) { delete [] e; e = (int *) nullptr; } n = 0; diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 034c3c1961..7138675705 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -29,7 +29,7 @@ const bool use_weighted_seeps = false; //////////////////////////////////////////////////////////////////////// void parse_row_col(const char *col_name, int &r, int &c) { - const char *ptr = (const char *) 0; + const char *ptr = (const char *) nullptr; // Parse Fi_Oj strings r = atoi(++col_name); @@ -76,7 +76,7 @@ void close_txt_file(ofstream *&out, const char *file_name) { // Close the output file out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; return; } diff --git a/src/libcode/vx_statistics/apply_mask.cc b/src/libcode/vx_statistics/apply_mask.cc index 010c091825..f3073d5f8f 100644 --- a/src/libcode/vx_statistics/apply_mask.cc +++ b/src/libcode/vx_statistics/apply_mask.cc @@ -108,7 +108,7 @@ Grid parse_grid_string(const char *grid_str) { << grid_str << "\".\n"; Met2dDataFileFactory m_factory; - Met2dDataFile *met_ptr = (Met2dDataFile *) 0; + Met2dDataFile *met_ptr = (Met2dDataFile *) nullptr; // Open the data file if(!(met_ptr = m_factory.new_met_2d_data_file(grid_str))) { @@ -251,7 +251,7 @@ void parse_grid_mask(const ConcatString &mask_grid_str, Grid &grid) { << mask_grid_str << "\".\n"; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Attempt to open the data file if(!(mtddf = mtddf_factory.new_met_2d_data_file( @@ -451,11 +451,11 @@ void parse_poly_2d_data_mask(const ConcatString &mask_poly_str, // 2D Data file Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // VarInfo object VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; // Open the data file mtddf = mtddf_factory.new_met_2d_data_file(file_name.c_str(), type); @@ -504,8 +504,8 @@ void parse_poly_2d_data_mask(const ConcatString &mask_poly_str, if(append_thresh) mask_name << st.get_str(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } return; } @@ -603,15 +603,15 @@ DataPlane parse_geog_data(Dictionary *dict, const Grid &vx_grid, StringArray geog_files; RegridInfo regrid_info; GrdFileType ftype; - Dictionary *field_dict = (Dictionary *) 0; + Dictionary *field_dict = (Dictionary *) nullptr; bool found = false; int i; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; if(!dict) { mlog << Error << "\nparse_geog_data() -> " @@ -673,8 +673,8 @@ DataPlane parse_geog_data(Dictionary *dict, const Grid &vx_grid, } // Deallocate memory - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } } if(!found) { diff --git a/src/libcode/vx_statistics/compute_ci.cc b/src/libcode/vx_statistics/compute_ci.cc index e4a9aabae7..e8a2d1df26 100644 --- a/src/libcode/vx_statistics/compute_ci.cc +++ b/src/libcode/vx_statistics/compute_ci.cc @@ -283,14 +283,15 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, int i, j, c; double s; NumArray i_na, ir_na, si_na, sr_na; - CTSInfo *cts_tmp = (CTSInfo *) 0; + CTSInfo *cts_tmp = (CTSInfo *) nullptr; // // Temp file streams for categorical statistics // - ofstream *cts_i_out = (ofstream *) 0, *cts_r_out = (ofstream *) 0; - ConcatString *cts_i_file = (ConcatString *) 0; - ConcatString *cts_r_file = (ConcatString *) 0; + ofstream *cts_i_out = (ofstream *) nullptr; + ofstream *cts_r_out = (ofstream *) nullptr; + ConcatString *cts_i_file = (ConcatString *) nullptr; + ConcatString *cts_r_file = (ConcatString *) nullptr; ConcatString prefix; // @@ -378,11 +379,11 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, } // deallocate memory - if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) 0; } - if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) 0; } - if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) 0; } - if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) 0; } - if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) 0; } + if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) nullptr; } + if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) nullptr; } + if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) nullptr; } + if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) nullptr; } + if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) nullptr; } throw(1); } } @@ -712,11 +713,11 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, // // Deallocate memory // - if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) 0; } - if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) 0; } - if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) 0; } - if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) 0; } - if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) 0; } + if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) nullptr; } + if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) nullptr; } + if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) nullptr; } + if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) nullptr; } + if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) nullptr; } return; } @@ -1420,13 +1421,14 @@ void compute_cts_stats_ci_perc(const gsl_rng *rng_ptr, int i, j, m, c; double s; NumArray i_na, ir_na, sr_na; - CTSInfo *cts_tmp = (CTSInfo *) 0; + CTSInfo *cts_tmp = (CTSInfo *) nullptr; // // Temp file streams for categorical statistics // - ofstream *cts_r_out = (ofstream *) 0; - ConcatString *cts_r_file = (ConcatString *) 0, prefix; + ofstream *cts_r_out = (ofstream *) nullptr; + ConcatString *cts_r_file = (ConcatString *) nullptr; + ConcatString prefix; // // Check that the forecast and observation arrays of the same length @@ -1506,9 +1508,9 @@ void compute_cts_stats_ci_perc(const gsl_rng *rng_ptr, // for(i=0; iempty() ) { } -if ( Thresholds ) { delete [] Thresholds; Thresholds = (double *) 0; } +if ( Thresholds ) { delete [] Thresholds; Thresholds = (double *) nullptr; } Thresholds = new double [Nrows + 1]; diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index f103284ee0..62e7a7e2f2 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -1077,8 +1077,8 @@ if ( N == 0 ) return ( bad_data_double ); int j, k, m, n; const double DN = (double) N; double t, sum; -double * p = (double *) 0; -double * s = (double *) 0; +double * p = (double *) nullptr; +double * s = (double *) nullptr; // // can't compute gerrity when the first column contains all zeros @@ -1140,8 +1140,8 @@ for (j=0; jfile_type()); @@ -1090,7 +1090,7 @@ void VxPairDataEnsemble::set_obs_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(obs_info) { delete obs_info; obs_info = (VarInfo *) 0; } + if(obs_info) { delete obs_info; obs_info = (VarInfo *) nullptr; } // Perform a deep copy obs_info = f.new_var_info(info->file_type()); @@ -1439,7 +1439,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, double cmn_v, csd_v, obs_v, wgt_v; int cmn_lvl_blw, cmn_lvl_abv; int csd_lvl_blw, csd_lvl_abv; - ObsErrorEntry *oerr_ptr = (ObsErrorEntry *) 0; + ObsErrorEntry *oerr_ptr = (ObsErrorEntry *) nullptr; // Check the observation VarInfo file type if(obs_info->file_type() != FileType_Gb1) { diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 15aa9133f0..7282d1504d 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -416,18 +416,18 @@ VxPairDataPoint & VxPairDataPoint::operator=(const VxPairDataPoint &vx_pd) { void VxPairDataPoint::init_from_scratch() { - fcst_info = (VarInfo *) 0; - climo_info = (VarInfo *) 0; - obs_info = (VarInfoGrib *) 0; - - pd = (PairDataPoint ***) 0; - rej_typ = (int ***) 0; - rej_mask = (int ***) 0; - rej_fcst = (int ***) 0; - rej_cmn = (int ***) 0; - rej_csd = (int ***) 0; - rej_mpr = (int ***) 0; - rej_dup = (int ***) 0; + fcst_info = (VarInfo *) nullptr; + climo_info = (VarInfo *) nullptr; + obs_info = (VarInfoGrib *) nullptr; + + pd = (PairDataPoint ***) nullptr; + rej_typ = (int ***) nullptr; + rej_mask = (int ***) nullptr; + rej_fcst = (int ***) nullptr; + rej_cmn = (int ***) nullptr; + rej_csd = (int ***) nullptr; + rej_mpr = (int ***) nullptr; + rej_dup = (int ***) nullptr; n_msg_typ = 0; n_mask = 0; @@ -443,9 +443,9 @@ void VxPairDataPoint::init_from_scratch() { void VxPairDataPoint::clear() { int i, j, k; - if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) 0; } - if(climo_info) { delete climo_info; climo_info = (VarInfo *) 0; } - if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) 0; } + if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) nullptr; } + if(climo_info) { delete climo_info; climo_info = (VarInfo *) nullptr; } + if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) nullptr; } desc.clear(); @@ -576,7 +576,7 @@ void VxPairDataPoint::set_fcst_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) 0; } + if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) nullptr; } // Perform a deep copy fcst_info = f.new_var_info(info->file_type()); @@ -591,7 +591,7 @@ void VxPairDataPoint::set_climo_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(climo_info) { delete climo_info; climo_info = (VarInfo *) 0; } + if(climo_info) { delete climo_info; climo_info = (VarInfo *) nullptr; } // Perform a deep copy climo_info = f.new_var_info(info->file_type()); @@ -605,7 +605,7 @@ void VxPairDataPoint::set_climo_info(VarInfo *info) { void VxPairDataPoint::set_obs_info(VarInfoGrib *info) { // Deallocate, if necessary - if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) 0; } + if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) nullptr; } // Perform a deep copy obs_info = new VarInfoGrib; diff --git a/src/libcode/vx_statistics/read_climo.cc b/src/libcode/vx_statistics/read_climo.cc index 27fe9e5eae..6e077c9173 100644 --- a/src/libcode/vx_statistics/read_climo.cc +++ b/src/libcode/vx_statistics/read_climo.cc @@ -152,10 +152,10 @@ void read_climo_file(const char *climo_file, GrdFileType ctype, DataPlaneArray &dpa) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; DataPlaneArray clm_dpa; DataPlane dp; @@ -240,8 +240,8 @@ void read_climo_file(const char *climo_file, GrdFileType ctype, } // end for i // Deallocate memory - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } return; } diff --git a/src/libcode/vx_tc_util/atcf_line_base.cc b/src/libcode/vx_tc_util/atcf_line_base.cc index 6db2d00651..7a5f658e5f 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.cc +++ b/src/libcode/vx_tc_util/atcf_line_base.cc @@ -79,10 +79,10 @@ void ATCFLineBase::init_from_scratch() { set_delimiter(","); // Initialize pointers - BasinMap = (map *) 0; - BestTechnique = (StringArray *) 0; - OperTechnique = (StringArray *) 0; - TechSuffix = (ConcatString *) 0; + BasinMap = (map *) nullptr; + BestTechnique = (StringArray *) nullptr; + OperTechnique = (StringArray *) nullptr; + TechSuffix = (ConcatString *) nullptr; clear(); @@ -503,7 +503,7 @@ ATCFLineType string_to_atcflinetype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString atcflinetype_to_string(const ATCFLineType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case ATCFLineType_Track: s = "Track"; break; diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index 106a646f88..19007127d0 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -553,7 +553,7 @@ WatchWarnType string_to_watchwarntype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString watchwarntype_to_string(const WatchWarnType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TropicalStormWatch: s = "TSWATCH"; break; @@ -597,7 +597,7 @@ CycloneLevel string_to_cyclonelevel(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString cyclonelevel_to_string(const CycloneLevel t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case Disturbance: s = "DB"; break; @@ -657,7 +657,7 @@ QuadrantType string_to_quadranttype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString quadranttype_to_string(const QuadrantType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case FullCircle: s = "AAA"; break; @@ -698,7 +698,7 @@ SubregionCode string_to_subregioncode(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString subregioncode_to_string(const SubregionCode t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case Arabian_Sea: s = "A"; break; @@ -733,7 +733,7 @@ SystemsDepth string_to_systemsdepth(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString systemsdepth_to_string(const SystemsDepth t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case DeepDepth: s = "D"; break; diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 95336c7765..35680981a7 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -339,10 +339,10 @@ void DiagFile::read_cira_rt(const ConcatString &path, if(convert_map) { if(convert_map->count(cs) > 0) fx_ptr = &convert_map->at(cs); else if(convert_map->count(dl[1]) > 0) fx_ptr = &convert_map->at(dl[1]); - else fx_ptr = (UserFunc_1Arg *) 0; + else fx_ptr = (UserFunc_1Arg *) nullptr; } else { - fx_ptr = (UserFunc_1Arg *) 0; + fx_ptr = (UserFunc_1Arg *) nullptr; } // Parse the data values @@ -492,10 +492,10 @@ void DiagFile::read_ships_rt(const ConcatString &path, // Check for a conversion function if(convert_map) { if(convert_map->count(cs) > 0) fx_ptr = &convert_map->at(cs); - else fx_ptr = (UserFunc_1Arg *) 0; + else fx_ptr = (UserFunc_1Arg *) nullptr; } else { - fx_ptr = (UserFunc_1Arg *) 0; + fx_ptr = (UserFunc_1Arg *) nullptr; } // Parse the data values diff --git a/src/libcode/vx_tc_util/pair_data_genesis.cc b/src/libcode/vx_tc_util/pair_data_genesis.cc index c5665e318f..9f5dd56f87 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.cc +++ b/src/libcode/vx_tc_util/pair_data_genesis.cc @@ -28,7 +28,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////// ConcatString genesispaircategory_to_string(const GenesisPairCategory c) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(c) { case FYOYGenesis: s = "FYOY"; break; diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 364e754035..e80d254f32 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -71,7 +71,7 @@ void ProbRIRWPairInfo::init_from_scratch() { void ProbRIRWPairInfo::clear() { ProbRIRW.clear(); - BDeck = (TrackInfo *) 0; + BDeck = (TrackInfo *) nullptr; StormName.clear(); BModel.clear(); BLat = BLon = bad_data_double; @@ -274,7 +274,7 @@ void ProbRIRWPairInfo::set(const TCStatLine &l) { ProbRIRW.set(l); // Do not populate the BDECK - BDeck = (TrackInfo *) 0; + BDeck = (TrackInfo *) nullptr; // Store column information StormName = l.get_item("STORM_NAME", false); diff --git a/src/libcode/vx_tc_util/tc_columns.cc b/src/libcode/vx_tc_util/tc_columns.cc index 3e38075aa7..af191ca329 100644 --- a/src/libcode/vx_tc_util/tc_columns.cc +++ b/src/libcode/vx_tc_util/tc_columns.cc @@ -58,7 +58,7 @@ void close_tc_txt_file(ofstream *&out, const char *file_name) { // Close the output file out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; return; } diff --git a/src/libcode/vx_tc_util/tc_stat_line.cc b/src/libcode/vx_tc_util/tc_stat_line.cc index 78bd215196..d30a909a54 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.cc +++ b/src/libcode/vx_tc_util/tc_stat_line.cc @@ -100,7 +100,7 @@ void TCStatLine::clear() { DataLine::clear(); Type = NoTCStatLineType; - HdrLine = (AsciiHeaderLine *) 0; + HdrLine = (AsciiHeaderLine *) nullptr; return; } @@ -382,7 +382,7 @@ TCStatLineType string_to_tcstatlinetype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString tcstatlinetype_to_string(const TCStatLineType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TCStatLineType_TCMPR: s = TCStatLineType_TCMPR_Str; break; diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index 379d60faa1..9202fe2afe 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -62,7 +62,7 @@ TrackInfo & TrackInfo::operator=(const TrackInfo & t) { void TrackInfo::init_from_scratch() { - Point = (TrackPoint *) 0; + Point = (TrackPoint *) nullptr; clear(); @@ -106,7 +106,7 @@ void TrackInfo::clear() { void TrackInfo::clear_points() { - if(Point) { delete [] Point; Point = (TrackPoint *) 0; } + if(Point) { delete [] Point; Point = (TrackPoint *) nullptr; } NPoints = NAlloc = 0; return; @@ -249,7 +249,7 @@ void TrackInfo::assign(const TrackInfo &t) { void TrackInfo::extend(int n, bool exact) { int j, k; - TrackPoint *new_line = (TrackPoint *) 0; + TrackPoint *new_line = (TrackPoint *) nullptr; // Check if enough memory is already allocated if(NAlloc >= n) return; @@ -273,12 +273,12 @@ void TrackInfo::extend(int n, bool exact) { // Copy the array contents and delete the old one if(Point) { for(j=0; j= n) return; @@ -1045,12 +1045,12 @@ void TrackPairInfoArray::extend(int n, bool exact) { // Copy the array contents and delete the old one if(Pair) { for(j=0; j Date: Tue, 27 Feb 2024 16:52:17 +0000 Subject: [PATCH 4/5] #2673 Change 0 to nullptr --- src/tools/core/ensemble_stat/ensemble_stat.cc | 12 +-- src/tools/core/ensemble_stat/ensemble_stat.h | 4 +- .../ensemble_stat/ensemble_stat_conf_info.cc | 12 +-- src/tools/core/grid_stat/grid_stat.cc | 4 +- src/tools/core/grid_stat/grid_stat.h | 10 +-- src/tools/core/mode/mode_exec.cc | 74 +++++++++---------- src/tools/core/mode/mode_ps_file.cc | 10 +-- src/tools/core/mode_analysis/mode_analysis.cc | 10 +-- src/tools/core/point_stat/point_stat.cc | 4 +- src/tools/core/point_stat/point_stat.h | 4 +- .../core/series_analysis/series_analysis.cc | 22 +++--- .../core/series_analysis/series_analysis.h | 8 +- .../series_analysis_conf_info.cc | 20 ++--- .../core/stat_analysis/aggr_stat_line.cc | 18 ++--- .../core/stat_analysis/parse_stat_line.cc | 4 +- src/tools/core/stat_analysis/stat_analysis.cc | 2 +- src/tools/core/stat_analysis/stat_analysis.h | 2 +- .../core/stat_analysis/stat_analysis_job.cc | 2 +- src/tools/core/wavelet_stat/wavelet_stat.cc | 71 +++++++++--------- src/tools/core/wavelet_stat/wavelet_stat.h | 12 +-- .../wavelet_stat/wavelet_stat_conf_info.cc | 34 ++++----- 21 files changed, 171 insertions(+), 168 deletions(-) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 8b86abcec5..d5342146f2 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -640,7 +640,7 @@ void process_n_vld() { bool get_data_plane(const char *infile, GrdFileType ftype, VarInfo *info, DataPlane &dp, bool do_regrid) { bool found; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Read the current ensemble file if(!(mtddf = mtddf_factory.new_met_2d_data_file(infile, ftype))) { @@ -916,7 +916,7 @@ void process_point_vx() { void process_point_obs(int i_nc) { int i_obs, j; unixtime hdr_ut; - NcFile *obs_in = (NcFile *) 0; + NcFile *obs_in = (NcFile *) nullptr; const char *method_name = "process_point_obs() -> "; mlog << Debug(2) << "\n" << sep_str << "\n\n" @@ -1122,7 +1122,7 @@ bool process_point_ens(int i_vx, int i_ens, DataPlaneArray &fcst_dpa) { //////////////////////////////////////////////////////////////////////// void process_point_scores() { - PairDataEnsemble *pd_ptr = (PairDataEnsemble *) 0; + PairDataEnsemble *pd_ptr = (PairDataEnsemble *) nullptr; PairDataEnsemble pd; ConcatString cs; int i, j, k, l; @@ -1326,7 +1326,7 @@ void process_grid_vx() { mlog << Debug(3) << "Observation error for gridded verification is " << "defined by a table lookup for each point.\n"; - oerr_ptr = (ObsErrorEntry *) 0; + oerr_ptr = (ObsErrorEntry *) nullptr; } } } @@ -1850,7 +1850,7 @@ void setup_txt_files() { max_col += n_header_columns; // Initialize file stream - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; // Build the file name stat_file << tmp_str << stat_file_ext; @@ -1884,7 +1884,7 @@ void setup_txt_files() { if(i == i_orank && !point_obs_flag) continue; // Initialize file stream - txt_out[i] = (ofstream *) 0; + txt_out[i] = (ofstream *) nullptr; // Build the file name txt_file[i] << tmp_str << "_" << txt_file_abbr[i] diff --git a/src/tools/core/ensemble_stat/ensemble_stat.h b/src/tools/core/ensemble_stat/ensemble_stat.h index 1dde2c06a1..28d26a5585 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.h +++ b/src/tools/core/ensemble_stat/ensemble_stat.h @@ -123,7 +123,7 @@ static int compress_level = -1; // Output NetCDF file static bool out_nc_flag = false; static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim; @@ -133,7 +133,7 @@ static StringArray nc_orank_var_sa; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; diff --git a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc index 8da7df73c6..be18529e0e 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -50,8 +50,8 @@ EnsembleStatConfInfo::~EnsembleStatConfInfo() { void EnsembleStatConfInfo::init_from_scratch() { // Initialize pointers - vx_opt = (EnsembleStatVxOpt *) 0; - rng_ptr = (gsl_rng *) 0; + vx_opt = (EnsembleStatVxOpt *) nullptr; + rng_ptr = (gsl_rng *) nullptr; clear(); @@ -86,7 +86,7 @@ void EnsembleStatConfInfo::clear() { nc_info.clear(); // Deallocate memory - if(vx_opt) { delete [] vx_opt; vx_opt = (EnsembleStatVxOpt *) 0; } + if(vx_opt) { delete [] vx_opt; vx_opt = (EnsembleStatVxOpt *) nullptr; } // Reset counts n_vx = 0; @@ -122,8 +122,8 @@ void EnsembleStatConfInfo::process_config(GrdFileType etype, int i, j, n_ens_files; VarInfoFactory info_factory; mapoutput_map; - Dictionary *fdict = (Dictionary *) 0; - Dictionary *odict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; + Dictionary *odict = (Dictionary *) nullptr; Dictionary i_fdict, i_odict; InterpMthd mthd; @@ -869,7 +869,7 @@ void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict, //////////////////////////////////////////////////////////////////////// void EnsembleStatVxOpt::parse_nc_info(Dictionary &odict) { - const DictionaryEntry * e = (const DictionaryEntry *) 0; + const DictionaryEntry * e = (const DictionaryEntry *) nullptr; e = odict.lookup(conf_key_nc_orank_flag); diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index c65ca49109..59495c569a 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -2608,7 +2608,7 @@ void write_nc(const ConcatString &field_name, const DataPlane &dp, n_masks = (apply_mask ? conf_info.vx_opt[i_vx].get_n_mask() : 1); // Allocate memory - float *data = (float *) 0; + float *data = (float *) nullptr; data = new float [grid.nx()*grid.ny()]; // Set the NetCDF compression level @@ -3070,7 +3070,7 @@ void clean_up() { //nc_out->close(); delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Deallocate memory for data files diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index ec85cacffd..b5db513b57 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -127,7 +127,7 @@ static ConcatString out_dir; // Output Netcdf file static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim; @@ -136,7 +136,7 @@ static StringArray nc_var_sa; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; @@ -163,11 +163,11 @@ static DataPlane wgt_dp; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used -static gsl_rng *rng_ptr = (gsl_rng *) 0; +static gsl_rng *rng_ptr = (gsl_rng *) nullptr; // Strings to be output in the STAT and optional text files static StatHdrColumns shc; diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index 9165051a6c..025177727c 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -87,8 +87,8 @@ void ModeExecutive::init_from_scratch() { - fcst_mtddf = (Met2dDataFile *) 0; - obs_mtddf = (Met2dDataFile *) 0; + fcst_mtddf = (Met2dDataFile *) nullptr; + obs_mtddf = (Met2dDataFile *) nullptr; clear(); @@ -111,8 +111,8 @@ void ModeExecutive::clear() fcst_file.clear(); obs_file.clear(); - if ( fcst_mtddf ) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) 0; } - if ( obs_mtddf ) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) 0; } + if ( fcst_mtddf ) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) nullptr; } + if ( obs_mtddf ) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) nullptr; } for (int j=0; jconv_thresh.get_str(5); const ConcatString obs_thresh = engine.conf_info.Obs->conv_thresh.get_str(5); - float *fcst_raw_data = (float *) 0; - float *fcst_obj_raw_data = (float *) 0; - int *fcst_obj_data = (int *) 0; - int *fcst_clus_data = (int *) 0; + float *fcst_raw_data = (float *) nullptr; + float *fcst_obj_raw_data = (float *) nullptr; + int *fcst_obj_data = (int *) nullptr; + int *fcst_clus_data = (int *) nullptr; - float *obs_raw_data = (float *) 0; - float *obs_obj_raw_data = (float *) 0; - int *obs_obj_data = (int *) 0; - int *obs_clus_data = (int *) 0; + float *obs_raw_data = (float *) nullptr; + float *obs_obj_raw_data = (float *) nullptr; + int *obs_obj_data = (int *) nullptr; + int *obs_clus_data = (int *) nullptr; - NcFile *f_out = (NcFile *) 0; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; @@ -1752,7 +1752,7 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) mlog << Error << "\nModeExecutive::write_obj_netcdf() -> trouble opening output file " << out_file << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -2094,15 +2094,15 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) // Delete allocated memory // - if (fcst_raw_data) { delete [] fcst_raw_data; fcst_raw_data = (float *) 0; } - if (fcst_obj_raw_data) { delete [] fcst_obj_raw_data; fcst_obj_raw_data = (float *) 0; } - if (fcst_obj_data) { delete [] fcst_obj_data; fcst_obj_data = (int *) 0; } - if (fcst_clus_data) { delete [] fcst_clus_data; fcst_clus_data = (int *) 0; } + if (fcst_raw_data) { delete [] fcst_raw_data; fcst_raw_data = (float *) nullptr; } + if (fcst_obj_raw_data) { delete [] fcst_obj_raw_data; fcst_obj_raw_data = (float *) nullptr; } + if (fcst_obj_data) { delete [] fcst_obj_data; fcst_obj_data = (int *) nullptr; } + if (fcst_clus_data) { delete [] fcst_clus_data; fcst_clus_data = (int *) nullptr; } - if (obs_raw_data) { delete [] obs_raw_data; obs_raw_data = (float *) 0; } - if (obs_obj_raw_data) { delete [] obs_obj_raw_data; obs_obj_raw_data = (float *) 0; } - if (obs_obj_data) { delete [] obs_obj_data; obs_obj_data = (int *) 0; } - if (obs_clus_data) { delete [] obs_clus_data; obs_clus_data = (int *) 0; } + if (obs_raw_data) { delete [] obs_raw_data; obs_raw_data = (float *) nullptr; } + if (obs_obj_raw_data) { delete [] obs_obj_raw_data; obs_obj_raw_data = (float *) nullptr; } + if (obs_obj_data) { delete [] obs_obj_data; obs_obj_data = (int *) nullptr; } + if (obs_clus_data) { delete [] obs_clus_data; obs_clus_data = (int *) nullptr; } // // Write out the values of the vertices of the polylines. @@ -2114,7 +2114,7 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) // Close the NetCDF file // delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; return; } @@ -2179,14 +2179,14 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) int i, j, x, y, n_pts, n_poly; double lat, lon; - Polyline **poly = (Polyline **) 0; + Polyline **poly = (Polyline **) nullptr; - int *poly_start = (int *) 0; - int *poly_npts = (int *) 0; - float *poly_lat = (float *) 0; - float *poly_lon = (float *) 0; - int *poly_x = (int *) 0; - int *poly_y = (int *) 0; + int *poly_start = (int *) nullptr; + int *poly_npts = (int *) nullptr; + float *poly_lat = (float *) nullptr; + float *poly_lon = (float *) nullptr; + int *poly_x = (int *) nullptr; + int *poly_y = (int *) nullptr; // Dimensions and variables for each object NcDim obj_dim ; @@ -2436,13 +2436,13 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) // // Delete allocated memory // - if(poly) { delete [] poly; poly = (Polyline **) 0; } - if(poly_start) { delete [] poly_start; poly_start = (int *) 0; } - if(poly_npts) { delete [] poly_npts; poly_npts = (int *) 0; } - if(poly_lat) { delete [] poly_lat; poly_lat = (float *) 0; } - if(poly_lon) { delete [] poly_lon; poly_lon = (float *) 0; } - if(poly_x) { delete [] poly_x; poly_x = (int *) 0; } - if(poly_y) { delete [] poly_y; poly_y = (int *) 0; } + if(poly) { delete [] poly; poly = (Polyline **) nullptr; } + if(poly_start) { delete [] poly_start; poly_start = (int *) nullptr; } + if(poly_npts) { delete [] poly_npts; poly_npts = (int *) nullptr; } + if(poly_lat) { delete [] poly_lat; poly_lat = (float *) nullptr; } + if(poly_lon) { delete [] poly_lon; poly_lon = (float *) nullptr; } + if(poly_x) { delete [] poly_x; poly_x = (int *) nullptr; } + if(poly_y) { delete [] poly_y; poly_y = (int *) nullptr; } return; } diff --git a/src/tools/core/mode/mode_ps_file.cc b/src/tools/core/mode/mode_ps_file.cc index 2a9c518599..66cba3b5d5 100644 --- a/src/tools/core/mode/mode_ps_file.cc +++ b/src/tools/core/mode/mode_ps_file.cc @@ -115,11 +115,11 @@ void ModePsFile::mpsf_init_from_scratch() { - Engine = (ModeFuzzyEngine *) 0; + Engine = (ModeFuzzyEngine *) nullptr; - ConfInfo = (ModeConfInfo *) 0; + ConfInfo = (ModeConfInfo *) nullptr; - grid = (Grid *) 0; + grid = (Grid *) nullptr; MetDataDir = replace_path("MET_BASE"); @@ -916,7 +916,7 @@ void ModePsFile::draw_colorbar(bool fcst) int i, n_colors; char label[max_str_len]; double bar_width, bar_height, x_ll, y_ll; - ColorTable * ct = (ColorTable *) 0; + ColorTable * ct = (ColorTable *) nullptr; Box b; Color c; @@ -1013,7 +1013,7 @@ void ModePsFile::render_ppm(ModeFuzzyEngine & eng, EngineType eng_type, const Sh double mag, v; Color c; Color fill_color; - ColorTable *ct = (ColorTable *) 0; + ColorTable *ct = (ColorTable *) nullptr; const int L = nint(XY_box.left()); const int B = nint(XY_box.bottom()); diff --git a/src/tools/core/mode_analysis/mode_analysis.cc b/src/tools/core/mode_analysis/mode_analysis.cc index 95e1bd43d1..e0ae0f8bb4 100644 --- a/src/tools/core/mode_analysis/mode_analysis.cc +++ b/src/tools/core/mode_analysis/mode_analysis.cc @@ -58,7 +58,7 @@ static const char * default_config_filename = "MET_BASE/config/MODEAnalysisConfi static ConcatString config_filename; -static BasicModeAnalysisJob * job = (BasicModeAnalysisJob *) 0; +static BasicModeAnalysisJob * job = (BasicModeAnalysisJob *) nullptr; static ModeAttributes config_atts; @@ -70,9 +70,9 @@ static StringArray mode_files; static StringArray lookin_dirs; -static ofstream * dumpfile = (ofstream *) 0; +static ofstream * dumpfile = (ofstream *) nullptr; -static ofstream * outfile = (ofstream *) 0; +static ofstream * outfile = (ofstream *) nullptr; //////////////////////////////////////////////////////////////////////// @@ -181,8 +181,8 @@ job->clear(); // done // -if ( dumpfile ) { delete dumpfile; dumpfile = (ofstream *) 0; } -if ( outfile ) { delete outfile; outfile = (ofstream *) 0; } +if ( dumpfile ) { delete dumpfile; dumpfile = (ofstream *) nullptr; } +if ( outfile ) { delete outfile; outfile = (ofstream *) nullptr; } return ( 0 ); diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 6c50ea880c..d950486015 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -414,7 +414,7 @@ void setup_txt_files() { max_col += n_header_columns + 1; // Initialize file stream - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; // Build the file name stat_file << base_name << stat_file_ext; @@ -445,7 +445,7 @@ void setup_txt_files() { if(conf_info.output_flag[i] == STATOutputType_Both) { // Initialize file stream - txt_out[i] = (ofstream *) 0; + txt_out[i] = (ofstream *) nullptr; // Build the file name txt_file[i] << base_name << "_" << txt_file_abbr[i] diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 510693068b..7d69a62b62 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -128,7 +128,7 @@ static int fcst_lead_sec = bad_data_int; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; @@ -150,7 +150,7 @@ static bool is_first_pass = true; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used static gsl_rng *rng_ptr = (gsl_rng *) nullptr; diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 223ce9ad65..5ce2b81d6d 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -378,7 +378,7 @@ void process_grid(const Grid &fcst_grid, const Grid &obs_grid) { Met2dDataFile *get_mtddf(const StringArray &file_list, const GrdFileType type) { int i; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Find the first file that actually exists for(i=0; igrid(); // Close the data file - delete mtddf; mtddf = (Met2dDataFile *) 0; + delete mtddf; mtddf = (Met2dDataFile *) nullptr; return(found); } @@ -677,9 +677,9 @@ bool read_single_entry(VarInfo *info, const ConcatString &cur_file, void process_scores() { int i, x, y, i_read, i_series, i_point, i_fcst; - VarInfo *fcst_info = (VarInfo *) 0; - VarInfo *obs_info = (VarInfo *) 0; - PairDataPoint *pd_ptr = (PairDataPoint *) 0; + VarInfo *fcst_info = (VarInfo *) nullptr; + VarInfo *obs_info = (VarInfo *) nullptr; + PairDataPoint *pd_ptr = (PairDataPoint *) nullptr; DataPlane fcst_dp, obs_dp; const char *method_name = "process_scores() "; @@ -878,7 +878,7 @@ void process_scores() { add_att(nc_out, "obs_lead_end", (string)sec_to_hhmmss(obs_lead_end)); // Clean up - if(pd_ptr) { delete [] pd_ptr; pd_ptr = (PairDataPoint *) 0; } + if(pd_ptr) { delete [] pd_ptr; pd_ptr = (PairDataPoint *) nullptr; } // Print summary counts mlog << Debug(2) @@ -964,7 +964,7 @@ void do_cts(int n, const PairDataPoint *pd_ptr) { } // end for i // Deallocate memory - if(cts_info) { delete [] cts_info; cts_info = (CTSInfo *) 0; } + if(cts_info) { delete [] cts_info; cts_info = (CTSInfo *) nullptr; } return; } @@ -2238,12 +2238,12 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Deallocate memory for data files - if(fcst_mtddf) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) 0; } - if(obs_mtddf) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) 0; } + if(fcst_mtddf) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) nullptr; } + if(obs_mtddf) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) nullptr; } // Deallocate memory for the random number generator rng_free(rng_ptr); diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index 51225c08ef..d50df6cb94 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -88,7 +88,7 @@ static SeriesAnalysisConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim ; @@ -113,11 +113,11 @@ static int n_reads = 1; // Initialize to at least one pass // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used -static gsl_rng *rng_ptr = (gsl_rng *) 0; +static gsl_rng *rng_ptr = (gsl_rng *) nullptr; // Enumeration of ways that a series can be defined enum SeriesType { diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.cc b/src/tools/core/series_analysis/series_analysis_conf_info.cc index 7d22d83643..08b97c1fd8 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -46,8 +46,8 @@ SeriesAnalysisConfInfo::~SeriesAnalysisConfInfo() { void SeriesAnalysisConfInfo::init_from_scratch() { // Initialize pointers - fcst_info = (VarInfo **) 0; - obs_info = (VarInfo **) 0; + fcst_info = (VarInfo **) nullptr; + obs_info = (VarInfo **) nullptr; clear(); @@ -92,15 +92,15 @@ void SeriesAnalysisConfInfo::clear() { // Clear fcst_info if(fcst_info) { for(i=0; i::iterator it; @@ -220,8 +220,8 @@ void SeriesAnalysisConfInfo::process_config(GrdFileType ftype, obs_info = new VarInfo * [n_obs]; // Initialize pointers - for(i=0; ilookup_thresh_array(conf_key_cat_thresh); diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 99b5906429..b9c4df9a25 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -2377,8 +2377,8 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // if(m.count(key) == 0) { aggr.isc_info.clear(); - aggr.total_na = aggr.mse_na = aggr.fen_na = (NumArray *) 0; - aggr.oen_na = aggr.baser_na = aggr.fbias_na = (NumArray *) 0; + aggr.total_na = aggr.mse_na = aggr.fen_na = (NumArray *) nullptr; + aggr.oen_na = aggr.baser_na = aggr.fbias_na = (NumArray *) nullptr; aggr.hdr.clear(); m[key] = aggr; mlog << Debug(3) << "[Case " << m.size() @@ -2568,12 +2568,12 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // // Deallocate memory // - if(it->second.total_na) { delete [] it->second.total_na; it->second.total_na = (NumArray *) 0; } - if(it->second.mse_na ) { delete [] it->second.mse_na; it->second.mse_na = (NumArray *) 0; } - if(it->second.fen_na ) { delete [] it->second.fen_na; it->second.fen_na = (NumArray *) 0; } - if(it->second.oen_na ) { delete [] it->second.oen_na; it->second.oen_na = (NumArray *) 0; } - if(it->second.baser_na) { delete [] it->second.baser_na; it->second.baser_na = (NumArray *) 0; } - if(it->second.fbias_na) { delete [] it->second.fbias_na; it->second.fbias_na = (NumArray *) 0; } + if(it->second.total_na) { delete [] it->second.total_na; it->second.total_na = (NumArray *) nullptr; } + if(it->second.mse_na ) { delete [] it->second.mse_na; it->second.mse_na = (NumArray *) nullptr; } + if(it->second.fen_na ) { delete [] it->second.fen_na; it->second.fen_na = (NumArray *) nullptr; } + if(it->second.oen_na ) { delete [] it->second.oen_na; it->second.oen_na = (NumArray *) nullptr; } + if(it->second.baser_na) { delete [] it->second.baser_na; it->second.baser_na = (NumArray *) nullptr; } + if(it->second.fbias_na) { delete [] it->second.fbias_na; it->second.fbias_na = (NumArray *) nullptr; } } // end for it @@ -3878,7 +3878,7 @@ void mpr_to_ctc(STATAnalysisJob &job, const AggrMPRInfo &info, void mpr_to_cts(STATAnalysisJob &job, const AggrMPRInfo &info, int i_thresh, CTSInfo &cts_info, const char *tmp_dir, gsl_rng *rng_ptr) { - CTSInfo *cts_info_ptr = (CTSInfo *) 0; + CTSInfo *cts_info_ptr = (CTSInfo *) nullptr; // // Initialize diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index 57bc92eb46..47c91c099d 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -150,7 +150,7 @@ void parse_nbrctc_ctable(STATLine &l, TTContingencyTable &ct) { void parse_nx2_ctable(STATLine &l, Nx2ContingencyTable &pct) { int i, n, oy, on; char col_str[max_str_len]; - double *thresh = (double *) 0; + double *thresh = (double *) nullptr; // N_THRESH n = atoi(l.get_item("N_THRESH")); @@ -181,7 +181,7 @@ void parse_nx2_ctable(STATLine &l, Nx2ContingencyTable &pct) { thresh[n-1] = atof(l.get_item(col_str)); pct.set_thresholds(thresh); - if ( thresh ) { delete [] thresh; thresh = (double *) 0; } + if ( thresh ) { delete [] thresh; thresh = (double *) nullptr; } return; } diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index 912617a213..366dbab0a3 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -639,7 +639,7 @@ while((*f) >> line) { f->close(); -if(pldf) { delete pldf; pldf = (PyLineDataFile *) 0; } +if(pldf) { delete pldf; pldf = (PyLineDataFile *) nullptr; } return; diff --git a/src/tools/core/stat_analysis/stat_analysis.h b/src/tools/core/stat_analysis/stat_analysis.h index b4992e75b0..0fa44910db 100644 --- a/src/tools/core/stat_analysis/stat_analysis.h +++ b/src/tools/core/stat_analysis/stat_analysis.h @@ -70,7 +70,7 @@ static StringArray files; // Output file set with -out static ConcatString out_file; -static std::ofstream *sa_out = (std::ofstream *) 0; +static std::ofstream *sa_out = (std::ofstream *) nullptr; // Config file set with -config static ConcatString config_file; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index dce6d0014f..a868b6b1d0 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -158,7 +158,7 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, const ConcatString &tmp_path, ofstream *sa_out) { LineDataFile f; int n_in, n_out; - gsl_rng *rng_ptr = (gsl_rng *) 0; + gsl_rng *rng_ptr = (gsl_rng *) nullptr; // // Open up the temp file for reading the intermediate STAT line data diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index b182a4538d..c1675cb365 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -506,12 +506,12 @@ void process_scores() { for(j=0; jclose(); delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Close the output PSfile as long as it was opened @@ -1906,7 +1909,7 @@ void close_out_files() { mlog << Debug(1) << "Output file: " << out_ps_file << "\n"; ps_out->close(); delete ps_out; - ps_out = (PSfile *) 0; + ps_out = (PSfile *) nullptr; } return; @@ -2614,7 +2617,7 @@ void draw_colorbar(PSfile *p, Box &dim, int fcst, int raw) { int i; char label[max_str_len]; double bar_width, bar_height, x_ll, y_ll, step, v; - ColorTable *ct_ptr = (ColorTable *) 0; + ColorTable *ct_ptr = (ColorTable *) nullptr; Color c; // @@ -2814,8 +2817,8 @@ void render_image(PSfile *p, const DataPlane &dp, Box &dim, int fcst) { int x, y, grid_x, grid_y; double mag; Color c; - Color *c_fill_ptr = (Color *) 0; - ColorTable *ct_ptr = (ColorTable *) 0; + Color *c_fill_ptr = (Color *) nullptr; + ColorTable *ct_ptr = (ColorTable *) nullptr; // // Set up pointers to the appropriate colortable and fill color @@ -2904,8 +2907,8 @@ void render_tile(PSfile *p, const double *data, int n, int i_tile, int i, x, y; double mag; Color c; - Color *c_fill_ptr = (Color *) 0; - ColorTable *ct_ptr = (ColorTable *) 0; + Color *c_fill_ptr = (Color *) nullptr; + ColorTable *ct_ptr = (ColorTable *) nullptr; // // Set up pointers to the appropriate colortable and fill color diff --git a/src/tools/core/wavelet_stat/wavelet_stat.h b/src/tools/core/wavelet_stat/wavelet_stat.h index 0b42b68e39..470477fa6b 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.h +++ b/src/tools/core/wavelet_stat/wavelet_stat.h @@ -93,7 +93,7 @@ static ConcatString out_dir; // Output NetCDF file static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim x_dim ; static netCDF::NcDim y_dim ; static netCDF::NcDim scale_dim ; @@ -104,17 +104,17 @@ static netCDF::NcVar diff_var ; // Output PostScript file static ConcatString out_ps_file; -static PSfile *ps_out = (PSfile *) 0; +static PSfile *ps_out = (PSfile *) nullptr; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; // Optional ISC output file static ConcatString isc_file; -static std::ofstream *isc_out = (std::ofstream *) 0; +static std::ofstream *isc_out = (std::ofstream *) nullptr; static AsciiTable isc_at; static int i_isc_row; @@ -177,8 +177,8 @@ static bool is_first_pass = true; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Strings to be output in the STAT and optional text files static StatHdrColumns shc; diff --git a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc index 8a2a896544..0d5ccedaa5 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -47,12 +47,12 @@ WaveletStatConfInfo::~WaveletStatConfInfo() { void WaveletStatConfInfo::init_from_scratch() { // Initialize pointers - fcst_info = (VarInfo **) 0; - obs_info = (VarInfo **) 0; - fcat_ta = (ThreshArray *) 0; - ocat_ta = (ThreshArray *) 0; - wvlt_ptr = (gsl_wavelet *) 0; - wvlt_work_ptr = (gsl_wavelet_workspace *) 0; + fcst_info = (VarInfo **) nullptr; + obs_info = (VarInfo **) nullptr; + fcat_ta = (ThreshArray *) nullptr; + ocat_ta = (ThreshArray *) nullptr; + wvlt_ptr = (gsl_wavelet *) nullptr; + wvlt_work_ptr = (gsl_wavelet_workspace *) nullptr; clear(); @@ -91,21 +91,21 @@ void WaveletStatConfInfo::clear() { // Deallocate memory if(wvlt_ptr) { wavelet_free(wvlt_ptr); } if(wvlt_work_ptr) { wavelet_workspace_free(wvlt_work_ptr); } - if(fcat_ta) { delete [] fcat_ta; fcat_ta = (ThreshArray *) 0; } - if(ocat_ta) { delete [] ocat_ta; ocat_ta = (ThreshArray *) 0; } + if(fcat_ta) { delete [] fcat_ta; fcat_ta = (ThreshArray *) nullptr; } + if(ocat_ta) { delete [] ocat_ta; ocat_ta = (ThreshArray *) nullptr; } // Clear fcst_info if(fcst_info) { for(i=0; ioutput_map; - Dictionary *fcst_dict = (Dictionary *) 0; - Dictionary *obs_dict = (Dictionary *) 0; - Dictionary *dict = (Dictionary *) 0; + Dictionary *fcst_dict = (Dictionary *) nullptr; + Dictionary *obs_dict = (Dictionary *) nullptr; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_fdict, i_odict; gsl_wavelet_type type; @@ -202,7 +202,7 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, ocat_ta = new ThreshArray [n_vx]; // Initialize pointers - for(i=0; i Date: Tue, 27 Feb 2024 16:52:25 +0000 Subject: [PATCH 5/5] #2673 Change 0 to nullptr --- src/tools/dev_utils/chk4copyright.cc | 4 +- src/tools/dev_utils/gen_climo_bin.cc | 14 ++-- src/tools/dev_utils/gribtab.dat_to_flat.cc | 6 +- src/tools/dev_utils/insitu_nc_file.cc | 6 +- src/tools/dev_utils/met_nc_file.cc | 8 +- src/tools/dev_utils/nceptab_to_flat.cc | 4 +- src/tools/other/ascii2nc/file_handler.cc | 2 +- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 34 ++++---- src/tools/other/gen_ens_prod/gen_ens_prod.h | 6 +- .../gen_ens_prod/gen_ens_prod_conf_info.cc | 2 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 24 +++--- src/tools/other/grid_diag/grid_diag.cc | 8 +- src/tools/other/grid_diag/grid_diag.h | 4 +- .../other/grid_diag/grid_diag_conf_info.cc | 12 +-- src/tools/other/gsi_tools/gsidens2orank.h | 2 +- src/tools/other/madis2nc/madis2nc.cc | 8 +- src/tools/other/madis2nc/madis2nc.h | 4 +- src/tools/other/mode_graphics/cgraph_font.cc | 4 +- src/tools/other/mode_graphics/cgraph_main.cc | 36 ++++---- .../cgraphbase_plottype_to_string.cc | 2 +- src/tools/other/mode_graphics/color_stack.cc | 10 +-- .../mode_graphics/mode_nc_output_file.cc | 26 +++--- src/tools/other/mode_time_domain/2d_att.cc | 2 +- .../other/mode_time_domain/2d_att_array.cc | 8 +- src/tools/other/mode_time_domain/3d_att.cc | 2 +- .../mode_time_domain/3d_att_pair_array.cc | 8 +- .../mode_time_domain/3d_att_single_array.cc | 8 +- .../other/mode_time_domain/fo_node_array.cc | 8 +- src/tools/other/mode_time_domain/mm_engine.cc | 2 +- .../other/mode_time_domain/mtd_config_info.cc | 34 ++++---- .../other/mode_time_domain/mtd_file_base.cc | 6 +- .../other/mode_time_domain/mtd_file_int.cc | 16 ++-- .../other/mode_time_domain/mtd_partition.cc | 22 ++--- .../mode_time_domain/mtdfiletype_to_string.cc | 2 +- .../other/mode_time_domain/nc_utils_local.cc | 2 +- .../other/modis_regrid/cloudsat_swath_file.cc | 84 +++++++++---------- src/tools/other/modis_regrid/data_averager.cc | 2 +- .../modis_regrid/data_plane_to_netcdf.cc | 10 +-- src/tools/other/modis_regrid/modis_file.cc | 2 +- src/tools/other/modis_regrid/modis_regrid.cc | 4 +- src/tools/other/pb2nc/pb2nc.cc | 4 +- src/tools/other/pb2nc/pb2nc_conf_info.cc | 4 +- .../plot_point_obs_conf_info.cc | 8 +- src/tools/other/point2grid/point2grid.cc | 30 +++---- .../other/point2grid/point2grid_conf_info.cc | 2 +- .../regrid_data_plane/regrid_data_plane.cc | 14 ++-- .../shift_data_plane/shift_data_plane.cc | 10 +-- src/tools/other/wwmca_tool/af_cp_file.cc | 4 +- src/tools/other/wwmca_tool/af_file.cc | 4 +- src/tools/other/wwmca_tool/af_pt_file.cc | 4 +- src/tools/other/wwmca_tool/ave_interp.cc | 2 +- src/tools/other/wwmca_tool/interp_base.cc | 4 +- src/tools/other/wwmca_tool/max_interp.cc | 2 +- src/tools/other/wwmca_tool/min_interp.cc | 2 +- src/tools/other/wwmca_tool/nc_output.cc | 4 +- src/tools/other/wwmca_tool/nearest_interp.cc | 2 +- src/tools/other/wwmca_tool/wwmca_plot.cc | 6 +- src/tools/other/wwmca_tool/wwmca_ref.cc | 36 ++++---- .../tc_utils/rmw_analysis/rmw_analysis.h | 4 +- .../rmw_analysis/rmw_analysis_conf_info.cc | 10 +-- src/tools/tc_utils/tc_diag/tc_diag.cc | 44 +++++----- .../tc_utils/tc_diag/tc_diag_conf_info.cc | 8 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 12 +-- src/tools/tc_utils/tc_dland/tc_poly.cc | 10 +-- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 12 +-- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 12 +-- .../tc_utils/tc_pairs/tc_pairs_conf_info.cc | 10 +-- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 8 +- src/tools/tc_utils/tc_rmw/tc_rmw.h | 2 +- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 10 +-- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 66 +++++++-------- src/tools/tc_utils/tc_stat/tc_stat.cc | 8 +- src/tools/tc_utils/tc_stat/tc_stat.h | 2 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 10 +-- 74 files changed, 409 insertions(+), 409 deletions(-) diff --git a/src/tools/dev_utils/chk4copyright.cc b/src/tools/dev_utils/chk4copyright.cc index e145909d31..d61649b318 100644 --- a/src/tools/dev_utils/chk4copyright.cc +++ b/src/tools/dev_utils/chk4copyright.cc @@ -210,8 +210,8 @@ void set_quiet(const StringArray &) void process_directory(const char * dir_name) { - DIR *dir = (DIR *) 0; // pointer to a DIR structure - dirent *pde = (dirent *) 0; // pointer to a portable directory entry + DIR *dir = (DIR *) nullptr; // pointer to a DIR structure + dirent *pde = (dirent *) nullptr; // pointer to a portable directory entry ConcatString new_directory; ConcatString tmp_directory; ConcatString new_filename; diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index fea08a5d9d..997ff00abd 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -53,7 +53,7 @@ static ConcatString program_name; static Grid grid; static ConcatString out_file; -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim, lon_dim, cdf_dim; static NcVar cdf_x_var, cdf_y_var; @@ -127,7 +127,7 @@ int met_main(int argc, char *argv[]) { mlog << Debug(1) << "Finished writing output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; return(0); } @@ -326,7 +326,7 @@ void write_nc_bin(const DataPlane &dp, int i_cdf, double cdf_y) { } // Deallocate and clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -335,9 +335,9 @@ void write_nc_bin(const DataPlane &dp, int i_cdf, double cdf_y) { void get_field(const char *file, const char *config_str, DataPlane &dp) { GrdFileType ftype; - Met2dDataFile * mtddf_ptr = (Met2dDataFile * ) 0; + Met2dDataFile * mtddf_ptr = (Met2dDataFile * ) nullptr; Met2dDataFileFactory m_factory; - VarInfo * vi_ptr = (VarInfo * ) 0; + VarInfo * vi_ptr = (VarInfo * ) nullptr; VarInfoFactory v_factory; double dmin, dmax; @@ -416,8 +416,8 @@ void get_field(const char *file, const char *config_str, DataPlane &dp) { } // Clean up - if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile * ) 0; } - if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) 0; } + if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile * ) nullptr; } + if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) nullptr; } return; } diff --git a/src/tools/dev_utils/gribtab.dat_to_flat.cc b/src/tools/dev_utils/gribtab.dat_to_flat.cc index fbf84434e1..1fca331615 100644 --- a/src/tools/dev_utils/gribtab.dat_to_flat.cc +++ b/src/tools/dev_utils/gribtab.dat_to_flat.cc @@ -96,7 +96,7 @@ int j; int i[6]; const char i_delim [] = "{} ,\""; const char s_delim [] = ",\""; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; char line2[512]; char * s = line2; const char *method_name = "parse_line() -> "; @@ -113,7 +113,7 @@ for (j=0; j<6; ++j) { i[j] = atoi(c); - s = (char *) 0; + s = (char *) nullptr; } // while @@ -134,7 +134,7 @@ for (j=0; j<3; ++j) { cout << ' ' << '\"' << c << '\"'; - s = (char *) 0; + s = (char *) nullptr; } // while diff --git a/src/tools/dev_utils/insitu_nc_file.cc b/src/tools/dev_utils/insitu_nc_file.cc index 7566eb366f..83df32b874 100644 --- a/src/tools/dev_utils/insitu_nc_file.cc +++ b/src/tools/dev_utils/insitu_nc_file.cc @@ -75,7 +75,7 @@ void InsituNcFile::init_from_scratch() { // Initialize the pointers - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; // Close any existing file @@ -96,7 +96,7 @@ void InsituNcFile::close() if (_ncFile) { delete _ncFile; - _ncFile = (NcFile *)0; + _ncFile = (NcFile *) nullptr; } // Reclaim the space used for the variables @@ -144,7 +144,7 @@ bool InsituNcFile::open(const char * filename) if (_ncFile) // close() is called already { delete _ncFile; - _ncFile = (NcFile *)0; + _ncFile = (NcFile *) nullptr; } return false; } diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 0389f8e883..4a962f9e68 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -83,7 +83,7 @@ bool MetNcFile::readFile(const int desired_grib_code, << _filePath << "\n\n"; //_ncFile->close(); delete _ncFile; - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; return false; } @@ -177,7 +177,7 @@ bool MetNcFile::readFile(const int desired_grib_code, char hdr_typ_str_full[hdr_buf_size][typ_len]; char hdr_sid_str_full[hdr_buf_size][sid_len]; char hdr_vld_str_full[hdr_buf_size][vld_len]; - //float **hdr_arr_full = (float **) 0, **obs_arr_block = (float **) 0; + //float **hdr_arr_full = (float **) nullptr, **obs_arr_block = (float **) nullptr; float hdr_arr_full[hdr_buf_size][hdr_arr_len]; float obs_arr_block[ buf_size][obs_arr_len]; @@ -327,8 +327,8 @@ bool MetNcFile::readFile(const int desired_grib_code, } // Cleanup - if (obs_arr) { delete [] obs_arr; obs_arr = (float *) 0; } - if (hdr_arr) { delete [] hdr_arr; hdr_arr = (float *) 0; } + if (obs_arr) { delete [] obs_arr; obs_arr = (float *) nullptr; } + if (hdr_arr) { delete [] hdr_arr; hdr_arr = (float *) nullptr; } return true; } diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index ab05cb7698..cfbf1378a2 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -243,7 +243,7 @@ bool parse_line(const char * line) int n, k; char line2[1024]; char * s = line2; -char * c = (char *) 0; +char * c = (char *) nullptr; const char *method_name = "parse_line() -> "; m_strncpy(line2, line, sizeof(line2), method_name); @@ -260,7 +260,7 @@ if ( ! strchr(line, '\"') ) return ( false ); c = strtok(s, " /*"); -s = (char *) 0; +s = (char *) nullptr; if ( !c ) return ( false ); diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 6c2a686abd..6e2521f0c8 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -194,7 +194,7 @@ bool FileHandler::summarizeObs(const TimeSummaryInfo &summary_info) void FileHandler::_closeNetcdf() { delete _ncFile; - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index dd6d003289..ea51bc749b 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -121,7 +121,7 @@ void process_command_line(int argc, char **argv) { int i; CommandLine cline; ConcatString default_config_file; - Met2dDataFile *ens_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *ens_mtddf = (Met2dDataFile *) nullptr; // // Check for zero arguments @@ -250,7 +250,7 @@ void process_command_line(int argc, char **argv) { } // Deallocate memory for data files - if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) 0; } + if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) nullptr; } return; } @@ -626,7 +626,7 @@ void get_ens_mean_stdev(GenEnsProdVarInfo *ens_info, bool get_data_plane(const char *infile, GrdFileType ftype, VarInfo *info, DataPlane &dp) { bool found; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Read the current ensemble file if(!(mtddf = mtddf_factory.new_met_2d_data_file(infile, ftype))) { @@ -668,7 +668,7 @@ bool get_data_plane(const char *infile, GrdFileType ftype, } // end if found // Deallocate the data file pointer, if necessary - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(found); } @@ -1049,14 +1049,14 @@ void write_ens_nc(GenEnsProdVarInfo *ens_info, int n_ens_vld, } // Deallocate and clean up - if(ens_mean) { delete [] ens_mean; ens_mean = (float *) 0; } - if(ens_stdev) { delete [] ens_stdev; ens_stdev = (float *) 0; } - if(ens_minus) { delete [] ens_minus; ens_minus = (float *) 0; } - if(ens_plus) { delete [] ens_plus; ens_plus = (float *) 0; } - if(ens_min) { delete [] ens_min; ens_min = (float *) 0; } - if(ens_max) { delete [] ens_max; ens_max = (float *) 0; } - if(ens_range) { delete [] ens_range; ens_range = (float *) 0; } - if(ens_vld) { delete [] ens_vld; ens_vld = (int *) 0; } + if(ens_mean) { delete [] ens_mean; ens_mean = (float *) nullptr; } + if(ens_stdev) { delete [] ens_stdev; ens_stdev = (float *) nullptr; } + if(ens_minus) { delete [] ens_minus; ens_minus = (float *) nullptr; } + if(ens_plus) { delete [] ens_plus; ens_plus = (float *) nullptr; } + if(ens_min) { delete [] ens_min; ens_min = (float *) nullptr; } + if(ens_max) { delete [] ens_max; ens_max = (float *) nullptr; } + if(ens_range) { delete [] ens_range; ens_range = (float *) nullptr; } + if(ens_vld) { delete [] ens_vld; ens_vld = (int *) nullptr; } return; } @@ -1179,7 +1179,7 @@ void write_ens_data_plane(GenEnsProdVarInfo *ens_info, const DataPlane &ens_dp, write_ens_var_float(ens_info, ens_data, dp, type_str, long_name_str); // Cleanup - if(ens_data) { delete [] ens_data; ens_data = (float *) 0; } + if(ens_data) { delete [] ens_data; ens_data = (float *) nullptr; } return; } @@ -1226,7 +1226,7 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; // Close the output NetCDF file - if(nc_out) { delete nc_out; nc_out = (NcFile *) 0; } + if(nc_out) { delete nc_out; nc_out = (NcFile *) nullptr; } // Deallocate threshold count arrays if(thresh_cnt_na) { @@ -1234,7 +1234,7 @@ void clean_up() { thresh_cnt_na[i].clear(); } delete [] thresh_cnt_na; - thresh_cnt_na = (NumArray *) 0; + thresh_cnt_na = (NumArray *) nullptr; } if(thresh_nbrhd_cnt_na) { for(i=0; i " @@ -452,7 +452,7 @@ void get_data_plane(const ConcatString &file_name, // Allocate new VarInfo object VarInfoFactory vi_factory; - VarInfo *vi_ptr = (VarInfo *) 0; + VarInfo *vi_ptr = (VarInfo *) nullptr; vi_ptr = vi_factory.new_var_info(mtddf_ptr->file_type()); if(!vi_ptr) { mlog << Error << "\nget_data_plane() -> " @@ -480,7 +480,7 @@ void get_data_plane(const ConcatString &file_name, << dmin << " to " << dmax << ".\n"; // Clean up - if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) 0; } + if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) nullptr; } } // end if @@ -488,7 +488,7 @@ void get_data_plane(const ConcatString &file_name, dp_grid = mtddf_ptr->grid(); // Clean up - if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile *) 0; } + if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile *) nullptr; } return; } @@ -1395,8 +1395,8 @@ void write_netcdf(const DataPlane &dp) { int n, x, y; ConcatString cs; - float *mask_data = (float *) 0; - NcFile *f_out = (NcFile *) 0; + float *mask_data = (float *) nullptr; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim; NcDim lon_dim; NcVar mask_var; @@ -1409,7 +1409,7 @@ void write_netcdf(const DataPlane &dp) { << "trouble opening output file " << out_filename << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -1474,15 +1474,15 @@ void write_netcdf(const DataPlane &dp) { mlog << Error << "\nwrite_netcdf() -> " << "error with mask_var->put\n\n"; // Delete allocated memory - if(mask_data) { delete[] mask_data; mask_data = (float *) 0; } + if(mask_data) { delete[] mask_data; mask_data = (float *) nullptr; } exit(1); } // Delete allocated memory - if(mask_data) { delete[] mask_data; mask_data = (float *) 0; } + if(mask_data) { delete[] mask_data; mask_data = (float *) nullptr; } delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; mlog << Debug(1) << "Output File:\t\t" << out_filename << "\n"; @@ -1525,7 +1525,7 @@ MaskType string_to_masktype(const char *s) { //////////////////////////////////////////////////////////////////////// const char * masktype_to_string(const MaskType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case MaskType_Poly: s = "poly"; break; @@ -1541,7 +1541,7 @@ const char * masktype_to_string(const MaskType t) { case MaskType_Lon: s = "lon"; break; case MaskType_Shape: s = "shape"; break; case MaskType_None: s = na_str; break; - default: s = (const char *) 0; break; + default: s = (const char *) nullptr; break; } return(s); diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index 4a54b42ee2..a8c603fab4 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -207,7 +207,7 @@ void process_command_line(int argc, char **argv) { // Deallocate memory for data files if(data_mtddf) { delete data_mtddf; - data_mtddf = (Met2dDataFile *) 0; + data_mtddf = (Met2dDataFile *) nullptr; } } // end for i @@ -748,8 +748,8 @@ void write_joint_histograms(void) { Met2dDataFile *get_mtddf(const StringArray &file_list, const int i_field) { - Met2dDataFile *mtddf = (Met2dDataFile *) 0; - Dictionary *dict = (Dictionary *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_dict; GrdFileType file_type; int i; @@ -798,7 +798,7 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } return; diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 06f1c50895..5f661bdb22 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -85,7 +85,7 @@ static GridDiagConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; vector data_var_dims; vector hist_vars; vector joint_hist_vars; @@ -107,7 +107,7 @@ static Grid grid; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *data_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *data_mtddf = (Met2dDataFile *) nullptr; // Variable min/max values vector var_mins; diff --git a/src/tools/other/grid_diag/grid_diag_conf_info.cc b/src/tools/other/grid_diag/grid_diag_conf_info.cc index b463db9081..d0d60908f0 100644 --- a/src/tools/other/grid_diag/grid_diag_conf_info.cc +++ b/src/tools/other/grid_diag/grid_diag_conf_info.cc @@ -44,7 +44,7 @@ GridDiagConfInfo::~GridDiagConfInfo() { void GridDiagConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo **) 0; + data_info = (VarInfo **) nullptr; clear(); @@ -69,10 +69,10 @@ void GridDiagConfInfo::clear() { for(int i=0; i file_types) { ConcatString s; StringArray sa; VarInfoFactory info_factory; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_dict; GrdFileType file_type; @@ -143,7 +143,7 @@ void GridDiagConfInfo::process_config(vector file_types) { data_info = new VarInfo * [n_data]; // Initialize pointers - for(int i=0; i " << "trouble opening output file: " << ncfile << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index a513946260..ab108d497c 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -132,7 +132,7 @@ static int rej_sid = 0; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -NcFile *f_out = (NcFile *) 0; +NcFile *f_out = (NcFile *) nullptr; int processed_count; @@ -142,7 +142,7 @@ static Madis2NcConfInfo conf_info; static bool do_summary; static bool save_summary_only = false; -static SummaryObs *summary_obs = 0; +static SummaryObs *summary_obs = nullptr; #endif // __MADIS2NC_H__ diff --git a/src/tools/other/mode_graphics/cgraph_font.cc b/src/tools/other/mode_graphics/cgraph_font.cc index 451b6f9c90..e3ed2db3b2 100644 --- a/src/tools/other/mode_graphics/cgraph_font.cc +++ b/src/tools/other/mode_graphics/cgraph_font.cc @@ -108,7 +108,7 @@ void CgFont::init_from_scratch() { -afm = (Afm *) 0; +afm = (Afm *) nullptr; face = 0; @@ -147,7 +147,7 @@ ps_name.clear(); orig_ps_size = scaled_ps_size = 0.0; -if ( afm ) { delete afm; afm = (Afm *) 0; } +if ( afm ) { delete afm; afm = (Afm *) nullptr; } ps_font_number = -1; diff --git a/src/tools/other/mode_graphics/cgraph_main.cc b/src/tools/other/mode_graphics/cgraph_main.cc index baa2b3be01..2c85c7525e 100644 --- a/src/tools/other/mode_graphics/cgraph_main.cc +++ b/src/tools/other/mode_graphics/cgraph_main.cc @@ -167,15 +167,15 @@ void CgraphBase::cgraph_init_from_scratch() { -Surface = (cairo_surface_t *) 0; +Surface = (cairo_surface_t *) nullptr; -Cr = (cairo_t *) 0; +Cr = (cairo_t *) nullptr; Ptype = no_cgraph_plot_type; Filename.clear(); -Library = (FT_Library) 0; +Library = (FT_Library) nullptr; CurrentFont = 0; @@ -205,11 +205,11 @@ void CgraphBase::close() { -if ( Cr ) { cairo_destroy (Cr); Cr = (cairo_t *) 0; } +if ( Cr ) { cairo_destroy (Cr); Cr = (cairo_t *) nullptr; } if ( Ptype != no_cgraph_plot_type ) write(); -if ( Surface ) { cairo_surface_destroy (Surface); Surface = (cairo_surface_t *) 0; } +if ( Surface ) { cairo_surface_destroy (Surface); Surface = (cairo_surface_t *) nullptr; } Ptype = no_cgraph_plot_type; @@ -220,7 +220,7 @@ DoLigatures = true; Fonts.clear(); -if ( Library ) { FT_Done_FreeType(Library); Library = (FT_Library) 0; } +if ( Library ) { FT_Done_FreeType(Library); Library = (FT_Library) nullptr; } Family = default_font_family; @@ -794,7 +794,7 @@ double x_page, y_page; double x_char_origin; FT_Face face = CurrentFont->face; // this should be nonzero FT_UInt previous; -FT_Glyph_Metrics * metrics = (FT_Glyph_Metrics *) 0; +FT_Glyph_Metrics * metrics = (FT_Glyph_Metrics *) nullptr; FT_Vector k_delta; const bool use_kerning = DoKerning && FT_HAS_KERNING(face); const char * new_string = (const char *) nullptr; @@ -1036,7 +1036,7 @@ if ( render_flag ) { // if ( DoLigatures ) delete [] new_string; -new_string = (char *) 0; +new_string = (char *) nullptr; return; @@ -1126,8 +1126,8 @@ void CgraphBase::import_image(const Ppm & ppm, double x, double y, double u, dou { double x_ll, y_ll; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; gsave(); @@ -1155,7 +1155,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); @@ -1175,9 +1175,9 @@ int R, G, B, alpha; int row, col, n; int bytes_per_row; int error; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; -unsigned char * d = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; +unsigned char * d = (unsigned char *) nullptr; const Color cc = current_color(); const int IR = (int) (cc.red()); const int IG = (int) (cc.green()); @@ -1262,7 +1262,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); @@ -1788,8 +1788,8 @@ void Cgraph::import_image(const Ppm & ppm, double x, double y, double u, double { double x_ll, y_ul, y_ll; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; const double scaled_nx = x_scale*(ppm.nx()); const double scaled_ny = y_scale*(ppm.ny()); @@ -1827,7 +1827,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); diff --git a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc index 313b169ca4..15b2cb6aa1 100644 --- a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc +++ b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc @@ -39,7 +39,7 @@ ConcatString cgraphbase_plottype_to_string(const CgraphBase::PlotType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/tools/other/mode_graphics/color_stack.cc b/src/tools/other/mode_graphics/color_stack.cc index fb9d750364..8d53f2d0c8 100644 --- a/src/tools/other/mode_graphics/color_stack.cc +++ b/src/tools/other/mode_graphics/color_stack.cc @@ -93,7 +93,7 @@ void ColorStack::init_from_scratch() { -e = (Color **) 0; +e = (Color **) nullptr; AllocInc = 10; // default value @@ -117,11 +117,11 @@ if ( e ) { for (j=0; j 0 ) { - delete [] ObjVolume; ObjVolume = (int *) 0; + delete [] ObjVolume; ObjVolume = (int *) nullptr; ObjVolume = new_volumes; @@ -1442,7 +1442,7 @@ if ( n_new > 0 ) { // done // -if ( old_to_new ) { delete [] old_to_new; old_to_new = (int *) 0; } +if ( old_to_new ) { delete [] old_to_new; old_to_new = (int *) nullptr; } return; @@ -1616,7 +1616,7 @@ void MtdIntFile::set_volumes(int n, const int * V) { -if ( ObjVolume ) { delete [] ObjVolume; ObjVolume = (int *) 0; } +if ( ObjVolume ) { delete [] ObjVolume; ObjVolume = (int *) nullptr; } int j; diff --git a/src/tools/other/mode_time_domain/mtd_partition.cc b/src/tools/other/mode_time_domain/mtd_partition.cc index 57db83dde7..4e3d34d4a2 100644 --- a/src/tools/other/mode_time_domain/mtd_partition.cc +++ b/src/tools/other/mode_time_domain/mtd_partition.cc @@ -110,7 +110,7 @@ void EquivalenceClass::init_from_scratch() { -E = (int *) 0; +E = (int *) nullptr; clear(); @@ -126,7 +126,7 @@ void EquivalenceClass::clear() { -if ( E ) { delete [] E; E = (int *) 0; } +if ( E ) { delete [] E; E = (int *) nullptr; } Nelements = Nalloc = 0; @@ -182,11 +182,11 @@ if ( E ) { memcpy(u, E, Nelements*sizeof(int)); - delete [] E; E = (int *) 0; + delete [] E; E = (int *) nullptr; } -E = u; u = (int *) 0; +E = u; u = (int *) nullptr; Nalloc = n; @@ -393,7 +393,7 @@ void Mtd_Partition::init_from_scratch() { -C = (EquivalenceClass **) 0; +C = (EquivalenceClass **) nullptr; clear(); @@ -415,11 +415,11 @@ if ( C ) { for (j=0; j can't get attribute names\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } if ( retval == 0 ) { - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } return; } parse_csl(att_buf, a); @@ -1331,7 +1331,7 @@ for (j=0; j can't get info on attribute \"" << (a[j]) << "\"\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } @@ -1345,7 +1345,7 @@ for (j=0; j can't get value for attribute \"" << (a[j]) << "\"\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } @@ -1360,7 +1360,7 @@ for (j=0; j " << "trouble opening output file " << out_filename << "\n\n"; - delete f_out; f_out = (NcFile *) 0; + delete f_out; f_out = (NcFile *) nullptr; exit(1); } @@ -127,7 +127,7 @@ void write_grid_to_netcdf(const DataPlane & plane, const Grid & grid, const char // Close and clean up delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; return; } diff --git a/src/tools/other/modis_regrid/modis_file.cc b/src/tools/other/modis_regrid/modis_file.cc index c712f2330f..e478a867e1 100644 --- a/src/tools/other/modis_regrid/modis_file.cc +++ b/src/tools/other/modis_regrid/modis_file.cc @@ -557,7 +557,7 @@ FileId = -1; Filename.clear(); -if ( Swath ) { delete Swath; Swath = (CloudsatSwath *) 0; } +if ( Swath ) { delete Swath; Swath = (CloudsatSwath *) nullptr; } Latitude = 0; diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 788898b60f..d98f42ef1b 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -270,7 +270,7 @@ void get_grid() // stole this code from plot_data_plane.cc // -Met2dDataFile * met_ptr = (Met2dDataFile * ) 0; +Met2dDataFile * met_ptr = (Met2dDataFile * ) nullptr; Met2dDataFileFactory m_factory; mlog << Debug(1) << "Opening data file: " << grid_data_file << "\n"; @@ -289,7 +289,7 @@ grid = met_ptr->grid(); // done // -delete met_ptr; met_ptr = (Met2dDataFile *) 0; +delete met_ptr; met_ptr = (Met2dDataFile *) nullptr; return; diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 2922c23d0a..1eededdeef 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -2617,7 +2617,7 @@ void clean_up() { if(f_out) { delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; } return; @@ -3003,7 +3003,7 @@ int combine_tqz_and_uv(map pqtzuv_map_tq, // Select first record by 1) merging two records with the same pressure // level or 2) interpolate int tq_pres, uv_pres; - next_pqtzuv = (float *)0; + next_pqtzuv = (float *)nullptr; it_tq = pqtzuv_map_tq.begin(); it_uv = pqtzuv_map_uv.begin(); pqtzuv_tq = (float *)it_tq->second; diff --git a/src/tools/other/pb2nc/pb2nc_conf_info.cc b/src/tools/other/pb2nc/pb2nc_conf_info.cc index 69af15a22d..81aba47688 100644 --- a/src/tools/other/pb2nc/pb2nc_conf_info.cc +++ b/src/tools/other/pb2nc/pb2nc_conf_info.cc @@ -144,7 +144,7 @@ void PB2NCConfInfo::process_config() { ConcatString s, mask_name; StringArray sa; StringArray * sid_list = 0; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Dump the contents of the config file if(mlog.verbosity_level() >= 5) conf.dump(cout); @@ -268,7 +268,7 @@ void PB2NCConfInfo::process_config() { obs_bufr_map = parse_conf_obs_bufr_map(&conf); message_type_map = parse_conf_message_type_map(&conf); - if ( sid_list ) { delete [] sid_list; sid_list = (StringArray *) 0; } + if ( sid_list ) { delete [] sid_list; sid_list = (StringArray *) nullptr; } return; } diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc index 04b798e71a..78e998fafa 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc @@ -350,7 +350,7 @@ PlotPointObsConfInfo::~PlotPointObsConfInfo() { void PlotPointObsConfInfo::init_from_scratch() { // Initialize pointers - grid_data_info = (VarInfo *) 0; + grid_data_info = (VarInfo *) nullptr; clear(); @@ -405,12 +405,12 @@ void PlotPointObsConfInfo::read_config(const char *user_file_name) { void PlotPointObsConfInfo::process_config( const char *plot_grid_string) { - Dictionary *dict = (Dictionary *) 0; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; + Dictionary *fdict = (Dictionary *) nullptr; Dictionary i_fdict; StringArray sa; Met2dDataFileFactory m_factory; - Met2dDataFile *met_ptr = (Met2dDataFile *) 0; + Met2dDataFile *met_ptr = (Met2dDataFile *) nullptr; PlotPointObsOpt opt; int i, n_vx; diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 2737e125c9..e6b8718c2b 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -120,7 +120,7 @@ static bool do_gaussian_filter = false; static SingleThresh prob_cat_thresh; // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim ; static NcDim lon_dim ; @@ -338,7 +338,7 @@ void process_command_line(int argc, char **argv) { else var_names.add(vname); } // Clean up - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } } // Check that the number of output names and fields match else if(VarNameSA.n() != FieldSA.n()) { @@ -367,7 +367,7 @@ void process_data_file() { Grid fr_grid, to_grid; GrdFileType ftype; ConcatString run_cs; - NcFile *nc_in = (NcFile *)0; + NcFile *nc_in = (NcFile *) nullptr; static const char *method_name = "process_data_file() -> "; // Initialize configuration object @@ -387,7 +387,7 @@ void process_data_file() { bool use_python = false; int obs_type; Met2dDataFileFactory m_factory; - Met2dDataFile *fr_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *fr_mtddf = (Met2dDataFile *) nullptr; #ifdef WITH_PYTHON string python_command = InputFilename; bool use_xarray = (0 == python_command.find(conf_val_python_xarray)); @@ -496,8 +496,8 @@ void process_data_file() { // Clean up if(nc_in) { delete nc_in; nc_in = 0; } - if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } return; } @@ -745,7 +745,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI // Loop through the requested fields int obs_count_zero_to, obs_count_non_zero_to; int obs_count_zero_from, obs_count_non_zero_from; - IntArray *cellMapping = (IntArray *)0; + IntArray *cellMapping = (IntArray *) nullptr; obs_count_zero_to = obs_count_non_zero_to = 0; obs_count_zero_from = obs_count_non_zero_from = 0; @@ -1130,7 +1130,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI } // end for i if (cellMapping) { - delete [] cellMapping; cellMapping = (IntArray *)0; + delete [] cellMapping; cellMapping = (IntArray *) nullptr; } } @@ -1387,7 +1387,7 @@ void process_point_nccf_file(NcFile *nc_in, MetConfig &config, } // end for i delete [] cellMapping; - cellMapping = (IntArray *)0; + cellMapping = (IntArray *) nullptr; if( 0 < filtered_by_time ) { mlog << Debug(2) << method_name << "Filtered by time: " << filtered_by_time << " out of " << from_size @@ -1594,7 +1594,7 @@ void write_nc_data(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -1624,7 +1624,7 @@ void write_nc_data_int(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (int *) 0; } + if(data) { delete [] data; data = (int *) nullptr; } return; } @@ -1687,7 +1687,7 @@ void process_goes_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo, int global_attr_count; bool opt_all_attrs = false; clock_t start_clock = clock(); - NcFile *nc_adp = (NcFile *)0; + NcFile *nc_adp = (NcFile *) nullptr; static const char *method_name = "process_goes_file() -> "; ConcatString tmp_dir = config.get_tmp_dir(); @@ -1816,7 +1816,7 @@ void process_goes_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo, //copy_nc_atts(_nc_in, nc_out, opt_all_attrs); delete nc_adp; nc_adp = 0; - delete [] cellMapping; cellMapping = (IntArray *)0; + delete [] cellMapping; cellMapping = (IntArray *) nullptr; mlog << Debug(LEVEL_FOR_PERFORMANCE) << method_name << "took " << (clock()-start_clock)/double(CLOCKS_PER_SEC) << " seconds\n"; @@ -2184,7 +2184,7 @@ void get_grid_mapping(Grid fr_grid, Grid to_grid, IntArray *cellMapping, } // Override the from nx & ny from NetCDF if exists - NcFile *coord_nc_in = (NcFile *)0; + NcFile *coord_nc_in = (NcFile *) nullptr; if (has_coord_input) { mlog << Debug(2) << method_name << "Reading coord file: " << cur_coord_name << "\n"; coord_nc_in = open_ncfile(cur_coord_name.c_str()); @@ -2720,7 +2720,7 @@ void close_nc() { // Clean up if(nc_out) { - delete nc_out; nc_out = (NcFile *) 0; + delete nc_out; nc_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/point2grid/point2grid_conf_info.cc b/src/tools/other/point2grid/point2grid_conf_info.cc index 84cfec4a12..e9fa0e0392 100644 --- a/src/tools/other/point2grid/point2grid_conf_info.cc +++ b/src/tools/other/point2grid/point2grid_conf_info.cc @@ -83,7 +83,7 @@ void PointToGridConfInfo::read_config(const char *default_file_name, void PointToGridConfInfo::process_config() { ConcatString s; StringArray sa; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Dump the contents of the config file if(mlog.verbosity_level() >= 5) conf.dump(cout); diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 309aaf3d6a..dd9b85bb0b 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -78,7 +78,7 @@ static StringArray VarNameSA; static int compress_level = -1; // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim ; static NcDim lon_dim ; @@ -219,7 +219,7 @@ void process_data_file() { //Variables for GOES unixtime valid_time = 0; bool opt_all_attrs = false; - NcFile *nc_in = (NcFile *)0; + NcFile *nc_in = (NcFile *) nullptr; static const char *method_name = "process_data_file() "; // Initialize configuration object @@ -235,7 +235,7 @@ void process_data_file() { // Read the input data file Met2dDataFileFactory m_factory; - Met2dDataFile *fr_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *fr_mtddf = (Met2dDataFile *) nullptr; // Determine the "from" grid mlog << Debug(1) << "Reading data file: " << InputFilename << "\n"; @@ -348,8 +348,8 @@ void process_data_file() { delete nc_in; nc_in = 0; // Clean up - if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } return; } @@ -408,7 +408,7 @@ void write_nc_data(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -439,7 +439,7 @@ void close_nc() { // Clean up if(nc_out) { - delete nc_out; nc_out = (NcFile *) 0; + delete nc_out; nc_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 411f5dd10f..e14fff46fd 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -185,7 +185,7 @@ void process_data_file() { // Read the input data file Met2dDataFileFactory m_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; mlog << Debug(1) << "Reading input file: " << InputFilename << "\n"; mtddf = m_factory.new_met_2d_data_file(InputFilename.c_str(), ftype); @@ -271,8 +271,8 @@ void process_data_file() { write_netcdf(dp_shift, grid, vinfo, mtddf->file_type()); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } #ifdef WITH_PYTHON GP.finalize(); @@ -352,9 +352,9 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } if(f_out) { - delete f_out; f_out = (NcFile *) 0; + delete f_out; f_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/wwmca_tool/af_cp_file.cc b/src/tools/other/wwmca_tool/af_cp_file.cc index 70acdb4941..969e4d2238 100644 --- a/src/tools/other/wwmca_tool/af_cp_file.cc +++ b/src/tools/other/wwmca_tool/af_cp_file.cc @@ -109,7 +109,7 @@ void AFCloudPctFile::init_from_scratch() { -Buf = (unsigned char *) 0; +Buf = (unsigned char *) nullptr; clear(); @@ -125,7 +125,7 @@ void AFCloudPctFile::clear() { -if ( Buf ) { delete [] Buf; Buf = (unsigned char *) 0; } +if ( Buf ) { delete [] Buf; Buf = (unsigned char *) nullptr; } AFDataFile::clear(); diff --git a/src/tools/other/wwmca_tool/af_file.cc b/src/tools/other/wwmca_tool/af_file.cc index e0618a2b41..bcbce8a719 100644 --- a/src/tools/other/wwmca_tool/af_file.cc +++ b/src/tools/other/wwmca_tool/af_file.cc @@ -102,7 +102,7 @@ void AFDataFile::init_from_scratch() { -grid = (const Grid *) 0; +grid = (const Grid *) nullptr; clear(); @@ -118,7 +118,7 @@ void AFDataFile::clear() { -if ( grid ) { delete grid; grid = (const Grid *) 0; } +if ( grid ) { delete grid; grid = (const Grid *) nullptr; } Filename.clear(); diff --git a/src/tools/other/wwmca_tool/af_pt_file.cc b/src/tools/other/wwmca_tool/af_pt_file.cc index 4b875257d4..eebc9a9d5c 100644 --- a/src/tools/other/wwmca_tool/af_pt_file.cc +++ b/src/tools/other/wwmca_tool/af_pt_file.cc @@ -112,7 +112,7 @@ void AFPixelTimeFile::init_from_scratch() { -Buf = (unsigned char *) 0; +Buf = (unsigned char *) nullptr; clear(); @@ -128,7 +128,7 @@ void AFPixelTimeFile::clear() { -if ( Buf ) { delete [] Buf; Buf = (unsigned char *) 0; } +if ( Buf ) { delete [] Buf; Buf = (unsigned char *) nullptr; } AFDataFile::clear(); diff --git a/src/tools/other/wwmca_tool/ave_interp.cc b/src/tools/other/wwmca_tool/ave_interp.cc index a9a2cbcf32..e0b27b9834 100644 --- a/src/tools/other/wwmca_tool/ave_interp.cc +++ b/src/tools/other/wwmca_tool/ave_interp.cc @@ -135,7 +135,7 @@ Interpolator * Ave_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Ave_Interp (*this); diff --git a/src/tools/other/wwmca_tool/interp_base.cc b/src/tools/other/wwmca_tool/interp_base.cc index 0b7dd9f182..cd41a5f94e 100644 --- a/src/tools/other/wwmca_tool/interp_base.cc +++ b/src/tools/other/wwmca_tool/interp_base.cc @@ -203,7 +203,7 @@ void Interpolator::init_from_scratch() { -Data = (InterpolationValue *) 0; +Data = (InterpolationValue *) nullptr; clear(); @@ -219,7 +219,7 @@ void Interpolator::clear() { -if ( Data ) { delete [] Data; Data = (InterpolationValue *) 0; } +if ( Data ) { delete [] Data; Data = (InterpolationValue *) nullptr; } Width = 0; diff --git a/src/tools/other/wwmca_tool/max_interp.cc b/src/tools/other/wwmca_tool/max_interp.cc index 42a1fe322c..2531579e27 100644 --- a/src/tools/other/wwmca_tool/max_interp.cc +++ b/src/tools/other/wwmca_tool/max_interp.cc @@ -135,7 +135,7 @@ Interpolator * Max_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Max_Interp (*this); diff --git a/src/tools/other/wwmca_tool/min_interp.cc b/src/tools/other/wwmca_tool/min_interp.cc index 536aa90211..c82811fae2 100644 --- a/src/tools/other/wwmca_tool/min_interp.cc +++ b/src/tools/other/wwmca_tool/min_interp.cc @@ -136,7 +136,7 @@ Interpolator * Min_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Min_Interp (*this); diff --git a/src/tools/other/wwmca_tool/nc_output.cc b/src/tools/other/wwmca_tool/nc_output.cc index 7e68c7ab11..808c974b48 100644 --- a/src/tools/other/wwmca_tool/nc_output.cc +++ b/src/tools/other/wwmca_tool/nc_output.cc @@ -47,7 +47,7 @@ void WwmcaRegridder::do_output(const char * output_filename) { - NcFile * ncfile = (NcFile *) 0; + NcFile * ncfile = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; NcVar data_var ; @@ -233,7 +233,7 @@ void WwmcaRegridder::do_output(const char * output_filename) // done // - if ( ncfile ) { delete ncfile; ncfile = (NcFile *) 0; } + if ( ncfile ) { delete ncfile; ncfile = (NcFile *) nullptr; } // // list output file name diff --git a/src/tools/other/wwmca_tool/nearest_interp.cc b/src/tools/other/wwmca_tool/nearest_interp.cc index 2951fdd635..6192a2145a 100644 --- a/src/tools/other/wwmca_tool/nearest_interp.cc +++ b/src/tools/other/wwmca_tool/nearest_interp.cc @@ -135,7 +135,7 @@ Interpolator * Nearest_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Nearest_Interp (*this); diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index b960362156..a0a0141213 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -68,7 +68,7 @@ static CommandLine cline; static const Grid nh(wwmca_north_data); static const Grid sh(wwmca_south_data); -static const Grid * grid = (const Grid *) 0; +static const Grid * grid = (const Grid *) nullptr; static int Nx, Ny; @@ -243,7 +243,7 @@ AFCloudPctFile f_cp; AFPixelTimeFile f_pt; ConcatString short_name; ConcatString output_filename; -char * pt_filename = (char *) 0; +char * pt_filename = (char *) nullptr; Pgm image; RenderInfo info; PSfile plot; @@ -280,7 +280,7 @@ if ( !(f_pt.read(pt_filename, bad_data_char)) ) { } -if (pt_filename) { delete [] pt_filename; pt_filename = (char *) 0; } +if (pt_filename) { delete [] pt_filename; pt_filename = (char *) nullptr; } if ( output_directory.length() > 0 ) output_filename << output_directory << '/'; diff --git a/src/tools/other/wwmca_tool/wwmca_ref.cc b/src/tools/other/wwmca_tool/wwmca_ref.cc index ff66c54268..4937a18290 100644 --- a/src/tools/other/wwmca_tool/wwmca_ref.cc +++ b/src/tools/other/wwmca_tool/wwmca_ref.cc @@ -62,8 +62,8 @@ WwmcaRegridder::~WwmcaRegridder() clear(); -if ( NHgrid ) { delete NHgrid; NHgrid = (const Grid *) 0; } -if ( SHgrid ) { delete SHgrid; SHgrid = (const Grid *) 0; } +if ( NHgrid ) { delete NHgrid; NHgrid = (const Grid *) nullptr; } +if ( SHgrid ) { delete SHgrid; SHgrid = (const Grid *) nullptr; } } @@ -78,15 +78,15 @@ void WwmcaRegridder::init_from_scratch() NHgrid = new Grid (wwmca_north_data); SHgrid = new Grid (wwmca_south_data); -cp_nh = (const AFCloudPctFile *) 0; -cp_sh = (const AFCloudPctFile *) 0; +cp_nh = (const AFCloudPctFile *) nullptr; +cp_sh = (const AFCloudPctFile *) nullptr; -pt_nh = (const AFPixelTimeFile *) 0; -pt_sh = (const AFPixelTimeFile *) 0; +pt_nh = (const AFPixelTimeFile *) nullptr; +pt_sh = (const AFPixelTimeFile *) nullptr; -ToGrid = (const Grid *) 0; +ToGrid = (const Grid *) nullptr; -Config = (MetConfig *) 0; +Config = (MetConfig *) nullptr; interp_func = 0; @@ -106,19 +106,19 @@ void WwmcaRegridder::clear() { -if ( cp_nh ) { delete cp_nh; cp_nh = (const AFCloudPctFile *) 0; } -if ( cp_sh ) { delete cp_sh; cp_sh = (const AFCloudPctFile *) 0; } +if ( cp_nh ) { delete cp_nh; cp_nh = (const AFCloudPctFile *) nullptr; } +if ( cp_sh ) { delete cp_sh; cp_sh = (const AFCloudPctFile *) nullptr; } -if ( pt_nh ) { delete pt_nh; pt_nh = (const AFPixelTimeFile *) 0; } -if ( pt_sh ) { delete pt_sh; pt_sh = (const AFPixelTimeFile *) 0; } +if ( pt_nh ) { delete pt_nh; pt_nh = (const AFPixelTimeFile *) nullptr; } +if ( pt_sh ) { delete pt_sh; pt_sh = (const AFPixelTimeFile *) nullptr; } -if ( ToGrid ) { delete ToGrid; ToGrid = (const Grid *) 0; } +if ( ToGrid ) { delete ToGrid; ToGrid = (const Grid *) nullptr; } Hemi = no_hemisphere; grid_strings.clear(); -Config = (MetConfig *) 0; +Config = (MetConfig *) nullptr; ConfigFilename.clear(); @@ -230,7 +230,7 @@ if ( !(f->read(filename, 'N')) ) { } -cp_nh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) 0; +cp_nh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) nullptr; return; @@ -255,7 +255,7 @@ if ( !(f->read(filename, 'S')) ) { } -cp_sh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) 0; +cp_sh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) nullptr; return; @@ -282,7 +282,7 @@ if ( !(f->read(filename, 'N')) ) { f->set_swap_endian(swap); -pt_nh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) 0; +pt_nh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) nullptr; return; @@ -309,7 +309,7 @@ if ( !(f->read(filename, 'S')) ) { f->set_swap_endian(swap); -pt_sh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) 0; +pt_sh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) nullptr; return; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index f5d5474610..87a9baf100 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -81,8 +81,8 @@ static ConcatString out_dir; ConcatString out_file; // NetCDF file information -static netCDF::NcFile* nc_in = (netCDF::NcFile*) 0; -static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_in = (netCDF::NcFile*) nullptr; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) nullptr; // Grid dimension information static netCDF::NcDim range_dim; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index 6862e56cae..9104c30279 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -46,7 +46,7 @@ RMWAnalysisConfInfo::~RMWAnalysisConfInfo() { void RMWAnalysisConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; clear(); @@ -80,11 +80,11 @@ void RMWAnalysisConfInfo::clear() { if(data_info) { for(int i = 0; i < n_data; i++) { if(data_info[i]) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } } delete data_info; - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; } // Reset field count @@ -115,7 +115,7 @@ void RMWAnalysisConfInfo::read_config(const char* default_file_name, void RMWAnalysisConfInfo::process_config() { VarInfoFactory info_factory; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; ConcatString poly_file; GrdFileType ftype = FileType_NcCF; @@ -184,7 +184,7 @@ void RMWAnalysisConfInfo::process_config() { // Initialize pointers for(int i = 0; i < n_data; i++) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } // Parse data field information diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 332587b9eb..f5d0c106fb 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -244,7 +244,7 @@ void process_command_line(int argc, char **argv) { void get_file_type() { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; int i; // Build one long list of input data files @@ -284,7 +284,7 @@ void get_file_type() { file_type = mtddf->file_type(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return; } @@ -973,7 +973,7 @@ void process_fields(const TrackInfoArray &tracks, int i, j, i_pnt; Grid grid_dp; VarInfoFactory vi_factory; - VarInfo *vi = (VarInfo *) 0; + VarInfo *vi = (VarInfo *) nullptr; vector vi_list; DataPlane dp; vector dp_list; @@ -1063,7 +1063,7 @@ void process_fields(const TrackInfoArray &tracks, // Deallocate memory if(vi_list[i]) { delete vi_list[i]; - vi_list[i] = (VarInfo *) 0; + vi_list[i] = (VarInfo *) nullptr; } } // end for i @@ -1188,7 +1188,7 @@ void process_out_files(const TrackInfoArray& tracks) { //////////////////////////////////////////////////////////////////////// void merge_tmp_files(const vector tmp_files) { - NcFile *nc_out = (NcFile *) 0; + NcFile *nc_out = (NcFile *) nullptr; // Loop over temp files for(int i_tmp=0; i_tmpclose(); delete nc_diag_out; - nc_diag_out = (NcFile *) 0; + nc_diag_out = (NcFile *) nullptr; } nc_diag_file.clear(); @@ -1418,7 +1418,7 @@ void OutFileInfo::clear() { // Close the output file cira_diag_out->close(); delete cira_diag_out; - cira_diag_out = (ofstream *) 0; + cira_diag_out = (ofstream *) nullptr; } cira_diag_file.clear(); @@ -1706,7 +1706,7 @@ void OutFileInfo::write_nc_diag() { } // Clean up - if(prs_data) { delete [] prs_data; prs_data = (float *) 0; } + if(prs_data) { delete [] prs_data; prs_data = (float *) nullptr; } return; } @@ -2085,9 +2085,9 @@ TmpFileInfo::~TmpFileInfo() { void TmpFileInfo::init_from_scratch() { // Initialize pointers - trk_ptr = (TrackInfo *) 0; - pnt_ptr = (TrackPoint *) 0; - tmp_out = (NcFile *) 0; + trk_ptr = (TrackInfo *) nullptr; + pnt_ptr = (TrackPoint *) nullptr; + tmp_out = (NcFile *) nullptr; clear(); @@ -2127,7 +2127,7 @@ void TmpFileInfo::close() { << tmp_file << "\n"; delete tmp_out; - tmp_out = (NcFile *) 0; + tmp_out = (NcFile *) nullptr; } return; @@ -2137,8 +2137,8 @@ void TmpFileInfo::close() { void TmpFileInfo::clear() { - trk_ptr = (TrackInfo *) 0; - pnt_ptr = (TrackPoint *) 0; + trk_ptr = (TrackInfo *) nullptr; + pnt_ptr = (TrackPoint *) nullptr; // Clear the diagnostics keys and maps diag_storm_keys.clear(); @@ -2167,7 +2167,7 @@ void TmpFileInfo::clear() { remove_temp_file(tmp_file); - tmp_out = (NcFile *) 0; + tmp_out = (NcFile *) nullptr; } tmp_file.clear(); @@ -2267,8 +2267,8 @@ void TmpFileInfo::setup_nc_file(const DomainInfo &di, write_tc_track_point(tmp_out, vld_dim, *pnt_ptr); // Clean up - if(lat_arr) { delete[] lat_arr; lat_arr = (double *) 0; } - if(lon_arr) { delete[] lon_arr; lon_arr = (double *) 0; } + if(lat_arr) { delete[] lat_arr; lat_arr = (double *) nullptr; } + if(lon_arr) { delete[] lon_arr; lon_arr = (double *) nullptr; } return; } diff --git a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc index 7684308b81..688308e356 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc @@ -81,7 +81,7 @@ void DomainInfo::clear() { data_files.clear(); domain.clear(); - data.name = (const char *) 0; + data.name = (const char *) nullptr; data.range_n = bad_data_int; data.azimuth_n = bad_data_int; data.range_max_km = bad_data_double; @@ -181,7 +181,7 @@ void TCDiagConfInfo::clear() { // Deallocate memory for(int i=0; i dmap) { int i, j; StringArray sa; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; VarInfoFactory vi_factory; // Conf: version @@ -368,7 +368,7 @@ void TCDiagConfInfo::process_config(GrdFileType file_type, //////////////////////////////////////////////////////////////////////// void TCDiagConfInfo::parse_domain_info(map dmap) { - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; int i, j; bool found; diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index dbdc7d976a..5a360479f4 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -201,13 +201,13 @@ void process_land_data() { void process_distances() { int n, x, y, c, npts, nlog, imin; double lat, lon; - float *dland = (float *) 0; + float *dland = (float *) nullptr; // Instantiate the grid Grid grid(GridData); // NetCDF variables - NcFile *f_out = (NcFile *) 0; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; NcVar dland_var ; @@ -220,7 +220,7 @@ void process_distances() { << "trouble opening output file " << out_filename << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -293,18 +293,18 @@ void process_distances() { // Write the computed distances to the output file mlog << Debug(3) << "Writing distance to land variable.\n"; if(!put_nc_data_with_dims(&dland_var, &dland[0], grid.ny(), grid.nx())) { - if(dland) { delete [] dland; dland = (float *) 0; } + if(dland) { delete [] dland; dland = (float *) nullptr; } mlog << Error << "\nprocess_distances() -> " << "error with dland_var->put\n\n"; exit(1); } // Delete allocated memory - if(dland) { delete [] dland; dland = (float *) 0; } + if(dland) { delete [] dland; dland = (float *) nullptr; } // Close the output NetCDF file delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; // List the output file mlog << Debug(1) diff --git a/src/tools/tc_utils/tc_dland/tc_poly.cc b/src/tools/tc_utils/tc_dland/tc_poly.cc index 9f3f892097..1eb7ac1a48 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.cc +++ b/src/tools/tc_utils/tc_dland/tc_poly.cc @@ -168,7 +168,7 @@ TCPolyArray & TCPolyArray::operator=(const TCPolyArray & a) { void TCPolyArray::init_from_scratch() { - Poly = (TCPoly *) 0; + Poly = (TCPoly *) nullptr; clear(); @@ -179,7 +179,7 @@ void TCPolyArray::init_from_scratch() { void TCPolyArray::clear() { - if(Poly) { delete [] Poly; Poly = (TCPoly *) 0; } + if(Poly) { delete [] Poly; Poly = (TCPoly *) nullptr; } NPolys = NAlloc = 0; @@ -222,7 +222,7 @@ void TCPolyArray::extend(int n, bool exact) { n = k*tc_poly_array_alloc_inc; } - TCPoly * p = (TCPoly *) 0; + TCPoly * p = (TCPoly *) nullptr; p = new TCPoly [n]; @@ -234,10 +234,10 @@ void TCPolyArray::extend(int n, bool exact) { if(Poly) { for(i=0; iclose(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } return; @@ -2174,7 +2174,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - ofstream *out = (ofstream *) 0; + ofstream *out = (ofstream *) nullptr; // Set the track pair output file name out_file << out_base << "_PROBRIRW" << tc_stat_file_ext; @@ -2239,7 +2239,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { *out << out_at; out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } return; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc index cfd22631b5..6b2cb8254d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc @@ -54,7 +54,7 @@ TCPairsConfInfo::~TCPairsConfInfo() { void TCPairsConfInfo::init_from_scratch() { // Initialize pointers - Consensus = (ConsensusInfo *) 0; + Consensus = (ConsensusInfo *) nullptr; clear(); @@ -66,7 +66,7 @@ void TCPairsConfInfo::init_from_scratch() { void TCPairsConfInfo::clear() { // Deallocate memory - if(Consensus) { delete [] Consensus; Consensus = (ConsensusInfo *) 0; } + if(Consensus) { delete [] Consensus; Consensus = (ConsensusInfo *) nullptr; } Desc.clear(); Model.clear(); @@ -139,7 +139,7 @@ void TCPairsConfInfo::process_config() { int i, j; StringArray sa; ConcatString poly_file; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Conf: Version Version = Conf.lookup_string(conf_key_version); @@ -395,7 +395,7 @@ void DiagInfo::clear() { void parse_conf_diag_info_map(Dictionary *dict, map &source_map) { int i; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; ConcatString diag_source; DiagInfo cur_info; @@ -445,7 +445,7 @@ void parse_conf_diag_info_map(Dictionary *dict, map &sour void parse_conf_diag_convert_map(Dictionary *dict, map< ConcatString,map > &source_map) { int i, j; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; map cur_map; ConcatString diag_source, key; StringArray sa; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 4520b1d5ca..dfcf84a9f9 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -214,7 +214,7 @@ GrdFileType get_file_type(const StringArray &file_list, const GrdFileType in_ftype) { int i; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; GrdFileType out_ftype; // Find the first file that actually exists @@ -239,7 +239,7 @@ GrdFileType get_file_type(const StringArray &file_list, out_ftype = mtddf->file_type(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(out_ftype); } @@ -561,7 +561,7 @@ void setup_grid() { //////////////////////////////////////////////////////////////////////// void setup_nc_file() { - VarInfo* data_info = (VarInfo*) 0; + VarInfo* data_info = (VarInfo*) nullptr; // Create NetCDF file nc_out = open_ncfile(out_file.c_str(), true); @@ -650,7 +650,7 @@ void compute_lat_lon(TcrmwGrid& tcrmw_grid, //////////////////////////////////////////////////////////////////////// void process_fields(const TrackInfoArray& tracks) { - VarInfo *data_info = (VarInfo *) 0; + VarInfo *data_info = (VarInfo *) nullptr; DataPlane data_dp; // Define latitude and longitude arrays diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 10aded04c4..b97f136188 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -97,7 +97,7 @@ static ConcatString out_prefix; // Output NetCDF file static ConcatString out_file; -static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) nullptr; static netCDF::NcDim range_dim; static netCDF::NcDim azimuth_dim; static netCDF::NcDim pressure_dim; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 19fa16a3c6..96f038f6ab 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -45,7 +45,7 @@ TCRMWConfInfo::~TCRMWConfInfo() { void TCRMWConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; clear(); @@ -86,11 +86,11 @@ void TCRMWConfInfo::clear() { if(data_info) { for(int i = 0; i < n_data; i++) { if(data_info[i]) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } } delete data_info; - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; } // Reset field count @@ -122,7 +122,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { int i; StringArray sa; VarInfoFactory info_factory; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; // Conf: version check_met_version(Conf.lookup_string(conf_key_version).c_str()); @@ -212,7 +212,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { // Initialize pointers for(i=0; iget_n_data(); i_var++) { data_info = _conf->data_info[i_var]; string varname = data_info->name_attr().string(); @@ -128,8 +128,8 @@ void TCRMW_WindConverter::update_input(const string &variableName, const string //////////////////////////////////////////////////////////////////////// void TCRMW_WindConverter::append_nc_output_vars(map > &variable_levels, - map &variable_long_names, - map &variable_units) { + map &variable_long_names, + map &variable_units) { if (!_computeWinds) { return; } @@ -145,11 +145,11 @@ void TCRMW_WindConverter::append_nc_output_vars(map > &va else { if (!_foundUInInput) { mlog << Warning << "\nTCWRMW_WindConverter::checkInputs() -> " - << "field not found in input \"" << _conf->u_wind_field_name << "\"\n\n"; + << "field not found in input \"" << _conf->u_wind_field_name << "\"\n\n"; } if (!_foundVInInput) { mlog << Warning << "\nTCWRMW_WindConverter::checkInputs() -> " - << "field not found in input \"" << _conf->v_wind_field_name << "\"\n\n"; + << "field not found in input \"" << _conf->v_wind_field_name << "\"\n\n"; } mlog << Warning << "\nNot computing radial and tangential winds\n\n"; _computeWinds = false; @@ -159,24 +159,24 @@ void TCRMW_WindConverter::append_nc_output_vars(map > &va //////////////////////////////////////////////////////////////////////// bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, - const string &varName, - const string &varLevel, - unixtime valid_time, - const StringArray &data_files, - const GrdFileType &ftype, - const Grid &latlon_arr, - const double *lat_arr, - const double *lon_arr, - const Grid &grid, - const DataPlane &data_dp, - const TcrmwGrid &tcrmw_grid) { + const string &varName, + const string &varLevel, + unixtime valid_time, + const StringArray &data_files, + const GrdFileType &ftype, + const Grid &latlon_arr, + const double *lat_arr, + const double *lon_arr, + const Grid &grid, + const DataPlane &data_dp, + const TcrmwGrid &tcrmw_grid) { if (!_computeWinds) { return false; } int uIndex = -1; int vIndex = -1; - VarInfo *data_infoV = (VarInfo *) 0; + VarInfo *data_infoV = (VarInfo *) nullptr; if (varName == _conf->u_wind_field_name.string()) { uIndex = _uIndexMap[varLevel]; vIndex = _vIndexMap[varLevel]; @@ -191,7 +191,7 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, DataPlane data_dpV; Grid latlon_arrV; get_series_entry(i_point, data_infoV, data_files, ftype, data_dpV, - latlon_arrV); + latlon_arrV); double data_min, data_max; data_dpV.data_range(data_min, data_max); mlog << Debug(4) << "V data_min:" << data_min << "\n"; @@ -203,7 +203,7 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, // here's the conversion, at last wind_ne_to_ra(tcrmw_grid, data_dp, data_dpV, lat_arr, lon_arr, - _windR, _windT); + _windR, _windT); // _windR and _windT now set return true; } @@ -212,9 +212,9 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, //////////////////////////////////////////////////////////////////////// void wind_ne_to_ra(const TcrmwGrid& tcrmw_grid, - const DataPlane& u_dp, const DataPlane& v_dp, - const double* lat_arr, const double* lon_arr, - double* wind_r_arr, double* wind_t_arr) { + const DataPlane& u_dp, const DataPlane& v_dp, + const double* lat_arr, const double* lon_arr, + double* wind_r_arr, double* wind_t_arr) { // Transform (u, v) to (radial, azimuthal) for(int ir = 0; ir < tcrmw_grid.range_n(); ir++) { for(int ia = 0; ia < tcrmw_grid.azimuth_n(); ia++) { @@ -225,15 +225,15 @@ void wind_ne_to_ra(const TcrmwGrid& tcrmw_grid, double v = v_dp.data()[i]; double wind_r; double wind_t; - if(is_bad_data(u) || is_bad_data(v)) { - mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " winds are missing\n"; - wind_r = bad_data_double; - wind_t = bad_data_double; - } else { - tcrmw_grid.wind_ne_to_ra(lat, lon, u, v, wind_r, wind_t); - mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " uv:" << u << "," - << v << ", rt:" << wind_r << "," << wind_t <<"\n"; - } + if(is_bad_data(u) || is_bad_data(v)) { + mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " winds are missing\n"; + wind_r = bad_data_double; + wind_t = bad_data_double; + } else { + tcrmw_grid.wind_ne_to_ra(lat, lon, u, v, wind_r, wind_t); + mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " uv:" << u << "," + << v << ", rt:" << wind_r << "," << wind_t <<"\n"; + } wind_r_arr[i] = wind_r; wind_t_arr[i] = wind_t; } diff --git a/src/tools/tc_utils/tc_stat/tc_stat.cc b/src/tools/tc_utils/tc_stat/tc_stat.cc index d1e85b0855..3bfd0b13a4 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -165,7 +165,7 @@ void process_search_dirs() { void process_jobs() { TCStatJobFactory factory; - TCStatJob *cur_job = (TCStatJob *) 0; + TCStatJob *cur_job = (TCStatJob *) nullptr; ConcatString jobstring; int i, n_jobs; TCPointCounts n; @@ -258,7 +258,7 @@ void process_jobs() { << "Rejected for out valid mask = " << n.RejOutValidMask << "\n"; // Deallocate current job - if(cur_job) { delete cur_job; cur_job = (TCStatJob *) 0; } + if(cur_job) { delete cur_job; cur_job = (TCStatJob *) nullptr; } } // end for i @@ -293,7 +293,7 @@ void open_out_file() { void close_out_file() { // Close the output file - if(tc_stat_out != (ofstream *) 0) { + if(tc_stat_out != (ofstream *) nullptr) { // List the file being closed mlog << Debug(1) @@ -302,7 +302,7 @@ void close_out_file() { // Close the output file tc_stat_out->close(); delete tc_stat_out; - tc_stat_out = (ofstream *) 0; + tc_stat_out = (ofstream *) nullptr; } return; diff --git a/src/tools/tc_utils/tc_stat/tc_stat.h b/src/tools/tc_utils/tc_stat/tc_stat.h index 1bf28f1610..64a3a214c0 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.h +++ b/src/tools/tc_utils/tc_stat/tc_stat.h @@ -81,7 +81,7 @@ static ConcatString command_line_job; //////////////////////////////////////////////////////////////////////// // Output file stream -static std::ofstream *tc_stat_out = (std::ofstream *) 0; +static std::ofstream *tc_stat_out = (std::ofstream *) nullptr; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 197c4f2f12..9814f759c4 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -2703,7 +2703,7 @@ TCStatJobType string_to_tcstatjobtype(const ConcatString s) { //////////////////////////////////////////////////////////////////////// ConcatString tcstatjobtype_to_string(const TCStatJobType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TCStatJobType_Filter: s = TCStatJobType_FilterStr; break; @@ -2936,7 +2936,7 @@ TCStatJobRIRW & TCStatJobRIRW::operator=(const TCStatJobRIRW &j) { void TCStatJobRIRW::init_from_scratch() { int i; - for(i=0; i<4; i++) DumpOutCTC[i] = (ofstream *) 0; + for(i=0; i<4; i++) DumpOutCTC[i] = (ofstream *) nullptr; TCStatJob::init_from_scratch(); @@ -3066,7 +3066,7 @@ void TCStatJobRIRW::close_dump_file() { DumpOutCTC[i]->close(); delete DumpOutCTC[i]; - DumpOutCTC[i] = (ofstream *) 0; + DumpOutCTC[i] = (ofstream *) nullptr; } } @@ -3977,7 +3977,7 @@ TCStatJobProbRIRW & TCStatJobProbRIRW::operator=(const TCStatJobProbRIRW &j) { void TCStatJobProbRIRW::init_from_scratch() { - StatOut = (ofstream *) 0; + StatOut = (ofstream *) nullptr; TCStatJob::init_from_scratch(); @@ -4081,7 +4081,7 @@ void TCStatJobProbRIRW::close_dump_file() { if(DumpOut) { DumpOut->close(); delete DumpOut; - DumpOut = (ofstream *) 0; + DumpOut = (ofstream *) nullptr; } // Prepare nicely formatted AsciiTable object