f_return_status f_utf_buffer_decrement(const f_string_static_t buffer, f_string_range_t *range, const f_string_length_t step) {
#ifndef _di_level_0_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
- if (range->start > range->stop) return F_status_set_error(F_parameter);
- if (range->start >= buffer.used) return F_status_set_error(F_parameter);
if (step < 1) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!buffer.used) return F_data_not;
+ if (!buffer.used || range->start > range->stop || range->start >= buffer.used) return F_data_not;
f_string_length_t i = 0;
uint8_t width = 0;
f_return_status f_utf_buffer_increment(const f_string_static_t buffer, f_string_range_t *range, const f_string_length_t step) {
#ifndef _di_level_0_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
- if (range->start > range->stop) return F_status_set_error(F_parameter);
- if (range->start >= buffer.used) return F_status_set_error(F_parameter);
if (step < 1) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!buffer.used) return F_data_not;
+ if (!buffer.used || range->start > range->stop || range->start >= buffer.used) return F_data_not;
f_string_length_t i = 0;
uint8_t width = 0;
* F_none on success.
* F_none_stop if the stop range is reached before all steps are completed.
* F_none_eos if the end of buffer is reached before all steps are completed.
- * F_data_not if buffer is empty.
+ * F_data_not if buffer is empty or out of range.
* F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_parameter (with error bit) if a parameter is invalid.
*/
* F_none on success.
* F_none_stop if the stop range is reached before all steps are completed.
* F_none_eos if the end of buffer is reached before all steps are completed.
- * F_data_not if buffer is empty.
+ * F_data_not if buffer is empty or out of range.
* F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed.
* F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_parameter (with error bit) if a parameter is invalid.