Use sizeOfType() instead of sizeof(void*)

This commit is contained in:
Reijo Tomperi 2009-11-28 18:24:16 +02:00
parent 03e7914c98
commit ee7b09fb8d
2 changed files with 2 additions and 2 deletions

View File

@ -767,7 +767,7 @@ void CheckBufferOverrun::checkStructVariable()
int arrsize = std::atoi(tok2->strAt(ivar + 2)); int arrsize = std::atoi(tok2->strAt(ivar + 2));
int total_size = arrsize * _tokenizer->sizeOfType(tok2->tokAt(1)); int total_size = arrsize * _tokenizer->sizeOfType(tok2->tokAt(1));
if (tok2->tokAt(2)->str() == "*") if (tok2->tokAt(2)->str() == "*")
total_size = arrsize * sizeof(void *); total_size = arrsize * _tokenizer->sizeOfType(tok2->tokAt(2));
if (total_size == 0) if (total_size == 0)
continue; continue;

View File

@ -1277,7 +1277,7 @@ std::string Preprocessor::getcode(const std::string &filedata, std::string cfg,
// We must not remove #file tags or line numbers // We must not remove #file tags or line numbers
// are corrupted. File tags are removed by the tokenizer. // are corrupted. File tags are removed by the tokenizer.
} }
else if (!match || line.compare(0,1,"#") == 0) else if (!match || line.compare(0, 1, "#") == 0)
{ {
// Remove #if, #else, #pragma etc, leaving only // Remove #if, #else, #pragma etc, leaving only
// #define, #undef, #file and #endfile. and also lines // #define, #undef, #file and #endfile. and also lines