SWDEV-306939 - Fix vdi errors/warnings by CppCheck

Change-Id: I56d910f8363787f1050d5d7e8064ed553c5827fd
This commit is contained in:
Satyanvesh Dittakavi
2021-12-01 17:23:00 +00:00
parent 8b5b2a2d79
commit e20dd61932
45 changed files with 113 additions and 160 deletions
+6 -6
View File
@@ -395,7 +395,7 @@ bool Elf::setupShdr (
ElfSections id,
section* section,
Elf64_Word shlink
)
) const
{
section->set_addr_align(ElfSecDesc[id].d_align);
section->set_type(ElfSecDesc[id].sh_type);
@@ -469,7 +469,7 @@ bool Elf::setTarget(uint16_t machine, ElfPlatform platform)
return true;
}
bool Elf::getType(uint16_t &type) {
bool Elf::getType(uint16_t &type) const {
type = _elfio.get_type();
return true;
}
@@ -479,7 +479,7 @@ bool Elf::setType(uint16_t type) {
return true;
}
bool Elf::getFlags(uint32_t &flag) {
bool Elf::getFlags(uint32_t &flag) const {
flag = _elfio.get_flags();
return true;
}
@@ -523,7 +523,7 @@ unsigned int Elf::getSegmentNum() const {
return _elfio.segments.size();
}
bool Elf::getSegment(const unsigned int index, segment*& seg) {
bool Elf::getSegment(const unsigned int index, segment*& seg) const {
bool ret = false;
if (index < _elfio.segments.size()) {
seg = _elfio.segments[index];
@@ -946,7 +946,7 @@ bool Elf::dumpImage(char** buff, size_t* len)
return ret;
}
bool Elf::dumpImage(std::istream &is, char **buff, size_t *len) {
bool Elf::dumpImage(std::istream &is, char **buff, size_t *len) const {
if (buff == nullptr || len == nullptr) {
return false;
}
@@ -1068,7 +1068,7 @@ void* Elf::calloc(size_t sz)
void
Elf::elfMemoryRelease()
{
for(EMemory::iterator it = _elfMemory.begin(); it != _elfMemory.end(); it++) {
for(EMemory::iterator it = _elfMemory.begin(); it != _elfMemory.end(); ++it) {
free(it->first);
}
_elfMemory.clear();
+7 -7
View File
@@ -253,7 +253,7 @@ public:
* if dumpImage() succeeds.
*/
bool dumpImage(char** buff, size_t* len);
bool dumpImage(std::istream& is, char** buff, size_t* len);
bool dumpImage(std::istream& is, char** buff, size_t* len) const;
/*
* If the session doesn't exist, create a new ELF section with data <d_buf, d_size>;
@@ -320,11 +320,11 @@ public:
bool setTarget(uint16_t machine, ElfPlatform platform);
/* Get/set elf type field from header */
bool getType(uint16_t &type);
bool getType(uint16_t &type) const;
bool setType(uint16_t type);
/* Get/set elf flag field from header */
bool getFlags(uint32_t &flag);
bool getFlags(uint32_t &flag) const;
bool setFlags(uint32_t flag);
/*
@@ -333,9 +333,9 @@ public:
*/
bool Clear();
unsigned char getELFClass() { return _eclass; }
unsigned char getELFClass() const { return _eclass; }
bool isSuccessful() { return _successful; }
bool isSuccessful() const { return _successful; }
bool isHsaCo() const { return _elfio.get_machine() == EM_AMDGPU; }
@@ -343,7 +343,7 @@ public:
unsigned int getSegmentNum() const;
/* Return segment at index */
bool getSegment(const unsigned int index, segment*& seg);
bool getSegment(const unsigned int index, segment*& seg) const;
/* Return size of elf file */
static uint64_t getElfSize(const void *emi);
@@ -369,7 +369,7 @@ private:
ElfSections id,
section* section,
Elf64_Word shlink = 0
);
) const ;
/*
* Create a new data into an existing section.