Commit Graph

132 Commits

Author SHA1 Message Date
Max Kellermann 044280c538 meson.build: require Meson 1.0
Debian Bookworm (the current stable) has 1.0.1 and Ubuntu LTS 24.04
has 1.3.2.  It's acceptable to require at least version 1.0 now.
2024-07-05 17:23:52 +02:00
Max Kellermann 381215fd73 *: use std::scoped_lock with implicit template parameter 2024-05-23 20:54:49 +02:00
Max Kellermann 0c1ecc96a8 *: let libfmt quote strings 2024-04-16 11:50:18 +02:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann fa58db798b lib/fmt/RuntimeError: new library
Replacing FormatRuntimeError().
2022-11-29 14:10:34 +01:00
Max Kellermann cf762f2a9d lib/icu/Error: std::system_error with UErrorCode 2022-11-29 09:31:48 +01:00
Max Kellermann 8ad0d919b1 lib/icuConverter, ...: use FmtBuffer() and FmtErrno() 2022-11-29 09:09:11 +01:00
Max Kellermann c158abe87c lib/icu/Compare: use StringIsEqualIgnoreCase() 2022-11-15 21:13:01 +01:00
Max Kellermann 53530bd1d5 lib/icu/Canonicalize: convert all punctuation to ASCII
To make tag matching easier.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1669
2022-11-15 21:04:16 +01:00
Max Kellermann d7f545721b lib/icu/Canonicalize: use unorm2_normalize() instead of u_strFoldCase()
unorm2_normalize() can case-fold as well, plus it applies Unicode
normalization which MPD should do for proper string comparisons.
2022-11-15 20:53:29 +01:00
Max Kellermann 8b72cb64b2 lib/icu/CaseFold: rename to IcuCanonicalize() and add flag parameter
Prepare for adding more transformations.
2022-11-15 20:53:04 +01:00
Max Kellermann 852df2239e lib/icu/Transliterator: pass std::basic_string_view<UChar> to constructor 2022-11-15 20:53:03 +01:00
Max Kellermann 264b3f8543 lib/icu/Collate: clear the global variable in IcuCollateFinish()
To allow repeated init/finish cycles.
2022-11-15 20:48:50 +01:00
Max Kellermann ac2bce8b7b lib/icu/Transliterator: add missing include 2022-11-15 17:07:54 +01:00
Max Kellermann 9f3faaf3c4 lib/icu/Transliterator: wrapper for UTransliterator 2022-11-15 01:09:27 +01:00
Max Kellermann 7be39e07e1 lib/icu/Normalize: wrapper for unorm2_normalize() 2022-11-15 00:49:25 +01:00
Max Kellermann 154fb4317f lib/icu/CaseFold: move low-level wrapper to FoldCase.cxx 2022-11-15 00:46:58 +01:00
Max Kellermann aad5210820 lib/icu/CaseFold: use ToStringView() 2022-11-15 00:36:47 +01:00
Max Kellermann 1a6ec716ef lib/icu/Converter: add noexcept 2022-11-15 00:28:41 +01:00
Max Kellermann 2c11095eed lib/icu/Compare: use StringStartsWith() for improved code clarity
Also fixes the inverted strncmp() call.
2022-09-27 20:23:10 +02:00
jcorporation 868a06eaf9 Add starts_with to filter expressions 2022-09-27 19:45:15 +02:00
Max Kellermann 4c08c0b8b1 Merge branch 'v0.23.x' 2022-07-27 11:06:47 +02:00
Rosen Penev cc557c4d60 meson: port ncpmc iconv solution
Properly deals with iconv, unlike the current solution. have_iconv fails
when libiconv CFLAGS are passed to the compiler. Tested under OpenWrt
with its CONFIG_BUILD_NLS, which adds libiconv include flags.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-07-20 08:03:24 +02:00
Max Kellermann cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann 020c9b41cc lib/icu: use std::span instead of ConstBuffer 2022-07-04 18:37:35 +02:00
Max Kellermann 5fb97b81d1 util/AllocatedArray: migrate from {Const,Writable}Buffer to std::span 2022-05-19 20:52:48 +02:00
Andreas Ziegler ee39af3419 fix typo in comment 2022-04-24 04:14:17 +00:00
aeolio 3882a5a263 src/lib/icu: fix iconv() detection when libiconv is installed 2022-04-20 16:10:39 +02:00
Rosen Penev 250011f016 return by braced init list
shorter

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:28:08 -08:00
Rosen Penev 4e0e4c00bf treewide: replace lock_guard with scoped_lock
SonarLint reports the latter to be better:

