return F_none;
}
- if (macro_f_utf_byte_width_is(*sequence) == 1) {
- return F_status_set_error(F_utf_fragment);
- }
-
- if (macro_f_utf_byte_width_is(*sequence) > width_max) {
- return F_status_set_error(F_complete_not_utf);
- }
+ if (macro_f_utf_byte_width_is(*sequence) == 1) return F_status_set_error(F_utf_fragment);
+ if (macro_f_utf_byte_width_is(*sequence) > width_max) return F_status_set_error(F_complete_not_utf);
*character_utf = macro_f_utf_char_t_from_char_1(sequence[0]);
- if (macro_f_utf_byte_width_is(*sequence) < 2) {
- return F_none;
- }
+ if (macro_f_utf_byte_width_is(*sequence) < 2) return F_none;
*character_utf |= macro_f_utf_char_t_from_char_2(sequence[1]);
- if (macro_f_utf_byte_width_is(*sequence) == 2) {
- return F_none;
- }
+ if (macro_f_utf_byte_width_is(*sequence) == 2) return F_none;
*character_utf |= macro_f_utf_char_t_from_char_3(sequence[2]);
- if (macro_f_utf_byte_width_is(*sequence) == 3) {
- return F_none;
- }
+ if (macro_f_utf_byte_width_is(*sequence) == 3) return F_none;
*character_utf |= macro_f_utf_char_t_from_char_4(sequence[3]);
#if !defined(_di_f_utf_unicode_to_) || !defined(_di_f_utf_character_unicode_to_)
f_status_t private_f_utf_character_unicode_to(const f_utf_char_t sequence, uint32_t *codepoint) {
- if (macro_f_utf_char_t_width_is(sequence) == 1) {
- return F_status_set_error(F_utf_fragment);
- }
-
- if (private_f_utf_character_is_valid(sequence) == F_false) {
- return F_status_set_error(F_utf_not);
- }
+ if (macro_f_utf_char_t_width_is(sequence) == 1) return F_status_set_error(F_utf_fragment);
+ if (private_f_utf_character_is_valid(sequence) == F_false) return F_status_set_error(F_utf_not);
// U+0000 -> U+007F (ASCII).
if (macro_f_utf_char_t_width(sequence) == 1) {
if (!character_utf) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (macro_f_utf_byte_width_is(*character) > width_max) {
- return F_status_set_error(F_failure);
- }
-
- if (macro_f_utf_byte_width_is(*character) == 1) {
- return F_status_set_error(F_utf_fragment);
- }
+ if (macro_f_utf_byte_width_is(*character) > width_max) return F_status_set_error(F_failure);
+ if (macro_f_utf_byte_width_is(*character) == 1) return F_status_set_error(F_utf_fragment);
return private_f_utf_char_to_character(character, width_max, character_utf);
}
#endif // _di_level_0_parameter_checking_
if (macro_f_utf_char_t_width_is(unicode)) {
- if (macro_f_utf_char_t_width_is(unicode) == 1) {
- return F_status_set_error(F_utf_fragment);
- }
+ if (macro_f_utf_char_t_width_is(unicode) == 1) return F_status_set_error(F_utf_fragment);
memcpy(*character, &unicode, sizeof(f_char_t) * macro_f_utf_char_t_width_is(unicode));
/*#if __BYTE_ORDER == __LITTLE_ENDIAN
if (!character) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (unicode > 0x10ffff) {
- return F_status_set_error(F_utf_not);
- }
+ if (unicode > 0x10ffff) return F_status_set_error(F_utf_not);
// U+0000 -> U+007F.
if (unicode < 0x80) {
if (!string[i]) continue;
// Only ASCII character numbers are allowed to represent
- if (macro_f_utf_char_t_width_is(string[i])) {
- return F_status_set_error(F_valid_not);
- }
+ if (macro_f_utf_char_t_width_is(string[i])) return F_status_set_error(F_valid_not);
value *= 16;
character = macro_f_utf_char_t_to_char_1(string[i]);
if (width_max < 1) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (codepoint > 0x10ffff) {
- return F_status_set_error(F_utf_not);
- }
+ if (codepoint > 0x10ffff) return F_status_set_error(F_utf_not);
if (codepoint < 0x80) {
}
}
else if (codepoint < 0x800) {
- if (width_max < 2) {
- return F_status_set_error(F_utf_not);
- }
+ if (width_max < 2) return F_status_set_error(F_utf_not);
// U+0080 -> U+07FF
(*character)[0] = F_utf_byte_2_d | ((f_char_t) ((codepoint & 0x7c0) >> 6));
}
}
else if (codepoint < 0x10000) {
- if (width_max < 3) {
- return F_status_set_error(F_utf_not);
- }
+ if (width_max < 3) return F_status_set_error(F_utf_not);
// U+0800 -> U+FFFF
(*character)[0] = F_utf_byte_3_d | ((f_char_t) ((codepoint & 0xf000) >> 12));
}
}
else {
- if (width_max < 4) {
- return F_status_set_error(F_utf_not);
- }
+ if (width_max < 4) return F_status_set_error(F_utf_not);
// U+10000 -> U+10FFFF
(*character)[0] = F_utf_byte_4_d | ((f_char_t) ((codepoint & 0x1c0000) >> 18));
}
}
- if (i == length) {
- return F_status_set_error(F_valid_not);
- }
+ if (i == length) return F_status_set_error(F_valid_not);
uint32_t value = 0;
}
} // for
- if (value > 0x10ffff) {
- return F_status_set_error(F_valid_not);
- }
+ if (value > 0x10ffff) return F_status_set_error(F_valid_not);
*unicode = value;