if (!output) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (fwrite_unlocked(&character, 1, 1, output) == -1) {
+ if (!fwrite_unlocked(&character, 1, 1, output)) {
return F_status_set_error(F_output);
}
#endif // _di_level_0_parameter_checking_
if (character == 0x7f) {
- if (fwrite_unlocked(f_print_sequence_delete_s, 1, 3, output) != -1) {
+ if (fwrite_unlocked(f_print_sequence_delete_s, 1, 3, output) == 3) {
return F_none;
}
}
else if (macro_f_utf_character_t_width_is(character) == 1) {
- if (fwrite_unlocked(f_print_sequence_unknown_s, 1, 3, output) != -1) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s, 1, 3, output) == 3) {
return F_none;
}
}
else if (macro_f_utf_character_t_width_is(character) > 1 || character > 0x1f) {
- if (fwrite_unlocked(&character, 1, 1, output) != -1) {
+ if (fwrite_unlocked(&character, 1, 1, output)) {
return F_utf;
}
}
else {
- if (fwrite_unlocked(f_print_sequence_set_control_s[character], 1, 3, output) != -1) {
+ if (fwrite_unlocked(f_print_sequence_set_control_s[character], 1, 3, output) == 3) {
return F_none;
}
}
#ifndef _di_f_print_character_safely_get_
f_string_t f_print_character_safely_get(const char character) {
+
return private_f_print_character_safely_get(character);
}
#endif // _di_f_print_character_safely_get_
if (safe) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
total = 0;
}
- if (fwrite_unlocked(safe, 1, 3, output) == -1) {
+ if (fwrite_unlocked(safe, 1, 3, output) < 3) {
return F_status_set_error(F_output);
}
if (total + width >= F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
} // for
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
total = F_print_write_max_d;
}
- if (fwrite_unlocked(string + i, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + i, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (!string[i] || i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (!string[i] || i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (safe) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
total = 0;
}
- if (fwrite_unlocked(safe, 1, 3, output) == -1) {
+ if (fwrite_unlocked(safe, 1, 3, output) < 3) {
return F_status_set_error(F_output);
}
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (safe) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
total = 0;
}
- if (fwrite_unlocked(safe, 1, 3, output) == -1) {
+ if (fwrite_unlocked(safe, 1, 3, output) < 3) {
return F_status_set_error(F_output);
}
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
total = F_print_write_max_d;
}
- if (fwrite_unlocked(string + i, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + i, 1, total, output) < total) {
return F_status_set_error(F_output);
}
} while (i < length && !string[i] && total < F_print_write_max_d);
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
if (safe) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
total = 0;
}
- if (fwrite_unlocked(safe, 1, 3, output) == -1) {
+ if (!fwrite_unlocked(safe, 1, 3, output) < 3) {
return F_status_set_error(F_output);
}
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ if (fwrite_unlocked(string + start, 1, total, output) < total) {
return F_status_set_error(F_output);
}
}
#if !defined(_di_f_print_terminated_) || !defined(_di_f_print_raw_terminated_)
f_status_t private_f_print_terminated(const f_string_t string, FILE *output) {
- if (fwrite_unlocked(string, 1, strlen(string), output) == -1) {
+ const size_t length = strlen(string);
+
+ if (fwrite_unlocked(string, 1, length, output) < length) {
return F_status_set_error(F_output);
}