Enable gcc wall and werror.

This commit is contained in:
James Grogan 2023-01-23 11:06:30 +00:00
parent 990cde402b
commit 3fad113178
64 changed files with 347 additions and 314 deletions

View file

@ -15,12 +15,13 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
elseif(FALSE)
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
set(GCC_COVERAGE_LINK_FLAGS "-lgcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
elseif(CMAKE_COMPILER_IS_GNUCC)
#set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
#set(GCC_COVERAGE_LINK_FLAGS "-lgcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
endif()
add_subdirectory(src)

View file

@ -1,8 +1,9 @@
#include "Terminal.h"
Terminal::Terminal(TerminalType type, const std::string& label)
: mType(type),
mLabel(label)
: mLabel(label),
mType(type)
{
}
@ -15,4 +16,4 @@ Wire* Terminal::getConnection() const
void Terminal::setConnection(Wire* connection)
{
mConnection = connection;
}
}

View file

@ -12,6 +12,10 @@ int MidiChannelEventAdapter::readEvent(std::ifstream* file, char firstByte, Midi
int second_four_bits = 0xF;
int event_type = (firstByte & first_four_bits) >> 4;
int midi_channel = (firstByte & second_four_bits) >> 4;
(void) event_type;
(void) midi_channel;
unsigned byteCount = 0;
//std::cout << "Channel: " << midi_channel << std::endl;
@ -45,6 +49,7 @@ int MidiChannelEventAdapter::readEvent(std::ifstream* file, char firstByte, Midi
case MidiChannelEvent::Type::PROGRAM:
{
int value0 = *BinaryStream::getNextByteAsInt(file);
(void) value0;
byteCount ++;
break;
}

View file

@ -36,6 +36,7 @@ int MidiMetaEventAdapter::ReadEvent(std::ifstream* file, MetaMidiEvent* event, i
case MetaMidiEvent::Type::END_TRACK:
{
int length = *BinaryStream::getNextByteAsInt(file);
(void) length;
byteCount ++;
break;
}
@ -157,6 +158,7 @@ int MidiMetaEventAdapter::ReadKeySignatureEvent(std::ifstream* file, MetaMidiEve
{
unsigned byteCount = 0;
int length = *BinaryStream::getNextByteAsInt(file);
(void)length;
byteCount++;
MidiKeySignature keySig;
@ -170,6 +172,7 @@ int MidiMetaEventAdapter::ReadTimeCodeEvent(std::ifstream* file, MetaMidiEvent*
{
unsigned byteCount = 0;
int length = *BinaryStream::getNextByteAsInt(file);
(void)length;
byteCount++;
MidiSmtpeTimecode timeCode;

View file

@ -9,4 +9,5 @@ TEST_CASE(TestReadMidi, "audio")
reader.read(TestUtils::getTestDataDir() / "test.mid");
auto document = reader.getDocument();
(void)document;
};

View file

@ -4,7 +4,7 @@ void CyclicRedundancyChecker::createTable()
{
mTable = std::vector<unsigned long>(TABLE_SIZE, 0);
unsigned long c{0};
for (int n = 0; n < TABLE_SIZE; n++)
for (std::size_t n = 0; n < TABLE_SIZE; n++)
{
c = (unsigned long) n;
for (int k = 0; k < 8; k++)

View file

@ -77,7 +77,7 @@ unsigned Lz77Encoder::lookAheadForMatchingChars(unsigned distance)
search_char = getSearchBufferItem(static_cast<unsigned>(search_offset));
}
unsigned char lookahead_char = mLookaheadBuffer.getItem(idx);
if ((lookahead_char != search_char) || (idx == mMaxLookAheadBufferIndex))
if ((lookahead_char != search_char) || (static_cast<int>(idx) == mMaxLookAheadBufferIndex))
{
if (idx + 1>= mMinLengthMatchSize)
{

View file

@ -164,6 +164,7 @@ bool ZlibEncoder::decode()
unsigned char byte3 = *mInputStream->readNextByte();
uint32_t adler32 = (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3;
(void)adler32;
//std::cout << "Got adler 32 checksum " << adler32 << std::endl;
return valid;

View file

@ -38,6 +38,7 @@ bool DeflateBlock::isFinalBlock() const
bool DeflateBlock::read()
{
auto working_byte = *mInputStream->readNextByte();
(void)working_byte;
//std::cout << mInputStream->logNextNBytes(60);
//std::cout << "DeflateBlock::read location " << mInputStream->logLocation();
@ -77,6 +78,7 @@ bool DeflateBlock::readUncompressedStream()
auto byte2 = *mInputStream->readNextByte();
auto byte3 = *mInputStream->readNextByte();
uint16_t len_check = (byte2 << 8) | byte3;
(void) len_check;
//std::cout << "Check block 2: " << ByteUtils::toString(byte2) << std::endl;
//std::cout << "Check block 3: " << ByteUtils::toString(byte3) << std::endl;

View file

@ -13,10 +13,10 @@ void HuffmanCodeLengthTable::buildCompressedLengthSequence()
RunLengthEncoder rl_encoder;
auto rle_encoded = rl_encoder.encode(mInputLengthSequence);
for (const auto& entry : rle_encoded)
{
//for (const auto& entry : rle_encoded)
//{
//std::cout << "Got rle " << static_cast<int>(entry.first) << " | " << entry.second << std::endl;
}
//}
mCompressedLengthSequence.clear();
for (const auto& entry : rle_encoded)
@ -117,7 +117,7 @@ bool HuffmanCodeLengthTable::readNextSymbol(unsigned& result, BitStream* stream)
while(!found)
{
auto valid = stream->readNextNBits(delta, buffer);
stream->readNextNBits(delta, buffer);
//std::cout << "Got buffer " << ByteUtils::toString(buffer) << std::endl;;
unsigned hold = buffer;

View file

@ -17,6 +17,7 @@ void HuffmanEncoder::dumpNode(RawNode<CountPair>* node, unsigned depth) const
}
auto data = node->getData();
(void)data;
std::string prefix(depth, '_');

View file

@ -211,7 +211,7 @@ void HuffmanStream::readSymbols()
else if (symbol <= 264)
{
auto length = 3 + symbol - 257;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol <= 268)
@ -220,7 +220,7 @@ void HuffmanStream::readSymbols()
mInputStream->readNextNBits(1, extra);
auto length = 11 + 2*(symbol - 265) + extra;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol <= 272)
@ -229,7 +229,7 @@ void HuffmanStream::readSymbols()
mInputStream->readNextNBits(2, extra);
auto length = 19 + 4*(symbol - 269) + extra;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol <= 276)
@ -238,7 +238,7 @@ void HuffmanStream::readSymbols()
mInputStream->readNextNBits(3, extra);
auto length = 35 + 8*(symbol - 273) + extra;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol <= 280)
@ -247,7 +247,7 @@ void HuffmanStream::readSymbols()
mInputStream->readNextNBits(4, extra);
auto length = 67 + 16*(symbol - 277) + extra;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol <= 284)
@ -256,13 +256,13 @@ void HuffmanStream::readSymbols()
mInputStream->readNextNBits(5, extra);
auto length = 131 + 32*(symbol - 281) + extra;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
else if (symbol == 285)
{
auto length = 258;
const auto valid_dist = readNextDistanceSymbol(distance);
readNextDistanceSymbol(distance);
copyFromBuffer(length, distance);
}
}

View file

@ -3,8 +3,8 @@
HttpHeader::HttpHeader()
: mContentType("text / html"),
mHttpVersion("1.1")
: mHttpVersion("1.1"),
mContentType("text / html")
{
}

View file

@ -6,7 +6,7 @@
bool BufferBitStream::isFinished() const
{
return mByteOffset == mBuffer.size() - 1;
return mByteOffset == static_cast<int>(mBuffer.size()) - 1;
}
std::vector<unsigned char> BufferBitStream::peekNextNBytes(unsigned n) const
@ -35,7 +35,7 @@ std::vector<unsigned char> BufferBitStream::peekNextNBytes(unsigned n) const
std::optional<unsigned char> BufferBitStream::readNextByte()
{
if (mByteOffset + 1 == mBuffer.size())
if (mByteOffset + 1 == static_cast<int>(mBuffer.size()))
{
return std::nullopt;
}
@ -76,3 +76,19 @@ void BufferBitStream::writeByte(unsigned char data, bool checkOverflow)
}
void BufferBitStream::writeBytes(const std::vector<unsigned char> data)
{
std::copy(data.begin(), data.end(), std::back_inserter(mBuffer));
}
const std::vector<unsigned char>& BufferBitStream::getBuffer() const
{
return mBuffer;
}
void BufferBitStream::reset()
{
BitStream::reset();
mBuffer.clear();
}

View file

@ -8,31 +8,21 @@
class BufferBitStream : public BitStream
{
public:
const std::vector<unsigned char>& getBuffer() const;
bool isFinished() const override;
std::vector<unsigned char> peekNextNBytes(unsigned n) const override;
std::optional<unsigned char> readNextByte() override;
void reset() override;
void setBuffer(const std::vector<unsigned char>& data);
void writeByte(unsigned char data, bool checkOverflow = true) override;
void writeBytes(const std::vector<unsigned char> data) override
{
std::copy(data.begin(), data.end(), std::back_inserter(mBuffer));
}
const std::vector<unsigned char>& getBuffer() const
{
return mBuffer;
}
void reset() override
{
BitStream::reset();
mBuffer.clear();
}
void writeBytes(const std::vector<unsigned char> data) override;
private:
unsigned mBufferSize{0};

View file

@ -12,9 +12,9 @@ using LS = XmlParser::LineState;
using DS = XmlParser::DocumentState;
XmlParser::XmlParser()
: mDocument(XmlDocument::Create()),
mDocumentState(XmlParser::DocumentState::Await_Prolog),
: mDocumentState(XmlParser::DocumentState::Await_Prolog),
mLineState(XmlParser::LineState::Await_Tag_Open),
mDocument(XmlDocument::Create()),
mWorkingElements()
{

View file

@ -1,30 +1,31 @@
#include "Circle.h"
Circle::Circle(const Point& centre, double radius)
: mCentre(centre),
mRadius(radius)
: mRadius(radius),
mCentre(centre)
{
mMinorRadius = mRadius;
mMinorRadius = mRadius;
}
const Point& Circle::getLocation() const
{
return mCentre;
return mCentre;
}
double Circle::getRadius() const
{
return mRadius;
return mRadius;
}
double Circle::getMinorRadius() const
{
return mMinorRadius;
return mMinorRadius;
}
void Circle::setMinorRadius(double radius)
{
mMinorRadius = radius;
mMinorRadius = radius;
}
void Circle::sample(SparseGrid<bool>* grid) const
@ -34,19 +35,19 @@ void Circle::sample(SparseGrid<bool>* grid) const
bool Circle::isEllipse() const
{
return mRadius != mMinorRadius;
return mRadius != mMinorRadius;
}
Bounds Circle::getBounds() const
{
double minX = mCentre.getX() - mRadius;
double maxX = mCentre.getX() + mRadius;
double minY = mCentre.getY() - mMinorRadius;
double maxY = mCentre.getY() + mMinorRadius;
return { minX, maxX, minY, maxY };
double minX = mCentre.getX() - mRadius;
double maxX = mCentre.getX() + mRadius;
double minY = mCentre.getY() - mMinorRadius;
double maxY = mCentre.getY() + mMinorRadius;
return { minX, maxX, minY, maxY };
}
Circle::Type Circle::getType() const
{
return Type::CIRCLE;
}
return Type::CIRCLE;
}

View file

@ -6,26 +6,26 @@
class Circle : public AbstractGeometricItem
{
public:
Circle(const Point& centre, double radius = 0.5);
Circle(const Point& centre, double radius = 0.5);
const Point& getLocation() const override;
const Point& getLocation() const override;
double getRadius() const;
double getRadius() const;
double getMinorRadius() const;
double getMinorRadius() const;
Bounds getBounds() const override;
Bounds getBounds() const override;
Type getType() const override;
Type getType() const override;
bool isEllipse() const;
bool isEllipse() const;
void setMinorRadius(double radius);
void setMinorRadius(double radius);
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>* grid) const override;
private:
double mMinorRadius{ 0.5 };
double mRadius{ 0.5 };
Point mCentre;
};
double mMinorRadius{ 0.5 };
double mRadius{ 0.5 };
Point mCentre;
};

View file

@ -9,9 +9,10 @@ namespace ntk {
}
Rectangle::Rectangle(const Point& bottomLeft, double width, double height)
: mBottomLeft(bottomLeft),
mHeight(height),
mWidth(width)
: mBottomLeft(bottomLeft),
mWidth(width),
mHeight(height)
{
}

View file

@ -1,12 +1,11 @@
#include "NetworkManager.h"
#ifdef __linux__
#include "UnixSocketInterface.h"
#else
#include "Win32WebServer.h"
#endif
#include <iostream>
NetworkManager::NetworkManager()
: mActiveSockets(),
mSocketInterface()
@ -44,9 +43,9 @@ void NetworkManager::runHttpServer(AbstractWebApp* webApp)
}
auto socket = Socket::Create();
mSocketInterface->InitializeSocket(socket);
mSocketInterface->Listen(socket);
mSocketInterface->Run(socket);
mSocketInterface->initializeSocket(socket);
mSocketInterface->socketListen(socket);
mSocketInterface->run(socket);
#endif
}
@ -63,8 +62,8 @@ void NetworkManager::runHttpClient()
}
auto socket = Socket::Create();
mSocketInterface->InitializeSocket(socket, "127.0.0.1");
mSocketInterface->Write(socket, "Hello Friend");
mSocketInterface->initializeSocket(socket, "127.0.0.1");
mSocketInterface->socketWrite(socket, "Hello Friend");
}
void NetworkManager::shutDown()

View file

@ -11,7 +11,6 @@ class AbstractWebApp;
class NetworkManager
{
public:
NetworkManager();
~NetworkManager();

View file

@ -1,9 +1,10 @@
#include "Socket.h"
Socket::Socket()
: mPort(8888),
mMessage(),
mHandle(-1)
: mHandle(-1),
mPort(8888),
mMessage()
{
}
@ -13,12 +14,12 @@ Socket::~Socket()
}
void Socket::SetHandle(SocketHandle handle)
void Socket::setHandle(SocketHandle handle)
{
mHandle = handle;
}
Socket::SocketHandle Socket::GetHandle() const
Socket::SocketHandle Socket::getHandle() const
{
return mHandle;
}
@ -28,33 +29,33 @@ std::unique_ptr<Socket> Socket::Create()
return std::make_unique<Socket>();
}
std::string Socket::GetMessage() const
std::string Socket::getMessage() const
{
return mMessage;
}
void Socket::SetMessage(const std::string& message)
void Socket::setMessage(const std::string& message)
{
mMessage = message;
}
void Socket::SetPort(unsigned port)
void Socket::setPort(unsigned port)
{
mPort = port;
}
unsigned Socket::GetPort() const
unsigned Socket::getPort() const
{
return mPort;
}
std::string Socket::getAddress() const
{
return mAddress;
return mAddress;
}
void Socket::setAddress(const std::string& address)
{
mAddress = address;
mAddress = address;
}

