Skip to content

Commit f1b9094

Browse files
authored
Use default C++/WinRT settings (remove WINRT_NO_MAKE_DETECTION) (#42)
WINRT_NO_MAKE_DETECTION ensure that winrt::make must be used, but prevent using final on the implementation classes. As is not a default option, it may confuss others.
1 parent 93104ca commit f1b9094

5 files changed

+12
-16
lines changed

Directory.Build.props

+2-3
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@
9595
NOMINMAX: Prevent that the Windows SDK header files define the macros min and max (conflict with C++ std::min\max).
9696
9797
* WINRT *
98-
WINRT_NO_MAKE_DETECTION: Enable making COM class implementation final
99-
_SILENCE_CLANG_COROUTINE_MESSAGE: Supress warning that coroutine is not compatible wih clang (clang-tidy fix)
98+
WINRT_LEAN_AND_MEAN: Disables rarely-used features (in order to reduce compile times)
10099
101100
* Secure C Runtime *
102101
__STDC_WANT_SECURE_LIB__=1;
103102
-->
104-
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOSERVICE;NOMCX;NOIME;NOMINMAX;WINRT_NO_MAKE_DETECTION;_SILENCE_CLANG_COROUTINE_MESSAGE;__STDC_WANT_SECURE_LIB__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
103+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOSERVICE;NOMCX;NOIME;NOMINMAX;WINRT_LEAN_AND_MEAN;__STDC_WANT_SECURE_LIB__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
105104

106105
<PrecompiledHeader>NotUsing</PrecompiledHeader>
107106

netpbm-wic-codec.sln.DotSettings

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClangTidyBugproneBranchClone/@EntryIndexedValue">DO_NOT_SHOW</s:String>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
34
<s:Boolean x:Key="/Default/UserDictionary/Words/=anymap/@EntryIndexedValue">True</s:Boolean>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=bugprone/@EntryIndexedValue">True</s:Boolean>
56
<s:Boolean x:Key="/Default/UserDictionary/Words/=CLSID/@EntryIndexedValue">True</s:Boolean>

src/netpbm_bitmap_decoder.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ using winrt::check_hresult;
2323
using winrt::com_ptr;
2424
using winrt::to_hresult;
2525

26+
namespace {
2627

27-
class netpbm_bitmap_decoder final : public winrt::implements<netpbm_bitmap_decoder, IWICBitmapDecoder>
28+
struct netpbm_bitmap_decoder : winrt::implements<netpbm_bitmap_decoder, IWICBitmapDecoder>
2829
{
29-
public:
3030
// IWICBitmapDecoder
3131
HRESULT __stdcall QueryCapability(_In_ IStream* stream, _Out_ DWORD* capability) noexcept override
3232
try
@@ -222,6 +222,7 @@ class netpbm_bitmap_decoder final : public winrt::implements<netpbm_bitmap_decod
222222
com_ptr<IWICBitmapFrameDecode> bitmap_frame_decode_;
223223
};
224224

225+
} // namespace
225226

226227
void create_netpbm_bitmap_decoder_factory(GUID const& interface_id, void** result)
227228
{

src/netpbm_bitmap_frame_decode.ixx

+5-9
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,22 @@ import <std.h>;
1111
import <win.h>;
1212
import winrt;
1313

14-
export class netpbm_bitmap_frame_decode final
15-
: public winrt::implements<netpbm_bitmap_frame_decode, IWICBitmapFrameDecode, IWICBitmapSource>
14+
export struct netpbm_bitmap_frame_decode
15+
: winrt::implements<netpbm_bitmap_frame_decode, IWICBitmapFrameDecode, IWICBitmapSource>
1616
{
17-
public:
1817
netpbm_bitmap_frame_decode(_In_ IStream* source_stream, _In_ IWICImagingFactory* factory);
1918

2019
// IWICBitmapSource
2120
HRESULT __stdcall GetSize(uint32_t* width, uint32_t* height) override;
2221
HRESULT __stdcall GetPixelFormat(GUID* pixel_format) override;
2322
HRESULT __stdcall GetResolution(double* dpi_x, double* dpi_y) override;
24-
HRESULT __stdcall CopyPixels(const WICRect* rectangle, uint32_t stride, uint32_t buffer_size,
25-
BYTE* buffer) override;
23+
HRESULT __stdcall CopyPixels(const WICRect* rectangle, uint32_t stride, uint32_t buffer_size, BYTE* buffer) override;
2624
HRESULT __stdcall CopyPalette(IWICPalette*) noexcept override;
2725

2826
// IWICBitmapFrameDecode : IWICBitmapSource
2927
HRESULT __stdcall GetThumbnail(IWICBitmapSource**) noexcept override;
30-
HRESULT __stdcall GetColorContexts(uint32_t count, IWICColorContext** color_contexts,
31-
uint32_t* actual_count) override;
32-
HRESULT __stdcall GetMetadataQueryReader(IWICMetadataQueryReader** metadata_query_reader)
33-
noexcept override;
28+
HRESULT __stdcall GetColorContexts(uint32_t count, IWICColorContext** color_contexts, uint32_t* actual_count) override;
29+
HRESULT __stdcall GetMetadataQueryReader(IWICMetadataQueryReader** metadata_query_reader) noexcept override;
3430

3531
private:
3632
winrt::com_ptr<IWICBitmapSource> bitmap_source_;

test/test_stream.ixx

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import test.winrt;
1212

1313
import test.errors;
1414

15-
export class test_stream final : public winrt::implements<test_stream, IStream>
15+
export struct test_stream : winrt::implements<test_stream, IStream>
1616
{
17-
public:
1817
test_stream(const bool fail_on_read, int fail_on_seek_counter) noexcept :
1918
fail_on_read_{fail_on_read}, fail_on_seek_counter_{fail_on_seek_counter}
2019
{

0 commit comments

Comments
 (0)