if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!source.used) {
- return F_data_not_eos;
- }
-
- if (range.start > range.stop) {
- return F_data_not_stop;
- }
+ if (!source.used) return F_data_not_eos;
+ if (range.start > range.stop) return F_data_not_stop;
f_array_length_t begin = range.start;
f_array_length_t end = range.stop;
{
const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end);
if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
- }
+ if (status == F_data_not) return status;
}
- if (begin > end) {
- return F_data_not_stop;
- }
+ if (begin > end) return F_data_not_stop;
return f_string_append(source.string + begin, (end - begin) + 1, destination);
}
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!source.used) {
- return F_data_not_eos;
- }
-
- if (range.start > range.stop) {
- return F_data_not_stop;
- }
+ if (!source.used) return F_data_not_eos;
+ if (range.start > range.stop) return F_data_not_stop;
f_array_length_t begin = range.start;
f_array_length_t end = range.stop;
{
const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end);
if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
- }
+ if (status == F_data_not) return status;
}
- if (begin > end) {
- return F_data_not_stop;
- }
+ if (begin > end) return F_data_not_stop;
return f_string_append_nulless(source.string + begin, (end - begin) + 1, destination);
}
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!source.used) {
- return F_data_not_eos;
- }
+ if (!source.used) return F_data_not_eos;
f_array_length_t begin = 0;
f_array_length_t end = source.used - 1;
{
const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end);
if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
- }
+ if (status == F_data_not) return status;
}
- if (begin > end) {
- return F_data_not_stop;
- }
+ if (begin > end) return F_data_not_stop;
return f_string_append(source.string + begin, (end - begin) + 1, destination);
}
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!source.used) {
- return F_data_not_eos;
- }
+ if (!source.used) return F_data_not_eos;
f_array_length_t begin = 0;
f_array_length_t end = source.used - 1;
{
const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end);
if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
- }
+ if (status == F_data_not) return status;
}
- if (begin > end) {
- return F_data_not_stop;
- }
+ if (begin > end) return F_data_not_stop;
return f_string_append_nulless(source.string + begin, (end - begin) + 1, destination);
}
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!buffer.used) {
- return F_data_not;
- }
-
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start >= buffer.used) return F_data_not_eos;
const unsigned short seek_width = macro_f_utf_char_t_width(seek_to_this);
unsigned short width = 0;
f_array_length_t width_max = 0;
- while (range->start <= range->stop) {
+ while (range->start <= range->stop && range->start < buffer.used) {
width_max = (range->stop - range->start) + 1;
width = macro_f_utf_byte_width_is(buffer.string[range->start]);
if (!width) {
width = 1;
- if (buffer.string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
-
- if (seek_width == width) {
- if (buffer.string[range->start] == seek_to_this) {
- return F_none;
- }
- }
+ if (buffer.string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
+ if (seek_width == width && buffer.string[range->start] == seek_to_this) return F_none;
}
// Do not operate on UTF-8 fragments that are not the first byte of the character.
else if (width == 1) {
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
+ if (range->start + width >= buffer.used) return F_status_set_error(F_complete_not_utf_eos);
if (width == seek_width) {
f_utf_char_t character = 0;
status = f_utf_char_to_character(buffer.string + range->start, width_max, &character);
if (F_status_is_error(status)) return status;
-
- if (character == seek_to_this) {
- return F_none;
- }
+ if (character == seek_to_this) return F_none;
}
}
range->start += width;
-
- if (range->start >= range->stop) {
- return F_none_stop;
- }
} // while
+ if (range->start > range->stop) return F_none_stop;
+ if (range->start > buffer.range) return F_none_eos;
+
return F_none_eos;
}
#endif // _di_fl_string_dynamic_seek_line_to_utf_character_
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!buffer.used) {
- return F_data_not;
- }
-
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start >= buffer.used) return F_data_not_eos;
f_status_t status = F_none;
unsigned short width = 0;
while (buffer.string[range->start] == placeholder || (status = f_utf_is_graph(buffer.string + range->start, width_max)) == F_false) {
if (F_status_is_error(status)) return status;
-
- if (buffer.string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
+ if (buffer.string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
width = macro_f_utf_byte_width_is(buffer.string[range->start]);
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
+ if (range->start + width >= buffer.used) return F_status_set_error(F_complete_not_utf_eos);
}
range->start += width;
- if (range->start > range->stop) {
- return F_none_stop;
- }
+ if (range->start > range->stop) return F_none_stop;
+ if (range->start >= buffer.used) return F_none_eos;
width_max = (range->stop - range->start) + 1;
} // while
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!buffer.used) {
- return F_data_not;
- }
-
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start >= buffer.used) return F_data_not_eos;
f_status_t status = F_none;
unsigned short width = 0;
while (buffer.string[range->start] == placeholder || (status = f_utf_is_whitespace(buffer.string + range->start, width_max, F_false)) == F_false) {
if (F_status_is_error(status)) return status;
-
- if (buffer.string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
+ if (buffer.string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
width = macro_f_utf_byte_width_is(buffer.string[range->start]);
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
+ if (range->start + width >= buffer.used) return F_status_set_error(F_complete_not_utf_eos);
}
range->start += width;
- if (range->start > range->stop) {
- return F_none_stop;
- }
+ if (range->start > range->stop) return F_none_stop;
+ if (range->start >= buffer.used) return F_none_eos;
width_max = (range->stop - range->start) + 1;
} // while
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!buffer.used) {
- return F_data_not;
- }
-
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start > buffer.used) return F_data_not_eos;
const unsigned short seek_width = macro_f_utf_char_t_width(seek_to_this);
f_array_length_t width_max = 0;
- while (range->start <= range->stop) {
+ while (range->start <= range->stop && range->start < buffer.used) {
width_max = (range->stop - range->start) + 1;
width = macro_f_utf_byte_width_is(buffer.string[range->start]);
width = 1;
if (seek_width == width) {
- if (buffer.string[range->start] == seek_to_this) {
- return F_none;
- }
+ if (buffer.string[range->start] == seek_to_this) return F_none;
}
}
// Do not operate on UTF-8 fragments that are not the first byte of the character.
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
+ if (range->start + width >= buffer.used) return F_status_set_error(F_complete_not_utf_eos);
if (width == seek_width) {
f_utf_char_t character = 0;
status = f_utf_char_to_character(buffer.string + range->start, width_max, &character);
if (F_status_is_error(status)) return status;
-
- if (character == seek_to_this) {
- return F_none;
- }
+ if (character == seek_to_this) return F_none;
}
}
range->start += width;
-
- if (range->start >= range->stop) {
- return F_none_stop;
- }
} // while
+ if (range->start > range->stop) return F_none_stop;
+
return F_none_eos;
}
#endif // _di_fl_string_dynamic_seek_to_utf_character_
}
// Skip past all leading NULLs.
- for (; range->start <= range->stop; ++range->start) {
+ for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
if (buffer.string[range->start]) break;
} // for
- if (range->start > range->stop) {
- return F_data_not;
- }
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start > range->stop) return F_data_not_eos;
// The FLL Identifier is always at least 6 characters ("X-0000").
if (range->stop - range->start < 5) {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
f_status_t status = F_none;
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
status = f_utf_is_whitespace(buffer.string + range->start, (range->stop - range->start) + 1, F_false);
if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_maybe) {
- return F_status_set_error(F_complete_not_utf);
- }
+ if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_complete_not_utf);
return status;
}
range->start += macro_f_utf_byte_width(buffer.string[range->start]);
} // for
- if (range->start > range->stop) {
- return F_found_not;
- }
+ if (range->start > range->stop || range->start > buffer.used) return F_found_not;
if (range->stop - range->start < 5) {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
f_array_length_t i = range->start;
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
status = f_utf_is_word(buffer.string + range->start, (range->stop - range->start) + 1, F_true);
if (F_status_is_error(status)) return status;
range->start += macro_f_utf_byte_width(buffer.string[range->start]);
} // for
- if (range->start > range->stop || buffer.string[range->start] != f_string_ascii_minus_s.string[0]) {
+ if (range->start > range->stop || range->start >= buffer.used || buffer.string[range->start] != f_string_ascii_minus_s.string[0]) {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
f_array_length_t j = 0;
f_char_t number[5] = { 0, 0, 0, 0, 0 };
- for (++range->start; range->start <= range->stop && j < 4; ++range->start, ++j) {
+ for (++range->start; range->start <= range->stop && range->start < buffer.used && j < 4; ++range->start, ++j) {
// The hexidecimal representing the number may only be ASCII.
if (macro_f_utf_byte_width_is(buffer.string[range->start])) {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
else {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
}
// Skip past all NULLs.
- for (; range->start <= range->stop; ++range->start) {
+ for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
if (buffer.string[range->start]) break;
} // for
if (status == F_false) {
// Increment until stop, while taking into consideration UTF-8 character widths.
- for (; range->start <= range->stop; ) {
+ for (; range->start <= range->stop && range->start < buffer.used; ) {
if (buffer.string[range->start] == f_string_eol_s.string[0]) {
++range->start;
}
if (id) {
- for (f_array_length_t j = i, i = 0; j <= range->stop; ++j) {
+ for (f_array_length_t j = i, i = 0; j <= range->stop && j < buffer.used; ++j) {
if (!buffer.string[j]) continue;
if (buffer.string[j] == f_string_ascii_minus_s.string[0]) break;
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!length) {
- return F_data_not_eos;
- }
+ if (!length) return F_data_not_eos;
f_array_length_t begin = 0;
f_array_length_t end = length - 1;
- const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end);
- if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
+ {
+ const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end);
+ if (F_status_is_error(status)) return status;
+ if (status == F_data_not) return status;
}
return f_string_append(source + begin, (end - begin) + 1, destination);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (!length) {
- return F_data_not_eos;
- }
+ if (!length) return F_data_not_eos;
f_array_length_t begin = 0;
f_array_length_t end = length - 1;
- const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end);
- if (F_status_is_error(status)) return status;
-
- if (status == F_data_not) {
- return status;
+ {
+ const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end);
+ if (F_status_is_error(status)) return status;
+ if (status == F_data_not) return status;
}
return f_string_append_nulless(source + begin, (end - begin) + 1, destination);
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (range->start > range->stop) return F_data_not_stop;
const unsigned short seek_width = macro_f_utf_char_t_width(seek_to);
if (!width) {
width = 1;
- if (string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
-
- if (seek_width == width) {
- if (string[range->start] == seek_to) {
- return F_none;
- }
- }
+ if (string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
+ if (seek_width == width && string[range->start] == seek_to) return F_none;
}
// Do not operate on UTF-8 fragments that are not the first byte of the character.
else if (width == 1) {
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_eos);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_eos);
if (width == seek_width) {
f_utf_char_t character = 0;
status = f_utf_char_to_character(string + range->start, width_max, &character);
if (F_status_is_error(status)) return status;
-
- if (character == seek_to) {
- return F_none;
- }
+ if (character == seek_to) return F_none;
}
}
} // for
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (range->start > range->stop) return F_data_not_stop;
f_status_t status = F_none;
unsigned short width = 0;
while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == F_false) {
if (F_status_is_error(status)) return status;
-
- if (string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
+ if (string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
width = macro_f_utf_byte_width_is(string[range->start]);
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
}
range->start += width;
- if (range->start > range->stop) {
- return F_none_stop;
- }
+ if (range->start > range->stop) return F_none_stop;
width_max = (range->stop - range->start) + 1;
} // while
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (range->start > range->stop) return F_data_not_stop;
f_status_t status = F_none;
unsigned short width = 0;
while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max, F_false)) == F_false) {
if (F_status_is_error(status)) return status;
-
- if (string[range->start] == f_string_eol_s.string[0]) {
- return F_none_eol;
- }
+ if (string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
width = macro_f_utf_byte_width_is(string[range->start]);
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
}
range->start += width;
- if (range->start > range->stop) {
- return F_none_stop;
- }
+ if (range->start > range->stop) return F_none_stop;
width_max = (range->stop - range->start) + 1;
} // while
if (!range) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (range->start > range->stop) return F_data_not_stop;
const unsigned short seek_width = macro_f_utf_char_t_width(seek_to);
if (!width) {
width = 1;
- if (seek_width == width) {
- if (string[range->start] == seek_to) {
- return F_none;
- }
- }
+ if (seek_width == width && string[range->start] == seek_to) return F_none;
}
// Do not operate on UTF-8 fragments that are not the first byte of the character.
else if (width == 1) {
return F_status_set_error(F_complete_not_utf);
}
else {
- if (range->start + width > range->stop) {
- return F_status_set_error(F_complete_not_utf_stop);
- }
+ if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop);
if (width == seek_width) {
f_utf_char_t character = 0;
status = f_utf_char_to_character(string + range->start, width_max, &character);
if (F_status_is_error(status)) return status;
-
- if (character == seek_to) {
- return F_none;
- }
+ if (character == seek_to) return F_none;
}
}
} // for