View file

@ -14,23 +14,23 @@ public:
static std::unique_ptr<Socket> Create();
void SetPort(unsigned port);
void SetHandle(SocketHandle handle);
SocketHandle GetHandle() const;
unsigned GetPort() const;
std::string GetMessage() const;
void SetMessage(const std::string& message);
std::string getAddress() const;
SocketHandle getHandle() const;
unsigned getPort() const;
std::string getMessage() const;
void setPort(unsigned port);
void setHandle(SocketHandle handle);
void setMessage(const std::string& message);
void setAddress(const std::string& address);
private:
SocketHandle mHandle;
unsigned mPort{0};
std::string mMessage;

View file

@ -8,16 +8,15 @@ using SocketPtr = std::unique_ptr<Socket>;
class ISocketInterface
{
public:
ISocketInterface() = default;
virtual ~ISocketInterface() = default;
virtual void InitializeSocket(const SocketPtr& socket, const std::string& address = {}) = 0;
virtual void Listen(const SocketPtr& socket) = 0;
virtual void Run(const SocketPtr& socket) = 0;
virtual void initializeSocket(const SocketPtr& socket, const std::string& address = {}) = 0;
virtual void socketListen(const SocketPtr& socket) = 0;
virtual void run(const SocketPtr& socket) = 0;
virtual void Write(const SocketPtr& socket, const std::string& message) = 0;
virtual void socketWrite(const SocketPtr& socket, const std::string& message) = 0;
};
using ISocketInterfaceUPtr = std::unique_ptr<ISocketInterface>;

