From 67d73da8986b1c49ff54774769ca7f0391b6cfad Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sun, 29 Aug 2021 16:52:43 +0200 Subject: [PATCH] Fixed issue with missing method in old Raspberry Pi OS protobuf implementation --- src/raspberrypi/rascsi.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index 09e3196b..47b53393 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -536,8 +536,9 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) PbDeviceProperties *properties = new PbDeviceProperties(); types_properties->set_allocated_properties(properties); properties->set_supports_file(true); - auto block_sizes = device_factory.GetSasiSectorSizes(); - properties->mutable_block_sizes()->Add(block_sizes.begin(), block_sizes.end()); + for (const auto& block_size : device_factory.GetSasiSectorSizes()) { + properties->add_block_sizes(block_size); + } types_properties = serverInfo.add_types_properties(); types_properties->set_type(SCHD); @@ -545,8 +546,9 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) types_properties->set_allocated_properties(properties); properties->set_protectable(true); properties->set_supports_file(true); - block_sizes = device_factory.GetScsiSectorSizes(); - properties->mutable_block_sizes()->Add(block_sizes.begin(), block_sizes.end()); + for (const auto& block_size : device_factory.GetScsiSectorSizes()) { + properties->add_block_sizes(block_size); + } types_properties = serverInfo.add_types_properties(); types_properties->set_type(SCRM); @@ -556,7 +558,9 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) properties->set_removable(true); properties->set_lockable(true); properties->set_supports_file(true); - properties->mutable_block_sizes()->Add(block_sizes.begin(), block_sizes.end()); + for (const auto& block_size : device_factory.GetScsiSectorSizes()) { + properties->add_block_sizes(block_size); + } types_properties = serverInfo.add_types_properties(); types_properties->set_type(SCMO); @@ -566,8 +570,9 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) properties->set_removable(true); properties->set_lockable(true); properties->set_supports_file(true); - auto capacities = device_factory.GetMoCapacities(); - properties->mutable_capacities()->Add(capacities.begin(), capacities.end()); + for (const auto& capacity : device_factory.GetMoCapacities()) { + properties->add_capacities(capacity); + } types_properties = serverInfo.add_types_properties(); types_properties->set_type(SCCD);