diff --git a/frameworks/native/neural_network_runtime/neural_network_runtime.cpp b/frameworks/native/neural_network_runtime/neural_network_runtime.cpp index 89ca18aa592b7b1843a78503923ac78c104a3451..ee6540c43e62e0dd2dbbfe26ab48170f18d0c08a 100644 --- a/frameworks/native/neural_network_runtime/neural_network_runtime.cpp +++ b/frameworks/native/neural_network_runtime/neural_network_runtime.cpp @@ -702,8 +702,7 @@ NNRT_API bool OH_NNModel_HasCache(const char *cacheDir, const char *modelName, u return false; } - size_t sizeNumber = fileNumber; - if (sizeNumber <= 0 || sizeNumber > FILE_NUMBER_MAX) { + if (fileNumber <= 0 || static_cast(fileNumber) > FILE_NUMBER_MAX) { LOGE("OH_NNModel_HasCache fileNumber is invalid or more than 100"); std::filesystem::remove_all(cacheInfoPath); return false;