1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Merge pull request #85 from dgl/werror

Make configure checks able to build with -Werror
This commit is contained in:
Alexander Færøy 2014-07-06 23:05:34 +02:00
commit b03b65e029
9 changed files with 31 additions and 17 deletions

View File

@ -221,7 +221,7 @@ AC_CACHE_VAL(irssi_cv_type_socklen_t,
[AC_TRY_COMPILE([ [AC_TRY_COMPILE([
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>], #include <sys/socket.h>],
[socklen_t t;], [socklen_t t = 0; return((int)t); ],
irssi_cv_type_socklen_t=yes, irssi_cv_type_socklen_t=yes,
irssi_cv_type_socklen_t=no, irssi_cv_type_socklen_t=no,
)]) )])
@ -455,8 +455,10 @@ if test "$want_perl" != "no"; then
esac esac
dnl * check that perl's ldflags actually work dnl * check that perl's ldflags actually work
echo "main(){perl_alloc(); return 0;}" > conftest.c echo "#include <EXTERN.h>" > conftest.c
$CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null echo "#include <perl.h>" >> conftest.c
echo "int main(){perl_alloc(); return 0;}" >> conftest.c
$CC $CFLAGS $PERL_CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`" perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
AC_MSG_RESULT([error linking with perl libraries, building without Perl]) AC_MSG_RESULT([error linking with perl libraries, building without Perl])
@ -626,7 +628,7 @@ if test "x$want_ipv6" = "xyes"; then
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/inet.h>], #include <arpa/inet.h>],
[struct in6_addr i;], [struct in6_addr i = in6addr_any; return &i == &i;],
have_ipv6=yes, have_ipv6=yes,
)]) )])
if test $have_ipv6 = yes; then if test $have_ipv6 = yes; then

View File

@ -968,7 +968,9 @@ static void cmd_cd(const char *data)
if (*data == '\0') return; if (*data == '\0') return;
str = convert_home(data); str = convert_home(data);
chdir(str); if (chdir(str) != 0) {
g_warning("Failed to chdir(): %s", strerror(errno));
}
g_free(str); g_free(str);
} }

View File

@ -60,7 +60,11 @@ GIOChannel *g_io_channel_new(int handle)
IPADDR ip4_any = { IPADDR ip4_any = {
AF_INET, AF_INET,
{ { { INADDR_ANY } } } #if defined(HAVE_IPV6) && defined(IN6ADDR_ANY_INIT)
IN6ADDR_ANY_INIT
#else
{ INADDR_ANY }
#endif
}; };
int net_ip_compare(IPADDR *ip1, IPADDR *ip2) int net_ip_compare(IPADDR *ip1, IPADDR *ip2)

View File

@ -102,10 +102,15 @@ void rawlog_redirect(RAWLOG_REC *rawlog, const char *str)
static void rawlog_dump(RAWLOG_REC *rawlog, int f) static void rawlog_dump(RAWLOG_REC *rawlog, int f)
{ {
GSList *tmp; GSList *tmp;
ssize_t ret = 1;
for (tmp = rawlog->lines; tmp != NULL; tmp = tmp->next) { for (tmp = rawlog->lines; ret && tmp != NULL; tmp = tmp->next) {
write(f, tmp->data, strlen((char *) tmp->data)); ret = write(f, tmp->data, strlen((char *) tmp->data));
write(f, "\n", 1); ret &= write(f, "\n", 1);
}
if (ret <= 0) {
g_warning("rawlog write() failed: %s", strerror(errno));
} }
} }

View File

@ -107,7 +107,9 @@ static int write_buffer_flush_rec(void *handlep, BUFFER_REC *rec)
for (tmp = rec->blocks; tmp != NULL; tmp = tmp->next) { for (tmp = rec->blocks; tmp != NULL; tmp = tmp->next) {
size = tmp->data != rec->active_block ? BUFFER_BLOCK_SIZE : size = tmp->data != rec->active_block ? BUFFER_BLOCK_SIZE :
rec->active_block_pos; rec->active_block_pos;
write(handle, tmp->data, size); if (write(handle, tmp->data, size) != size) {
g_warning("Failed to write(): %s", strerror(errno));
}
} }
empty_blocks = g_slist_concat(empty_blocks, rec->blocks); empty_blocks = g_slist_concat(empty_blocks, rec->blocks);

View File

@ -452,7 +452,7 @@ void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str)
g_utf8_validate(str, -1, &ptr); g_utf8_validate(str, -1, &ptr);
len = g_utf8_pointer_to_offset(str, ptr); len = g_utf8_pointer_to_offset(str, ptr);
} else if (term_type == TERM_TYPE_BIG5) } else if (term_type == TERM_TYPE_BIG5)
len = strlen_big5(str); len = strlen_big5((const unsigned char *)str);
else else
len = strlen(str); len = strlen(str);
entry_text_grow(entry, len); entry_text_grow(entry, len);

View File

@ -140,7 +140,7 @@ int term_init(void)
term_set_input_type(TERM_TYPE_8BIT); term_set_input_type(TERM_TYPE_8BIT);
term_common_init(); term_common_init();
g_atexit(term_deinit); atexit(term_deinit);
return TRUE; return TRUE;
} }
@ -575,7 +575,7 @@ void term_stop(void)
static int input_utf8(const unsigned char *buffer, int size, unichar *result) static int input_utf8(const unsigned char *buffer, int size, unichar *result)
{ {
unichar c = g_utf8_get_char_validated(buffer, size); unichar c = g_utf8_get_char_validated((char *)buffer, size);
switch (c) { switch (c) {
case (unichar)-1: case (unichar)-1:

View File

@ -179,14 +179,14 @@ static void unformat_24bit_line_color(const unsigned char **ptr, int off, int *f
static inline unichar read_unichar(const unsigned char *data, const unsigned char **next, int *width) static inline unichar read_unichar(const unsigned char *data, const unsigned char **next, int *width)
{ {
unichar chr = g_utf8_get_char_validated(data, -1); unichar chr = g_utf8_get_char_validated((const char *) data, -1);
if (chr & 0x80000000) { if (chr & 0x80000000) {
chr = 0xfffd; chr = 0xfffd;
*next = data + 1; *next = data + 1;
*width = 1; *width = 1;
} else { } else {
*next = g_utf8_next_char(data); *next = (unsigned char *)g_utf8_next_char(data);
*width = unichar_isprint(chr) ? mk_wcwidth(chr) : 1; *width = unichar_isprint(chr) ? mk_wcwidth(chr) : 1;
} }
return chr; return chr;

View File

@ -50,7 +50,6 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
int get_size_only) int get_size_only)
{ {
dSP; dSP;
int retcount;
SV *item_sv, **sv; SV *item_sv, **sv;
HV *hv; HV *hv;
@ -63,7 +62,7 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
XPUSHs(sv_2mortal(newSViv(get_size_only))); XPUSHs(sv_2mortal(newSViv(get_size_only)));
PUTBACK; PUTBACK;
retcount = perl_call_pv(function, G_EVAL|G_DISCARD); perl_call_pv(function, G_EVAL|G_DISCARD);
SPAGAIN; SPAGAIN;
if (SvTRUE(ERRSV)) { if (SvTRUE(ERRSV)) {