diff --git a/tdutils/td/utils/port/MemoryMapping.cpp b/tdutils/td/utils/port/MemoryMapping.cpp index 234026ac..722adde3 100644 --- a/tdutils/td/utils/port/MemoryMapping.cpp +++ b/tdutils/td/utils/port/MemoryMapping.cpp @@ -82,9 +82,9 @@ Result MemoryMapping::create_from_file(const FileFd &file_fd, con auto fixed_begin = begin / page_size * page_size; auto data_offset = begin - fixed_begin; - auto data_size = end - fixed_begin; + auto data_size = narrow_cast(end - fixed_begin); - void *data = mmap(nullptr, narrow_cast(data_size), PROT_READ, MAP_PRIVATE, fd, narrow_cast(fixed_begin)); + void *data = mmap(nullptr, data_size, PROT_READ, MAP_PRIVATE, fd, narrow_cast(fixed_begin)); if (data == MAP_FAILED) { return OS_ERROR("mmap call failed"); }