OSDN Git Service

Use direct assignment to replace memcpy
authoryinxu <yinxu@google.com>
Fri, 23 Jun 2017 00:10:59 +0000 (17:10 -0700)
committeryinxu <yinxu@google.com>
Fri, 23 Jun 2017 17:13:58 +0000 (10:13 -0700)
memcpy does not work here.

Test: Telephony sanity tests
Bug: 30954762
Change-Id: I1e1048fc358bd57df2b230caef16ebf84e255c0a

libril/ril_service.cpp

index 205436e..324e138 100644 (file)
@@ -1372,7 +1372,9 @@ Return<void> RadioImpl::startNetworkScan(int32_t serial, const NetworkScanReques
                 return Void();
         }
         // safe to copy to geran_bands because it's a union member
-        std::memcpy(&ras_to.bands.geran_bands, bands, ras_to.bands_length * sizeof(uint32_t));
+        for (size_t idx = 0; idx < ras_to.bands_length; ++idx) {
+            ras_to.bands.geran_bands[idx] = (RIL_GeranBands) (*bands)[idx];
+        }
     }
 
     s_vendorFunctions->onRequest(