if (string == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- // @fixme: the string here does not have to be NULL terminated, so this usage is invalid/unsafe!
if (start_color.used != 0) {
- fprintf(file, "%s", start_color.string);
+ f_status status = f_print_dynamic_string(file, start_color);
+
+ if (f_status_is_error(status)) return status;
}
va_list ap;
va_end(ap);
- // @fixme: the string here does not have to be NULL terminated, so this usage is invalid/unsafe!
if (end_color.used != 0) {
- fprintf(file, "%s", end_color.string);
+ f_status status = f_print_dynamic_string(file, end_color);
+
+ if (f_status_is_error(status)) return status;
}
return f_none;
if (string == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- // @fixme: the string here does not have to be NULL terminated, so this usage is invalid/unsafe!
if (start_color.used != 0) {
- fprintf(file, "%s", start_color.string);
+ f_status status = f_print_dynamic_string(file, start_color);
+
+ if (f_status_is_error(status)) return status;
}
va_list ap;
va_end(ap);
- // @fixme: the string here does not have to be NULL terminated, so this usage is invalid/unsafe!
if (end_color.used != 0) {
- fprintf(file, "%s", end_color.string);
+ f_status status = f_print_dynamic_string(file, end_color);
+
+ if (f_status_is_error(status)) return status;
}
// now print the trailing newline, this is done _after_ ending the colors to avoid color wrapping issues that can happen when a color code follows a newline
#ifndef _di_fl_color_print_code_
f_return_status fl_color_print_code(FILE *file, const f_dynamic_string color) {
- // @fixme: the string here does not have to be NULL terminated, so this usage is invalid/unsafe!
if (color.used != 0) {
- fprintf(file, "%s", color.string);
+ f_status status = f_print_dynamic_string(file, color);
+
+ if (f_status_is_error(status)) return status;
}
return f_none;
#include <level_0/file.h>
#include <level_0/strings.h>
#include <level_0/types.h>
+#include <level_0/print.h>
#ifdef __cplusplus
extern "C" {
* @return
* f_none on success.
* f_invalid_parameter (with error bit) if a parameter is invalid.
+ * f_output_error (with error bit) on output error.
*/
#ifndef _di_fl_color_print_
extern f_return_status fl_color_print(FILE *file, const f_dynamic_string start_color, const f_dynamic_string end_color, const char *string, ...);
* @return
* f_none on success.
* f_invalid_parameter (with error bit) if a parameter is invalid.
+ * f_output_error (with error bit) on output error.
*/
#ifndef _di_fl_color_print_line_
extern f_return_status fl_color_print_line(FILE *file, const f_dynamic_string start_color, const f_dynamic_string end_color, const char *string, ...);
* @return
* f_none on success.
* f_invalid_parameter (with error bit) if a parameter is invalid.
+ * f_output_error (with error bit) on output error.
*/
#ifndef _di_fl_color_print_code_
extern f_return_status fl_color_print_code(FILE *file, const f_dynamic_string color);