Commit Graph

116 Commits

Author SHA1 Message Date
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
Max Kellermann e620677d7c lib/icu/CaseFold: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann 09d8e44d56 lib/icu/Converter: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann 9dc530ab51 lib/icu/Util: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann 2d0798cd4d lib/icu/Win32: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann 915c48f748 util/AllocatedString: std::string_view support 2020-04-03 16:08:55 +02:00
Rosen Penev 608d7ec1e7 [clang-tidy] change integer prefixes to uppercase
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26 17:25:20 +01:00
Rosen Penev 2b3d6461e3 remove unused ctype.h header
None of the functions in these files come from ctype.h

Also changed one instance of isdigit to the C++ variant.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:43:50 -07:00
Rosen Penev ab9f5d2067 replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Rosen Penev a3963de668 [clang-tidy] change integer prefixes to uppercase
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-02-04 15:20:50 -08:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann ed327c597a lib/icu/Converter: Create() returns std::unique_ptr 2019-11-04 15:44:06 +01:00
Max Kellermann e1867a99e9 Merge tag 'v0.21.16'
release v0.21.16
2019-10-16 12:03:12 +02:00
Andre Heider 96a9670c69 lib/icu: fix build with iconv() 2019-10-07 13:34:04 +02:00
Max Kellermann f909615b14 include cleanups (powered by iwyu) 2019-08-15 17:57:20 +02:00
Max Kellermann cde6c46d2f util/Macros: replace with std::size() (C++17) 2019-08-03 13:10:49 +02:00
Max Kellermann 9cdebc90a0 lib/icu/Compare: use StringIsEqualIgnoreCase() 2019-07-05 09:59:58 +02:00