Skip to content

Commit

Permalink
Fix compilation errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kachsheev committed Sep 23, 2024
1 parent 81169f6 commit 2cd47f2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions include/FlameIDE/Common/Expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ Expected<ResultType, ErrorType>::operator=(Me &&expected) noexcept
{
expected.ifResult([this](ResultType &&result)
{
operator=(move(result));
this->operator=(move(result));
}).ifError([this](ErrorType &&error)
{
operator=(move(error));
this->operator=(move(error));
}).done();
return *this;
}
Expand Down
8 changes: 4 additions & 4 deletions include/FlameIDE/Templates/Optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Optional
typename Me::Pointer toValue();
typename Me::PointerToConst toValue() const;

AlignObject<T> value;
AlignObject<T> object;
bool isFill;
};

Expand All @@ -67,7 +67,7 @@ namespace flame_ide
{

template<typename T, typename Traits>
Optional<T, Traits>::Optional() noexcept : value(), isFill(false)
Optional<T, Traits>::Optional() noexcept : object(), isFill(false)
{}

template<typename T, typename Traits>
Expand Down Expand Up @@ -277,15 +277,15 @@ template<typename T, typename Traits>
typename Optional<T, Traits>::Pointer Optional<T, Traits>::toValue()
{
return static_cast<typename Me::Pointer>(
static_cast<void *>(value.array)
static_cast<void *>(object.array)
);
}

template<typename T, typename Traits>
typename Optional<T, Traits>::PointerToConst Optional<T, Traits>::toValue() const
{
return static_cast<typename Me::PointerToConst>(
static_cast<const void *>(value.array)
static_cast<const void *>(object.array)
);
}

Expand Down
19 changes: 11 additions & 8 deletions src/Handler/Network/Handler.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <FlameIDE/Handler/Network/Handler.hpp>

#include <FlameIDE/Common/ReferenceWrapper.hpp>
#include <FlameIDE/Templates/Allocator/ObjectAllocator.hpp>

#include <FlameIDE/../../src/Handler/Network/Internal.hpp>
Expand Down Expand Up @@ -56,52 +55,56 @@ Handler::ExpectedServerHandle Handler::pushUdp(os::network::UdpServer &&server)
const auto descriptor = server.native().descriptor;

auto result = internal->udp().push(flame_ide::move(server));
flame_ide::makeConstReferenceWrapper(result)->ifResult(
const decltype(result) &constResult = result;
constResult.ifResult(
[descriptor, this](const auto &)
{
internal->registrar().pushUdpServer(descriptor);
}
);

return result;
return flame_ide::move(result);
}

Handler::ExpectedSessionHandle Handler::pushUdp(os::network::UdpClient &&client) noexcept
{
const auto descriptor = client.native().descriptor;

auto result = internal->udp().push(flame_ide::move(client));
flame_ide::makeConstReferenceWrapper(result)->ifResult(
const decltype(result) &constResult = result;
constResult.ifResult(
[descriptor, this](const auto &)
{
internal->registrar().pushUdpServer(descriptor);
}
);

return result;
return flame_ide::move(result);
}

Handler::ExpectedServerHandle Handler::pushTcp(os::network::TcpServer &&server) noexcept
{
const auto descriptor = server.native().descriptor;

auto result = internal->tcp().push(flame_ide::move(server));
flame_ide::makeConstReferenceWrapper(result)->ifResult(
const decltype(result) &constResult = result;
constResult.ifResult(
[descriptor, this](const auto &)
{
internal->registrar().pushUdpServer(descriptor);
}
);

return result;
return flame_ide::move(result);
}

Handler::ExpectedSessionHandle Handler::pushTcp(os::network::TcpClient &&client) noexcept
{
const auto descriptor = client.native().descriptor;

auto result = internal->tcp().push(flame_ide::move(client));
flame_ide::makeConstReferenceWrapper(result)->ifResult(
const decltype(result) &constResult = result;
constResult.ifResult(
[descriptor, this](const auto &)
{
internal->registrar().pushUdpServer(descriptor);
Expand Down
4 changes: 2 additions & 2 deletions src/Handler/Network/Udp/InternalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ serverSend(
auto &output = *data->output;
ServerMessage *message = nullptr;
{
os::threads::Locker locker{ output.spin };
os::threads::Locker outputLocker{ output.spin };
message = output.last->pointer();
{
os::threads::Locker locker{ message->spin };
os::threads::Locker messageLocker{ message->spin };
message->state = MessageState::PROCESSING;
}
++output.last;
Expand Down

0 comments on commit 2cd47f2

Please sign in to comment.