Index: cppcheck.err =================================================================== diff -u -rcf61c7736f11f4b75a4e2df803f29bdc7769db53 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- cppcheck.err (.../cppcheck.err) (revision cf61c7736f11f4b75a4e2df803f29bdc7769db53) +++ cppcheck.err (.../cppcheck.err) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,63 +1,54 @@ -05/31/2023 2:53 +07/18/2023 3:05 Behrouz NematiPour sources/canbus/MessageAcknowModel.h:58:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning '_sequence' a value by passing the value to the constructor in the initialization list. [useInitializationList] _sequence = vSequence ; ^ sources/canbus/MessageAcknowModel.h:59:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning '_frameList' a value by passing the value to the constructor in the initialization list. [useInitializationList] _frameList = vFrameList ; ^ -sources/device/DeviceModels.h:50:21: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] - mString += QString(",%1").arg(param.toString()); - ^ -sources/storage/FileHandler.h:102:14: style: Condition '!createFolder' is always false [knownConditionTrueFalse] +sources/storage/FileHandler.h:107:14: style: Condition '!createFolder' is always false [knownConditionTrueFalse] if ( ! createFolder ) { if ( ! dstDir.exists() ) { err = eDstFolderNotExist ; goto lErr; }} ^ -sources/storage/FileHandler.h:95:35: note: Assignment 'createFolder=true', assigned value is 1 +sources/storage/FileHandler.h:99:35: note: Assignment 'createFolder=true', assigned value is 1 bool createFolder = true; ^ -sources/storage/FileHandler.h:102:14: note: Condition '!createFolder' is always false +sources/storage/FileHandler.h:107:14: note: Condition '!createFolder' is always false if ( ! createFolder ) { if ( ! dstDir.exists() ) { err = eDstFolderNotExist ; goto lErr; }} ^ -sources/ApplicationPost.cpp:113:9: style: Condition '!ok' is always false [knownConditionTrueFalse] +sources/storage/FileHandler.h:96:17: style: Local variable 'totalSize' shadows outer function [shadowFunction] + qint64 totalSize = 0; + ^ +sources/storage/FileHandler.h:77:21: note: Shadowed declaration + static quint64 totalSize(const QFileInfoList &vFileInfoList); + ^ +sources/storage/FileHandler.h:96:17: note: Shadow variable + qint64 totalSize = 0; + ^ +sources/device/DeviceModels.h:50:21: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] + mString += QString(",%1").arg(param.toString()); + ^ +sources/storage/FileHandler.h:91:33: style: Variable 'err' is assigned a value that is never used. [unreadVariable] + FileCopyError_Enums err = eOK; + ^ +sources/ApplicationPost.cpp:115:9: style: Condition '!ok' is always false [knownConditionTrueFalse] if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_DISPLAY); ^ -sources/ApplicationPost.cpp:111:15: note: Assignment 'ok=true', assigned value is 1 +sources/ApplicationPost.cpp:113:15: note: Assignment 'ok=true', assigned value is 1 bool ok = true; ^ -sources/ApplicationPost.cpp:113:9: note: Condition '!ok' is always false +sources/ApplicationPost.cpp:115:9: note: Condition '!ok' is always false if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_DISPLAY); ^ -sources/ApplicationPost.cpp:208:9: style: Condition '!ok' is always false [knownConditionTrueFalse] - if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_ETHERNET); - ^ -sources/ApplicationPost.cpp:206:15: note: Assignment 'ok=true', assigned value is 1 - bool ok = true; - ^ -sources/ApplicationPost.cpp:208:9: note: Condition '!ok' is always false - if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_ETHERNET); - ^ -sources/ApplicationPost.cpp:222:9: style: Condition '!ok' is always false [knownConditionTrueFalse] +sources/ApplicationPost.cpp:253:9: style: Condition '!ok' is always false [knownConditionTrueFalse] if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SOUND); ^ -sources/ApplicationPost.cpp:220:15: note: Assignment 'ok=true', assigned value is 1 +sources/ApplicationPost.cpp:251:15: note: Assignment 'ok=true', assigned value is 1 bool ok = true; ^ -sources/ApplicationPost.cpp:222:9: note: Condition '!ok' is always false +sources/ApplicationPost.cpp:253:9: note: Condition '!ok' is always false if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SOUND); ^ -sources/storage/FileHandler.h:92:17: style: Local variable 'totalSize' shadows outer function [shadowFunction] - qint64 totalSize = 0; - ^ -sources/storage/FileHandler.h:75:21: note: Shadowed declaration - static quint64 totalSize(const QFileInfoList &vFileInfoList); - ^ -sources/storage/FileHandler.h:92:17: note: Shadow variable - qint64 totalSize = 0; - ^ -sources/storage/FileHandler.h:87:33: style: Variable 'err' is assigned a value that is never used. [unreadVariable] - FileCopyError_Enums err = eOK; - ^ -sources/MainTimer.cpp:69:16: style: The scope of the variable 'oH' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: +sources/MainTimer.cpp:78:16: style: The scope of the variable 'oH' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; @@ -72,7 +63,7 @@ When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ -sources/MainTimer.cpp:69:19: style: The scope of the variable 'oM' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: +sources/MainTimer.cpp:78:19: style: The scope of the variable 'oM' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; @@ -87,7 +78,7 @@ When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ -sources/MainTimer.cpp:69:22: style: The scope of the variable 'oS' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: +sources/MainTimer.cpp:78:22: style: The scope of the variable 'oS' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; @@ -102,33 +93,36 @@ When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ -sources/cloudsync/CloudSyncController.cpp:420:13: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] +sources/cloudsync/CloudSyncController.cpp:431:13: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] buf += item.toString(); ^ -sources/cloudsync/CloudSyncController.cpp:226:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:239:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ -sources/cloudsync/CloudSyncController.cpp:250:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:263:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ -sources/cloudsync/CloudSyncController.cpp:523:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:534:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ -sources/cloudsync/CloudSyncController.cpp:572:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:589:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ -sources/cloudsync/CloudSyncController.cpp:581:51: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:598:51: style: Variable 'error' is assigned a value that is never used. [unreadVariable] if ( isDuplicate(messageID, data) ) { error = eError_Duplicate; args = { messageID }; ok = false; return ok; } // TODO: goto lErr; } don't log it just ignore and return false. ^ -sources/cloudsync/CloudSyncController.cpp:581:76: style: Variable 'args' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:598:76: style: Variable 'args' is assigned a value that is never used. [unreadVariable] if ( isDuplicate(messageID, data) ) { error = eError_Duplicate; args = { messageID }; ok = false; return ok; } // TODO: goto lErr; } don't log it just ignore and return false. ^ -sources/cloudsync/CloudSyncController.cpp:603:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:620:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ -sources/cloudsync/CloudSyncController.cpp:667:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] +sources/cloudsync/CloudSyncController.cpp:684:27: style: Variable 'error' is assigned a value that is never used. [unreadVariable] Errors_Enum error = eError_Unknown; ^ +sources/device/DeviceView.h:68:32: style: The condition 'vData.mAccepted || !vData.mAccepted && vData.mReason!=0' is equivalent to 'vData.mAccepted || vData.mReason!=0'. [redundantCondition] + return vData.mAccepted || (!vData.mAccepted && vData.mReason != 0 ); + ^ sources/model/MAbstractDynamic.h:80:5: warning: Member variable 'MAbstractDynamic::_data' is not initialized in the constructor. [uninitMemberVar] MAbstractDynamic () { } ^ @@ -423,13 +417,13 @@ sources/storage/Logger.cpp:43:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning '_logFileNamePrefix' a value by passing the value to the constructor in the initialization list. [useInitializationList] _logFileNamePrefix = QFileInfo(qApp->applicationFilePath()).baseName(); ^ -sources/storage/Logger.cpp:244:10: style: Condition 'ok' is always true [knownConditionTrueFalse] +sources/storage/Logger.cpp:243:10: style: Condition 'ok' is always true [knownConditionTrueFalse] if ( ok && ! setLogPath(LogType::eLogAppED) ) ok = false; ^ -sources/storage/Logger.cpp:243:15: note: Assignment 'ok=true', assigned value is 1 +sources/storage/Logger.cpp:242:15: note: Assignment 'ok=true', assigned value is 1 bool ok = true; ^ -sources/storage/Logger.cpp:244:10: note: Condition 'ok' is always true +sources/storage/Logger.cpp:243:10: note: Condition 'ok' is always true if ( ok && ! setLogPath(LogType::eLogAppED) ) ok = false; ^ sources/storage/Logger.cpp:189:17: style: The scope of the variable 'notified' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: @@ -447,6 +441,9 @@ When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static bool notified = false; ^ +sources/storage/Settings.cpp:34:13: style: Variable 'err' is assigned a value that is never used. [unreadVariable] + int err = Settings::Settings_Error::eError_None; + ^ sources/storage/TreatmentLog.cpp:487:10: style: Condition '!ok' is always false [knownConditionTrueFalse] if ( ! ok ) { ^ @@ -471,7 +468,7 @@ sources/view/settings/VNetworkModel.cpp:280:9: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm] { ^ -sources/view/settings/VSettings.cpp:184:17: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] +sources/view/settings/VSettings.cpp:199:17: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] keyList += keys.join(""); ^ unittests/tst_messaging.cpp:294:18: style: Variable 'msg.actionId' is reassigned a value before the old one has been used. [redundantAssignment] @@ -486,9 +483,6 @@ unittests/tst_views.cpp:711:26: style: Variable 'action' is assigned a value that is never used. [unreadVariable] GuiActionType action = GuiActionType::ID_AdjustParametersValidationRsp; ^ -sources/AlarmGenerator.cpp:72:0: style: The function 'ALARM_ID_UI_POST_FAILURE_SDCARD' is never used. [unusedFunction] - -^ unittests/tst_views.cpp:406:0: style: The function 'VCreateTreatment_check_init' is never used. [unusedFunction] ^ @@ -525,12 +519,24 @@ unittests/tst_views.cpp:35:0: style: The function 'VTreatmentAdjustmentsResponse_text_WAReason' is never used. [unusedFunction] ^ +sources/view/settings/VSettings.cpp:316:0: style: The function 'checkServicePasswordSet' is never used. [unusedFunction] + +^ unittests/tst_canbus.cpp:312:0: style: The function 'cleanup' is never used. [unusedFunction] ^ unittests/tst_acknow.cpp:164:0: style: The function 'cleanupTestCase' is never used. [unusedFunction] ^ +sources/utility/encryption.cpp:28:0: style: The function 'cryptClose' is never used. [unusedFunction] + +^ +sources/utility/encryption.cpp:22:0: style: The function 'cryptFormat' is never used. [unusedFunction] + +^ +sources/utility/encryption.cpp:16:0: style: The function 'cryptOpen' is never used. [unusedFunction] + +^ sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentPatientConnectionBegin.cpp:49:0: style: The function 'doBegin' is never used. [unusedFunction] ^ @@ -576,13 +582,13 @@ sources/view/hd/adjustment/disinfect/VDisinfectAdjustDisinfect.cpp:147:0: style: The function 'doDisinfectROPermeate' is never used. [unusedFunction] ^ -sources/gui/GuiView.cpp:250:0: style: The function 'doExportListInsert' is never used. [unusedFunction] +sources/gui/GuiView.cpp:256:0: style: The function 'doExportListInsert' is never used. [unusedFunction] ^ -sources/gui/GuiView.cpp:293:0: style: The function 'doExportListPercent' is never used. [unusedFunction] +sources/gui/GuiView.cpp:299:0: style: The function 'doExportListPercent' is never used. [unusedFunction] ^ -sources/gui/GuiView.cpp:281:0: style: The function 'doExportListSelect' is never used. [unusedFunction] +sources/gui/GuiView.cpp:287:0: style: The function 'doExportListSelect' is never used. [unusedFunction] ^ sources/view/VTreatmentCreate(legacy).cpp:504:0: style: The function 'doGetPrescriptionParameterValues' is never used. [unusedFunction] @@ -591,15 +597,27 @@ sources/view/settings/VDateTime.cpp:44:0: style: The function 'doInit' is never used. [unusedFunction] ^ -sources/device/DeviceView.cpp:89:0: style: The function 'doInitBluetoothPairedQuery' is never used. [unusedFunction] +sources/device/DeviceView.cpp:130:0: style: The function 'doInitBluetoothPairedQuery' is never used. [unusedFunction] ^ -sources/device/DeviceView.cpp:65:0: style: The function 'doInitBluetoothPairedReset' is never used. [unusedFunction] +sources/device/DeviceView.cpp:105:0: style: The function 'doInitBluetoothPairedReset' is never used. [unusedFunction] ^ -sources/device/DeviceView.cpp:32:0: style: The function 'doInitBrightness' is never used. [unusedFunction] +sources/device/DeviceView.cpp:33:0: style: The function 'doInitBrightness' is never used. [unusedFunction] ^ +sources/device/DeviceView.cpp:67:0: style: The function 'doInitCryptSetup' is never used. [unusedFunction] + +^ +sources/device/DeviceView.cpp:219:0: style: The function 'doInitDecommission' is never used. [unusedFunction] + +^ +sources/device/DeviceView.cpp:190:0: style: The function 'doInitFactoryReset' is never used. [unusedFunction] + +^ +sources/device/DeviceView.cpp:155:0: style: The function 'doInitRootSSHAccess' is never used. [unusedFunction] + +^ sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentInitTreatment.cpp:49:0: style: The function 'doInitiate' is never used. [unusedFunction] ^ @@ -687,10 +705,10 @@ sources/view/hd/alarm/VAlarmStatus.cpp:201:0: style: The function 'instructionValues' is never used. [unusedFunction] ^ -sources/view/settings/VSettings.cpp:286:0: style: The function 'isPasswordMatch' is never used. [unusedFunction] +sources/view/settings/VSettings.cpp:256:0: style: The function 'isPasswordValid' is never used. [unusedFunction] ^ -sources/view/settings/VSettings.cpp:241:0: style: The function 'isPasswordValid' is never used. [unusedFunction] +sources/view/settings/VSettings.cpp:298:0: style: The function 'isServicePasswordMatch' is never used. [unusedFunction] ^ unittests/tst_logging.cpp:66:0: style: The function 'logDatum' is never used. [unusedFunction] @@ -717,16 +735,16 @@ sources/bluetooth/BluetoothInterface.cpp:1207:0: style: The function 'mimic' is never used. [unusedFunction] ^ -sources/storage/FileHandler.cpp:167:0: style: The function 'moveFolder' is never used. [unusedFunction] +sources/utility/encryption.cpp:34:0: style: The function 'mkfsExt4' is never used. [unusedFunction] ^ -unittests/tst_logging.cpp:149:0: style: The function 'readUnknown' is never used. [unusedFunction] +sources/storage/FileHandler.cpp:168:0: style: The function 'moveFolder' is never used. [unusedFunction] ^ -sources/storage/FileHandler.cpp:208:0: style: The function 'removeFiles' is never used. [unusedFunction] +unittests/tst_logging.cpp:149:0: style: The function 'readUnknown' is never used. [unusedFunction] ^ -sources/storage/FileHandler.cpp:188:0: style: The function 'removeFolder' is never used. [unusedFunction] +sources/storage/FileHandler.cpp:209:0: style: The function 'removeFiles' is never used. [unusedFunction] ^ sources/bluetooth/BluetoothInterface.cpp:1287:0: style: The function 'requestBattery' is never used. [unusedFunction] @@ -747,9 +765,12 @@ unittests/tst_logging.cpp:142:0: style: The function 'setLogPath_T' is never used. [unusedFunction] ^ -sources/MainTimer.cpp:116:0: style: The function 'timerEvent' is never used. [unusedFunction] +sources/MainTimer.cpp:137:0: style: The function 'timerEvent' is never used. [unusedFunction] ^ +sources/storage/FileHandler.cpp:301:0: style: The function 'tmpUsable' is never used. [unusedFunction] + +^ unittests/tst_acknow.cpp:62:0: style: The function 'tst_AcknowModel_Init' is never used. [unusedFunction] ^ @@ -1308,7 +1329,7 @@ unittests/tst_utilities.cpp:204:0: style: The function 'tst_toStringList_RemoveDuplicate' is never used. [unusedFunction] ^ -sources/view/settings/VSettings.cpp:290:0: style: The function 'updatePassword' is never used. [unusedFunction] +sources/view/settings/VSettings.cpp:311:0: style: The function 'updateServicePassword' is never used. [unusedFunction] ^ sources/wifi/WifiInterface.cpp:936:0: style: The function 'variantListToSecurityTypes' is never used. [unusedFunction]