Skip to content

Commit

Permalink
Merge pull request #10736 from NREL/CppCheck-InternalHeatGains
Browse files Browse the repository at this point in the history
CppCheck InternalHeatGains
  • Loading branch information
Myoldmopar authored Sep 13, 2024
2 parents 1da7008 + c41c753 commit ba8a8b9
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 91 deletions.
3 changes: 1 addition & 2 deletions src/EnergyPlus/InputProcessing/IdfParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,13 @@ std::string IdfParser::parse_string(std::string_view idf, size_t &index)
eat_whitespace(idf, index);

std::string str;
char c;

while (true) {
if (index == idf_size) {
break;
}

c = idf[index];
char c = idf[index];
increment_both_index(index, index_into_cur_line);
if (c == ',' || c == ';' || c == '!') {
decrement_both_index(index, index_into_cur_line);
Expand Down
23 changes: 10 additions & 13 deletions src/EnergyPlus/InputProcessing/InputProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,9 @@ void InputProcessor::getObjectItem(EnergyPlusData &state,
NumericFieldNames);
}

size_t extensible_count = 0;
auto const legacy_idd_extensibles_iter = legacy_idd.find("extensibles");
if (legacy_idd_extensibles_iter != legacy_idd.end()) {
size_t extensible_count = 0;
auto const epJSON_extensions_array_itr = obj_val.find(extension_key);
if (epJSON_extensions_array_itr != obj_val.end()) {
auto const &legacy_idd_extensibles = legacy_idd_extensibles_iter.value();
Expand Down Expand Up @@ -1738,21 +1738,18 @@ void InputProcessor::preProcessorCheck(EnergyPlusData &state, bool &PreP_Fatal)
// A11, \field message line 9
// A12; \field message line 10

int NumAlphas; // Used to retrieve names from IDF
int NumNumbers; // Used to retrieve rNumericArgs from IDF
int IOStat; // Could be used in the Get Routines, not currently checked
int NumParams; // Total Number of Parameters in 'Output:PreprocessorMessage' Object
int NumPrePM; // Number of Preprocessor Message objects in IDF
int CountP;
int CountM;
std::string Multiples;

state.dataIPShortCut->cCurrentModuleObject = "Output:PreprocessorMessage";
NumPrePM = getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject);
int NumPrePM = getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject);
if (NumPrePM > 0) {
int NumAlphas; // Used to retrieve names from IDF
int NumNumbers; // Used to retrieve rNumericArgs from IDF
int IOStat; // Could be used in the Get Routines, not currently checked
int NumParams; // Total Number of Parameters in 'Output:PreprocessorMessage' Object
std::string Multiples;

getObjectDefMaxArgs(state, state.dataIPShortCut->cCurrentModuleObject, NumParams, NumAlphas, NumNumbers);
state.dataIPShortCut->cAlphaArgs({1, NumAlphas}) = BlankString;
for (CountP = 1; CountP <= NumPrePM; ++CountP) {
for (int CountP = 1; CountP <= NumPrePM; ++CountP) {
getObjectItem(state,
state.dataIPShortCut->cCurrentModuleObject,
CountP,
Expand Down Expand Up @@ -1797,7 +1794,7 @@ void InputProcessor::preProcessorCheck(EnergyPlusData &state, bool &PreP_Fatal)
"\" has the following " + state.dataIPShortCut->cAlphaArgs(2) + " condition" + Multiples + ':');
}
}
CountM = 3;
int CountM = 3;
if (CountM > NumAlphas) {
ShowContinueError(state,
state.dataIPShortCut->cCurrentModuleObject + " was blank. Check " + state.dataIPShortCut->cAlphaArgs(1) +
Expand Down
Loading

1 comment on commit ba8a8b9

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2913 of 2913 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.