Change BX_add_to_screen() and BX_skip_incoming_mirc() to use char * rather than unsigned char * arguments.

This clears up a few pointer type mismatch warnings.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@477 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-11-18 12:38:07 +00:00
parent ced7f9bcc9
commit f22dc54b13
3 changed files with 34 additions and 31 deletions

View File

@@ -251,7 +251,6 @@ extern Function_ptr *global;
#define put_it (*(void (*)(const char *, ...))global[PUT_IT]) #define put_it (*(void (*)(const char *, ...))global[PUT_IT])
#define bitchsay (*(void (*)(const char *, ...))global[BITCHSAY]) #define bitchsay (*(void (*)(const char *, ...))global[BITCHSAY])
#define yell (*(void (*)(const char *, ...))global[YELL]) #define yell (*(void (*)(const char *, ...))global[YELL])
#define add_to_screen (*(void (*)(unsigned char *))global[ADD_TO_SCREEN])
#define add_to_log (*(void (*)(FILE *, time_t, const char *, int ))global[ADD_TO_LOG]) #define add_to_log (*(void (*)(FILE *, time_t, const char *, int ))global[ADD_TO_LOG])
#define bsd_glob (*(int (*)(const char *, int, int (*)(const char *, int), glob_t *))global[BSD_GLOB]) #define bsd_glob (*(int (*)(const char *, int, int (*)(const char *, int), glob_t *))global[BSD_GLOB])
@@ -278,8 +277,8 @@ extern Function_ptr *global;
/* screen.c */ /* screen.c */
#define prepare_display (*(unsigned char **(*)(const unsigned char *, int , int *, int ))global[PREPARE_DISPLAY]) #define prepare_display (*(unsigned char **(*)(const unsigned char *, int , int *, int ))global[PREPARE_DISPLAY])
#define add_to_window (*(void (*)(Window *, const unsigned char *))global[ADD_TO_WINDOW]) #define add_to_window (*(void (*)(Window *, const unsigned char *))global[ADD_TO_WINDOW])
#define skip_incoming_mirc (*(unsigned char *(*)(unsigned char *))global[SKIP_INCOMING_MIRC]) #define skip_incoming_mirc (*(char *(*)(char *))global[SKIP_INCOMING_MIRC])
#define add_to_screen (*(void (*)(unsigned char *))global[ADD_TO_SCREEN]) #define add_to_screen (*(void (*)(char *))global[ADD_TO_SCREEN])
#define split_up_line (*(unsigned char **(*)(const unsigned char *, int ))global[SPLIT_UP_LINE]) #define split_up_line (*(unsigned char **(*)(const unsigned char *, int ))global[SPLIT_UP_LINE])
#define output_line (*(int (*)(const unsigned char *))global[OUTPUT_LINE]) #define output_line (*(int (*)(const unsigned char *))global[OUTPUT_LINE])
#define output_with_count (*(int (*)(const unsigned char *, int , int ))global[OUTPUT_WITH_COUNT]) #define output_with_count (*(int (*)(const unsigned char *, int , int ))global[OUTPUT_WITH_COUNT])

View File

@@ -48,7 +48,7 @@ RETSIGTYPE sig_refresh_screen (int);
ShrinkInfo resize_display (Window *); ShrinkInfo resize_display (Window *);
void redraw_window (Window *, int); void redraw_window (Window *, int);
void redraw_all_windows (void); void redraw_all_windows (void);
void BX_add_to_screen (unsigned char *); void BX_add_to_screen (char *);
void do_screens (fd_set *); void do_screens (fd_set *);
unsigned char **BX_split_up_line(const unsigned char *, int); unsigned char **BX_split_up_line(const unsigned char *, int);
void BX_xterm_settitle(void); void BX_xterm_settitle(void);
@@ -65,8 +65,7 @@ Screen * BX_create_new_screen(void);
const u_char *BX_skip_ctl_c_seq (const u_char *, int *, int *, int); const u_char *BX_skip_ctl_c_seq (const u_char *, int *, int *, int);
u_char **BX_prepare_display (const u_char *, int, int *, int); u_char **BX_prepare_display (const u_char *, int, int *, int);
int BX_output_with_count (const unsigned char *, int, int); int BX_output_with_count (const unsigned char *, int, int);
unsigned char *BX_skip_incoming_mirc (unsigned char *); char *BX_skip_incoming_mirc (char *);
void delchar(unsigned char **text, int cnum);
/* Dont do any word-wrapping, just truncate each line at its place. */ /* Dont do any word-wrapping, just truncate each line at its place. */
#define PREPARE_NOWRAP 0x01 #define PREPARE_NOWRAP 0x01

View File

@@ -91,20 +91,35 @@ static void put_color (int, int);
const u_char *BX_skip_ctl_c_seq (const u_char *start, int *lhs, int *rhs, int proper); 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;
unsigned char *BX_skip_incoming_mirc(unsigned char *text) for (i = 0; i < strlen(*text) - 1; i++)
if (i >= cnum) text[0][i] = text[0][i+1];
text[0][i] = 0;
}
char *BX_skip_incoming_mirc(char *text)
{ {
int i, x; int i, x;
for (i=0;i<strlen(text);i++) {
if ((int)text[i] != 3) continue; for (i = 0; i < strlen(text); i++) {
else { if (text[i] == 3)
{
x = 0; x = 0;
while (((isdigit(text[i])) || ((int)text[i] == 3))) { while (isdigit((unsigned char)text[i]) || text[i] == 3)
while((int)text[i] == 3) delchar(&text, i); {
while((isdigit(text[i])) && (x<2)) { while (text[i] == 3)
delchar(&text, i); delchar(&text, i);
if (isdigit(text[i])) { while (isdigit((unsigned char)text[i]) && x < 2)
delchar(&text, i); x += 2; {
delchar(&text, i);
if (isdigit((unsigned char)text[i]))
{
delchar(&text, i);
x += 2;
} else x += 1; } else x += 1;
} }
if (text[i] != ',') break; if (text[i] != ',') break;
@@ -116,30 +131,20 @@ unsigned char *BX_skip_incoming_mirc(unsigned char *text)
return text; return text;
} }
void delchar(unsigned char **text, int cnum)
{
int i;
for (i=0;i<strlen(*text)-1;i++)
if (i >= cnum) text[0][i] = text[0][i+1];
text[0][i] = 0;
}
/* /*
* add_to_screen: This adds the given null terminated buffer to the screen. * add_to_screen: This adds the given null terminated buffer to the screen.
* That is, it determines which window the information should go to, which * That is, it determines which window the information should go to, which
* lastlog the information should be added to, which log the information * lastlog the information should be added to, which log the information
* should be sent to, etc * should be sent to, etc
*/ */
void BX_add_to_screen(unsigned char *buffer) void BX_add_to_screen(char *buffer)
{ {
char *out = NULL; char *out;
if (!get_int_var(MIRCS_VAR))
buffer = skip_incoming_mirc(buffer);
if (!get_int_var(MIRCS_VAR))
out = buffer; out = skip_incoming_mirc(buffer);
else
out = buffer;
if (in_window_command) if (in_window_command)
{ {