View file

@ -16,7 +16,7 @@
UnixSocketInterface::UnixSocketInterface()
: mBufferSize(1024)
{
mMessageHandler = std::make_unique<HttpMessageHandler>();
mMessageHandler = std::make_unique<HttpMessageHandler>();
}
std::unique_ptr<UnixSocketInterface> UnixSocketInterface::Create()
@ -29,26 +29,26 @@ UnixSocketInterface::~UnixSocketInterface()
}
void UnixSocketInterface::InitializeSocket(const SocketPtr& socketPtr, const std::string& address)
void UnixSocketInterface::initializeSocket(const SocketPtr& socketPtr, const std::string& address)
{
auto handle = ::socket(AF_INET, SOCK_STREAM, 0);
socketPtr->SetHandle(handle);
socketPtr->setHandle(handle);
if (!address.empty())
{
socketPtr->setAddress(address);
socketPtr->setAddress(address);
}
}
void UnixSocketInterface::Write(const SocketPtr& socket, const std::string& message)
void UnixSocketInterface::socketWrite(const SocketPtr& socket, const std::string& message)
{
if(socket->GetHandle() < 0)
if(socket->getHandle() < 0)
{
MLOG_ERROR("Error opening socket" );
return;
}
const auto port = static_cast<int>(socket->GetPort());
const auto port = static_cast<int>(socket->getPort());
struct sockaddr_in serv_addr;
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
@ -56,14 +56,14 @@ void UnixSocketInterface::Write(const SocketPtr& socket, const std::string& mess
inet_aton(socket->getAddress().c_str(), &serv_addr.sin_addr);
serv_addr.sin_port = htons(port);
int result = connect(socket->GetHandle(), (struct sockaddr *)&serv_addr, sizeof(serv_addr));
int result = connect(socket->getHandle(), (struct sockaddr *)&serv_addr, sizeof(serv_addr));
if(result< 0)
{
MLOG_ERROR("Error connecting to socket" );
return;
}
auto n = write(socket->GetHandle(), message.c_str(), message.length());
auto n = write(socket->getHandle(), message.c_str(), message.length());
if (n < 0)
{
std::cerr << "Error on write" << std::endl;
@ -71,44 +71,44 @@ void UnixSocketInterface::Write(const SocketPtr& socket, const std::string& mess
}
char buffer[BUFFER_SIZE] = {0};
int res = read(socket->GetHandle(), buffer, BUFFER_SIZE);
int res = read(socket->getHandle(), buffer, BUFFER_SIZE);
if (res < 0)
{
std::cerr << "Error on read" << std::endl;
return;
}
socket->SetMessage(buffer);
socket->setMessage(buffer);
std::cout << "Here is the message: " << buffer << std::endl;
}
void UnixSocketInterface::Listen(const SocketPtr& socket)
void UnixSocketInterface::socketListen(const SocketPtr& socket)
{
if(socket->GetHandle() < 0)
if(socket->getHandle() < 0)
{
std::cerr << "Error opening socket" << std::endl;
return;
}
const auto port = static_cast<int>(socket->GetPort());
const auto port = static_cast<int>(socket->getPort());
struct sockaddr_in serv_addr;
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(port);
int result = bind(socket->GetHandle(), (struct sockaddr *)&serv_addr, sizeof(serv_addr));
int result = bind(socket->getHandle(), (struct sockaddr *)&serv_addr, sizeof(serv_addr));
if(result< 0)
{
std::cerr << "Error binding socket" << std::endl;
return;
}
listen(socket->GetHandle(), 5);
listen(socket->getHandle(), 5);
}
void UnixSocketInterface::Run(const SocketPtr& socket)
void UnixSocketInterface::run(const SocketPtr& socket)
{
if(socket->GetHandle() < 0)
if(socket->getHandle() < 0)
{
std::cerr << "Error opening socket" << std::endl;
return;
@ -118,7 +118,7 @@ void UnixSocketInterface::Run(const SocketPtr& socket)
socklen_t clilen = sizeof(cli_addr);
while(true)
{
const auto new_socket_handle = accept(socket->GetHandle(), (struct sockaddr *) &cli_addr, &clilen);
const auto new_socket_handle = accept(socket->getHandle(), (struct sockaddr *) &cli_addr, &clilen);
if (new_socket_handle < 0)
{
std::cerr << "Error on accept" << std::endl;
@ -132,7 +132,7 @@ void UnixSocketInterface::Run(const SocketPtr& socket)
std::cerr << "Error on read" << std::endl;
return;
}
socket->SetMessage(buffer);
socket->setMessage(buffer);
std::cout << "Here is the message: " << buffer << std::endl;
const auto response = mMessageHandler->onMessage(buffer);

View file

@ -10,25 +10,22 @@ class ISocketMessageHandler;
class UnixSocketInterface : public ISocketInterface
{
public:
UnixSocketInterface();
virtual ~UnixSocketInterface();
static std::unique_ptr<UnixSocketInterface> Create();
void InitializeSocket(const SocketPtr& socket, const std::string& address = {}) override;
void initializeSocket(const SocketPtr& socket, const std::string& address = {}) override;
void Listen(const SocketPtr& socket) override;
void socketListen(const SocketPtr& socket) override;
void Write(const SocketPtr& socket, const std::string& message) override;
void socketWrite(const SocketPtr& socket, const std::string& message) override;
void Run(const SocketPtr& socket) override;
void run(const SocketPtr& socket) override;
private:
static constexpr unsigned BUFFER_SIZE{1024};
std::size_t mBufferSize { 0 };
std::unique_ptr<ISocketMessageHandler> mMessageHandler;

View file

@ -18,8 +18,9 @@
#include <filesystem>
MainApplication::MainApplication()
: mDatabaseManager(),
mCommandLineArgs()
: mCommandLineArgs(),
mDatabaseManager()
{
}

View file

@ -148,10 +148,11 @@ void AlsaInterface::play(AudioDevice* device, AudioSample* sample, unsigned dura
const auto data = sample->getChannelData(0);
int numFrames = mPeriodSize >> 2;
for(int count = 0; count < duration; count++)
for(unsigned count = 0; count < duration; count++)
{
const auto offset= count*4*numFrames;
unsigned char frame[4] = {data[offset], data[offset+1], data[offset+2], data[offset+3]};
unsigned char frame[4] = {static_cast<unsigned char>(data[offset]),
static_cast<unsigned char>(data[offset+1]), static_cast<unsigned char>(data[offset+2]), static_cast<unsigned char>(data[offset+3])};
while ((snd_pcm_writei(mHandle, frame, numFrames)) < 0)
{
snd_pcm_prepare(mHandle);

View file

@ -11,7 +11,7 @@ ImageBitStream::ImageBitStream(Image* image)
bool ImageBitStream::isFinished() const
{
return mByteOffset == mImage->getGrid()->getDataSize();
return mByteOffset == static_cast<int>(mImage->getGrid()->getDataSize());
}
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned n) const

View file

@ -118,7 +118,7 @@ void BasicPngWriter::writeDataChunks(const BufferBitStream& buffer)
std::size_t max_bytes{ 32000 };
auto num_dat_chunks = num_bytes / max_bytes + 1;
std::size_t offset = 0;
//std::size_t offset = 0;
for (std::size_t idx = 0; idx < num_dat_chunks; idx++)
{
auto length = max_bytes;
@ -126,6 +126,7 @@ void BasicPngWriter::writeDataChunks(const BufferBitStream& buffer)
{
length = num_bytes - num_dat_chunks * num_bytes;
}
(void)length;
//std::cout << "Writing idat length " << num_bytes << std::endl;
mOutStream->write(static_cast<uint32_t>(num_bytes));
@ -213,4 +214,4 @@ void BasicPngWriter::write(const Path& path, Image* image)
writeDataChunks(zlib_out_stream);
writeEndChunk();
}
}

View file

@ -74,6 +74,7 @@ bool PngReader::readChunk()
decodeData();
}
unsigned crcCheck = *BinaryStream::getNextDWord(mFile->getInHandle());
(void) crcCheck;
}
else if(chunkType == "IDAT")
{
@ -96,6 +97,7 @@ bool PngReader::readChunk()
}
unsigned crcCheck = *BinaryStream::getNextDWord(mFile->getInHandle());
(void) crcCheck;
}
return !lastChunk;
}
@ -193,7 +195,7 @@ std::unique_ptr<Image> PngReader::read()
PngFilter filter(mOutputStream.get(), image_bit_stream.get());
filter.decode();
return std::move(image);
return image;
}
void PngReader::decodeData()

View file

@ -56,12 +56,13 @@ std::string GlyphRunOutlines::toPostScriptPath()
}
FontGlyph::FontGlyph(unsigned width, unsigned height, int bearingX, int bearingY, int advanceX, std::unique_ptr<Image> image)
: mImage(std::move(image)),
:
mWidth(width),
mHeight(height),
mBearingX(bearingX),
mBearingY(bearingY),
mAdvanceX(advanceX)
mAdvanceX(advanceX),
mImage(std::move(image))
{
}

View file

@ -1,8 +1,9 @@
#include "FontItem.h"
FontItem::FontItem(const std::string& faceName, float size)
: mFaceName(faceName),
mSize(size)
: mSize(size),
mFaceName(faceName)
{
}
@ -30,4 +31,4 @@ const std::string& FontItem::getFaceName() const
float FontItem::getSize() const
{
return mSize;
}
}

