diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-02-21 19:40:58 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2023-02-21 19:40:58 +0100 |
commit | 98d1813f2516aa4c771dd8824e7cada98393049f (patch) | |
tree | b0d4b1c7006bc2ebfa9d21199f6f83fafba2114a | |
parent | c00676a28af82f4c73c19916b803d7058f02d104 (diff) | |
download | patchelf-98d1813f2516aa4c771dd8824e7cada98393049f.tar.gz |
Drop unnecessary casts in getElfType()
Also declare the function static and warn if return value not used.
-rw-r--r-- | src/patchelf.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 8240361..4c94175 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -212,10 +212,10 @@ struct ElfType }; -ElfType getElfType(const FileContents & fileContents) +[[nodiscard]] static ElfType getElfType(const FileContents & fileContents) { /* Check the ELF header for basic validity. */ - if (fileContents->size() < static_cast<off_t>(sizeof(Elf32_Ehdr))) + if (fileContents->size() < sizeof(Elf32_Ehdr)) error("missing ELF header"); auto contents = fileContents->data(); |