Skip to content

Commit a9210e5

Browse files
committed
Cleanup
1 parent 16508f9 commit a9210e5

File tree

16 files changed

+46
-63
lines changed

16 files changed

+46
-63
lines changed

api/python/src/ELF/objects/pyDynamicEntryRpath.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void create<DynamicEntryRpath>(nb::module_& m) {
4848
[] (const DynamicEntryRpath& obj) {
4949
return LIEF::py::safe_string(obj.rpath());
5050
},
51-
nb::overload_cast<const std::string&>(&DynamicEntryRpath::rpath),
51+
nb::overload_cast<std::string>(&DynamicEntryRpath::rpath),
5252
"The actual rpath as a string"_doc)
5353

5454
.def_prop_rw("paths",

api/python/src/PE/objects/resources/pyResourceVarFileInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void create<ResourceVarFileInfo>(nb::module_& m) {
4848

4949
.def_prop_rw("translations",
5050
nb::overload_cast<>(&ResourceVarFileInfo::translations),
51-
nb::overload_cast<const std::vector<uint32_t>&>(&ResourceVarFileInfo::translations),
51+
nb::overload_cast<std::vector<uint32_t>>(&ResourceVarFileInfo::translations),
5252
R"delim(
5353
List of languages that the application supports
5454

include/LIEF/ELF/DynamicEntryRpath.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class LIEF_API DynamicEntryRpath : public DynamicEntry {
5959
return rpath_;
6060
}
6161

62-
void rpath(const std::string& name) {
62+
void rpath(std::string name) {
6363
rpath_ = std::move(name);
6464
}
6565

@@ -71,7 +71,7 @@ class LIEF_API DynamicEntryRpath : public DynamicEntry {
7171
DynamicEntryRpath& insert(size_t pos, const std::string& path);
7272

7373
//! Append the given ``path``
74-
DynamicEntryRpath& append(const std::string& path);
74+
DynamicEntryRpath& append(std::string path);
7575

7676
//! Remove the given ``path``
7777
DynamicEntryRpath& remove(const std::string& path);

include/LIEF/PE/resources/ResourceVarFileInfo.hpp

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#ifndef LIEF_PE_RESOURCE_VAR_FILE_INFO_H
1717
#define LIEF_PE_RESOURCE_VAR_FILE_INFO_H
1818
#include <ostream>
19-
#include <sstream>
2019
#include <cstdint>
2120
#include <vector>
2221

2322
#include "LIEF/visibility.h"
2423

2524
#include "LIEF/Object.hpp"
25+
2626
namespace LIEF {
2727
namespace PE {
2828

@@ -42,41 +42,57 @@ class LIEF_API ResourceVarFileInfo : public Object {
4242
public:
4343
ResourceVarFileInfo();
4444
ResourceVarFileInfo(uint16_t type, std::u16string key);
45-
ResourceVarFileInfo(const ResourceVarFileInfo&);
46-
ResourceVarFileInfo& operator=(const ResourceVarFileInfo&);
47-
~ResourceVarFileInfo() override;
45+
ResourceVarFileInfo(const ResourceVarFileInfo&) = default;
46+
ResourceVarFileInfo& operator=(const ResourceVarFileInfo&) = default;
47+
~ResourceVarFileInfo() override = default;
4848

4949
//! The type of data in the version resource
5050
//! * ``1`` if it contains text data
5151
//! * ``0`` if it contains binary data
52-
uint16_t type() const;
52+
uint16_t type() const {
53+
return type_;
54+
}
5355

5456
//! Signature of the structure:
5557
//! Must be the unicode string "VarFileInfo"
56-
const std::u16string& key() const;
58+
const std::u16string& key() const {
59+
return key_;
60+
}
5761

5862
//! List of languages that the application supports
5963
//!
6064
//! The **least** significant 16-bits must contain a Microsoft language identifier,
6165
//! and the **most** significant 16-bits must contain the PE::CODE_PAGES
6266
//! Either **most** or **least** 16-bits can be zero, indicating that the file is language or code page independent.
63-
const std::vector<uint32_t>& translations() const;
64-
std::vector<uint32_t>& translations();
67+
const std::vector<uint32_t>& translations() const {
68+
return translations_;
69+
}
70+
71+
std::vector<uint32_t>& translations() {
72+
return translations_;
73+
}
74+
75+
void type(uint16_t type) {
76+
type_ = type;
77+
}
6578

66-
void type(uint16_t type);
79+
void key(std::u16string key) {
80+
key_ = std::move(key);
81+
}
6782

68-
void key(const std::u16string& key);
6983
void key(const std::string& key);
7084

71-
void translations(const std::vector<uint32_t>& translations);
85+
void translations(std::vector<uint32_t> translations) {
86+
translations_ = std::move(translations);
87+
}
7288

7389
void accept(Visitor& visitor) const override;
7490

7591

7692
LIEF_API friend std::ostream& operator<<(std::ostream& os, const ResourceVarFileInfo& entry);
7793

7894
private:
79-
uint16_t type_ = 0;
95+
uint16_t type_ = 0;
8096
std::u16string key_;
8197
std::vector<uint32_t> translations_;
8298

include/LIEF/PE/signature/Signature.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class LIEF_API Signature : public Object {
4747
static std::vector<uint8_t> hash(const std::vector<uint8_t>& input, ALGORITHMS algo) {
4848
return hash(input.data(), input.size(), algo);
4949
}
50+
5051
static std::vector<uint8_t> hash(const uint8_t* buffer, size_t size, ALGORITHMS algo);
5152

5253
public:

include/LIEF/PE/signature/SignatureParser.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class LIEF_API SignatureParser {
6868
SignatureParser& operator=(const SignatureParser&) = delete;
6969
private:
7070

71-
~SignatureParser();
72-
SignatureParser();
71+
~SignatureParser() = default;
72+
SignatureParser() = default;
7373

7474
static result<Signature> parse_signature(BinaryStream& stream);
7575

include/LIEF/iterators.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ref_iterator {
7979
return *this;
8080
}
8181

82-
void swap(ref_iterator& other) {
82+
void swap(ref_iterator& other) noexcept {
8383
std::swap(const_cast<add_lvalue_reference_t<remove_const_t<DT>>>(container_),
8484
const_cast<add_lvalue_reference_t<remove_const_t<DT>>>(other.container_));
8585
std::swap(it_, other.it_);
@@ -330,7 +330,7 @@ class filter_iterator {
330330
return *this;
331331
}
332332

333-
void swap(filter_iterator& other) {
333+
void swap(filter_iterator& other) noexcept {
334334
std::swap(const_cast<remove_const_t<DT>&>(container_), const_cast<remove_const_t<DT>&>(other.container_));
335335
std::swap(it_, other.it_);
336336
std::swap(filters_, other.filters_);

src/ELF/DynamicEntryRpath.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ void DynamicEntryRpath::paths(const std::vector<std::string>& paths) {
4444
});
4545
}
4646

47-
DynamicEntryRpath& DynamicEntryRpath::append(const std::string& path) {
47+
DynamicEntryRpath& DynamicEntryRpath::append(std::string path) {
4848
std::vector<std::string> paths = this->paths();
49-
paths.push_back(path);
49+
paths.push_back(std::move(path));
5050
this->paths(paths);
5151
return *this;
5252
}

src/ELF/ObjectFileLayout.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
#include <LIEF/ELF/Section.hpp>
2222
#include <LIEF/ELF/Symbol.hpp>
2323
#include <LIEF/iostream.hpp>
24-
#include <ELF/DataHandler/Handler.hpp>
24+
25+
#include "ELF/DataHandler/Handler.hpp"
2526

2627
#include "logging.hpp"
2728
#include "Layout.hpp"

src/MachO/DyldChainedFixups.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ std::ostream& DyldChainedFixups::print(std::ostream& os) const {
116116

117117
if (const auto* lib = bind.library()) {
118118
libname = lib->name();
119-
auto pos = libname.rfind("/");
119+
auto pos = libname.rfind('/');
120120
if (pos != std::string::npos) {
121121
libname = libname.substr(pos + 1);
122122
}

0 commit comments

Comments
 (0)