Skip to content

Commit

Permalink
Merge pull request #2827 from dtcenter/feature_2673_sonarqube_beta3_n…
Browse files Browse the repository at this point in the history
…ullptr

Feature 2673 sonarqube beta4 nullptr
  • Loading branch information
hsoh-u authored Feb 27, 2024
2 parents b558794 + 6c30e49 commit 5cca97e
Show file tree
Hide file tree
Showing 223 changed files with 1,316 additions and 1,300 deletions.
6 changes: 3 additions & 3 deletions src/basic/enum_to_string/enum_to_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;


////////////////////////////////////////////////////////////////////////
Expand Down
12 changes: 6 additions & 6 deletions src/basic/enum_to_string/scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ScopeStackElement::ScopeStackElement()

{

Name = (const char *) 0;
Name = (const char *) nullptr;

clear();

Expand All @@ -64,7 +64,7 @@ ScopeStackElement::ScopeStackElement(const ScopeStackElement & e)

{

Name = (const char *) 0;
Name = (const char *) nullptr;

assign(e);

Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/basic/vx_config/celltype_to_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Expand Down
2 changes: 1 addition & 1 deletion src/basic/vx_config/grdfiletype_to_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Expand Down
14 changes: 7 additions & 7 deletions src/basic/vx_config/icode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -596,7 +596,7 @@ void IcodeVector::init_from_scratch()

{

Cell = (IcodeCell *) 0;
Cell = (IcodeCell *) nullptr;

Ncells = Nalloc = 0;

Expand Down Expand Up @@ -1155,7 +1155,7 @@ ICVStack::ICVStack()

{

for (int j=0; j<icv_stack_size; ++j) v[j] = (IcodeVector *) 0;
for (int j=0; j<icv_stack_size; ++j) v[j] = (IcodeVector *) nullptr;

clear();

Expand All @@ -1181,7 +1181,7 @@ ICVStack::ICVStack(const ICVStack & s)

{

for (int j=0; j<icv_stack_size; ++j) v[j] = (IcodeVector *) 0;
for (int j=0; j<icv_stack_size; ++j) v[j] = (IcodeVector *) nullptr;

Depth = 0;

Expand Down Expand Up @@ -1320,7 +1320,7 @@ IcodeVector V;

V = *(v[Depth - 1]);

delete v[Depth - 1]; v[Depth - 1] = (IcodeVector *) 0;
delete v[Depth - 1]; v[Depth - 1] = (IcodeVector *) nullptr;

--Depth;

Expand Down Expand Up @@ -1595,7 +1595,7 @@ for (int j=1; j<Nelements; ++j) {

}

v[Nelements - 1] = (IcodeVector *) 0;
v[Nelements - 1] = (IcodeVector *) nullptr;

--Nelements;

Expand Down
12 changes: 6 additions & 6 deletions src/basic/vx_config/idstack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void IdentifierQueue::clear()

for (int j=0; j<max_id_queue_size; ++j) {

if ( i[j] ) { delete i[j]; i[j] = (Identifier *) 0; }
if ( i[j] ) { delete i[j]; i[j] = (Identifier *) nullptr; }

}

Expand Down Expand Up @@ -344,7 +344,7 @@ for (int j=1; j<Nelements; ++j) {

}

i[Nelements - 1] = (Identifier *) 0;
i[Nelements - 1] = (Identifier *) nullptr;

--Nelements;

Expand Down Expand Up @@ -426,7 +426,7 @@ void IdentifierArray::init_from_scratch()

Nelements = Nalloc = 0;

i = (Identifier *) 0;
i = (Identifier *) nullptr;

extend(1);

Expand Down Expand Up @@ -486,7 +486,7 @@ void IdentifierArray::extend(int n)
if ( Nalloc > n ) return;

int k;
Identifier * inew = (Identifier *) 0;
Identifier * inew = (Identifier *) nullptr;


k = n/id_array_jump;
Expand All @@ -507,9 +507,9 @@ if ( !inew ) {

for (int j=0; j<Nelements; ++j) inew[j] = i[j];

if ( i ) { delete [] i; i = (Identifier *) 0; }
if ( i ) { delete [] i; i = (Identifier *) nullptr; }

i = inew; inew = (Identifier *) 0;
i = inew; inew = (Identifier *) nullptr;

Nalloc = k;

Expand Down
6 changes: 3 additions & 3 deletions src/basic/vx_config/number_stack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void NumberStack::init_from_scratch()

{

e = 0;
e = nullptr;

AllocInc = default_ns_alloc_inc;

Expand All @@ -124,7 +124,7 @@ void NumberStack::clear(bool initialize)

{

if ( e ) { delete [] e; e = 0; }
if ( e ) { delete [] e; e = nullptr; }


Nelements = 0;
Expand Down Expand Up @@ -202,7 +202,7 @@ for(j=0; j<Nelements; ++j) {

}

if ( e ) { delete [] e; e = 0; }
if ( e ) { delete [] e; e = nullptr; }

e = u;

Expand Down
28 changes: 14 additions & 14 deletions src/basic/vx_config/threshold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Or_Node::Or_Node()

{

left_child = right_child = 0;
left_child = right_child = nullptr;

}

Expand All @@ -110,8 +110,8 @@ Or_Node::~Or_Node()

{

if ( left_child ) { delete left_child; left_child = 0; }
if ( right_child ) { delete right_child; right_child = 0; }
if ( left_child ) { delete left_child; left_child = nullptr; }
if ( right_child ) { delete right_child; right_child = nullptr; }

}

Expand Down Expand Up @@ -319,7 +319,7 @@ And_Node::And_Node()

{

left_child = right_child = 0;
left_child = right_child = nullptr;

}

Expand All @@ -331,8 +331,8 @@ And_Node::~And_Node()

{

if ( left_child ) { delete left_child; left_child = 0; }
if ( right_child ) { delete right_child; right_child = 0; }
if ( left_child ) { delete left_child; left_child = nullptr; }
if ( right_child ) { delete right_child; right_child = nullptr; }

}

Expand Down Expand Up @@ -558,7 +558,7 @@ Not_Node::Not_Node()

{

child = 0;
child = nullptr;

}

Expand All @@ -570,7 +570,7 @@ Not_Node::~Not_Node()

{

if ( child ) { delete child; child = 0; }
if ( child ) { delete child; child = nullptr; }

}

Expand Down Expand Up @@ -939,7 +939,7 @@ void Simple_Node::set_perc(const NumArray *fptr, const NumArray *optr, const Num
int i;
double ptile, diff;
NumArray data;
const NumArray * ptr = 0;
const NumArray * ptr = nullptr;
bool fbias_fcst = false;

//
Expand Down Expand Up @@ -1427,7 +1427,7 @@ void SingleThresh::init_from_scratch()

{

node = 0;
node = nullptr;

clear();

Expand All @@ -1443,7 +1443,7 @@ void SingleThresh::clear()

{

if ( node ) { delete node; node = 0; }
if ( node ) { delete node; node = nullptr; }

return;

Expand Down Expand Up @@ -1486,7 +1486,7 @@ a->abbr_s << thresh_abbr_str[ind] << t;

node = a;

a = 0;
a = nullptr;

return;

Expand Down Expand Up @@ -1527,7 +1527,7 @@ a->abbr_s << thresh_abbr_str[ind] << cs;

node = a;

a = 0;
a = nullptr;

return;

Expand Down Expand Up @@ -1565,7 +1565,7 @@ a->set_na();

node = a;

a = 0;
a = nullptr;

return;

Expand Down
4 changes: 2 additions & 2 deletions src/basic/vx_log/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Logger & Logger::operator=(const Logger & l)

void Logger::init_from_scratch()
{
out = (ofstream *) 0;
out = (ofstream *) nullptr;

clear();

Expand All @@ -458,7 +458,7 @@ void Logger::clear()

delete out;

out = (ofstream *) 0;
out = (ofstream *) nullptr;

}

Expand Down
2 changes: 1 addition & 1 deletion src/basic/vx_log/str_wrappers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/basic/vx_math/hist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Histogram::~Histogram()

{

if ( Count ) { delete [] Count; Count = (int *) 0; }
if ( Count ) { delete [] Count; Count = (int *) nullptr; }

}

Expand Down Expand Up @@ -94,7 +94,7 @@ void Histogram::init_from_scratch()

{

Count = (int *) 0;
Count = (int *) nullptr;

Nbins = 0;

Expand Down Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 5cca97e

Please sign in to comment.