diff --git a/rosen/samples/composer/hello_composer.cpp b/rosen/samples/composer/hello_composer.cpp index f9661c47b8..1976efbab9 100644 --- a/rosen/samples/composer/hello_composer.cpp +++ b/rosen/samples/composer/hello_composer.cpp @@ -37,7 +37,7 @@ namespace { sptr g_receiver = nullptr; } -void HelloComposer::Run(std::vector &runArgs) +void HelloComposer::Run(const std::vector &runArgs) { auto generator = CreateVSyncGenerator(); sptr vsyncController = new VSyncController(generator, 0); @@ -82,7 +82,7 @@ void HelloComposer::Run(std::vector &runArgs) void HelloComposer::ParseArgs(const std::vector &runArgs) { - for (std::string &arg : runArgs) { + for (const std::string &arg : runArgs) { if (arg == "--dump") { dump_ = true; } else if (arg == "--testClient") { diff --git a/rosen/samples/hello_native_buffer/hello_native_buffer.cpp b/rosen/samples/hello_native_buffer/hello_native_buffer.cpp index 1f8f1490d6..64c127a1e1 100644 --- a/rosen/samples/hello_native_buffer/hello_native_buffer.cpp +++ b/rosen/samples/hello_native_buffer/hello_native_buffer.cpp @@ -44,7 +44,7 @@ OH_NativeBuffer_Config config { .usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA }; -void CompareOH_NativeBufferConfig(OH_NativeBuffer_Config &config, const OH_NativeBuffer_Config &checkConfig) +void CompareOH_NativeBufferConfig(const OH_NativeBuffer_Config &config, const OH_NativeBuffer_Config &checkConfig) { if (config.width != checkConfig.width) { LOGE("OH_NativeBufferConfig width different"); diff --git a/utils/sync_fence/src/sync_fence.cpp b/utils/sync_fence/src/sync_fence.cpp index e669a2282a..55b874068d 100644 --- a/utils/sync_fence/src/sync_fence.cpp +++ b/utils/sync_fence/src/sync_fence.cpp @@ -186,7 +186,7 @@ ns_sec_t SyncFence::SyncFileReadTimestamp() return FENCE_PENDING_TIMESTAMP; } size_t signalFenceCount = 0; - for (auto &info : ptInfos) { + for (const auto &info : ptInfos) { if (info.status == SIGNALED) { signalFenceCount++; } @@ -194,7 +194,7 @@ ns_sec_t SyncFence::SyncFileReadTimestamp() if (signalFenceCount == ptInfos.size()) { // fence signaled uint64_t timestamp = 0; - for (auto &ptInfo : ptInfos) { + for (const auto &ptInfo : ptInfos) { if (ptInfo.timestampNs > timestamp) { timestamp = ptInfo.timestampNs; } @@ -265,7 +265,7 @@ FenceStatus SyncFence::GetStatus() return ERROR; } size_t signalFenceCount = 0; - for (auto &info : ptInfos) { + for (const auto &info : ptInfos) { if (info.status == SIGNALED) { signalFenceCount++; }