Fix coverity issue accepted/tizen/unified/20250310.024604 accepted/tizen/unified/x/20250310.042802
authorWoongsuk <ws77.cho@samsung.com>
Thu, 6 Mar 2025 01:00:12 +0000 (10:00 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Thu, 6 Mar 2025 01:09:15 +0000 (10:09 +0900)
add & keyword to avoid object copying

NativeLauncher/tool/ni_common.cc

index 9bd09ad57dca4ba9229f9bb09b5f8aa65149eaad..2a78afcac389a86db8f87c0fdf490bda51cff2a1 100644 (file)
@@ -1341,7 +1341,7 @@ ni_error_e regeneratePkgNI(NIOption* opt, bool removeOnly)
        std::sort(pkgList.begin(), pkgList.end());
        pkgList.erase(unique(pkgList.begin(), pkgList.end()), pkgList.end());
 
-       for (const auto pkg : pkgList) {
+       for (const auto& pkg : pkgList) {
                if (isReadOnlyPkg(pkg) && opt->flags & NI_FLAGS_SKIP_RO_APP) {
                        continue;
                }
@@ -1413,7 +1413,7 @@ static int regenTacCb(pkgmgrinfo_appinfo_h handle, void *userData)
                nugetPaths += concatPath(__DOTNET_DIR, nuget);
        }
 
-       for (auto& nuget : nugets) {
+       for (const auto& nuget : nugets) {
                createNIUnderTAC(concatPath(__DOTNET_DIR, nuget), nugetPaths, *pOpt);
        }