From 55e0aaeeef4e7a482b7fb85ac5c876a2d51816be Mon Sep 17 00:00:00 2001 From: Hector Li Date: Fri, 19 Apr 2024 14:21:34 -0700 Subject: [PATCH] fix android build issue (#20389) fix android build issue --- onnxruntime/test/shared_lib/test_model_loading.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/onnxruntime/test/shared_lib/test_model_loading.cc b/onnxruntime/test/shared_lib/test_model_loading.cc index 921441f90b..b7f6f7f4b9 100644 --- a/onnxruntime/test/shared_lib/test_model_loading.cc +++ b/onnxruntime/test/shared_lib/test_model_loading.cc @@ -248,7 +248,8 @@ void FileMmap(const ORTCHAR_T* file_path, void*& mapped_base) { ASSERT_TRUE(file_descriptor.IsValid()); struct stat sb; stat(file_path, &sb); - mapped_base = mmap(nullptr, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, file_descriptor.Get(), 0); + mapped_base = mmap(nullptr, narrow(sb.st_size), PROT_READ | PROT_WRITE, + MAP_PRIVATE, file_descriptor.Get(), 0); #endif return; } @@ -302,7 +303,7 @@ void TestLoadModelFromArrayWithExternalInitializerFromFileMmap(const std::string #else struct stat sb; stat(external_bin_path.c_str(), &sb); - int ret = munmap(mapped_base, sb.st_size); + int ret = munmap(mapped_base, narrow(sb.st_size)); ASSERT_TRUE(ret == 0); #endif