Fix warnings
This commit is contained in:
parent
f7c6db0132
commit
5935ea0691
|
@ -10,7 +10,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
|||
set(META_APP_DESCRIPTION "C++ library to read/write passwords from/to encrypted files")
|
||||
set(META_VERSION_MAJOR 5)
|
||||
set(META_VERSION_MINOR 0)
|
||||
set(META_VERSION_PATCH 4)
|
||||
set(META_VERSION_PATCH 5)
|
||||
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
|
||||
|
||||
# add project files
|
||||
|
|
14
io/entry.cpp
14
io/entry.cpp
|
@ -114,7 +114,7 @@ void Entry::setParent(NodeEntry *parent, int index)
|
|||
// attach the new parent
|
||||
if (parent) {
|
||||
if (index < 0 || static_cast<size_t>(index) >= parent->m_children.size()) {
|
||||
m_index = parent->m_children.size();
|
||||
m_index = static_cast<int>(parent->m_children.size());
|
||||
parent->m_children.push_back(this);
|
||||
} else {
|
||||
for (auto i = parent->m_children.insert(parent->m_children.begin() + index, this) + 1; i != parent->m_children.end(); ++i) {
|
||||
|
@ -265,7 +265,7 @@ NodeEntry::NodeEntry(const NodeEntry &other)
|
|||
for (Entry *const otherChild : other.m_children) {
|
||||
Entry *clonedChild = otherChild->clone();
|
||||
clonedChild->m_parent = this;
|
||||
clonedChild->m_index = m_children.size();
|
||||
clonedChild->m_index = static_cast<int>(m_children.size());
|
||||
m_children.push_back(clonedChild);
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ void NodeEntry::replaceChild(size_t at, Entry *newChild)
|
|||
|
||||
// do the actual assignment
|
||||
newChild->m_parent = this;
|
||||
newChild->m_index = at;
|
||||
newChild->m_index = static_cast<int>(at);
|
||||
m_children[at] = newChild;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ void NodeEntry::make(ostream &stream) const
|
|||
writer.writeByte(isExpandedByDefault() && m_extendedData.empty() ? 0x0 : 0x1); // version
|
||||
writer.writeLengthPrefixedString(label());
|
||||
if (!isExpandedByDefault() || !m_extendedData.empty()) {
|
||||
writer.writeUInt16BE(1 + m_extendedData.size()); // extended header is 1 byte long
|
||||
writer.writeUInt16BE(static_cast<std::uint16_t>(1 + m_extendedData.size())); // extended header is 1 byte long
|
||||
std::uint8_t flags = 0x00;
|
||||
if (isExpandedByDefault()) {
|
||||
flags |= 0x80;
|
||||
|
@ -406,7 +406,7 @@ void NodeEntry::make(ostream &stream) const
|
|||
writer.writeByte(flags);
|
||||
writer.writeString(m_extendedData);
|
||||
}
|
||||
writer.writeUInt32BE(m_children.size());
|
||||
writer.writeUInt32BE(static_cast<std::uint32_t>(m_children.size()));
|
||||
for (const Entry *const child : m_children) {
|
||||
child->make(stream);
|
||||
}
|
||||
|
@ -496,10 +496,10 @@ void AccountEntry::make(ostream &stream) const
|
|||
writer.writeByte(0x80 | (m_extendedData.empty() ? 0x0 : 0x1)); // version
|
||||
writer.writeLengthPrefixedString(label());
|
||||
if (!m_extendedData.empty()) {
|
||||
writer.writeUInt16BE(m_extendedData.size());
|
||||
writer.writeUInt16BE(static_cast<std::uint16_t>(m_extendedData.size()));
|
||||
writer.writeString(m_extendedData);
|
||||
}
|
||||
writer.writeUInt32BE(m_fields.size());
|
||||
writer.writeUInt32BE(static_cast<std::uint32_t>(m_fields.size()));
|
||||
for (const Field &field : m_fields) {
|
||||
field.make(stream);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void Field::make(ostream &stream) const
|
|||
writer.writeLengthPrefixedString(m_value);
|
||||
writer.writeByte(static_cast<std::uint8_t>(m_type));
|
||||
if (!m_extendedData.empty()) {
|
||||
writer.writeUInt16BE(m_extendedData.size());
|
||||
writer.writeUInt16BE(static_cast<std::uint16_t>(m_extendedData.size()));
|
||||
writer.writeString(m_extendedData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,7 +398,7 @@ void PasswordFile::save(PasswordFileSaveFlags options)
|
|||
}
|
||||
|
||||
// use already opened and writable file; otherwise re-open the file
|
||||
if (m_file.good() && m_file.is_open() && (m_file.flags() & ios_base::out)) {
|
||||
if (m_file.good() && m_file.is_open() && !(m_openOptions & PasswordFileOpenFlags::ReadOnly)) {
|
||||
m_file.seekp(0);
|
||||
} else {
|
||||
m_file.clear();
|
||||
|
|
|
@ -49,7 +49,7 @@ void OpenSslUtilsTests::testComputeSha256Sum()
|
|||
string sumAsHex;
|
||||
sumAsHex.reserve(64);
|
||||
for (unsigned char hashNumber : sum.data) {
|
||||
const string digits = numberToString(hashNumber, 16);
|
||||
const string digits = numberToString(hashNumber, static_cast<unsigned char>(16));
|
||||
sumAsHex.push_back(digits.size() < 2 ? '0' : digits.front());
|
||||
sumAsHex.push_back(digits.back());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue