Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

598 sanitizr address #599

Merged
merged 10 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ project('iptux', 'cpp',
version: '0.9.1',
default_options: ['warning_level=3', 'cpp_std=c++14'])
add_global_arguments('-Werror=format', language : 'cpp')
if get_option('buildtype') == 'debug'
add_project_arguments('-fsanitize=address', language: 'cpp')
add_project_link_arguments('-fsanitize=address', language: 'cpp')
endif

so_version = '0.9.1'
subdir('src')
subdir('share')
Expand Down
10 changes: 6 additions & 4 deletions src/iptux-core/internal/UdpDataServiceTest.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "gtest/gtest.h"

#include <memory>

#include "iptux-core/TestHelper.h"
#include "iptux-core/internal/UdpDataService.h"
#include "iptux-utils/utils.h"
Expand All @@ -9,13 +11,13 @@ using namespace iptux;

TEST(UdpDataService, process) {
auto core = newCoreThread();
auto service = new UdpDataService(*core.get());
auto service = make_unique<UdpDataService>(*core.get());
service->process(inAddrFromString("127.0.0.1"), 1234, "", 0, true);
}

TEST(UdpDataService, SomeoneEntry) {
auto core = newCoreThread();
auto service = new UdpDataService(*core.get());
auto service = std::make_unique<UdpDataService>(*core.get());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Use std::make_unique for consistency

In the previous line, you used make_unique, but here you used std::make_unique. For consistency and clarity, it's better to use std::make_unique in both places.

const char* data = "iptux 0.8.0:1:lidaobing:lidaobing.lan:257:lidaobing";
service->process(inAddrFromString("127.0.0.1"), 1234, data, strlen(data),
true);
Expand All @@ -28,7 +30,7 @@ TEST(UdpDataService, CreatePalInfo) {
"1_iptux "
"0.8.0-b1:6:lidaobing:LIs-MacBook-Pro.local:259:中\xe4\xb8\x00\x00icon-"
"tux.png\x00utf-8\x00";
auto service = new UdpDataService(*core.get());
auto service = make_unique<UdpDataService>(*core.get());
auto udp = service->process(inAddrFromString("127.0.0.1"), 1234, data,
strlen(data), false);
auto pal = udp->CreatePalInfo();
Expand All @@ -43,7 +45,7 @@ TEST(UdpDataService, CreatePalInfo) {
"1_iptux "
"0.8.0-b1:6:中\xe4\xb8:LIs-MacBook-Pro.local:259:"
"中\xe4\xb8\x00\x00icon-tux.png\x00utf-8\x00";
auto service = new UdpDataService(*core.get());
auto service = make_unique<UdpDataService>(*core.get());
auto udp = service->process(inAddrFromString("127.0.0.1"), 1234, data,
strlen(data), false);
auto pal = udp->CreatePalInfo();
Expand Down
Loading