Project

General

Profile

Feature #807 ยป 0016-fc_utf8.c-Replace-NULLs-with-nullptrs.patch

Marko Lindqvist, 08/25/2024 10:15 PM

View differences:

utility/fc_utf8.c
const char *end;
size_t src_len, len;
fc_assert_ret_val(NULL != src, 0);
fc_assert_ret_val(src != nullptr, 0);
src_len = strlen(src);
while (TRUE) {
......
/* Jump to next character in src. */
src = fc_utf8_find_next_char(end);
if (src == NULL || *src == '\0') {
if (src == nullptr || *src == '\0') {
*dest = '\0';
return src_len; /* End of 'src' reached. */
}
......
/************************************************************************//**
Returns TRUE if the string 'utf8_string' contains only valid UTF-8
characters. If 'end' is not NULL, the end of the valid string will be
characters. If 'end' is not nullptr, the end of the valid string will be
stored there, even if it returns TRUE.
See also fc_utf8_validate_len().
......
while ('\0' != *utf8_string) {
size = FC_UTF8_CHAR_SIZE(utf8_string);
if (!base_fc_utf8_char_validate(utf8_string, size)) {
if (NULL != end) {
if (end != nullptr) {
*end = utf8_string;
}
return FALSE;
}
utf8_string += size;
}
if (NULL != end) {
if (end != nullptr) {
*end = utf8_string;
}
......
/************************************************************************//**
Returns TRUE if the string 'utf8_string' contains only valid UTF-8
characters in the limit of the length (in bytes) 'byte_len'. If 'end' is
not NULL, the end of the valid string will be stored there, even if it
not nullptr, the end of the valid string will be stored there, even if it
returns TRUE.
See also fc_utf8_validate().
......
size = FC_UTF8_CHAR_SIZE(utf8_string);
if (!base_fc_utf8_char_validate(utf8_string, size)) {
if (end != NULL) {
if (end != nullptr) {
*end = utf8_string;
}
return FALSE;
}
if (size > byte_len) {
if (end != NULL) {
if (end != nullptr) {
*end = utf8_string;
}
return FALSE;
......
utf8_string += size;
}
if (end != NULL) {
if (end != nullptr) {
*end = utf8_string;
}
......
va_start(args, format);
ret = fc_utf8_vsnprintf_rep(str, n, format, args);
va_end(args);
return ret;
}
    (1-1/1)