Commit Graph

2392 Commits

Author SHA1 Message Date
48c4bf9c05 change two loops to while (#1147)
and one to for range.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 13:28:12 +02:00
bdf50eda99 use some more auto (#1146) 2023-09-16 13:12:04 +02:00
653c2fe9e1 clang-tidy: use using instead of typedef (#1120)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 09:06:14 +02:00
6ed0ca28db add utf8cpp git submodule (#1142)
* add utf8cpp git submodule

More standard. Allows using the system provided utf8cpp.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* cmake: use standard find_package for zlib

Simpler.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 08:41:01 +02:00
cf5ad66922 default some more (#1135)
* remove defaulted constructor

It gets implicitly generated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* default some more

swap is not needed here as shared_ptr is copyable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 08:25:04 +02:00
97a74ca3d8 clang: fix -Wextra-semi warnings (#1134)
Achieved by adding do/while to mandate a semicolon.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 08:23:45 +02:00
7646184d6b unused includes (#1133)
* unused includes

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* Use consistent order of includes

Always include in the following order:
- Own header files
- Standard header files
- System header files
- Project header files (toolkit first)

Exceptions:
- cppunit/extensions/HelperMacros.h must be included after
  header files declaring stream operators
- config.h must be included before its definitions are used

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-09-16 08:22:36 +02:00
2dc1aa4ec9 build(deps): bump actions/checkout from 3 to 4 (#1143)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 12:27:11 +02:00
00cfee30b6 github: add dependabot (#1141)
Bot to update CI.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-10 07:10:59 +02:00
88cb197111 replace vector with array (#1140)
No need for vector. Allows simplifying some code.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-10 06:44:13 +02:00
110a253ba3 use using declarations (#1139)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-10 06:40:24 +02:00
d42e8ed3fe remove out of line declaration (#1137)
Seems to have been an oversight at some point.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-08 13:41:41 +02:00
37ba5a5cc1 convert missed for loop (#1136)
clang-tidy missed it as the declaration is outside of the loop.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-07 11:04:02 -05:00
23186f24ff remove unused typedefs (#1138)
This was done in C++98 times. No longer needed with auto.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-07 11:02:55 -05:00
528b84fbde size() to isEmpty() (#1131)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-06 21:23:28 +02:00
912897cd35 simplify boolean expressions (#1130)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-06 21:16:59 +02:00
54f84cc924 clang-tidy: use data() (#1129)
Found with readability-container-data-pointer

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-06 21:15:56 +02:00
47c4e0859c Restore const iterators replaced in #1107 (#1128)
Also make sure that the lines calling std algorithms are not
excessively long.
2023-09-06 20:59:01 +02:00
524b588a1e manual range loop conversions (#1126)
* manual range loop conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* Restore const containers where non const temporaries are iterated

* Use std::as_const() instead of const container copies where possible

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-09-06 20:58:13 +02:00
303b55fb97 clang-tidy: ending namespace comment (#1132)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-03 21:39:49 -05:00
ecf1d4fa53 clang: fix documentation (#1111)
* Use [[deprecated]] always

Simplifies the code. Codebase is C++17 anyways.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang: fix documentation

Found with Wdocumentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* add deprecated to length() and fix usages

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-03 15:14:05 +02:00
d2bd56c519 Fix possible loss of data warning by MSVC 2023-09-02 16:30:45 +02:00
040b069957 clang-tidy: fix mismatched variable names (#1109)
Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-31 06:46:58 +02:00
f44ea9b80b Fixed signedness warning 2023-08-30 17:58:15 +02:00
0ba61343a4 std::list and unique_ptr conversions (#1122)
The former is standard C++ and the latter allows getting rid of
autodelete.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-30 16:49:31 +02:00
cdc87aec10 clang-tidy: init members by default (#1110)
Found with modernize-use-default-member-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-30 16:26:14 +02:00
4a86489186 clang-tidy: no else after return (#1119)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-21 09:19:53 -05:00
85c678f587 Use nullptr (#1117)
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-17 10:36:22 -05:00
29e88cfe66 Default FileName copy constructor (#1118)
Found with: modernize-use-equals-default

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-17 10:33:56 -05:00
128c55bc53 Remove dead forward declaration (#1121)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-17 10:30:01 -05:00
cf352ac7f4 Move temporary into vector instead of copying (#1115)
more efficient.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-15 19:13:22 -05:00
bbb8221301 Handle self-assignment (#1114)
Found with cert-oop54-cpp

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-15 16:58:56 -05:00
f69c21c8e6 Additional none_of conversion (#1113) 2023-08-15 09:21:43 -05:00
574604765f Use std algorithms (#1107)
Found with: readability-use-anyofallof

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-09 12:09:28 -05:00
f2d0e664e7 Add ending namespace comments (#1108)
Found with google-readability-namespace-comments

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-07 20:44:11 -05:00
185bb7042e Use unique_ptr for d-pointers (#1095)
* clang-tidy: make deleted members public

One oversight of modernize-use-equals-delete is that the C++11 way of
doing this is to make it public, which makes the warning still trigger.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang-tidy: add missing deleted functions

Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* unique_ptr conversions

unique_ptr is a safer and cleaner way to handle d pointers.

Also added missing = default.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-07 15:08:40 -05:00
843a8aac80 Replace RefCounter with shared_ptr (#1100)
* clang-tidy: replace RefCounter with shared_ptr

The latter is C++11.

Found with clang-analyzer-webkit.NoUncountedMemberChecker

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* remove trefcounter

It is now unused.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-07 08:40:24 -05:00
dcef356e3f Replace raw buffers with std containers (#1101)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-06 17:46:59 -05:00
868f4eef3d Various cleanups (#1099)
* cmake: remove atomic checks

All this stuff was replaced with std::atomic

Fixes: 9bcba812af

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* cmake: remove vsnprintf checks

Available since C++11

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang-tidy: const ref conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang-tidy: handle self assignment

Found with bugprone-unhandled-self-assignment,cert-oop54-cpp

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang-tidy: remove wrong forward declarations

Found with bugprone-forward-declaration-namespace

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-05 10:31:46 -05:00
c0e9428218 Fix warnings under clang-cl (#1106)
-Wmicrosoft-unqualified-friend
-Wdllexport-explicit-instantiation-decl
-Wunused-parameter

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-05 10:07:52 -05:00
bec59b4b7b Convert to range-based for (#1104)
Found with MSVC: warning C4456

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-05 10:00:07 -05:00
bd6c3ba174 Use constexpr if (#1103)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-05 09:56:23 -05:00
ee8124ed7a Replace unnecessary loop (#1105)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-05 09:45:32 -05:00
965260e3cb Add a note about how I generated list of classes 2023-07-30 06:55:23 +02:00
f903e1ad71 Add checks for the expected sizes of all public classes
This ensures that d-pointers exist where they're expected, and that
classes are virtual that we expect to be virtual, as well as ensuring
that we get a failure if the class size changes when it shouldn't.

This also fixes the issues that were discovered by adding these tests.
2023-07-30 06:31:48 +02:00
a1bdb0171d Remove virtual destructors from POD toolkit types
This one's been haunting me for a couple decades.  "Make all the things
virtual!" was kind of a strategy I had for forward compatibility when I
wrote this code when I was 20 or so and didn't know better.
2023-07-30 02:47:00 +02:00
9bcba812af Use C++11 atomics for RefCounter (#1097) 2023-07-29 06:58:50 +02:00
271bd05afa Improve FrameFactory subclassing
Change the ID3v2 frame factory so it is possible to subclass it for
implementing own frames.  Additionally it splits up the createFrame()
method to make its usage in subclasses a bit more easy.
2023-07-26 07:39:31 +02:00
c54c924333 Use static_cast instead of C-style casts 2023-07-22 07:09:58 +02:00
d314bfa06a Make sure that own header file is included first
Each header corresponding to a .cpp file must be self-contained,
and can be #included without prerequisites.
2023-07-22 07:09:58 +02:00