std::scoped_lock basically provides the same feature as std::lock_guard,
but is more generic: It can lock several mutexes at the same time, with a
deadlock prevention mechanism (see {rule:cpp:S5524}). The equivalent code
to perform simultaneous locking with std::lock_guard is significantly more
complex. Therefore, it is simpler to use std::scoped_lock all the time,
even when locking only one mutex (there will be no performance impact).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:13:03 -08:00
Rosen Penev 31aa6d0c4f use auto with make_unique
C arrays can be used with make_unique in C++17.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 01:33:03 -08:00
Max Kellermann f510564d9d more [[gnu::...]] attributes 2021-10-13 12:07:05 +02:00
Max Kellermann 262e1957b7 lib/icu/Converter: use libfmt 2021-05-27 16:09:56 +02:00
Max Kellermann 3bc45fbf68 util/AllocatedString: remove Null(), IsNull() 2021-01-21 20:12:05 +01:00
Max Kellermann c1a7aa652d util/AllocatedString: replace Clone() with copy constructor 2021-01-21 20:02:41 +01:00
Max Kellermann a81c9bfb81 util/AllocatedString: add string_view constructor
Replaces the static Duplicate() method.
2021-01-21 18:05:51 +01:00
Max Kellermann 1caf57644f util/AllocatedString: add default constructor 2021-01-21 18:05:50 +01:00
Max Kellermann c70b63c183 util/AllocatedString: rename to BasicAllocatedString
To make things simpler, AllocatedString is now a non-template class.
2021-01-21 18:04:03 +01:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann 67c7116f05 Merge branch 'v0.21.x' into master 2020-09-04 18:35:21 +02:00
Rosen Penev c876d6a51c lib/icu: fix build without libc iconv support
Need to check for it in iconv.h. Otherwise meson prefixes a __builtin variant in the check.
2020-07-23 14:09:43 +02:00
Max Kellermann 99afe8e6d1 lib/icu/Win32: paranoid-ify the buffer length checks
Passing `length+1` to `MultiByteToWideChar()` means the function may
fill the whole buffer with output data, and could theoretically
overwrite the null terminator.  In practice, this will never happen,
but this way, it's slightly more correct.

Also, null-terminate after `MultiByteToWideChar()`, after we got the
real output length.  Again, this would never have been a problem, but
who knows...
2020-05-30 13:29:09 +02:00
Shen-Ta Hsieh 169810e8f4 lib/icu: add null terminate in win32 string and wstring 2020-05-30 04:04:34 +08:00
Max Kellermann 6cc58ccb9b lib/icu/Converter: add missing <string_view> include 2020-05-26 17:48:01 +02:00
Max Kellermann 0b3acc3eec Merge tag 'v0.21.23'
release v0.21.23
2020-04-23 18:01:23 +02:00
Max Kellermann 8f00dbea45 lib/icu/Compare: add Windows implementation
Using CompareStringEx() and FindNLSStringEx().

Implements a missing piece for
https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 21:42:12 +02:00
Max Kellermann f3fd2eb618 lib/icu/Compare: use AllocatedString::Clone() 2020-04-22 21:39:13 +02:00
Max Kellermann fc92db83cf lib/icu/Collate: use NORM_IGNORECASE instead of LINGUISTIC_IGNORECASE
LINGUISTIC_IGNORECASE is unimplemented on Wine, but since we don't
have any locale support (yet), and we're using LOCALE_NAME_INVARIANT,
NORM_IGNORECASE should essentially be the same, so why bother.
2020-04-22 21:39:13 +02:00
Max Kellermann 3b0f8d5516 lib/icu/CaseFold: remove Windows implementation
Reverts commit fb3564fbe7

LCMapStringEx() doesn't do what I imagined it would do 5 years ago.
D'oh!

Closes https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 19:32:36 +02:00
Max Kellermann 91c75a133f lib/icu/Collate: pass std::string_view 2020-04-03 16:13:15 +02:00