-
Notifications
You must be signed in to change notification settings - Fork 461
Resolve cppcheck unreadVariable warnings #11411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -689,7 +689,6 @@ int InputProcessor::getIntFieldValue(json const &ep_object, json const &schema_o | |
|
|
||
| auto const &schema_field_obj = schema_obj_props[fieldName]; | ||
| assert(!schema_field_obj.empty()); // Check that field name exists in the schema for this object type | ||
| bool isDefaulted = false; | ||
| int value = 0; | ||
| Real64 defaultValue = 0.0; | ||
| auto it = ep_object.find(fieldName); | ||
|
|
@@ -702,14 +701,12 @@ int InputProcessor::getIntFieldValue(json const &ep_object, json const &schema_o | |
| // really is an int then the input processor will have forced it to be an integer. | ||
| assert(!field_value.is_number()); | ||
| } else if (field_value.get<std::string>().empty()) { | ||
| isDefaulted = findDefault(defaultValue, schema_field_obj); | ||
| if (isDefaulted) { | ||
| if (findDefault(defaultValue, schema_field_obj)) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the temporary |
||
| value = static_cast<int>(defaultValue); | ||
| } | ||
| } | ||
| } else { | ||
| isDefaulted = findDefault(defaultValue, schema_field_obj); | ||
| if (isDefaulted) { | ||
| if (findDefault(defaultValue, schema_field_obj)) { | ||
| value = static_cast<int>(defaultValue); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,9 +176,6 @@ namespace ThermalComfort { | |
| state.dataThermalComforts->ThermalComfortData.allocate(state.dataHeatBal->TotPeople); | ||
|
|
||
| for (Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) { | ||
|
|
||
| std::string CurrentGroupName = state.dataHeatBal->People(Loop).Name; | ||
|
|
||
| // CurrentModuleObject='People' | ||
| // MJW MRT ToDo: Rename most Zone Thermal Comfort output variables to People Thermal Comfort ('cause they're keyed by People name) | ||
| if (state.dataHeatBal->People(Loop).Fanger) { | ||
|
|
@@ -2791,7 +2788,7 @@ namespace ThermalComfort { | |
| std::string epwLine; | ||
| auto epwFile = state.files.inputWeatherFilePath.open(state, "CalcThermalComfortAdaptiveASH55"); | ||
| for (i = 1; i <= 8; ++i) { // Headers | ||
| epwLine = epwFile.readLine().data; | ||
| epwFile.readLine(); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the code to call |
||
| } | ||
| int jStartDay = state.dataEnvrn->DayOfYear - 1; | ||
| int calcStartDay = jStartDay - 30; | ||
|
|
@@ -2837,7 +2834,7 @@ namespace ThermalComfort { | |
| state.dataThermalComforts->DailyAveOutTemp(i + 30 - calcEndDay) = state.dataThermalComforts->avgDryBulbASH; | ||
| } | ||
| for (i = calcEndHr + 1; i <= calcStartHr - 1; ++i) { | ||
| epwLine = epwFile.readLine().data; | ||
| epwFile.readLine(); | ||
| } | ||
| for (i = 1; i <= 30 - calcEndDay; ++i) { | ||
| state.dataThermalComforts->avgDryBulbASH = 0.0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,15 +232,13 @@ namespace Util { | |
| int Probe = 0; | ||
| int LBnd = 0; | ||
| int UBnd = NumItems + 1; | ||
| bool Found = false; | ||
| while ((!Found) || (Probe != 0)) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| while (true) { | ||
| Probe = (UBnd - LBnd) / 2; | ||
| if (Probe == 0) { | ||
| break; | ||
| } | ||
| Probe += LBnd; | ||
| if (equali(String, ListOfItems(Probe))) { | ||
| Found = true; | ||
| break; | ||
| } | ||
| if (lessthani(String, ListOfItems(Probe))) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the zero-initialization of
tmpRealARR. It is always overwritten before being read, so the initialization was redundant and triggered a cppcheck warning.