View file

@ -10,9 +10,9 @@
#include "Scene.h"
DrawingContext::DrawingContext(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode)
: mSurface(surface),
mDrawingMode(requestedDrawingMode),
mFontsManager(fontsManager)
: mDrawingMode(requestedDrawingMode),
mFontsManager(fontsManager),
mSurface(surface)
{
mPainter = PainterFactory::Create(this, mDrawingMode);
@ -47,4 +47,4 @@ void DrawingContext::paint()
AbstractPainter* DrawingContext::getPainter() const
{
return mPainter.get();
}
}

View file

@ -3,9 +3,9 @@
#include "Node.h"
Edge::Edge(Node* node0, Node* node1, std::size_t id)
: mNode0(node0),
mNode1(node1),
mId(id)
: mId(id),
mNode0(node0),
mNode1(node1)
{
}

View file

@ -79,7 +79,7 @@ std::unique_ptr<TriMesh> MeshPrimitives::buildCircleAsTriMesh(std::size_t numSeg
std::unique_ptr<LineMesh> MeshPrimitives::buildCircleAsLineMesh(std::size_t numSegments)
{
VecPoints locations(numSegments);
const double delta_theta = (2.0*M_PI)/double(numSegments);
//const double delta_theta = (2.0*M_PI)/double(numSegments);
double theta = 0.0;
for(unsigned idx=0; idx<numSegments; idx++)
{
@ -176,7 +176,7 @@ std::unique_ptr<TriMesh> MeshPrimitives::buildRoundedRectangleAsTriMesh(double r
}
// Inner rect edges
std::size_t edge_offset = num_edges_per_fan*num_fans;
// std::size_t edge_offset = num_edges_per_fan*num_fans;
return nullptr;
}

View file

@ -11,8 +11,8 @@ Node::~Node()
}
Node::Node(const Point& p, std::size_t index)
: mPoint(p),
mIndex(index)
: mIndex(index),
mPoint(p)
{
}

View file

@ -110,7 +110,7 @@ void GridNode::update(SceneInfo* sceneInfo)
if (mDataDirty)
{
auto difference = mNumberX*mNumberY - mData.size();
//auto difference = mNumberX*mNumberY - mData.size();
mData.resize(mNumberX*mNumberY, {});
auto node_data = std::vector<std::vector<double> >(4*mNumberX*mNumberY);
@ -128,7 +128,7 @@ void GridNode::update(SceneInfo* sceneInfo)
if (mTransformIsDirty)
{
auto size = mHeight > mWidth ? mWidth : mHeight;
//auto size = mHeight > mWidth ? mWidth : mHeight;
//mBackgroundModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});
//mOutlineModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});

View file

@ -81,7 +81,7 @@ void MeshNode::update(SceneInfo* sceneInfo)
if (mTransformIsDirty)
{
auto size = mHeight > mWidth ? mWidth : mHeight;
//auto size = mHeight > mWidth ? mWidth : mHeight;
//mModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});
mTransformIsDirty = false;
}

View file

@ -7,9 +7,10 @@
#include <iostream>
Scene::Scene()
: mRootNode(std::make_unique<RootNode>()),
mSceneInfo(std::make_unique<SceneInfo>()),
mBackGroundColor(Color(255, 255, 255))
: mBackGroundColor(Color(255, 255, 255)),
mRootNode(std::make_unique<RootNode>()),
mSceneInfo(std::make_unique<SceneInfo>())
{
mRootNode->setName("Scene_RootNode");
}

View file

@ -7,139 +7,139 @@
#include "SvgShapeElements.h"
SvgNode::SvgNode(const Transform& transform)
: MaterialNode(transform)
: MaterialNode(transform)
{
}
void SvgNode::setContent(std::unique_ptr<SvgDocument> doc)
{
mContent = std::move(doc);
mContentDirty = true;
mContent = std::move(doc);
mContentDirty = true;
mChildren.clear();
mGeometryNodes.clear();
mChildren.clear();
mGeometryNodes.clear();
}
unsigned SvgNode::getContentWidth() const
{
return mContentWidth;
return mContentWidth;
}
unsigned SvgNode::getContentHeight() const
{
return mContentHeight;
return mContentHeight;
}
void SvgNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
{
if (!mContent->getRoot())
{
return;
}
if (!mContent->getRoot())
{
return;
}
auto viewbox = mContent->getViewBox();
//auto viewbox = mContent->getViewBox();
for (const auto& svg_element : mContent->getRoot()->getChildren())
{
std::unique_ptr<GeometryNode> geom_node;
for (const auto& svg_element : mContent->getRoot()->getChildren())
{
std::unique_ptr<GeometryNode> geom_node;
if (svg_element->getTagName() == "circle")
{
onCircle(svg_element.get(), geom_node);
}
else if (svg_element->getTagName() == "path")
{
onPath(svg_element.get(), geom_node);
}
if (svg_element->getTagName() == "circle")
{
onCircle(svg_element.get(), geom_node);
}
else if (svg_element->getTagName() == "path")
{
onPath(svg_element.get(), geom_node);
}
AbstractVisualNode* raw_node{ nullptr };
if (geom_node)
{
raw_node = geom_node.get();
mGeometryNodes.push_back(std::move(geom_node));
}
AbstractVisualNode* raw_node{ nullptr };
if (geom_node)
{
raw_node = geom_node.get();
mGeometryNodes.push_back(std::move(geom_node));
}
if (raw_node)
{
addChild(raw_node);
}
}
if (raw_node)
{
addChild(raw_node);
}
}
}
void SvgNode::update(SceneInfo* sceneInfo)
{
if (mContent && mContentDirty)
{
createOrUpdateGeometry(sceneInfo);
mContentDirty = false;
}
if (mContent && mContentDirty)
{
createOrUpdateGeometry(sceneInfo);
mContentDirty = false;
}
if (mMaterialIsDirty)
{
if (mHasFillColor)
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setFillColor(mFillColor);
}
}
else
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setHasFillColor(false);
}
}
if (mMaterialIsDirty)
{
if (mHasFillColor)
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setFillColor(mFillColor);
}
}
else
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setHasFillColor(false);
}
}
if (mHasStrokeColor)
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setStrokeColor(mStrokeColor);
}
}
else
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setHasStrokeColor(false);
}
}
mMaterialIsDirty = false;
}
if (mHasStrokeColor)
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setStrokeColor(mStrokeColor);
}
}
else
{
for (const auto& geom_node : mGeometryNodes)
{
geom_node->setHasStrokeColor(false);
}
}
mMaterialIsDirty = false;
}
}
void SvgNode::onCircle(XmlElement* element, std::unique_ptr<GeometryNode>& node)
{
auto svg_circle = dynamic_cast<SvgCircle*>(element);
auto loc = svg_circle->getLocation();
auto radius = svg_circle->getRadius();
auto minor_radius = radius;
auto svg_circle = dynamic_cast<SvgCircle*>(element);
auto loc = svg_circle->getLocation();
auto radius = svg_circle->getRadius();
auto minor_radius = radius;
if (svg_circle->getType() == SvgCircle::Type::ELLIPSE)
{
minor_radius = svg_circle->getMinorRadius();
}
if (svg_circle->getType() == SvgCircle::Type::ELLIPSE)
{
minor_radius = svg_circle->getMinorRadius();
}
if (element->hasAttribute("transform"))
{
const auto transform = svg_circle->getTransform();
loc.move(transform.getLocation().getX(), transform.getLocation().getY());
radius *= transform.getScaleX();
minor_radius *= transform.getScaleY();
}
if (element->hasAttribute("transform"))
{
const auto transform = svg_circle->getTransform();
loc.move(transform.getLocation().getX(), transform.getLocation().getY());
radius *= transform.getScaleX();
minor_radius *= transform.getScaleY();
}
auto circle_node = std::make_unique<CircleNode>(loc, radius);
circle_node->setMinorRadius(minor_radius);
node = std::move(circle_node);
auto circle_node = std::make_unique<CircleNode>(loc, radius);
circle_node->setMinorRadius(minor_radius);
node = std::move(circle_node);
}
void SvgNode::onPath(XmlElement* element, std::unique_ptr<GeometryNode>& node)
{
auto svg_path = dynamic_cast<SvgPath*>(element);
auto svg_path = dynamic_cast<SvgPath*>(element);
Point loc;
auto path_node = std::make_unique<PathNode>(loc, svg_path->getPath());
node = std::move(path_node);
}
Point loc;
auto path_node = std::make_unique<PathNode>(loc, svg_path->getPath());
node = std::move(path_node);
}

