Don't compile convert_output_format2() in non-GUI builds

This function is only used by the GUI menu code, so we don't need to
build it for normal builds.

Also clean up some unsigned char / char mismatches that the compiler warned
about.
This commit is contained in:
Kevin Easton
2015-06-20 23:42:04 +10:00
parent 64860729b3
commit b0f0124779
2 changed files with 14 additions and 9 deletions

View File

@@ -108,7 +108,9 @@ ChannelList * BX_prepare_command (int *, char *, int);
int isme (char *); int isme (char *);
char *BX_convert_output_format (const char *, const char *, ...); char *BX_convert_output_format (const char *, const char *, ...);
#ifdef GUI
char *convert_output_format2 (const char *); char *convert_output_format2 (const char *);
#endif
void add_last_type (LastMsg *, int, char *, char *, char *, char *); void add_last_type (LastMsg *, int, char *, char *, char *, char *);
int check_last_type (LastMsg *, int, char *, char *); int check_last_type (LastMsg *, int, char *, char *);
int matchmcommand (char *, int); int matchmcommand (char *, int);

View File

@@ -4709,23 +4709,25 @@ char *BX_convert_output_format(const char *format, const char *str, ...)
return s; return s;
} }
#ifdef GUI
/* This cut-down version of convert_output_format is used by the GUI menu functions. */
#define RAW_BUFFER_SIZE (MAX_RECURSE * BIG_BUFFER_SIZE * 2) #define RAW_BUFFER_SIZE (MAX_RECURSE * BIG_BUFFER_SIZE * 2)
char *convert_output_format2(const char *str) char *convert_output_format2(const char *str)
{ {
unsigned char buffer[RAW_BUFFER_SIZE+1]; char buffer[RAW_BUFFER_SIZE+1];
unsigned char buffer2[RAW_BUFFER_SIZE+1]; char buffer2[RAW_BUFFER_SIZE+1];
register unsigned char *s; char *s;
char *copy = NULL; char *copy = NULL;
char *tmpc = NULL; char *tmpc = NULL;
int arg_flags; int arg_flags;
if (!str) if (!str)
return m_strdup(empty_string); return m_strdup(empty_string);
memset(buffer, 0, BIG_BUFFER_SIZE); memset(buffer, 0, BIG_BUFFER_SIZE);
strlcpy(buffer2, str, RAW_BUFFER_SIZE); strlcpy(buffer2, str, RAW_BUFFER_SIZE);
copy = tmpc = buffer2; copy = tmpc = buffer2;
s = buffer; s = buffer;
while (*tmpc) while (*tmpc)
{ {
if (*tmpc == '$') if (*tmpc == '$')
@@ -4741,7 +4743,7 @@ int arg_flags;
#else #else
strlcat(s, new_str, RAW_BUFFER_SIZE); strlcat(s, new_str, RAW_BUFFER_SIZE);
#endif #endif
s = s + (strlen(new_str)); s += strlen(new_str);
new_free(&new_str); new_free(&new_str);
if (!tmpc) break; if (!tmpc) break;
continue; continue;
@@ -4752,6 +4754,7 @@ int arg_flags;
*s = 0; *s = 0;
return m_strdup(buffer); return m_strdup(buffer);
} }
#endif /* GUI */
void add_last_type (LastMsg *array, int size, char *from, char *uh, char *to, char *str) void add_last_type (LastMsg *array, int size, char *from, char *uh, char *to, char *str)
{ {