diff --git a/asam_cmp_capture_module/src/capture_fb.cpp b/asam_cmp_capture_module/src/capture_fb.cpp index 01563f0..ce7c679 100644 --- a/asam_cmp_capture_module/src/capture_fb.cpp +++ b/asam_cmp_capture_module/src/capture_fb.cpp @@ -120,7 +120,7 @@ void CaptureFb::statusLoop() ethernetWrapper->sendPacket(e); - for (int i = 0; i < captureStatus.getInterfaceStatusCount(); ++i) + for (SizeT i = 0; i < captureStatus.getInterfaceStatusCount(); ++i) { encodedData = encoders.encode(1, captureStatus.getInterfaceStatus(i).getPacket(), encoderContext); for (const auto& e : encodedData) diff --git a/asam_cmp_capture_module/src/input_descriptors_validator.cpp b/asam_cmp_capture_module/src/input_descriptors_validator.cpp index 51ca531..5df1e01 100644 --- a/asam_cmp_capture_module/src/input_descriptors_validator.cpp +++ b/asam_cmp_capture_module/src/input_descriptors_validator.cpp @@ -86,7 +86,7 @@ namespace if (inputDataDescriptorStruct.getCount() != referenceDataDescriptorStruct.getCount()) return false; - for (int i = 0; i < inputDataDescriptorStruct.getCount(); ++i) + for (SizeT i = 0; i < inputDataDescriptorStruct.getCount(); ++i) { if (!checkDataDescriptor(inputDataDescriptorStruct.getItemAt(i), referenceDataDescriptorStruct.getItemAt(i))) return false; diff --git a/asam_cmp_capture_module/src/stream_fb.cpp b/asam_cmp_capture_module/src/stream_fb.cpp index bb742f0..51d68cb 100644 --- a/asam_cmp_capture_module/src/stream_fb.cpp +++ b/asam_cmp_capture_module/src/stream_fb.cpp @@ -426,7 +426,7 @@ void createAnalogPayloadWithInternalScaling(ASAM::CMP::AnalogPayload& payload, payload.setSampleOffset(analogDataOffset); std::vector scaledData(sampleCount); - for (int i = 0; i < sampleCount; ++i) + for (size_t i = 0; i < sampleCount; ++i) { scaledData[i] = std::round((rawData[i] - analogDataOffset) / analogDataScale); } diff --git a/asam_cmp_capture_module/tests/test_analog_messages.cpp b/asam_cmp_capture_module/tests/test_analog_messages.cpp index 5cfeacf..cc28545 100644 --- a/asam_cmp_capture_module/tests/test_analog_messages.cpp +++ b/asam_cmp_capture_module/tests/test_analog_messages.cpp @@ -76,7 +76,7 @@ class AnalogMessagesTest : public testing::Test void testAnalogPackets(bool setScale); template - bool checkSamples(const ASAM::CMP::AnalogPayload& analogPayload, int& receivedSamples); + bool checkSamples(const ASAM::CMP::AnalogPayload& analogPayload, size_t& receivedSamples); protected: TimeStub timeStub; @@ -97,7 +97,7 @@ class AnalogMessagesTest : public testing::Test }; template -bool AnalogMessagesTest::checkSamples(const ASAM::CMP::AnalogPayload& analogPayload, int& receivedSamples) +bool AnalogMessagesTest::checkSamples(const ASAM::CMP::AnalogPayload& analogPayload, size_t& receivedSamples) { auto rawData = reinterpret_cast(analogPayload.getData()); auto receivedSamplesCnt = analogPayload.getSamplesCount(); @@ -150,7 +150,7 @@ void AnalogMessagesTest::testAnalogPackets(bool setScale) auto chPrivate = analogChannel.asPtr(); chPrivate->collectSamples(curTime); - int receivedSamples = 0; + size_t receivedSamples = 0; auto checker = [&]() -> bool { std::scoped_lock lock{packedReceivedSync}; diff --git a/asam_cmp_capture_module/tests/test_interface.cpp b/asam_cmp_capture_module/tests/test_interface.cpp index 89054a0..21f5b9d 100644 --- a/asam_cmp_capture_module/tests/test_interface.cpp +++ b/asam_cmp_capture_module/tests/test_interface.cpp @@ -249,7 +249,7 @@ TEST_F(InterfaceFbTest, TestInterfaceStatusWithStreamsReceived) const uint8_t* receivedVendorData = static_cast(lastReceivedPacket.getPayload()).getVendorData(); - for (int i = 0; i < vendorDataLen; ++i) + for (size_t i = 0; i < vendorDataLen; ++i) { if (vendorData[i] != receivedVendorData[i]) return false; diff --git a/asam_cmp_common_lib/src/network_manager_fb.cpp b/asam_cmp_common_lib/src/network_manager_fb.cpp index d6209bb..2fbfa8f 100644 --- a/asam_cmp_common_lib/src/network_manager_fb.cpp +++ b/asam_cmp_common_lib/src/network_manager_fb.cpp @@ -29,12 +29,10 @@ void NetworkManagerFb::addNetworkAdaptersProperty() ListPtr devicesNames = ethernetWrapper->getEthernetDevicesNamesList(); ListPtr devicesDescriptions = ethernetWrapper->getEthernetDevicesDescriptionsList(); - int selectedDeviceInd = 0; - for (int i = 0; i < devicesNames.getCount(); ++i) + for (SizeT i = 0; i < devicesNames.getCount(); ++i) { if (ethernetWrapper->setDevice(devicesNames[i])) { - selectedDeviceInd = i; selectedEthernetDeviceName = devicesNames[i]; break; } @@ -49,9 +47,6 @@ void NetworkManagerFb::addNetworkAdaptersProperty() objPtr.addProperty(prop); objPtr.getOnPropertyValueWrite(propName) += [this, propName](PropertyObjectPtr& obj, PropertyValueEventArgsPtr& args) { - // setPropertyValueInternal( - // String("InterfaceId").asPtr(true), BaseObjectPtr(interfaceId).asPtr(true), false, false, false); - StringPtr oldName = objPtr.getPropertySelectionValue("NetworkAdaptersNames"); int oldInd = objPtr.getPropertyValue("NetworkAdaptersNames"); diff --git a/asam_cmp_data_sink/tests/test_capture_fb.cpp b/asam_cmp_data_sink/tests/test_capture_fb.cpp index 705351c..27d5c12 100644 --- a/asam_cmp_data_sink/tests/test_capture_fb.cpp +++ b/asam_cmp_data_sink/tests/test_capture_fb.cpp @@ -42,7 +42,7 @@ TEST_F(CaptureFbTest, FunctionBlockType) TEST_F(CaptureFbTest, AvailableFunctionBlockTypes) { auto availableTypes = captureFb.getAvailableFunctionBlockTypes(); - ASSERT_EQ(availableTypes.getCount(), 1); + ASSERT_EQ(availableTypes.getCount(), 1u); ASSERT_TRUE(availableTypes.hasKey("AsamCmpInterface")); ASSERT_EQ(availableTypes.get("AsamCmpInterface"), asam_cmp_common_lib::InterfaceCommonFb::CreateType()); } @@ -127,17 +127,17 @@ TEST_F(CaptureFbTest, TestCreateInterface) { ProcedurePtr createProc = captureFb.getPropertyValue("AddInterface"); - ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 0); + ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 0u); createProc(); createProc(); - ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 2); + ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 2u); int lstId = captureFb.getFunctionBlocks().getItemAt(1).getPropertyValue("InterfaceId"); ProcedurePtr removeProc = captureFb.getPropertyValue("RemoveInterface"); removeProc(0); - ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 1); + ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 1u); ASSERT_EQ(captureFb.getFunctionBlocks().getItemAt(0).getPropertyValue("InterfaceId"), lstId); } diff --git a/asam_cmp_data_sink/tests/test_data_sink_fb.cpp b/asam_cmp_data_sink/tests/test_data_sink_fb.cpp index 5265265..1ce522a 100644 --- a/asam_cmp_data_sink/tests/test_data_sink_fb.cpp +++ b/asam_cmp_data_sink/tests/test_data_sink_fb.cpp @@ -85,7 +85,7 @@ TEST_F(DataSinkFbTest, FunctionBlockType) TEST_F(DataSinkFbTest, AvailableFunctionBlockTypes) { auto availableTypes = funcBlock.getAvailableFunctionBlockTypes(); - ASSERT_EQ(availableTypes.getCount(), 1); + ASSERT_EQ(availableTypes.getCount(), 1u); ASSERT_TRUE(availableTypes.hasKey("AsamCmpCapture")); ASSERT_EQ(availableTypes.get("AsamCmpCapture"), CaptureFb::CreateType()); } @@ -110,7 +110,7 @@ TEST_F(DataSinkFbTest, AddCaptureModuleFromStatus) ProcedurePtr addCaptureModuleFromStatus = funcBlock.getPropertyValue("AddCaptureModuleFromStatus"); addCaptureModuleFromStatus(0); addCaptureModuleFromStatus(0); - ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 2); + ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 2u); auto captureModule = funcBlock.getFunctionBlocks()[0]; StringPtr propVal = captureModule.getPropertyValue("DeviceDescription"); @@ -130,7 +130,7 @@ TEST_F(DataSinkFbTest, AddCaptureModuleFromStatus) { return arg.hasProperty("InterfaceId") && (arg.getPropertyValue("InterfaceId") == targetInterfaceId); }); SearchFilterPtr interfaceFilter = search::Custom(isCorrectInterface); - ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1); + ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1u); auto interfaceFb = captureModule.getFunctionBlocks(interfaceFilter)[0]; int targetStreamId = 1; @@ -138,7 +138,7 @@ TEST_F(DataSinkFbTest, AddCaptureModuleFromStatus) { return arg.hasProperty("StreamId") && (arg.getPropertyValue("StreamId") == targetStreamId); }); SearchFilterPtr streamFilter = search::Custom(isCorrectStream); - ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1u); cmPacket->setDeviceId(3); statusHandler->processStatusPacket(cmPacket); @@ -154,26 +154,26 @@ TEST_F(DataSinkFbTest, AddCaptureModuleFromStatus) statusHandler->processStatusPacket(ifPacket); addCaptureModuleFromStatus(1); - ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 3); + ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 3u); captureModule = funcBlock.getFunctionBlocks()[2]; targetInterfaceId = 22; - ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1); + ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1u); interfaceFb = captureModule.getFunctionBlocks(interfaceFilter)[0]; targetStreamId = 1; - ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1u); targetInterfaceId = 33; - ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1); + ASSERT_EQ(captureModule.getFunctionBlocks(interfaceFilter).getCount(), 1u); interfaceFb = captureModule.getFunctionBlocks(interfaceFilter)[0]; targetStreamId = 3; - ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1u); targetStreamId = 5; - ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1u); targetStreamId = 10; - ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks(streamFilter).getCount(), 1u); } TEST_F(DataSinkFbTest, RemoveCaptureFromStatus) @@ -200,7 +200,7 @@ TEST_F(DataSinkFbTest, AddCaptureModuleEmpty) ProcedurePtr func = funcBlock.getPropertyValue("AddCaptureModuleEmpty"); func(); func(); - ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 2); + ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 2u); } TEST_F(DataSinkFbTest, UpdateDeviceInfo) @@ -229,7 +229,7 @@ TEST_F(DataSinkFbTest, RemoveCaptureModuleReadOnly) TEST_F(DataSinkFbTest, RemoveCaptureModule) { - ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 0); + ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 0u); ProcedurePtr addFunc = funcBlock.getPropertyValue("AddCaptureModuleEmpty"); addFunc(); auto captureFb = funcBlock.getFunctionBlocks().getItemAt(0); @@ -239,8 +239,8 @@ TEST_F(DataSinkFbTest, RemoveCaptureModule) ProcedurePtr removeFunc = funcBlock.getPropertyValue("RemoveCaptureModule"); removeFunc(0); - ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 0); - ASSERT_EQ(publisher.size(), 0); + ASSERT_EQ(funcBlock.getFunctionBlocks().getCount(), 0u); + ASSERT_EQ(publisher.size(), 0u); } TEST_F(DataSinkFbTest, DefaultDevicesIds) diff --git a/asam_cmp_data_sink/tests/test_interface_fb.cpp b/asam_cmp_data_sink/tests/test_interface_fb.cpp index f1eeea9..e9c11a6 100644 --- a/asam_cmp_data_sink/tests/test_interface_fb.cpp +++ b/asam_cmp_data_sink/tests/test_interface_fb.cpp @@ -49,7 +49,7 @@ TEST_F(InterfaceFbTest, FunctionBlockType) TEST_F(InterfaceFbTest, AvailableFunctionBlockTypes) { auto availableTypes = interfaceFb.getAvailableFunctionBlockTypes(); - ASSERT_EQ(availableTypes.getCount(), 1); + ASSERT_EQ(availableTypes.getCount(), 1u); ASSERT_TRUE(availableTypes.hasKey("AsamCmpStream")); ASSERT_EQ(availableTypes.get("AsamCmpStream"), modules::asam_cmp_data_sink_module::StreamFb::CreateType()); } @@ -71,7 +71,7 @@ TEST_F(InterfaceFbTest, CaptureModuleProperties) TEST_F(InterfaceFbTest, InterfaceId) { captureFb.getPropertyValue("AddInterface").execute(); - ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 2); + ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 2u); const auto interfaceFb2 = captureFb.getFunctionBlocks().getItemAt(1); @@ -117,7 +117,7 @@ TEST_F(InterfaceFbTest, AddRemoveStream) interfaceFb.getPropertyValue("RemoveStream").execute(0); - ASSERT_EQ(interfaceFb.getFunctionBlocks().getCount(), 1); + ASSERT_EQ(interfaceFb.getFunctionBlocks().getCount(), 1u); } TEST_F(InterfaceFbTest, TestBeginUpdateEndUpdate) diff --git a/asam_cmp_data_sink/tests/test_status_fb.cpp b/asam_cmp_data_sink/tests/test_status_fb.cpp index 51707a0..1b04b02 100644 --- a/asam_cmp_data_sink/tests/test_status_fb.cpp +++ b/asam_cmp_data_sink/tests/test_status_fb.cpp @@ -67,7 +67,7 @@ TEST_F(StatusFbTest, FunctionBlockType) TEST_F(StatusFbTest, CaptureModuleList) { ListPtr cmList = funcBlock.getPropertyValue("CaptureModuleList"); - ASSERT_EQ(cmList.getCount(), 0); + ASSERT_EQ(cmList.getCount(), 0u); EXPECT_THROW(funcBlock.setPropertyValue("CaptureModuleList", cmList), daq::AccessDeniedException); } diff --git a/asam_cmp_data_sink/tests/test_stream_fb.cpp b/asam_cmp_data_sink/tests/test_stream_fb.cpp index 0188ad4..b7db86f 100644 --- a/asam_cmp_data_sink/tests/test_stream_fb.cpp +++ b/asam_cmp_data_sink/tests/test_stream_fb.cpp @@ -135,7 +135,7 @@ TEST_F(StreamFbTest, StreamIdMax) TEST_F(StreamFbTest, SignalsCount) { const auto outputSignals = funcBlock.getSignalsRecursive(); - ASSERT_EQ(outputSignals.getCount(), 1); + ASSERT_EQ(outputSignals.getCount(), 1u); } TEST_F(StreamFbTest, SignalName) @@ -169,9 +169,9 @@ TEST_F(StreamFbTest, DefaultSignalDescriptors) TEST_F(StreamFbTest, RemoveStream) { interfaceFb.getPropertyValue("RemoveStream").execute(0); - ASSERT_EQ(interfaceFb.getFunctionBlocks().getCount(), 0); + ASSERT_EQ(interfaceFb.getFunctionBlocks().getCount(), 0u); - ASSERT_EQ(publisher.size(), 0); + ASSERT_EQ(publisher.size(), 0u); } TEST_F(StreamFbTest, RemoveAddStream) @@ -188,9 +188,9 @@ TEST_F(StreamFbTest, RemoveAddStream) TEST_F(StreamFbTest, RemoveInterface) { captureFb.getPropertyValue("RemoveInterface").execute(0); - ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 0); + ASSERT_EQ(captureFb.getFunctionBlocks().getCount(), 0u); - ASSERT_EQ(publisher.size(), 0); + ASSERT_EQ(publisher.size(), 0u); } class StreamFbCanPayloadTest : public StreamFbTest @@ -249,12 +249,12 @@ TEST_F(StreamFbCanPayloadTest, ChangeStreamId) publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); auto samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 0); + ASSERT_EQ(samplesCount, 0u); canPacket->setStreamId(newStreamId); publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 1); + ASSERT_EQ(samplesCount, 1u); } TEST_F(StreamFbCanPayloadTest, ChangeInterfaceId) @@ -268,12 +268,12 @@ TEST_F(StreamFbCanPayloadTest, ChangeInterfaceId) publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); auto samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 0); + ASSERT_EQ(samplesCount, 0u); canPacket->setInterfaceId(newInterfaceId); publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 1); + ASSERT_EQ(samplesCount, 1u); } TEST_F(StreamFbCanPayloadTest, ChangeDeviceId) @@ -287,12 +287,12 @@ TEST_F(StreamFbCanPayloadTest, ChangeDeviceId) publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); auto samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 0); + ASSERT_EQ(samplesCount, 0u); canPacket->setDeviceId(newDeviceId); publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 1); + ASSERT_EQ(samplesCount, 1u); } TEST_F(StreamFbCanPayloadTest, CanSignalDescriptors) @@ -338,13 +338,13 @@ TEST_F(StreamFbCanPayloadTest, ReadOutputCanSignal) publisher.publish({canPacket->getDeviceId(), canPacket->getInterfaceId(), canPacket->getStreamId()}, canPacket); const auto samplesCount = waitForSamples(reader); - ASSERT_EQ(samplesCount, 1); + ASSERT_EQ(samplesCount, 1u); CANData sample; uint64_t domainSample; size_t count = 1; reader.readWithDomain(&sample, &domainSample, &count); - ASSERT_EQ(count, 1); + ASSERT_EQ(count, 1u); ASSERT_EQ(domainSample, canPacket->getTimestamp()); ASSERT_EQ(sample.arbId, arbId); ASSERT_EQ(sample.length, sizeof(canData));