View file

@ -48,7 +48,7 @@ std::unique_ptr<SvgDocument> SvgPainter::paint(Scene* scene, double width, doubl
}
}
return std::move(doc);
return doc;
}
void SvgPainter::paintMesh(SvgDocument* document, SceneModel* model, bool showOutline) const
@ -161,7 +161,6 @@ void SvgPainter::paintCircle(SvgDocument* document, SceneModel* model) const
{
auto model_circle = dynamic_cast<Circle*>(model->getGeometry());
auto is_ellipse = model_circle->getMinorRadius() != model_circle->getRadius();
auto circle = std::make_unique<SvgCircle>(model_circle->isEllipse() ? SvgCircle::Type::ELLIPSE : SvgCircle::Type::REGULAR);
circle->setRadius(model_circle->getRadius());
if (model_circle->isEllipse())
@ -223,5 +222,5 @@ std::unique_ptr<XmlAttribute> SvgPainter::toTransform(const Transform& transform
}
svg_transform->setValue(ops);
return std::move(svg_transform);
return svg_transform;
}

View file

@ -9,7 +9,6 @@ class TopBarMenu : public Widget
public:
void popupFrom(Widget* parent)
{
auto window = parent->getTopLevelWindow();
}

View file

@ -30,7 +30,6 @@ void VerticalSpacer::updateChildLocations()
{
double scaleSum = std::accumulate(mScales.begin(), mScales.end(), 0.0);
double offset = 0;
unsigned delta = mSize.mWidth / unsigned(mChildren.size());
for(std::size_t idx=0; idx<mChildren.size(); idx++)
{
auto& child = mChildren[idx];

View file

@ -29,5 +29,5 @@ std::unique_ptr<SvgNode> MediaResourceManager::getSvgIconNode(Resource::Icon::Sv
auto svg_node = std::make_unique<SvgNode>(Point(0.0, 0.0));
svg_node->setContent(std::move(svg_doc));
return std::move(svg_node);
}
return svg_node;
}

View file

@ -21,9 +21,9 @@ Widget::Widget()
: BoxGeometry(),
mRootNode(std::make_unique<TransformNode>()),
mChildren(),
mBorder(Theme::Sys::Color::Outline),
mBorderThickness(0),
mBackground(Theme::Sys::Color::Primary),
mBorder(Theme::Sys::Color::Outline),
mVisible(true)
{
mName = "Widget";

View file

@ -11,10 +11,10 @@
DesktopManager::DesktopManager(AbstractDesktopApp* application)
: mScreens(),
mKeyboard(Keyboard::Create()),
mUiApplication(application),
mEventManager(EventManager::Create()),
mFontsManager(FontsManager::Create()),
mThemeManager(std::make_unique<ThemeManager>())
mEventManager(EventManager::Create()),
mThemeManager(std::make_unique<ThemeManager>()),
mUiApplication(application)
{
mWindowManager = WindowManager::Create(this);
}

View file

@ -54,7 +54,7 @@ std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonPress(xcb_button_pre
auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->setScreenLocation(DiscretePoint(screen_x, screen_y));
ui_event->setAction(MouseEvent::Action::Pressed);
return ui_event;
}
@ -68,7 +68,7 @@ std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonRelease(xcb_button_p
auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->setScreenLocation(DiscretePoint(screen_x, screen_y));
ui_event->setAction(MouseEvent::Action::Released);
return ui_event;

View file

@ -55,7 +55,7 @@ bool XcbGlWindowInterface::initialize(xcb_window_t window)
return false;
}
if (auto context = glXGetCurrentContext())
if (glXGetCurrentContext())
{
MLOG_INFO("Has valid GL context");
}

View file

@ -148,12 +148,12 @@ void XcbInterface::createGraphicsContext()
}
auto gc = xcb_generate_id(mConnection);
xcb_drawable_t window = xcb_screen->GetNativeScreen()->root;
xcb_drawable_t window = xcb_screen->getNativeScreen()->root;
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
auto color = Color(240, 240, 240);
uint32_t values[2] = {color.getAsUInt32(), 0};
xcb_create_gc(mConnection, gc, window, mask, values);
xcb_screen->SetGraphicsContext(gc);
xcb_screen->setGraphicsContext(gc);
}
void XcbInterface::mapWindow(mt::Window* window)

