From 5ea99371dd6dd6c5b73c6efc7fa455126109ef35 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 31 Jan 2022 16:41:29 +0100 Subject: [PATCH] [bfu] const --- src/bfu/text.c | 7 ++++--- src/bfu/text.h | 2 +- src/intl/charsets.c | 2 +- src/intl/charsets.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bfu/text.c b/src/bfu/text.c index 728367be..6794919b 100644 --- a/src/bfu/text.c +++ b/src/bfu/text.c @@ -38,12 +38,13 @@ add_dlg_text(struct dialog *dlg, char *text, /* Returns length of substring (from start of @text) before a split. */ #ifdef CONFIG_UTF8 static inline int -split_line(char *text, int max_width, int *cells, int utf8) +split_line(const char *text2, int max_width, int *cells, int utf8) #else static inline int -split_line(char *text, int max_width, int *cells) +split_line(const char *text2, int max_width, int *cells) #endif /* CONFIG_UTF8 */ { + char *text = (char *)text2; char *split = text; #ifdef CONFIG_UTF8 char *text_end = split + strlen(split); @@ -212,7 +213,7 @@ split_lines(struct widget_data *widget_data, int max_width) /* Format text according to dialog box and alignment. */ void dlg_format_text_do(struct dialog_data *dlg_data, - char *text, + const char *text, int x, int *y, int width, int *real_width, struct color_pair *color, format_align_T align, int format_only) diff --git a/src/bfu/text.h b/src/bfu/text.h index 0833bc5d..d8c81f1c 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -51,7 +51,7 @@ void add_dlg_text(struct dialog *dlg, char *text, extern const struct widget_ops text_ops; void dlg_format_text_do(struct dialog_data *dlg_data, - char *text, int x, int *y, int w, int *rw, + const char *text, int x, int *y, int w, int *rw, struct color_pair *scolor, format_align_T align, int format_only); void diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 05a12c22..d92d78f4 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -402,7 +402,7 @@ utf8_ptr2chars(char *string, char *end) * specified number of cells. */ int -utf8_cells2bytes(char *string, int max_cells, char *end) +utf8_cells2bytes(const char *string, int max_cells, char *end) { unsigned int bytes = 0, cells = 0; diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 87dc9351..1d86c645 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -139,7 +139,7 @@ int utf8charlen(const char *); int utf8_char2cells(const char *, char *); int utf8_ptr2cells(const char *, char *); int utf8_ptr2chars(char *, char *); -int utf8_cells2bytes(char *, int, char *); +int utf8_cells2bytes(const char *, int, char *); /* How utf8_step_forward and utf8_step_backward count steps. */ enum utf8_step { /* Each step is one character, even if it is a combining or