Merge pull request #31 from mpictor/tp/cppcheck-fixes · stepcode/stepcode@80a5a19 · GitHub
Skip to content

Commit 80a5a19

Browse files
committed
Merge pull request #31 from mpictor/tp/cppcheck-fixes
tp/cppcheck-fixes
2 parents 728cf28 + ec62001 commit 80a5a19

10 files changed

Lines changed: 34 additions & 42 deletions

File tree

src/clprobe-ui/stepenteditor.cc

Lines changed: 2 additions & 2 deletions

src/clstepcore/ExpDict.cc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ AttrDescriptor::ExpandedTypeName(std::string & s) const
780780
const char *
781781
AttrDescriptor::GenerateExpress (std::string &buf) const
782782
{
783-
char tmp[BUFSIZ];
784783
std::string sstr;
785784
buf = AttrExprDefStr(sstr);
786785
buf.append(";\n");
@@ -877,8 +876,6 @@ EnumTypeDescriptor::GenerateExpress (std::string &buf) const
877876
buf.append(" = ENUMERATION OF \n (");
878877
const char *desc = Description();
879878
const char *ptr = &(desc[16]);
880-
int count;
881-
int i;
882879
int all_comments = 1;
883880

884881
while(*ptr != '\0')
@@ -898,8 +895,8 @@ EnumTypeDescriptor::GenerateExpress (std::string &buf) const
898895
// count is # of WHERE rules
899896
if(_where_rules != 0)
900897
{
901-
count = _where_rules->Count();
902-
for(i = 0; i < count; i++) // print out each UNIQUE rule
898+
int count = _where_rules->Count();
899+
for(int i = 0; i < count; i++) // print out each UNIQUE rule
903900
{
904901
if( !(*(_where_rules))[i]->_label.size() )
905902
all_comments = 0;
@@ -910,7 +907,7 @@ EnumTypeDescriptor::GenerateExpress (std::string &buf) const
910907
else
911908
buf.append(" WHERE\n");
912909

913-
for(i = 0; i < count; i++) // print out each WHERE rule
910+
for(int i = 0; i < count; i++) // print out each WHERE rule
914911
{
915912
if( !(*(_where_rules))[i]->_comment.empty() )
916913
{
@@ -980,7 +977,6 @@ EntityDescriptor::~EntityDescriptor ()
980977
const char *
981978
EntityDescriptor::GenerateExpress (std::string &buf) const
982979
{
983-
char tmp[BUFSIZ];
984980
std::string sstr;
985981
int count;
986982
int i;
@@ -1600,8 +1596,6 @@ TypeDescriptor::GenerateExpress (std::string &buf) const
16001596
buf.append(" = ");
16011597
const char *desc = Description();
16021598
const char *ptr = desc;
1603-
int count;
1604-
int i;
16051599
int all_comments = 1;
16061600

16071601
while(*ptr != '\0')
@@ -1623,8 +1617,8 @@ TypeDescriptor::GenerateExpress (std::string &buf) const
16231617
// count is # of WHERE rules
16241618
if(_where_rules != 0)
16251619
{
1626-
count = _where_rules->Count();
1627-
for(i = 0; i < count; i++) // print out each UNIQUE rule
1620+
int count = _where_rules->Count();
1621+
for(int i = 0; i < count; i++) // print out each UNIQUE rule
16281622
{
16291623
if( !(*(_where_rules))[i]->_label.size() )
16301624
all_comments = 0;
@@ -1635,7 +1629,7 @@ TypeDescriptor::GenerateExpress (std::string &buf) const
16351629
else
16361630
buf.append(" WHERE\n");
16371631

1638-
for(i = 0; i < count; i++) // print out each WHERE rule
1632+
for(int i = 0; i < count; i++) // print out each WHERE rule
16391633
{
16401634
if( !(*(_where_rules))[i]->_comment.empty() )
16411635
{

src/clstepcore/ExpDict.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,9 @@ class TypeDescriptor {
12581258
const;
12591259
virtual const TypeDescriptor * IsA (const char *) const;
12601260
virtual const TypeDescriptor * CanBe (const TypeDescriptor *n) const
1261-
{ return TypeDescriptor::IsA (n); }
1261+
{ return IsA (n); }
12621262
virtual const TypeDescriptor * CanBe (const char *n) const
1263-
{ return TypeDescriptor::IsA (n); }
1263+
{ return IsA (n); }
12641264
virtual const TypeDescriptor * CanBeSet (const char *n,
12651265
const char *schNm =0) const
12661266
{ return ( CurrName( n, schNm ) ? this : 0 ); }

src/clstepcore/complexSupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class AndList : public JoinList {
259259

260260
class OrList : public MultList {
261261
public:
262-
OrList() : MultList( OR ), choice(-1), choiceCount(0) {}
262+
OrList() : MultList( OR ), choice(-1), choice1(-2), choiceCount(0) {}
263263
~OrList() {}
264264
int hit( char * );
265265
MatchType matchORs( EntNode * );
@@ -268,7 +268,7 @@ class OrList : public MultList {
268268
int acceptChoice( EntNode * );
269269
int acceptNextChoice( EntNode *ents )
270270
{ choice++; return ( acceptChoice( ents ) ); }
271-
void reset() { choice = -1; choiceCount = 0; MultList::reset(); }
271+
void reset() { choice = -1; choice1 = -2; choiceCount = 0; MultList::reset(); }
272272

273273
private:
274274
int choice, choice1, choiceCount;

src/express/object.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ OBJinitialize()
5959
void
6060
OBJcreate(char type,struct Symbol_ *(*get_symbol)(Generic),char *printable_type,int bits)
6161
{
62-
OBJ[type].get_symbol = get_symbol;
63-
OBJ[type].type = printable_type;
64-
OBJ[type].bits = bits;
62+
unsigned index = (unsigned)type;
63+
OBJ[index].get_symbol = get_symbol;
64+
OBJ[index].type = printable_type;
65+
OBJ[index].bits = bits;
6566
}

src/express/resolve.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ void
14871487
ENTITYresolve_types(Entity e)
14881488
{
14891489
int i;
1490-
Qualified_Attr *ref;
1490+
Qualified_Attr *reference;
14911491
Variable attr;
14921492
int failed = 0;
14931493

@@ -1517,9 +1517,9 @@ ENTITYresolve_types(Entity e)
15171517
/* skip first which is always the label (or NULL if no label) */
15181518
i++;
15191519
if (i == 1) continue;
1520-
ref = (Qualified_Attr *)reflink->data;
1520+
reference = (Qualified_Attr *)reflink->data;
15211521

1522-
attr = ENTITYresolve_attr_ref(e, ref->entity, ref->attribute);
1522+
attr = ENTITYresolve_attr_ref(e, reference->entity, reference->attribute);
15231523
if (!attr) {
15241524
/* ERRORreport_with_symbol(ERROR_unknown_attr_in_entity,*/
15251525
/* ref->attribute, ref->attribute->name,*/
@@ -1528,7 +1528,7 @@ ENTITYresolve_types(Entity e)
15281528
continue;
15291529
}
15301530

1531-
QUAL_ATTR_destroy(ref);
1531+
QUAL_ATTR_destroy(reference);
15321532
reflink->data = (Generic)attr;
15331533

15341534
if (ENTITYdeclares_variable(e,attr)) {

src/fedex_plus/classes.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,6 @@ MemberFunctionSign (Entity entity, FILE* file)
23392339
/* added for calling multiple_inheritance */
23402340
Linked_List parent_attr_list;
23412341
Linked_List parent_list;
2342-
__attribute__((unused)) Entity super =0;
23432342
int super_cnt =0;
23442343

23452344
strncpy (entnm, ENTITYget_classname (entity), BUFSIZ); /* assign entnm */
@@ -2390,7 +2389,7 @@ MemberFunctionSign (Entity entity, FILE* file)
23902389
or the super class doesn\'t have any attributes
23912390
*/
23922391

2393-
super = e;
2392+
__attribute__((unused)) Entity super = e;
23942393
super_cnt++;
23952394
if (super_cnt == 1)
23962395
{

src/fedex_plus/complexSupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class AndList : public JoinList {
266266

267267
class OrList : public MultList {
268268
public:
269-
OrList() : MultList( OR ), choice(-1), choiceCount(0) {}
269+
OrList() : MultList( OR ), choice(-1), choice1(-2), choiceCount(0) {}
270270
~OrList() {}
271271
int hit( const char * );
272272
MatchType matchORs( EntNode * );
@@ -275,7 +275,7 @@ class OrList : public MultList {
275275
int acceptChoice( EntNode * );
276276
int acceptNextChoice( EntNode *ents )
277277
{ choice++; return ( acceptChoice( ents ) ); }
278-
void reset() { choice = -1; choiceCount = 0; MultList::reset(); }
278+
void reset() { choice = -1; choice1 = -2; choiceCount = 0; MultList::reset(); }
279279

280280
private:
281281
int choice, choice1, choiceCount;

src/fedex_plus/fedex_idl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ SCOPEPrintHooks(Scope scope, FILE *os_hooks_file,Schema schema,Express model)
241241
{
242242
const char * entnm;
243243
Linked_List list;
244-
char nm[BUFSIZ];
245244
char classNm [BUFSIZ];
246245

247246
DictionaryEntry de;
@@ -293,7 +292,6 @@ TYPEget_idl_type (const Type t)
293292
Class_Of_Type class, class2;
294293
Type bt;
295294
static char retval [BUFSIZ];
296-
char *n;
297295

298296
/* aggregates are based on their base type
299297
case TYPE_ARRAY:
@@ -821,12 +819,10 @@ FundamentalType(const Type t,int report_reftypes) {
821819
void
822820
idlSCHEMAprint (Schema schema, FILES* files, Express model)
823821
{
824-
char fnm [BUFSIZ], *np;
822+
char fnm [BUFSIZ];
825823
char schnm[BUFSIZ];
826824

827825
FILE *idl_file;
828-
FILE *os_hooks_file_h;
829-
FILE *os_hooks_file_cc;
830826
FILE* os_makefile = files -> make;
831827
/*
832828
FILE* idl_file;

src/fedex_plus/fedex_os.c

Lines changed: 10 additions & 8 deletions

0 commit comments

Comments
 (0)