Convert skip_ctl_c_seq() and its callers (except strip_ansi()) from unsigned char to char
This should make no functional difference, and cuts out a large number of unsigned char * / char * mismatch warnings.
This commit is contained in:
@@ -5757,7 +5757,7 @@ BUILT_IN_FUNCTION(function_count, input)
|
||||
*/
|
||||
BUILT_IN_FUNCTION(function_leftpc, word)
|
||||
{
|
||||
u_char **prepared = NULL;
|
||||
char **prepared;
|
||||
int lines = 1;
|
||||
int count;
|
||||
|
||||
@@ -5766,7 +5766,7 @@ BUILT_IN_FUNCTION(function_leftpc, word)
|
||||
RETURN_EMPTY;
|
||||
|
||||
prepared = prepare_display(word, count, &lines, PREPARE_NOWRAP);
|
||||
RETURN_STR((char *)prepared[0]);
|
||||
RETURN_STR(prepared[0]);
|
||||
}
|
||||
/*
|
||||
* $uname()
|
||||
@@ -6344,9 +6344,9 @@ BUILT_IN_FUNCTION(function_getflags, input)
|
||||
|
||||
BUILT_IN_FUNCTION(function_numlines, input)
|
||||
{
|
||||
int count = 0;
|
||||
unsigned char **lines = NULL;
|
||||
char *s = NULL;
|
||||
int count = 0;
|
||||
char **lines = NULL;
|
||||
char *s = NULL;
|
||||
if (input && *input)
|
||||
{
|
||||
int cols;
|
||||
|
||||
@@ -2829,13 +2829,13 @@ char * BX_strmpcat (char *source, size_t siz, const char *format, ...)
|
||||
|
||||
|
||||
|
||||
u_char *BX_strcpy_nocolorcodes (u_char *dest, const u_char *source)
|
||||
char *BX_strcpy_nocolorcodes(char *dest, const char *source)
|
||||
{
|
||||
u_char *save = dest;
|
||||
char *save = dest;
|
||||
|
||||
do
|
||||
{
|
||||
while (*source == 3)
|
||||
while (*source == COLOR_CHAR)
|
||||
source = skip_ctl_c_seq(source, NULL, NULL, 0);
|
||||
*dest++ = *source;
|
||||
}
|
||||
@@ -2975,8 +2975,8 @@ size_t BX_mangle_line (char *incoming, int how, size_t how_much)
|
||||
{
|
||||
for (i = 0; incoming[i]; i++)
|
||||
{
|
||||
if (incoming[i] == 0x1b)
|
||||
incoming[i] = 0x5b;
|
||||
if (incoming[i] == '\x1b')
|
||||
incoming[i] = '\x5b';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3002,13 +3002,13 @@ size_t BX_mangle_line (char *incoming, int how, size_t how_much)
|
||||
{
|
||||
switch (*s)
|
||||
{
|
||||
case 003: /* color codes */
|
||||
case COLOR_CHAR: /* color codes */
|
||||
{
|
||||
int lhs = 0,
|
||||
rhs = 0;
|
||||
char *end;
|
||||
int lhs = 0,
|
||||
rhs = 0;
|
||||
char *end;
|
||||
|
||||
end = (char *)skip_ctl_c_seq(s, &lhs, &rhs, 0);
|
||||
end = skip_ctl_c_seq(s, &lhs, &rhs, 0);
|
||||
if (!(stuff & STRIP_COLOR))
|
||||
{
|
||||
while (s < end)
|
||||
|
||||
@@ -579,17 +579,15 @@ int logmsg(unsigned long log_type, char *from, int flag, char *format, ...)
|
||||
char *filename = NULL;
|
||||
char *expand = NULL;
|
||||
char *type = NULL;
|
||||
unsigned char **lines = NULL;
|
||||
char **lines = NULL;
|
||||
char msglog_buffer[BIG_BUFFER_SIZE+1];
|
||||
|
||||
|
||||
if (!get_string_var(MSGLOGFILE_VAR) || !get_string_var(CTOOLZ_DIR_VAR))
|
||||
return 0;
|
||||
|
||||
t = now;
|
||||
timestr = update_clock(GET_TIME);
|
||||
|
||||
|
||||
if (format)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -598,7 +596,6 @@ int logmsg(unsigned long log_type, char *from, int flag, char *format, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -74,10 +74,9 @@ Screen *screen_list = NULL;
|
||||
* ------- Which calls term_putchar().
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
u_char **BX_prepare_display (const u_char *, int, int *, int);
|
||||
static int add_to_display_list (Window *, const unsigned char *);
|
||||
static int add_to_display_list(Window *, const char *);
|
||||
Display *new_display_line (Display *);
|
||||
void BX_add_to_window (Window *, const unsigned char *);
|
||||
static int rite (Window *, const char *);
|
||||
|
||||
static char display_standout (int flag);
|
||||
static char display_bold (int flag);
|
||||
@@ -89,8 +88,6 @@ static char display_altcharset (int flag);
|
||||
|
||||
static void put_color (int, int);
|
||||
|
||||
const u_char *BX_skip_ctl_c_seq (const u_char *start, int *lhs, int *rhs, int proper);
|
||||
|
||||
static void delchar(char **text, int cnum)
|
||||
{
|
||||
int i;
|
||||
@@ -204,7 +201,7 @@ void BX_add_to_screen(char *buffer)
|
||||
* function just dumps it onto the screen. This is because the scrollback
|
||||
* functions need to be able to figure out how to split things up too.
|
||||
*/
|
||||
void BX_add_to_window(Window *window, const unsigned char *str)
|
||||
void BX_add_to_window(Window *window, const char *str)
|
||||
{
|
||||
|
||||
if (window->server >= 0 && get_server_redirect(window->server))
|
||||
@@ -213,7 +210,7 @@ void BX_add_to_window(Window *window, const unsigned char *str)
|
||||
str, NULL, 0, 0);
|
||||
if (do_hook(WINDOW_LIST, "%u %s", window->refnum, str))
|
||||
{
|
||||
unsigned char **lines;
|
||||
char **lines;
|
||||
int cols;
|
||||
|
||||
add_to_log(window->log_fp, 0, str, window->mangler);
|
||||
@@ -284,7 +281,7 @@ void BX_add_to_window(Window *window, const unsigned char *str)
|
||||
}
|
||||
|
||||
|
||||
u_char **BX_split_up_line (const unsigned char *str, int max_cols)
|
||||
char **BX_split_up_line(const char *str, int max_cols)
|
||||
{
|
||||
int nl = 0;
|
||||
return prepare_display(str, max_cols, &nl, 0);
|
||||
@@ -362,15 +359,15 @@ u_char **BX_split_up_line (const unsigned char *str, int max_cols)
|
||||
* PRINTED Characters not buffer positions :-)
|
||||
*/
|
||||
#define SPLIT_EXTENT 40
|
||||
unsigned char **BX_prepare_display(const unsigned char *orig_str,
|
||||
char **BX_prepare_display(const char *orig_str,
|
||||
int max_cols,
|
||||
int *lused,
|
||||
int flags)
|
||||
{
|
||||
int gchar_mode;
|
||||
static int recursion = 0,
|
||||
static int recursion = 0,
|
||||
output_size = 0;
|
||||
int pos = 0, /* Current position in "buffer" */
|
||||
int pos = 0, /* Current position in "buffer" */
|
||||
col = 0, /* Current column in display */
|
||||
word_break = 0, /* Last end of word */
|
||||
indent = 0, /* Start of second word */
|
||||
@@ -386,9 +383,9 @@ static int recursion = 0,
|
||||
do_indent, /* Use indent or continued line? */
|
||||
in_rev = 0, /* Are we in reverse mode? */
|
||||
newline = 0; /* Number of newlines */
|
||||
static u_char **output = NULL;
|
||||
const u_char *ptr = NULL;
|
||||
u_char buffer[BIG_BUFFER_SIZE + 1],
|
||||
static char **output = NULL;
|
||||
const char *ptr = NULL;
|
||||
char buffer[BIG_BUFFER_SIZE + 1],
|
||||
*cont_ptr = NULL,
|
||||
*cont = empty_string,
|
||||
c,
|
||||
@@ -404,12 +401,12 @@ const u_char *ptr = NULL;
|
||||
tab_max = get_int_var(TAB_VAR) ? get_int_var(TAB_MAX_VAR) : -1;
|
||||
nds_max = get_int_var(ND_SPACE_MAX_VAR);
|
||||
do_indent = get_int_var(INDENT_VAR);
|
||||
words = (char *)get_string_var(WORD_BREAK_VAR);
|
||||
words = get_string_var(WORD_BREAK_VAR);
|
||||
|
||||
if (!words)
|
||||
words = ", ";
|
||||
if (!(cont_ptr = (char *)get_string_var(CONTINUED_LINE_VAR)))
|
||||
cont_ptr = (char *)empty_string;
|
||||
if (!(cont_ptr = get_string_var(CONTINUED_LINE_VAR)))
|
||||
cont_ptr = empty_string;
|
||||
|
||||
buffer[0] = 0;
|
||||
|
||||
@@ -525,7 +522,7 @@ const u_char *ptr = NULL;
|
||||
case COLOR_CHAR:
|
||||
{
|
||||
int lhs = 0, rhs = 0;
|
||||
const u_char *end = skip_ctl_c_seq(ptr, &lhs, &rhs, 0);
|
||||
const char *end = skip_ctl_c_seq(ptr, &lhs, &rhs, 0);
|
||||
while (ptr < end)
|
||||
buffer[pos++] = *ptr++;
|
||||
ptr = end - 1;
|
||||
@@ -608,7 +605,7 @@ const u_char *ptr = NULL;
|
||||
*/
|
||||
if ((col >= max_cols) || newline)
|
||||
{
|
||||
unsigned char *pos_copy;
|
||||
char *pos_copy;
|
||||
|
||||
if (!word_break || (flags & PREPARE_NOWRAP))
|
||||
word_break = max_cols /*pos - 1*/;
|
||||
@@ -655,7 +652,7 @@ const u_char *ptr = NULL;
|
||||
|
||||
c = buffer[word_break];
|
||||
buffer[word_break] = 0;
|
||||
malloc_strcpy((char **)&(output[line++]), buffer);
|
||||
malloc_strcpy(&(output[line++]), buffer);
|
||||
|
||||
buffer[word_break] = c;
|
||||
|
||||
@@ -693,7 +690,7 @@ const u_char *ptr = NULL;
|
||||
buffer[pos++] = ALL_OFF;
|
||||
buffer[pos] = 0;
|
||||
if (*buffer)
|
||||
malloc_strcpy((char **)&(output[line++]),buffer);
|
||||
malloc_strcpy(&(output[line++]),buffer);
|
||||
|
||||
recursion--;
|
||||
new_free(&output[line]);
|
||||
@@ -707,7 +704,7 @@ const u_char *ptr = NULL;
|
||||
* This puts the given string into a scratch window. It ALWAYS suppresses
|
||||
* any further action (by returning a FAIL, so rite() is not called).
|
||||
*/
|
||||
static int add_to_scratch_window_display_list (Window *window, const unsigned char *str)
|
||||
static int add_to_scratch_window_display_list(Window *window, const char *str)
|
||||
{
|
||||
Display *my_line, *my_line_prev;
|
||||
int cnt;
|
||||
@@ -805,7 +802,7 @@ static int add_to_scratch_window_display_list (Window *window, const unsigned ch
|
||||
* not to be displayed, then 0 is returned. This function handles all
|
||||
* the hold_mode stuff.
|
||||
*/
|
||||
static int add_to_display_list (Window *window, const unsigned char *str)
|
||||
static int add_to_display_list(Window *window, const char *str)
|
||||
{
|
||||
if (window->scratch_line != -1)
|
||||
return add_to_scratch_window_display_list(window, str);
|
||||
@@ -886,7 +883,7 @@ static int add_to_display_list (Window *window, const unsigned char *str)
|
||||
* bold face will remain the same and the it won't interfere with anything
|
||||
* else (i.e. status line, input line).
|
||||
*/
|
||||
int rite(Window *window, const unsigned char *str)
|
||||
static int rite(Window *window, const char *str)
|
||||
{
|
||||
static int high = OFF;
|
||||
static int bold = OFF;
|
||||
@@ -933,9 +930,9 @@ static int altc = OFF;
|
||||
/*
|
||||
* A temporary wrapper function for backwards compatibility.
|
||||
*/
|
||||
int BX_output_line(const unsigned char *str)
|
||||
int BX_output_line(const char *str)
|
||||
{
|
||||
output_with_count(str,1, 1);
|
||||
output_with_count(str, 1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -960,14 +957,14 @@ int BX_output_line(const unsigned char *str)
|
||||
* correct rendering of colors than to get just one more nanosecond of
|
||||
* display speed.
|
||||
*/
|
||||
int BX_output_with_count(const unsigned char *str, int clreol, int output)
|
||||
int BX_output_with_count(const char *str, int clreol, int output)
|
||||
{
|
||||
const u_char *ptr = str;
|
||||
int beep = 0,
|
||||
const char *ptr = str;
|
||||
int beep = 0,
|
||||
out = 0;
|
||||
int val1,
|
||||
int val1,
|
||||
val2;
|
||||
char old_bold = 0,
|
||||
char old_bold = 0,
|
||||
old_rev = 0,
|
||||
old_blink = 0,
|
||||
old_undl = 0,
|
||||
@@ -2038,11 +2035,11 @@ void BX_add_wait_prompt(char *prompt, void (*func)(char *, char *), char *data,
|
||||
* Se we have to actually slurp up only those digits that comprise a legal
|
||||
* ^C code.
|
||||
*/
|
||||
const u_char *BX_skip_ctl_c_seq (const u_char *start, int *lhs, int *rhs, int proper)
|
||||
char *BX_skip_ctl_c_seq(const char *start, int *lhs, int *rhs, int proper)
|
||||
{
|
||||
const u_char *after = start;
|
||||
u_char c1, c2;
|
||||
int * val;
|
||||
const char *after = start;
|
||||
char c1, c2;
|
||||
int *val;
|
||||
int lv1, rv1;
|
||||
|
||||
/*
|
||||
@@ -2060,7 +2057,7 @@ const u_char *after = start;
|
||||
* If we're passed a non ^C code, dont do anything.
|
||||
*/
|
||||
if (*after != COLOR_CHAR)
|
||||
return after;
|
||||
return (char *)after;
|
||||
|
||||
/*
|
||||
* This is a one-or-two-time-through loop. We find the maximum
|
||||
@@ -2076,7 +2073,7 @@ const u_char *after = start;
|
||||
*/
|
||||
after++;
|
||||
if (*after == 0)
|
||||
return after;
|
||||
return (char *)after;
|
||||
|
||||
/*
|
||||
* Check for the very special case of a definite terminator.
|
||||
@@ -2084,13 +2081,13 @@ const u_char *after = start;
|
||||
* this ends the code without starting a new one
|
||||
*/
|
||||
if (after[0] == '-' && after[1] == '1')
|
||||
return after + 2;
|
||||
return (char *)after + 2;
|
||||
|
||||
/*
|
||||
* Further checks against a lonely old naked ^C.
|
||||
*/
|
||||
if (!isdigit(after[0]) && after[0] != ',')
|
||||
return after;
|
||||
if (!isdigit((unsigned char)after[0]) && after[0] != ',')
|
||||
return (char *)after;
|
||||
|
||||
|
||||
/*
|
||||
@@ -2191,7 +2188,7 @@ const u_char *after = start;
|
||||
break;
|
||||
}
|
||||
|
||||
return after;
|
||||
return (char *)after;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -448,9 +448,9 @@ static char *convert_format(Window *win, char *format, int k)
|
||||
|
||||
void fix_status_buffer(Window *win, char *buffer, int in_status)
|
||||
{
|
||||
unsigned char rhs_buffer[3*BIG_BUFFER_SIZE + 1];
|
||||
unsigned char lhs_buffer[3*BIG_BUFFER_SIZE + 1];
|
||||
unsigned char lhs_fillchar[6],
|
||||
char rhs_buffer[3*BIG_BUFFER_SIZE + 1];
|
||||
char lhs_buffer[3*BIG_BUFFER_SIZE + 1];
|
||||
char lhs_fillchar[6],
|
||||
rhs_fillchar[6],
|
||||
*fillchar = lhs_fillchar,
|
||||
*lhp = lhs_buffer,
|
||||
@@ -458,7 +458,7 @@ unsigned char lhs_fillchar[6],
|
||||
*cp,
|
||||
*start_rhs = 0,
|
||||
*str = NULL, *ptr = NULL;
|
||||
int in_rhs = 0,
|
||||
int in_rhs = 0,
|
||||
pr_lhs = 0,
|
||||
pr_rhs = 0,
|
||||
*prc = &pr_lhs;
|
||||
@@ -517,7 +517,7 @@ int in_rhs = 0,
|
||||
*/
|
||||
else if (*ptr == COLOR_CHAR)
|
||||
{
|
||||
const u_char *end = skip_ctl_c_seq(ptr, NULL, NULL, 0);
|
||||
const char *end = skip_ctl_c_seq(ptr, NULL, NULL, 0);
|
||||
while (ptr < end)
|
||||
*cp++ = *ptr++;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ char *stat_convert_format(Window *win, char *form)
|
||||
{
|
||||
int map, key, i, pos = 0;
|
||||
char *ptr = form;
|
||||
unsigned char buffer[2 * BIG_BUFFER_SIZE + 1];
|
||||
char buffer[2 * BIG_BUFFER_SIZE + 1];
|
||||
|
||||
if (!form || !*form)
|
||||
return m_strdup(empty_string);
|
||||
@@ -662,11 +662,11 @@ void BX_build_status(Window *win, char *format, int unused)
|
||||
|
||||
void make_status(Window *win)
|
||||
{
|
||||
u_char buffer [BIG_BUFFER_SIZE + 1];
|
||||
u_char lhs_buffer [BIG_BUFFER_SIZE + 1];
|
||||
u_char rhs_buffer [BIG_BUFFER_SIZE + 1];
|
||||
char *func_value[MAX_FUNCTIONS+10] = {NULL};
|
||||
u_char *ptr;
|
||||
char buffer[BIG_BUFFER_SIZE + 1];
|
||||
char lhs_buffer[BIG_BUFFER_SIZE + 1];
|
||||
char rhs_buffer[BIG_BUFFER_SIZE + 1];
|
||||
char *func_value[MAX_FUNCTIONS+10] = {NULL};
|
||||
char *ptr;
|
||||
|
||||
int len = 1,
|
||||
status_line,
|
||||
@@ -678,7 +678,7 @@ void make_status(Window *win)
|
||||
*/
|
||||
for (status_line = 0 ; status_line < 1+win->double_status + win->status_lines; status_line++)
|
||||
{
|
||||
u_char lhs_fillchar[6],
|
||||
char lhs_fillchar[6],
|
||||
rhs_fillchar[6],
|
||||
*fillchar = lhs_fillchar,
|
||||
*lhp = lhs_buffer,
|
||||
@@ -785,7 +785,7 @@ void make_status(Window *win)
|
||||
*/
|
||||
else if (*ptr == COLOR_CHAR)
|
||||
{
|
||||
const u_char *end = skip_ctl_c_seq(ptr, NULL, NULL, 0);
|
||||
const char *end = skip_ctl_c_seq(ptr, NULL, NULL, 0);
|
||||
while (ptr < end)
|
||||
*cp++ = *ptr++;
|
||||
}
|
||||
|
||||
@@ -3144,7 +3144,7 @@ static Window *window_echo (Window *window, char **args, char *usage)
|
||||
else
|
||||
to_echo = *args, *args = NULL;
|
||||
|
||||
add_to_window(window, (const unsigned char *)to_echo);
|
||||
add_to_window(window, to_echo);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user