129 Commits (f3f66c56dba7670c48a8cd3e3f2030f4eb21601c)

Author SHA1 Message Date
Rosen Penev d856ca7d82 cland-tidy: simplify booleans
Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 71dc04ebb1 misc sonarlint stuff
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev b6c2062fae std::to_string conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev fc840405cc revert std::function back to function pointers
The former has too much overhead. No point in it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 5c90684441 simplify some defines
As far as I can tell, _WIN32 is defined for true Windows platforms.
Cygwin is a POSIX platform.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev f3b572d211 fix iconv handling and windows
WIN32 as a define is wrong. _WIN32 is the correct one.

Which opens up the issue of the used functions and the wrong logic.
Changed the function logic to use if and elif, as done later in the
code.

Also changed all usages of WIN32 with _WIN32

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev e41dd1d227 remove pointless UNUSED statement
Does not compile as it is no longer present.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 2b8ca5a9d7 fix compilation with mingw iconv
The parameter there is const. Use the appropriate macro.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Kevin Backhouse 97e58a4573
Merge pull request #2267 from neheb/clang
mostly clang-tidy fixes
3 years ago
Kevin Backhouse 7f673c766d
Fix some "signed shift" warnings 3 years ago
Rosen Penev 5be42f132c try to fix some fanalyzer warnings
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev cf963e9e4d clang-tidy: C casts to C++
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev fdfcde5e4b structured binding conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev e82be13b73 C to std::function
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev dfb93dd8cd clang-tidy: use C++ headers
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 9f67620503 clang-tidy: add more nodiscard
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más 30bf563f4d Update .clang-format file & apply clang-format to whole project 3 years ago
Rosen Penev b2b6d834ba
some std::array conversions (#2148)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Diaz 7576a2757b More size_t for sizes 3 years ago
Luis Díaz Más c115d4daf7
Merge pull request #2131 from Exiv2/mainCleanups
Include what you use + more SPDX identifiers + few other cleanups
3 years ago
Rosen Penev 8dadcdf72a manual nullptr removals
unique_ptr has a bool overload. It's also easier to reason about.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev b8304fffa4 clang-tidy: don't use C casts
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más 2834fa5f05 Use [[maybe_unused]] 3 years ago
Luis Díaz Más 8b1fe379a1 Removing unused headers thanks to IWYU 3 years ago
Rosen Penev 04bacdedd6 clang-tidy: use auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más b17828b454
Use SPDX for licenses (#2122)
* Use SPDX identifier in header files

* Use SPDX identifier in rest of source files

* Fix usage of SPDX for files with 2 licenses

* Add global license file

* Fix compilation
3 years ago
Luis Díaz Más 208ec70df8 Fix windows builds 3 years ago
Luis Díaz Más 12738214f2 Fix warnings and place return statements separated from if 3 years ago
Luis Díaz Más b9f9d041ea Several transformations on DataBuf + migration to size_t
- Provide begin/end iterators to DataBuf and simplify code
- Adapt test output after last changes
- Replacing long by size_t in value.hpp
- Use size_t in some Photoshop functions
- Remove some static_casts
3 years ago
Luis Díaz Más c5a9dfd9af
Merge pull request #2109 from Exiv2/main_StringView
Refactoring & cleanup
3 years ago
Luis Díaz Más 76f01fd4d3 Clean more header inclusions 3 years ago
Luis Díaz Más ea201ce613 Remove dead code 3 years ago
Kevin Backhouse 256365830a
Replace Metadatum::toLong() with Metadatum::toInt64(). 3 years ago
Luis Díaz Más db4b63937e Add some TODO comments 3 years ago
Kevin Backhouse bb9ff53ebe
Throw an exception on integer overflow. 4 years ago
Kevin Backhouse 9ff72e5ca5
Make offset=0 the default parameter. 4 years ago
Kevin Backhouse c9d0cf3643
Make fields of DataBuf private. 4 years ago
Kevin Backhouse 69d82ffe01
Defensive coding changes to avoid integer overflow in loop conditions. 4 years ago
Kevin Backhouse c2b52119d4 Check that findKey didn't return end(). 4 years ago
Kevin Backhouse 2b84f4bd64
fix: zero initialize local variables. (#1743)
* Zero initialize local variables.

* Initialize xmpID_
4 years ago
Kevin Backhouse 3e099da7b7 Remove obsolete snprintf macros. 4 years ago
Luis Díaz Más f30022d73d
Fix issues detected with PVS-Studio + other little improvements (#1689)
* avoid re-declaration of constant variables

* Replace pthreads critical section with std::mutex

* ci - better naming

* cmake - increase minimum version to 3.11. Use project DESCRIPTION

* fix - do not treat string::find() return type as bool

* remove conditions that were always true

* remove condition that were always false

* Remove EXV_HAVE_GMTIME_R which is not used anymore

* pixelWidth_ was inherited from Exiv2::Image

The width & height variables in the TiffImage class need to be mutable
to be able to change their values on the getters pixelHeight() and
pixelWidth() ... Do not ask me why ...

* Remove superfluous if

* pvs:V766 item with identical key added already

* pvs:V730 not all members were initialized (time)

* pvs:V730 not all members are initialized

* pvs:v668 no point in testing pointer against null after new

* pvs:V1048 variable assigned the same value

* replace c-style dynamic vector with std one

* pvs:547 fakeData is always true

* Remove useless constructor in derived class

* pvs:V690 modern way to disable copy-ctor

* Replace malloc/free with new/delete. No need to check for null

* pvs:V1028 cast operands and not result

* Remove custom MIN/MAX functions

* pvs:V595 pointer used before verified against null

* pvs: index used before being checked

* pvs:V1028 possible overflow. Cast operands

* pvs:v575 potential null pointer passed to other functions

* pvs:V547 deal with always true/false expressions

* pvs:V560 part of conditional expressions always false or true

* pvs:V701 possible break in realloc -> move to std::vector

* Make some classes 'final'

* Replace sprintf with std::to_string()

* fix compilation on windows
4 years ago
Rosen Penev 2c57f214c5 clang-tidy: use nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev a74bceacb0 clang-tidy: remove pointless return
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev b8712188bb clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev fdf9d3799c clang-tidy: don't use else after return
Found with llvm-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 1b9b77c51f clang-tidy: add ending namespace comments
Found with google-readability-namespace-comments

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 80595f8468 clang-tidy: remove duplicate public
Found with readability-redundant-access-specifiers

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev bd6a996181 clang-tidy: use using
Found with modernize-use-using

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 4ceb325c8f clang-tidy: range for loop conversions
Found with modernize-loop-convert

Ran through git clang-format.

Also removed several questionable loops and replaced with simpler
algorithms.

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