summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2023-02-21 19:40:58 +0100
committerChristian Göttsche <cgzones@googlemail.com>2023-02-21 19:40:58 +0100
commit98d1813f2516aa4c771dd8824e7cada98393049f (patch)
treeb0d4b1c7006bc2ebfa9d21199f6f83fafba2114a
parentc00676a28af82f4c73c19916b803d7058f02d104 (diff)
downloadpatchelf-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.cc4
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();