Commit Graph

129 Commits

Author SHA1 Message Date
Rosen Penev
22b12012a6 more SonarLint cleanups
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-03-20 08:01:22 -07:00
Rosen Penev
01aab49f6f don't assign an fs::path to a string
Seems to trip up MemorySanitizer on ARM32.

Also applied various simplifications to the code using std::filesystem

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-03-20 08:01:22 -07:00
Rosen Penev
ca95edc6bd random fixes
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-03-20 08:01:22 -07:00
Rosen Penev
4a26eba0d9 fix compilation under FreeBSD
sys headers must come before libprocstat

meson is missing a libprocstat dependency. iconv is also broken with
meson and freebsd.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-03-19 11:08:30 -07:00
Rosen Penev
725875497b SonarLint cleanups 2023-03-03 19:35:42 -08:00
Rosen Penev
5eebbbcbfb make conversions explicit
Found with MSVC's C4244

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-02-13 09:35:03 -08:00
Rosen Penev
b8d4b9c6ea remove manual math
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-02-03 07:21:13 -08:00
Rosen Penev
d874fc4dd8 use __has_include
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-01-29 12:21:47 -08:00
Rosen Penev
376638259d namespace enforce.hpp functions to Internal
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-01-29 11:14:59 -08:00
Rosen Penev
77834807c2 add support for gcc and clang 7
Uses std::experimental::filesystem

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-01-29 09:29:46 -08:00
Rosen Penev
0169739a4e add missing const
Found with cppcheck

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-01-26 22:44:43 -08:00
Rosen Penev
dd3b3d4ff4 add const
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-01-05 23:29:31 -08:00
Rosen Penev
28d1880176 replace find/rfind with startsWith
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-10-28 11:05:23 -07:00
Rosen Penev
71dc04ebb1 misc sonarlint stuff
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-08-22 23:00:32 -07:00
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>
2022-08-08 15:31:05 -07:00
Rosen Penev
9ca7f861cf remove string_view from headers
This should allow usage with C++11 projects. It's also wrong. The only
user of this assigns an std::string from a string_view, which is not
safe.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-07-24 16:37:25 -07:00
Rosen Penev
5479792d50 remove pointless &*
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-07-24 16:34:00 -07:00
Rosen Penev
b8eaae649d use some auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-07-24 16:34:00 -07:00
Rosen Penev
543c951bde clang-tidy: use '' for find
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-07-24 16:34:00 -07:00
Rosen Penev
d59e1433c0 replace readlink with std::filesystem
Simpler.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-04-25 07:44:44 +02:00
Rosen Penev
043547cbd0 remove various usages of memset
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-03-27 01:47:02 -07:00
Luis Díaz Más
30bf563f4d Update .clang-format file & apply clang-format to whole project 2022-03-16 22:30:53 +01:00
Luis Diaz
7576a2757b More size_t for sizes 2022-03-14 11:50:42 +01:00
Luis Díaz Más
96f7f2e4c5 Convert Exiv2::ErrorCode into an enum class 2022-03-12 16:58:40 +01:00
Luis Díaz Más
c146ae5215 Fix mac build 2022-03-07 22:27:25 +01:00
Luis Díaz Más
bbc99ae581 Use auto for unique pointers 2022-03-07 22:25:51 +01:00
Luis Díaz Más
8b1fe379a1 Removing unused headers thanks to IWYU 2022-03-07 22:25:47 +01:00
Luis Díaz Más
23da0c3955 Do not define not needed stuff 2022-03-07 22:25:35 +01:00
Rosen Penev
5833101b9b manual nullptr conversions
Mostly not caught because I'm not running clang-tidy on Windows.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-03-05 16:21:25 -08:00
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
2022-03-04 11:44:39 +01:00
Luis Díaz Más
8b3da36f42 Improvements from code review 2022-02-19 17:27:29 +01:00
Luis Díaz Más
59f4d0de27 cppcheck: reduce scope of variables 2022-02-18 18:01:02 +01:00
Luis Díaz Más
0726104b1a Hide pathOfFileUrl in the only place where it is used 2022-02-18 17:54:04 +01:00
Luis Díaz Más
6f762b4e66 Use std::filesystem for fileExist 2022-02-18 17:54:04 +01:00
Luis Díaz Más
f1ff3aaa4c Make urldecode in-place 2022-02-18 17:54:04 +01:00
Luis Díaz Más
3d370cc2ae Improvements in urlencode 2022-02-18 17:54:04 +01:00
Luis Díaz Más
7933ff401d Remove dead code around EXV_UNICODE_PATH 2022-02-13 22:49:32 +01:00
Evan Miller
04f4624718
Explicitly test for libproc.h (#1916)
This change adds support for ancient macOS lacking libproc. It also
eliminates a bug where exiv2 could not be built on case-sensitive
file systems (the header file is properly TargetConditionals.h).
2021-09-20 14:42:40 +02:00
Matthias Kuhn
5aafb351e5 Fix building on ios 2021-06-16 09:51:23 +02:00
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
2021-06-01 12:39:10 +02:00
Rosen Penev
2c57f214c5 clang-tidy: use nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-26 08:31:45 +02:00
Rosen Penev
86c71ae6c3 clang-tidy: avoid global non const variables
Found with cppcoreguidelines-avoid-non-const-global-variables

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-25 08:43:27 +02:00
Rosen Penev
743da1a564 clang-tidy: use C++ casting
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-20 07:29:02 +02:00
Rosen Penev
b8712188bb clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-17 21:52:03 +02:00
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>
2021-05-15 17:32:56 +02:00
Rosen Penev
143a1fbbe2 clang-tidy: don't use string compare
Found with readability-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-12 07:12:15 +02:00
Rosen Penev
bd6a996181 clang-tidy: use using
Found with modernize-use-using

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-09 17:42:51 +02:00
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>
2021-05-03 14:50:04 +02:00
Luis Díaz Más
94b87a8dec Remove deprecated SSH support 2021-04-18 09:44:51 +02:00
Robin Mills
d632988bbd Massive code prolog cleanup. 2021-03-17 13:34:21 +00:00