[ox] Address CLion warnings

This commit is contained in:
Gary Talent 2021-02-27 02:38:18 -06:00
parent 44f4d67c80
commit 70168286ab
13 changed files with 10 additions and 39 deletions

View File

@ -9,12 +9,10 @@
// make sure asserts are enabled for the test file
#undef NDEBUG
#include <iostream>
#include <assert.h>
#include <map>
#include <vector>
#include <string>
#include <ox/fs/fs.hpp>
#include <ox/std/std.hpp>
#include <ox/fs/filestore/filestoretemplate.hpp>
#include <ox/fs/filesystem/filesystem.hpp>

View File

@ -7,7 +7,6 @@
*/
#include <ox/std/byteswap.hpp>
#include <ox/std/memops.hpp>
#include "err.hpp"
#include "presenceindicator.hpp"
@ -44,11 +43,7 @@ void FieldPresenceIndicator::setFields(int fields) noexcept {
m_maskLen = (fields / 8 + 1) - (fields % 8 == 0);
}
int FieldPresenceIndicator::getFields() const noexcept {
return m_fields;
}
void FieldPresenceIndicator::setMaxLen(int maxLen) noexcept {
void FieldPresenceIndicator::setMaxLen(int maxLen) noexcept {
m_maskLen = maxLen;
}

View File

@ -28,9 +28,7 @@ class FieldPresenceIndicator {
void setFields(int) noexcept;
int getFields() const noexcept;
void setMaxLen(int) noexcept;
void setMaxLen(int) noexcept;
int getMaxLen() const noexcept;

View File

@ -13,7 +13,6 @@
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <ox/mc/mc.hpp>
#include <ox/model/model.hpp>

View File

@ -216,7 +216,6 @@ Error MetalClawWriter::appendInteger(I val) noexcept {
oxReturnError(m_fieldPresence.set(m_field, fieldSet));
m_field++;
return OxError(0);
;
}
template<typename T>

View File

@ -10,7 +10,6 @@
#include <iostream>
#include <map>
#include <string>
#include <ox/model/model.hpp>
#include <ox/oc/oc.hpp>

View File

@ -126,8 +126,6 @@ class OX_PACKED NodeBuffer {
[[nodiscard]] ItemPtr ptr(size_t offset);
[[nodiscard]] ItemPtr ptr(void *item);
[[nodiscard]] ItemPtr malloc(size_t size);
Error free(ItemPtr item);
@ -159,9 +157,7 @@ class OX_PACKED NodeBuffer {
template<typename F>
Error compact(F cb = [](uint64_t, ItemPtr) {});
void truncate();
private:
private:
uint8_t *data();
};
@ -268,7 +264,7 @@ typename NodeBuffer<size_t, Item>::ItemPtr NodeBuffer<size_t, Item>::malloc(size
size_t fullSize = size + sizeof(Item);
if (m_header.size - m_header.bytesUsed >= fullSize) {
auto last = lastItem();
size_t addr = 0;
size_t addr;
if (last.valid()) {
addr = last.offset() + last.size();
} else {
@ -422,11 +418,6 @@ Error NodeBuffer<size_t, Item>::compact(F cb) {
return OxError(0);
}
template<typename size_t, typename Item>
void NodeBuffer<size_t, Item>::truncate() {
m_header.size = m_header.bytesUsed;
}
template<typename size_t, typename Item>
uint8_t *NodeBuffer<size_t, Item>::data() {
return reinterpret_cast<uint8_t*>(ptr(sizeof(*this)).get());

View File

@ -9,18 +9,13 @@
// make sure asserts are enabled for the test file
#undef NDEBUG
#include <iostream>
#include <assert.h>
#include <array>
#include <map>
#include <vector>
#include <string>
#include <ox/ptrarith/nodebuffer.hpp>
#include <ox/fs/fs.hpp>
#include <ox/std/std.hpp>
#include <ox/fs/filestore/filestoretemplate.hpp>
#include <ox/fs/filesystem/filesystem.hpp>
using namespace std;
using namespace ox;

View File

@ -7,11 +7,9 @@
*/
#if defined(OX_USE_STDLIB)
#include <bitset>
#include <iostream>
#endif
#include "defines.hpp"
#include "stacktrace.hpp"
#include "trace.hpp"

View File

@ -22,7 +22,7 @@ class OX_PACKED Random {
public:
Random();
Random(RandomSeed seed);
explicit Random(RandomSeed seed);
uint64_t gen();
};

View File

@ -177,7 +177,7 @@ std::size_t String::len() const noexcept {
}
std::size_t String::bytes() const noexcept {
std::size_t i = 0;
std::size_t i;
for (i = 0; i < m_buff.size() && m_buff[i]; i++);
return i + 1; // add one for null terminator
}

View File

@ -25,25 +25,25 @@ std::map<std::string, std::function<int()>> tests = {
{
"ABCDEFG != HIJKLMN",
[]() {
return !(ox_memcmp("ABCDEFG", "HIJKLMN", 7) < 0);
return ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0;
}
},
{
"HIJKLMN != ABCDEFG",
[]() {
return !(ox_memcmp("HIJKLMN", "ABCDEFG", 7) > 0);
return ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0;
}
},
{
"ABCDEFG == ABCDEFG",
[]() {
return !(ox_memcmp("ABCDEFG", "ABCDEFG", 7) == 0);
return ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0;
}
},
{
"ABCDEFGHI == ABCDEFG",
[]() {
return !(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) == 0);
return ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0;
}
},
{

View File

@ -9,7 +9,6 @@
#if defined(OX_USE_STDLIB)
#include <iomanip>
#include <iostream>
#include <stdio.h>
#endif
#include "trace.hpp"