Enable gcc wall and werror.
This commit is contained in:
parent
990cde402b
commit
3fad113178
64 changed files with 347 additions and 314 deletions
|
@ -16,11 +16,12 @@ 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}")
|
||||
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)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Terminal.h"
|
||||
|
||||
Terminal::Terminal(TerminalType type, const std::string& label)
|
||||
: mType(type),
|
||||
mLabel(label)
|
||||
: mLabel(label),
|
||||
mType(type)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -9,4 +9,5 @@ TEST_CASE(TestReadMidi, "audio")
|
|||
reader.read(TestUtils::getTestDataDir() / "test.mid");
|
||||
|
||||
auto document = reader.getDocument();
|
||||
(void)document;
|
||||
};
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -17,6 +17,7 @@ void HuffmanEncoder::dumpNode(RawNode<CountPair>* node, unsigned depth) const
|
|||
}
|
||||
|
||||
auto data = node->getData();
|
||||
(void)data;
|
||||
|
||||
std::string prefix(depth, '_');
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
|
||||
HttpHeader::HttpHeader()
|
||||
: mContentType("text / html"),
|
||||
mHttpVersion("1.1")
|
||||
: mHttpVersion("1.1"),
|
||||
mContentType("text / html")
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Circle.h"
|
||||
|
||||
Circle::Circle(const Point& centre, double radius)
|
||||
: mCentre(centre),
|
||||
mRadius(radius)
|
||||
: mRadius(radius),
|
||||
mCentre(centre)
|
||||
|
||||
{
|
||||
mMinorRadius = mRadius;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ namespace ntk {
|
|||
|
||||
Rectangle::Rectangle(const Point& bottomLeft, double width, double height)
|
||||
: mBottomLeft(bottomLeft),
|
||||
mHeight(height),
|
||||
mWidth(width)
|
||||
mWidth(width),
|
||||
mHeight(height)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -11,7 +11,6 @@ class AbstractWebApp;
|
|||
class NetworkManager
|
||||
{
|
||||
public:
|
||||
|
||||
NetworkManager();
|
||||
|
||||
~NetworkManager();
|
||||
|
|
|
@ -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,22 +29,22 @@ 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>;
|
||||
|
|
|
@ -29,10 +29,10 @@ 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())
|
||||
{
|
||||
|
@ -40,15 +40,15 @@ void UnixSocketInterface::InitializeSocket(const SocketPtr& socketPtr, const std
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
#include <filesystem>
|
||||
|
||||
MainApplication::MainApplication()
|
||||
: mDatabaseManager(),
|
||||
mCommandLineArgs()
|
||||
: mCommandLineArgs(),
|
||||
mDatabaseManager()
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "FontItem.h"
|
||||
|
||||
FontItem::FontItem(const std::string& faceName, float size)
|
||||
: mFaceName(faceName),
|
||||
mSize(size)
|
||||
: mSize(size),
|
||||
mFaceName(faceName)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ Node::~Node()
|
|||
}
|
||||
|
||||
Node::Node(const Point& p, std::size_t index)
|
||||
: mPoint(p),
|
||||
mIndex(index)
|
||||
: mIndex(index),
|
||||
mPoint(p)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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)});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void SvgNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
auto viewbox = mContent->getViewBox();
|
||||
//auto viewbox = mContent->getViewBox();
|
||||
|
||||
for (const auto& svg_element : mContent->getRoot()->getChildren())
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ class TopBarMenu : public Widget
|
|||
public:
|
||||
void popupFrom(Widget* parent)
|
||||
{
|
||||
auto window = parent->getTopLevelWindow();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -401,5 +401,5 @@ std::unique_ptr<MarkdownDocument> MarkdownParser::run(const std::string& content
|
|||
|
||||
run(content, doc.get());
|
||||
|
||||
return std::move(doc);
|
||||
return doc;
|
||||
}
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue