Skip to content

Commit 0adb7ad

Browse files
committed
make narrowing cast explicit
1 parent ad4fb7d commit 0adb7ad

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/util/elf_binary.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const typename Elf_binary<Arch>::Section_header& Elf_binary<Arch>::section_heade
149149

150150
template <typename Arch>
151151
const typename Elf_binary<Arch>::Span Elf_binary<Arch>::section_data(const Section_header& sh) const {
152-
return {data_.data() + sh.sh_offset, static_cast<std::ptrdiff_t>(sh.sh_size)};
152+
return {data_.data() + static_cast<std::size_t>(sh.sh_offset), static_cast<std::ptrdiff_t>(sh.sh_size)};
153153
};
154154

155155
template <typename Arch>

vmbuild/vmbuild.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ int main(int argc, char** argv)
211211
// 32-bit ELF
212212
if (binary_imgloc[EI_CLASS] == ELFCLASS32)
213213
{
214-
Elf_binary<Elf32> binary ({binary_imgloc, stat_binary.st_size});
214+
Elf_binary<Elf32> binary ({binary_imgloc, static_cast<size_t>(stat_binary.st_size)});
215215
binary.validate();
216216
srv_entry = binary.entry();
217217

@@ -232,7 +232,7 @@ int main(int argc, char** argv)
232232
// 64-bit ELF
233233
else if (binary_imgloc[EI_CLASS] == ELFCLASS64)
234234
{
235-
Elf_binary<Elf64> binary ({binary_imgloc, stat_binary.st_size});
235+
Elf_binary<Elf64> binary ({binary_imgloc, static_cast<size_t>(stat_binary.st_size)});
236236
binary.validate();
237237
srv_entry = binary.entry();
238238

0 commit comments

Comments
 (0)