Skip to content

Commit 62f651b

Browse files
committed
Fixed: warnings
1 parent c031f8f commit 62f651b

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

FreeTypeWrapper/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if (FREETYPE_WRAPPER_DISABLE_WARNINGS_EXTERNAL_LIBS)
5959
-Wno-nonportable-system-include-path
6060
-Wno-missing-noreturn
6161
-Wno-extra-semi-stmt
62+
-Wno-switch-default
6263
)
6364
if (FREETYPE_WRAPPER_BUILD_FRIBIDI)
6465
target_compile_options(libfribidi PRIVATE
@@ -76,7 +77,7 @@ if (FREETYPE_WRAPPER_DISABLE_WARNINGS_EXTERNAL_LIBS)
7677
-Wno-shadow
7778
-Wno-unsafe-buffer-usage
7879
-Wno-reserved-identifier
79-
80+
-Wno-switch-default
8081
)
8182
endif()
8283

FreeTypeWrapper/Source/BlitBox.h

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace FreeType
55
{
66
struct BlitBox
77
{
8-
std::byte* buffer;
8+
std::byte *buffer;
99
uint32_t rowPitch;
1010
uint32_t width;
1111
uint32_t height;
@@ -18,19 +18,18 @@ namespace FreeType
1818
return (top * rowPitch) + (left * pixelSizeInbytes);
1919
}
2020

21+
LLUTILS_DISABLE_WARNING_PUSH
22+
LLUTILS_DISABLE_WARNING_UNSAFE_BUFFER_USAGE
2123
template <typename color_type>
22-
static void BlitPremultiplied (BlitBox& dst, const BlitBox& src)
24+
static void BlitPremultiplied(BlitBox &dst, const BlitBox &src)
2325
{
24-
LLUTILS_DISABLE_WARNING_PUSH
25-
LLUTILS_DISABLE_WARNING_UNSAFE_BUFFER_USAGE
26+
const std::byte *srcPos = src.buffer + src.GetStartOffset();
27+
std::byte *dstPos = dst.buffer + dst.GetStartOffset();
2628

27-
const std::byte* srcPos = src.buffer + src.GetStartOffset();
28-
std::byte* dstPos = dst.buffer + dst.GetStartOffset();
29-
30-
//Perform range check on target.
29+
// Perform range check on target.
3130
if (dst.left + src.width > dst.width || dst.top + src.height > dst.height)
3231
LL_EXCEPTION(LLUtils::Exception::ErrorCode::LogicError, "Buffer out of bounds");
33-
LLUTILS_DISABLE_WARNING_POP
32+
3433
const uint32_t bytesPerLine = src.pixelSizeInbytes * src.width;
3534

3635
for (uint32_t y = src.top; y < src.height; y++)
@@ -39,27 +38,23 @@ LLUTILS_DISABLE_WARNING_POP
3938
{
4039
using namespace LLUtils;
4140

42-
const color_type& srcColor = *reinterpret_cast<const color_type*>(srcPos + x);
43-
color_type& dstColor = *reinterpret_cast<color_type*>(dstPos + x);
41+
const color_type &srcColor = *reinterpret_cast<const color_type *>(srcPos + x);
42+
color_type &dstColor = *reinterpret_cast<color_type *>(dstPos + x);
4443
dstColor = dstColor.BlendPreMultiplied(srcColor);
4544
}
4645
dstPos += dst.rowPitch;
4746
srcPos += src.rowPitch;
4847
}
4948
}
5049

51-
52-
static void Blit(BlitBox& dst, const BlitBox& src)
50+
static void Blit(BlitBox &dst, const BlitBox &src)
5351
{
54-
LLUTILS_DISABLE_WARNING_PUSH
55-
LLUTILS_DISABLE_WARNING_UNSAFE_BUFFER_USAGE
56-
const std::byte* srcPos = src.buffer + src.GetStartOffset();
57-
std::byte* dstPos = dst.buffer + dst.GetStartOffset();
52+
const std::byte *srcPos = src.buffer + src.GetStartOffset();
53+
std::byte *dstPos = dst.buffer + dst.GetStartOffset();
5854

59-
//Perform range check on target.
55+
// Perform range check on target.
6056
if (dst.left + src.width > dst.width || dst.top + src.height > dst.height)
6157
LL_EXCEPTION(LLUtils::Exception::ErrorCode::LogicError, "Buffer out of bounds");
62-
LLUTILS_DISABLE_WARNING_POP
6358

6459
const uint32_t bytesPerLine = src.pixelSizeInbytes * src.width;
6560

@@ -69,13 +64,14 @@ LLUTILS_DISABLE_WARNING_POP
6964
{
7065
using namespace LLUtils;
7166

72-
const Color& srcColor = *reinterpret_cast<const Color*>(srcPos + x);
73-
Color& dstColor = *reinterpret_cast<Color*>(dstPos + x);
67+
const Color &srcColor = *reinterpret_cast<const Color *>(srcPos + x);
68+
Color &dstColor = *reinterpret_cast<Color *>(dstPos + x);
7469
dstColor = dstColor.Blend(srcColor);
7570
}
7671
dstPos += dst.rowPitch;
7772
srcPos += src.rowPitch;
7873
}
7974
}
75+
LLUTILS_DISABLE_WARNING_POP
8076
};
8177
}

0 commit comments

Comments
 (0)