View file

@ -13,17 +13,17 @@ std::unique_ptr<XcbScreen> XcbScreen::Create(xcb_screen_t* screen)
return std::make_unique<XcbScreen>(screen);
}
xcb_screen_t* XcbScreen::GetNativeScreen() const
xcb_screen_t* XcbScreen::getNativeScreen() const
{
return mNativeScreen;
}
void XcbScreen::SetGraphicsContext(unsigned gc)
void XcbScreen::setGraphicsContext(unsigned gc)
{
mGraphicsContext = gc;
}
unsigned XcbScreen::GetGraphicsContext() const
unsigned XcbScreen::getGraphicsContext() const
{
return mGraphicsContext;
}

View file

@ -1,4 +1,4 @@
#pragma
#pragma once
#include "IPlatformScreen.h"
@ -7,18 +7,17 @@ struct xcb_screen_t;
class XcbScreen : public IPlatformScreen
{
public:
XcbScreen(xcb_screen_t* screen);
virtual ~XcbScreen() = default;
static std::unique_ptr<XcbScreen> Create(xcb_screen_t* screen);
xcb_screen_t* GetNativeScreen() const;
unsigned getGraphicsContext() const;
void SetGraphicsContext(unsigned gc);
xcb_screen_t* getNativeScreen() const;
unsigned GetGraphicsContext() const;
void setGraphicsContext(unsigned gc);
private:
unsigned mGraphicsContext {0};

View file

@ -40,9 +40,9 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
const auto hwnd = xcb_generate_id(connection);
const uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
const uint32_t values[2] = {xcb_screen->GetNativeScreen()->white_pixel, eventMask};
const uint32_t values[2] = {xcb_screen->getNativeScreen()->white_pixel, eventMask};
xcb_window_t parent_hwnd = xcb_screen->GetNativeScreen()->root;
xcb_window_t parent_hwnd = xcb_screen->getNativeScreen()->root;
if (auto parent = window->getParent())
{
parent_hwnd = dynamic_cast<XcbWindow*>(parent->getPlatformWindow())->getHandle();
@ -56,7 +56,7 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
window->getWidth(), window->getHeight(), /* width, height */
10, /* border_width */
XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
xcb_screen->GetNativeScreen()->root_visual, /* visual */
xcb_screen->getNativeScreen()->root_visual, /* visual */
mask, values ); /* masks */
if (!window->getTitle().empty())
@ -68,7 +68,7 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
auto xcb_window = std::make_unique<XcbWindow>(window, hwnd, connection, xcbGlInterface);
const auto drawing_mode = xcbGlInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
//const auto drawing_mode = xcbGlInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
window->setPlatformWindow(std::move(xcb_window));
}
@ -98,7 +98,7 @@ void XcbWindow::beforePaint(mt::Screen* screen)
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
if (!mBackingImage)
{
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, xcb_screen->GetNativeScreen());
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, xcb_screen->getNativeScreen());
}
}
}
@ -112,9 +112,9 @@ void XcbWindow::afterPaint(mt::Screen* screen)
else
{
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
mBackingImage->update(mWindow, xcb_screen->GetNativeScreen(), mConnection, xcb_screen->GetGraphicsContext());
mBackingImage->update(mWindow, xcb_screen->getNativeScreen(), mConnection, xcb_screen->getGraphicsContext());
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, xcb_screen->GetGraphicsContext(), 0, 0 ,0 , 0, mWindow->getWidth(), mWindow->getHeight());
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, xcb_screen->getGraphicsContext(), 0, 0 ,0 , 0, mWindow->getWidth(), mWindow->getHeight());
}
}

