Skip to content

Commit

Permalink
Rename headers from .h to .hpp to identify CharLS as a C++ project
Browse files Browse the repository at this point in the history
To make it more clear to users and tooling that the project is a C++ project use the extension .hpp for pure C++ headers.
Add a new public header file charls.hpp. External C++ projects should this header file, C projects should still use charls.h.
  • Loading branch information
vbaderks committed Aug 23, 2024
1 parent 2c48039 commit 5f80417
Show file tree
Hide file tree
Showing 107 changed files with 1,437 additions and 1,388 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
- BREAKING: encoding_options::include_pc_parameters_jai is not enabled by default anymore.
- BREAKING: charls::jpegls_decoder and charls::jpegls_encoder follow the same const pattern as the C API.
- BREAKING: the failure values of the enum charls::jpegls_errc are now divided in 2 groups: runtime failures and logic.
- BREAKING: The public charls.h header has been split into charls.h (C users) and charls.hpp (C++ users).

### Removed

Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@

<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include</AdditionalIncludeDirectories>

<!-- Use by default precompiled headers with the modern name pch.h -->
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<!-- Use by default precompiled headers with the modern name pch.hpp -->
<PrecompiledHeaderFile>pch.hpp</PrecompiledHeaderFile>

<!-- For checked builds, enable the MS static analyzer build into the compiler. -->
<EnablePREfast Condition="'$(Configuration)'=='Checked'">true</EnablePREfast>
Expand Down
4 changes: 0 additions & 4 deletions benchmark/benchmark.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="benchmark.cpp">
Expand Down
4 changes: 2 additions & 2 deletions fuzzing/afl/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Team CharLS.
// SPDX-License-Identifier: BSD-3-Clause

#include <charls/charls.h>
#include <charls/charls.hpp>

#include "../src/conditional_static_cast.h"
#include "../src/conditional_static_cast.hpp"

#ifdef _MSC_VER
#include <io.h>
Expand Down
8 changes: 0 additions & 8 deletions fuzzing/libfuzzer/LibFuzzerTest.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/libfuzzer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: BSD-3-Clause

#include <vector>
#include "../include/charls/charls_jpegls_decoder.h"
#include "../include/charls/jpegls_decoder.hpp"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, const size_t size)
{
Expand Down
26 changes: 1 addition & 25 deletions include/charls/charls.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,8 @@

#pragma once


#include "charls_jpegls_decoder.h"
#include "charls_jpegls_encoder.h"
#include "version.h"


// Undefine CHARLS macros to prevent global macro namespace pollution and usage by client code.
// The macros are not part of the official API.
#if !defined(CHARLS_LIBRARY_BUILD)

#undef CHARLS_API_IMPORT_EXPORT
#undef CHARLS_FINAL
#undef CHARLS_NOEXCEPT
#undef CHARLS_ATTRIBUTE
#undef CHARLS_C_VOID
#undef CHARLS_NO_INLINE
#undef CHARLS_IN
#undef CHARLS_IN_OPT
#undef CHARLS_IN_Z
#undef CHARLS_IN_READS_BYTES
#undef CHARLS_OUT
#undef CHARLS_OUT_OPT
#undef CHARLS_OUT_WRITES_BYTES
#undef CHARLS_OUT_WRITES_Z
#undef CHARLS_RETURN_TYPE_SUCCESS
#undef CHARLS_CHECK_RETURN
#undef CHARLS_RET_MAY_BE_NULL

#endif
#include "undef_macros.h"
10 changes: 10 additions & 0 deletions include/charls/charls.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Team CharLS.
// SPDX-License-Identifier: BSD-3-Clause

#pragma once

#include "jpegls_decoder.hpp"
#include "jpegls_encoder.hpp"
#include "version.h"

#include "undef_macros.h"
Loading

0 comments on commit 5f80417

Please sign in to comment.