166 Commits (1f364be1fa9573848396e3c06019e5c019e9e9a1)

Author SHA1 Message Date
Peter 1f364be1fa
Fix seg fault when using `iconv_open()` (#2403)
* Fix seg fault when using `iconv_open()`

- Fix failure condition for `iconv_open()`
- Add new exception when failing to change the text encoding of an
Exif comment

* Add testing for `iconv_open()` seg fault bug

* Fix Python test by changing log level
3 years ago
Rosen Penev 88fcd234bb remove pointless x_default variable
Just replace it with the string.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 1602afef0a const conversions
These were not const.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 1d0530f04d misc sonarlint changes
Mostly const changes.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 5d2d47032b replace [0] with front() where applicable
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Kevin Backhouse 1958e70a71 Use int32_t in TimeValue 3 years ago
Rosen Penev 3ae1d3b48e return make_unique directly
Simpler

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev bae7da19ca clang-tidy: use default member init
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev b4c90b5e16 clang-tidy: replace pointer magic with data()
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev a8061e7ee9 clang-tidy: default member init
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 b72e4b0e44 clang-tidy: use auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 043547cbd0 remove various usages of memset
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más d7f35e33f0 Remove useless static_casts 3 years ago
Luis Díaz Más b05573fadc Remove most of the asserts from codebase 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 Diaz 62aad98d0b Change Metadatum::copy return value from long to size_t 3 years ago
Luis Díaz Más 96f7f2e4c5 Convert Exiv2::ErrorCode into an enum class 3 years ago
Luis Díaz Más 5d08bb9bec
Merge pull request #2146 from Exiv2/mainDatesWithZeros
DateValue is now a bit more permissive with malformed dates
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
Luis Diaz 56c52be8b5 DateValue is now a bit more permissive with malformed dates 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
Luis Díaz Más b3a216310a Removing unused headers thanks to IWYU 3 years ago
Luis Díaz Más 2834fa5f05 Use [[maybe_unused]] 3 years ago
Rosen Penev a25bbe133f constexpr string conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 04bacdedd6 clang-tidy: use auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Rosen Penev 118aa78aa0 clang-tidy: use braced init list
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 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 59f4d0de27 cppcheck: reduce scope of variables 3 years ago
Luis Díaz Más ea201ce613 Remove dead code 3 years ago
Kevin Backhouse 2a3dd2def9
Replace Value::toLong with Value::toInt64. (#2062)
* Replace Value::toLong with Value::toInt64.

* Fix compiler warning.

* Fix compile error.

* Fix declaration of canonEv

* Fix compiler warning.

* Fix compiler warning.

* Use int64_t for offsets in tiffcomposite_int.cpp

* Fix compiler warning.

* Fix compiler warnings.

* Fix compiler warning.

* Fix compiler warning.

* Fix compiler warning.

* Fix compiler warning.

* Remove static_cast<long int> in TagDetails initializer.
3 years ago
Luis Díaz Más 0f03e77634 Simplify code around UniquePtr(s) & use make_unique over new 3 years ago
Robin Mills 13a2cf336d
fix_1416_iptc_DateCreated (#1547)
* fix_1416_iptc_DateCreated

* Fix unit tests

* DateValue:read 2nd iteration on pre-condition

* test with ISO_8601 date format

* Use std::regex for ISO 8601 basic & extended date formats

* Use std::regex for ISO 8601 basic & extended time formats

* Add more tests & notes for DateValue & TimeValue

* Comment tests using local calendar times

* DateValue::write also adds padding to year field

Co-authored-by: Luis Díaz Más <piponazo@gmail.com>
4 years ago
Kevin Backhouse 644aaaac92
Check that the string isn't empty 4 years ago
Kevin Backhouse dc2c77ce81
Safer std::vector indexing. 4 years ago
Kevin Backhouse d5ada325af
Check that `type` isn't an empty string. 4 years ago
Kevin Backhouse a4c5bdac19 fix: stricter date parsing in value.cpp (#1720)
* Regression test for issue 1713

* Stricter date parsing.

* Fix test failure caused by stdout mismatch.

(cherry picked from commit ab58026cff0e5edebc026261e9dc4b7db05b802d)
4 years ago
mergify[bot] 1d64f482ff
fix: use vector::at() rather than operator[] (backport #1735) (#1741)
* fix: use vector::at() rather than operator[] (#1735)

* Regression test for https://github.com/Exiv2/exiv2/issues/1706

* Use vector::at() rather than operator[].

* Print to stderr when exception is caught and EXIV2_DEBUG_MESSAGES is enabled.

* Check that it prints "Bad value" for the date.

(cherry picked from commit f4d3adbf91e6dc4e34aee5bac7b7fd9e127a5c00)

# Conflicts:
#	src/value.cpp

* fix merge conflicts from mergify backport

Co-authored-by: Kevin Backhouse <kevinbackhouse@github.com>
Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com>
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
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 ff39473c18 clang-tidy: convert to static
Found with readability-convert-member-functions-to-static

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 20dfab8036 manual for range loop conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev c73dfa0106 clang-tidy: use uppercase numeric literals
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 2e73aa9dc0 default con/destructors in headers
Helps to optimize trivially destructable stuff.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 8337462032 clang-tidy: use empty() instead of comparing size
Found with readability-container-size-empty

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