summaryrefslogtreecommitdiffstats
path: root/src/basic/utf8.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bootctl: Add --secure-boot-auto-enrollDaan De Meyer2024-11-031-0/+1
| | | | | | When specified, bootctl install will also set up secure boot auto-enrollment. For now, We sign all variables using the same certificate and key pair.
* various: move ptr indicator to return valueZbigniew Jędrzejewski-Szmek2024-06-191-4/+4
|
* utf8: export utf8_char_console_width()Lennart Poettering2024-06-171-0/+1
|
* basic/utf8: modernize ascii_is_valid_n, make ascii_is_valid static inlineMike Yuan2024-06-161-2/+5
|
* basic/utf8: modernize utf8_is_valid_n a bitMike Yuan2024-06-161-3/+3
|
* tree-wide: "<n>bit" → "<n>-bit"Zbigniew Jędrzejewski-Szmek2023-07-021-1/+1
| | | | In some places, "<n> bits" is used when more appropriate.
* basic/utf8: add function to convert to ASCIIZbigniew Jędrzejewski-Szmek2021-11-161-0/+2
| | | | The conversion must be lossy because ASCII doesn't have enough chars.
* basic/escape: allow truncation mode where "…" is always appendedZbigniew Jędrzejewski-Szmek2021-05-051-2/+2
| | | | | | | | | | | So far we would append "…" or "..." when the string was wider than the specified output width. But let's add a mode where the caller knows that the string being passed is already truncated. The condition for jumping back in utf8_escape_non_printable_full() was off-by-one. But we only jumped to that label after doing a check with a stronger condition, so I think it didn't matter. Now it matters because we'd output the forced ellipsis one column too early.
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-041-2/+2
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* shared/utf8: add utf8_is_valid_n()Zbigniew Jędrzejewski-Szmek2020-09-011-1/+4
| | | | | Sometimes we need to check strings without the terminating NUL. Add a variant that does that.
* basic/utf8: rename parameterZbigniew Jędrzejewski-Szmek2020-08-171-1/+1
| | | | | Every time I was using this function I had to check whether "newline" means that newlines are good or bad.
* util-lib: add truncation based on printable width to utf8_escape_non_printable()Zbigniew Jędrzejewski-Szmek2019-05-221-1/+4
|
* basic/utf8: do not read past end of string when looking for a multi-byte ↵Zbigniew Jędrzejewski-Szmek2019-02-261-1/+1
| | | | | | character Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9341.
* missing: move char{16,32}_t definitions to missing_type.hYu Watanabe2018-12-041-1/+1
|
* uft8: add comment, requested by @keszybzLennart Poettering2018-09-271-1/+1
|
* utf8: add utf8_to_utf16() helperLennart Poettering2018-09-251-0/+5
|
* utf8: let's update utf16_to_utf8() a bitLennart Poettering2018-09-251-1/+1
| | | | | | | | | | | Let's change utf16_to_utf8() prototype to refer to utf16 chars with char16_t rather than void Let's not cast away a "const" needlessly. Let's add a few comments. Let's fix the calculations of the buffer size to allocate, and how long to run the loop in case of uneven byte numbers
* utf8: modernize utf16 inline calls a bitLennart Poettering2018-09-251-3/+3
| | | | | | | | | | | | | | | Let's fix an indentation issue. Let's avoid yoda comparisons. Let's drop unnecessary (). Let's make sure we convert 16bit values to 32bit before shifting them by 10bit to the left, to avoid overflows. Let's avoid comparisons between signed literals and unsigned variables, in particular if the literals are outside of the minimum range C requires for "int".
* utf8: update utf8_is_valid() a bitLennart Poettering2018-09-251-1/+1
| | | | | | | Let's avoid a few casts in the function. Also, let's drop the "const" when returning the string, for similar reasons as strchr() and friends drop it: so that we don't add a const if the user passes in a non-const string.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* basic/utf8: add ascii_is_valid_n()Zbigniew Jędrzejewski-Szmek2018-06-091-0/+1
|
* utf8: add helper call for counting display width of stringsLennart Poettering2018-04-181-0/+1
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* utf8: add utf8_n_codepoints() for counting complete utf8 codepoints in a stringLennart Poettering2018-02-141-0/+2
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* Ignore BOM in config filesZbigniew Jędrzejewski-Szmek2016-03-221-0/+1
| | | | | | Fixes #2823. Also remove unnecessary feof check.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* utf8.[ch] et al: use char32_t and char16_t instead of int, int32_t, int16_tShawn Landden2016-01-271-6/+8
| | | | | | | | | | | | rework C11 utf8.[ch] to use char32_t instead of uint32_t when referring to unicode chars, to make things more expressive. [ @zonque: * rebased to current master * use AC_CHECK_DECLS to detect availibility of char{16,32}_t * make utf8_encoded_to_unichar() return int ]
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-0/+2
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* Revert "utf8.[ch]: use char32_t and char16_t instead of int, int32_t, int16_t"Lennart Poettering2015-11-021-7/+6
|
* utf8.[ch]: use char32_t and char16_t instead of int, int32_t, int16_tShawn Landden2015-11-011-6/+7
| | | | | rework C11 utf8.[ch] to use char32_t instead of uint32_t when referring to unicode chars, to make things more expressive.
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+57
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/