View file

@ -109,6 +109,6 @@ std::unique_ptr<HtmlDocument> MarkdownConverter::convert(MarkdownDocument* markd
auto body_element = html_doc->getBodyElement();
convert(markdownDoc, body_element);
return std::move(html_doc);
return html_doc;
}

View file

@ -401,5 +401,5 @@ std::unique_ptr<MarkdownDocument> MarkdownParser::run(const std::string& content
run(content, doc.get());
return std::move(doc);
return doc;
}

View file

@ -22,10 +22,10 @@ TEST_CASE(TestHuffmanCodeLengthTable, "compression")
table.buildCompressedLengthSequence();
auto compressed_sequence = table.getCompressedLengthSequence();
for (auto entry : compressed_sequence)
{
//for (auto entry : compressed_sequence)
//{
// std::cout << "Count " << entry.first << " extra bits " << entry.second << std::endl;
}
//}
auto compressed_lengths = table.getCompressedLengthCounts();
for(unsigned idx = 0; idx<compressed_lengths.size(); idx++)
@ -53,10 +53,10 @@ TEST_CASE(TestLiteralsTable, "compression")
table.buildCompressedLengthSequence();
auto compressed_sequence = table.getCompressedLengthSequence();
for (auto entry : compressed_sequence)
{
//for (auto entry : compressed_sequence)
//{
// std::cout << "Code " << entry.first << " extra bits " << entry.second << std::endl;
}
//}
auto compressed_lengths = table.getCompressedLengthCounts();
for(unsigned idx = 0; idx<compressed_lengths.size(); idx++)

