[ox/mc] Replace int errors with Error

This commit is contained in:
Gary Talent 2019-03-04 21:16:30 -06:00
parent d51acfd033
commit 40dac704d0
3 changed files with 11 additions and 10 deletions

View File

@ -17,7 +17,7 @@ FieldPresenseMask::FieldPresenseMask(uint8_t *mask, std::size_t maxLen) {
m_maskLen = maxLen;
}
bool FieldPresenseMask::get(int i) {
bool FieldPresenseMask::get(int i) const {
if (i / 8 < m_maskLen) {
return (m_mask[i / 8] >> (i % 8)) & 1;
} else {
@ -25,7 +25,7 @@ bool FieldPresenseMask::get(int i) {
}
}
int FieldPresenseMask::set(int i, bool on) {
Error FieldPresenseMask::set(int i, bool on) {
if (i / 8 < m_maskLen) {
if (on) {
m_mask[i / 8] |= 1 << (i % 8);

View File

@ -8,6 +8,7 @@
#pragma once
#include <ox/std/error.hpp>
#include <ox/std/types.hpp>
namespace ox {
@ -21,17 +22,17 @@ class FieldPresenseMask {
public:
FieldPresenseMask(uint8_t *mask, std::size_t maxLen);
bool get(int i);
bool get(int i) const;
int set(int i, bool on);
Error set(int i, bool on);
constexpr void setFields(int) noexcept;
constexpr int getFields() noexcept;
constexpr int getFields() const noexcept;
constexpr void setMaxLen(int) noexcept;
constexpr int getMaxLen() noexcept;
constexpr int getMaxLen() const noexcept;
};
@ -39,7 +40,7 @@ constexpr void FieldPresenseMask::setFields(int fields) noexcept {
m_fields = fields;
}
constexpr int FieldPresenseMask::getFields() noexcept {
constexpr int FieldPresenseMask::getFields() const noexcept {
return m_fields;
}
@ -47,7 +48,7 @@ constexpr void FieldPresenseMask::setMaxLen(int maxLen) noexcept {
m_maskLen = maxLen;
}
constexpr int FieldPresenseMask::getMaxLen() noexcept {
constexpr int FieldPresenseMask::getMaxLen() const noexcept {
return m_maskLen;
}

View File

@ -103,7 +103,7 @@ Error MetalClawWriter::op(const char*, ox::Vector<T> *val) {
template<typename I>
Error MetalClawWriter::appendInteger(I val) {
int err = 0;
Error err = 0;
bool fieldSet = false;
if (val) {
if (m_buffIt + sizeof(I) < m_buffLen) {
@ -121,7 +121,7 @@ Error MetalClawWriter::appendInteger(I val) {
template<typename T>
Error MetalClawWriter::op(const char*, T *val, std::size_t len) {
int err = 0;
Error err = 0;
bool fieldSet = false;
if (len) {