Skip to content

Commit

Permalink
Merge pull request #67 from davvid/pvs-studio-fixes
Browse files Browse the repository at this point in the history
PVS Studio fixes
  • Loading branch information
lchai committed Aug 9, 2017
2 parents 949a40b + e5225eb commit 2a6c32e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/lib/core/ParticleSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ addParticle()
{
if(allocatedCount==particleCount){
allocatedCount=std::max(10,std::max(allocatedCount*3/2,particleCount));
for(unsigned int i=0;i<attributes.size();i++)
attributeData[i]=(char*)realloc(attributeData[i],(size_t)attributeStrides[i]*(size_t)allocatedCount);
for(unsigned int i=0;i<attributes.size();i++) {
char *memory = (char*)realloc(attributeData[i],(size_t)attributeStrides[i]*(size_t)allocatedCount);
if(memory){
attributeData[i]=memory;
}
}
}
ParticleIndex index=particleCount;
particleCount++;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/io/MC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ bool ReadAttrHeader(std::istream& input, Attribute_Header& attribute){

int CharArrayLen(char** charArray){
int i = 0;
if(charArray != false){
while(charArray[i] != '\0'){
if(charArray != NULL){
while(charArray[i] != NULL){
i++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/io/PDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ ParticlesDataMutable* readPDA(const char* filename,const bool headersOnly,std::o

if(word=="V"){
attrs.push_back(simple->addAttribute(attrNames[index].c_str(),Partio::VECTOR,3));
}else if("R"){
}else if(word=="R"){
attrs.push_back(simple->addAttribute(attrNames[index].c_str(),Partio::FLOAT,1));
}else if("I"){
}else if(word=="I"){
attrs.push_back(simple->addAttribute(attrNames[index].c_str(),Partio::INT,1));
}

Expand Down

0 comments on commit 2a6c32e

Please sign in to comment.