View file

@ -25,11 +25,11 @@ TEST_CASE(TestLz77Encoder, "compression")
encoder.encode();
auto hit_buffer = encoder.getHitBuffer();
for(const auto& hit : hit_buffer)
{
const auto& [length, distance, next_char] = hit;
//for(const auto& hit : hit_buffer)
//{
//const auto& [length, distance, next_char] = hit;
//std::cout << "Got hit " << length << " | " << distance << " | " << static_cast<int>(next_char) << std::endl;
}
//}
HuffmanEncoder huffman_encoder;
huffman_encoder.initializeTrees(hit_buffer);

View file

@ -37,6 +37,7 @@ TEST_CASE(TestReadBitStream, "core")
valid = stream.readNextNBits(3, buffer);
//std::cout << "Slice3 is " << ByteUtils::toString(buffer) << std::endl;
REQUIRE(valid);
}
TEST_CASE(TestWritingBitStream, "core")

View file

@ -14,6 +14,7 @@ TEST_CASE(TestReadByteUtils, "core")
auto slice = ByteUtils::getMBitsAtN(byte, 3, 3);
//std::cout << "Slice is " << ByteUtils::toString(slice) << std::endl;
(void) slice;
uint32_t input {12345678};
auto byte0 = ByteUtils::getByteN(input, 0);
@ -21,6 +22,11 @@ TEST_CASE(TestReadByteUtils, "core")
auto byte2 = ByteUtils::getByteN(input, 2);
auto byte3 = ByteUtils::getByteN(input, 3);
(void)byte0;
(void)byte1;
(void)byte2;
(void)byte3;
//std::cout << "Byte0 is " << ByteUtils::toString(byte0) << std::endl;
//std::cout << "Byte1 is " << ByteUtils::toString(byte1) << std::endl;
//std::cout << "Byte2 is " << ByteUtils::toString(byte2) << std::endl;
@ -28,10 +34,11 @@ TEST_CASE(TestReadByteUtils, "core")
//std::cout << "Mirroring" << std::endl;
auto out = ByteUtils::mirror(byte);
//auto out = ByteUtils::mirror(byte);
//std::cout << "Mirror is " << ByteUtils::toString(out) << std::endl;
unsigned hold = byte;
hold = (hold << 5) + 3;
(void)hold;
//std::cout << "Big val is " << ByteUtils::toString(hold, 16) << std::endl;
}

View file

@ -18,17 +18,20 @@ TEST_CASE(TestCircleBuffer, "core")
{
auto item = buffer.getItem(idx);
//std::cout << "Got item: " << idx << " " << item << std::endl;
(void)item;
}
for (auto item : {4, 5})
{
//std::cout << "Add item: " << item << std::endl;
//buffer.addItem(item);
(void)item;
}
for (std::size_t idx=0; idx<3; idx++)
{
auto item = buffer.getItem(idx);
//std::cout << "Got item: " << idx << " " << item << std::endl;
(void)item;
}
}

View file

@ -12,8 +12,8 @@ TEST_CASE(TestTomlReader, "core")
REQUIRE(themes_table);
for (const auto& items : themes_table->getKeyValuePairs())
{
//for (const auto& items : themes_table->getKeyValuePairs())
//{
//std::cout << "Got entry with key: " << items.first << " and val " << items.second << std::endl;
}
//}
}

View file

@ -16,7 +16,7 @@ int main(int argc, char *argv[])
auto args = CommandLineArgs::Create();
args->process(argc, argv);
auto result = TestCaseRunner::getInstance().run(args->getUserArgs());
TestCaseRunner::getInstance().run(args->getUserArgs());
#ifdef _WIN32
CoUninitialize();

View file

@ -10,9 +10,9 @@ public:
using TestCaseFunction = std::function<void()>;
TestCase(const std::string& name, const std::string& tags, TestCaseFunction func)
: mName(name),
mTags(tags),
mTestFunction(func)
: mTestFunction(func),
mName(name),
mTags(tags)
{
};

View file

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
#endif
TestCaseRunner::getInstance().setTestApplication(gui_app.get());
auto result = TestCaseRunner::getInstance().run(user_args);
TestCaseRunner::getInstance().run(user_args);
#ifdef _WIN32
CoUninitialize();