# HG changeset patch # User Richard Laager # Date 1132878765 0 # Node ID 9cbc5967fbfd93a186dc25db916eb984ff550337 # Parent 029802981b81df9013c45a8ffd52846cb4100090 [gaim-migrate @ 14520] Crush some warnings. I ran this by Bartosz Oler and made some corrections at his suggestion. I'll be submitting this upstream and merging any changes they suggest/make-when-accepting. committer: Tailor Script diff -r 029802981b81 -r 9cbc5967fbfd src/protocols/gg/lib/dcc.c --- a/src/protocols/gg/lib/dcc.c Thu Nov 24 21:07:12 2005 +0000 +++ b/src/protocols/gg/lib/dcc.c Fri Nov 25 00:32:45 2005 +0000 @@ -1,4 +1,4 @@ -/* $Id: dcc.c 13801 2005-09-14 19:10:39Z datallah $ */ +/* $Id: dcc.c 14520 2005-11-25 00:32:45Z rlaager $ */ /* * (C) Copyright 2001-2002 Wojtek Kaniewski @@ -83,7 +83,7 @@ */ int gg_dcc_request(struct gg_session *sess, uin_t uin) { - return gg_send_message_ctcp(sess, GG_CLASS_CTCP, uin, "\002", 1); + return gg_send_message_ctcp(sess, GG_CLASS_CTCP, uin, (const unsigned char *)"\002", 1); } /* @@ -227,7 +227,7 @@ } gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() short name \"%s\", dos name \"%s\"\n", name, d->file_info.short_filename); - strncpy(d->file_info.filename, name, sizeof(d->file_info.filename) - 1); + strncpy((char *)d->file_info.filename, name, sizeof(d->file_info.filename) - 1); return 0; } @@ -568,7 +568,9 @@ if (h->type == GG_SESSION_DCC_SOCKET) { struct sockaddr_in sin; struct gg_dcc *c; - int fd, sin_len = sizeof(sin), one = 1; + int fd; + socklen_t sin_len = sizeof(sin); + int one = 1; if ((fd = accept(h->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't accept() new connection (errno=%d, %s)\n", errno, strerror(errno)); @@ -614,7 +616,8 @@ struct gg_dcc_tiny_packet tiny; struct gg_dcc_small_packet small; struct gg_dcc_big_packet big; - int size, tmp, res, res_size = sizeof(res); + int size, tmp, res; + socklen_t res_size = sizeof(res); unsigned int utmp; char buf[1024], ack[] = "UDAG"; diff -r 029802981b81 -r 9cbc5967fbfd src/protocols/gg/lib/events.c --- a/src/protocols/gg/lib/events.c Thu Nov 24 21:07:12 2005 +0000 +++ b/src/protocols/gg/lib/events.c Fri Nov 25 00:32:45 2005 +0000 @@ -1,4 +1,4 @@ -/* $Id: events.c 13801 2005-09-14 19:10:39Z datallah $ */ +/* $Id: events.c 14520 2005-11-25 00:32:45Z rlaager $ */ /* * (C) Copyright 2001-2003 Wojtek Kaniewski @@ -194,7 +194,7 @@ } if (p[0] == 0x05) { - int i, ok = 0; + unsigned int i, ok = 0; q->done = 0; @@ -420,7 +420,7 @@ e->event.msg.msgclass = gg_fix32(r->msgclass); e->event.msg.sender = gg_fix32(r->sender); e->event.msg.time = gg_fix32(r->time); - e->event.msg.message = strdup((char*) r + sizeof(*r)); + e->event.msg.message = (unsigned char *)strdup((char*) r + sizeof(*r)); return 0; @@ -895,7 +895,8 @@ case GG_STATE_CONNECTING_HUB: { char buf[1024], *client, *auth; - int res = 0, res_size = sizeof(res); + int res = 0; + socklen_t res_size = sizeof(res); const char *host, *appmsg; gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n"); @@ -1079,7 +1080,7 @@ e->type = GG_EVENT_MSG; e->event.msg.msgclass = atoi(buf); e->event.msg.sender = 0; - e->event.msg.message = sysmsg_buf; + e->event.msg.message = (unsigned char *)sysmsg_buf; } close(sess->fd); @@ -1146,7 +1147,8 @@ case GG_STATE_CONNECTING_GG: { - int res = 0, res_size = sizeof(res); + int res = 0; + socklen_t res_size = sizeof(res); gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n"); @@ -1337,7 +1339,7 @@ struct gg_welcome *w; struct gg_login60 l; unsigned int hash; - unsigned char *password = sess->password; + char *password = sess->password; int ret; gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n"); @@ -1398,7 +1400,7 @@ w = (struct gg_welcome*) ((char*) h + sizeof(struct gg_header)); w->key = gg_fix32(w->key); - hash = gg_login_hash(password, w->key); + hash = gg_login_hash((unsigned char *)password, w->key); gg_debug(GG_DEBUG_DUMP, "// gg_watch_fd() challenge %.4x --> hash %.8x\n", w->key, hash); @@ -1415,7 +1417,7 @@ if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) { struct sockaddr_in sin; - int sin_len = sizeof(sin); + socklen_t sin_len = sizeof(sin); gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n"); diff -r 029802981b81 -r 9cbc5967fbfd src/protocols/gg/lib/http.c --- a/src/protocols/gg/lib/http.c Thu Nov 24 21:07:12 2005 +0000 +++ b/src/protocols/gg/lib/http.c Fri Nov 25 00:32:45 2005 +0000 @@ -1,4 +1,4 @@ -/* $Id: http.c 13801 2005-09-14 19:10:39Z datallah $ */ +/* $Id: http.c 14520 2005-11-25 00:32:45Z rlaager $ */ /* * (C) Copyright 2001-2002 Wojtek Kaniewski @@ -237,7 +237,7 @@ if (h->state == GG_STATE_CONNECTING) { int res = 0; - unsigned int res_size = sizeof(res); + socklen_t res_size = sizeof(res); if (h->async && (getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { gg_debug(GG_DEBUG_MISC, "=> http, async connection failed (errno=%d, %s)\n", (res) ? res : errno , strerror((res) ? res : errno)); @@ -256,14 +256,14 @@ } if (h->state == GG_STATE_SENDING_QUERY) { - int res; + ssize_t res; if ((res = write(h->fd, h->query, strlen(h->query))) < 1) { gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno); gg_http_error(GG_ERROR_WRITING); } - if (res < strlen(h->query)) { + if (res < 0 || (size_t)res < strlen(h->query)) { gg_debug(GG_DEBUG_MISC, "=> http, partial header sent (led=%d, sent=%d)\n", strlen(h->query), res); memmove(h->query, h->query + res, strlen(h->query) - res + 1); diff -r 029802981b81 -r 9cbc5967fbfd src/protocols/gg/lib/libgadu.c --- a/src/protocols/gg/lib/libgadu.c Thu Nov 24 21:07:12 2005 +0000 +++ b/src/protocols/gg/lib/libgadu.c Fri Nov 25 00:32:45 2005 +0000 @@ -1,4 +1,4 @@ -/* $Id: libgadu.c 14300 2005-11-08 19:45:09Z datallah $ */ +/* $Id: libgadu.c 14520 2005-11-25 00:32:45Z rlaager $ */ /* * (C) Copyright 2001-2003 Wojtek Kaniewski @@ -81,7 +81,7 @@ #ifdef __GNUC__ __attribute__ ((unused)) #endif -= "$Id: libgadu.c 14300 2005-11-08 19:45:09Z datallah $"; += "$Id: libgadu.c 14520 2005-11-25 00:32:45Z rlaager $"; #endif #ifdef _WIN32 @@ -699,8 +699,7 @@ { struct gg_header h; char *buf = NULL; - int ret = 0; - unsigned int offset, size = 0; + int ret = 0, offset, size = 0; gg_debug(GG_DEBUG_FUNCTION, "** gg_recv_packet(%p);\n", sess); @@ -853,7 +852,7 @@ { struct gg_header *h; char *tmp; - unsigned int tmp_length; + int tmp_length; void *payload; unsigned int payload_length; va_list ap; @@ -899,7 +898,7 @@ h->length = gg_fix32(tmp_length - sizeof(struct gg_header)); if ((gg_debug_level & GG_DEBUG_DUMP)) { - unsigned int i; + int i; gg_debug(GG_DEBUG_DUMP, "// gg_send_packet(0x%.2x)", gg_fix32(h->type)); for (i = 0; i < tmp_length; ++i) @@ -1461,7 +1460,7 @@ * * 0/-1 */ -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const char *image, int size) +int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size) { struct gg_msg_image_reply *r; struct gg_send_msg s; @@ -1507,7 +1506,7 @@ r->crc32 = gg_fix32(gg_crc32(0, image, size)); while (size > 0) { - int buflen, chunklen; + size_t buflen, chunklen; /* \0 + struct gg_msg_image_reply */ buflen = sizeof(struct gg_msg_image_reply) + 1; @@ -1518,7 +1517,7 @@ buflen += strlen(filename) + 1; } - chunklen = (size >= sizeof(buf) - buflen) ? (sizeof(buf) - buflen) : size; + chunklen = ((size_t)size >= sizeof(buf) - buflen) ? (sizeof(buf) - buflen) : (size_t)size; memcpy(buf + buflen, image, chunklen); size -= chunklen; @@ -1635,7 +1634,7 @@ s.msgclass = gg_fix32(msgclass); sess->seq += (rand() % 0x300) + 0x300; - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen(message) + 1, format, formatlen, NULL) == -1) + if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, format, formatlen, NULL) == -1) return -1; return gg_fix32(s.seq); @@ -1728,7 +1727,7 @@ if (!i) sess->seq += (rand() % 0x300) + 0x300; - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen(message) + 1, &r, sizeof(r), recps, (recipients_count - 1) * sizeof(uin_t), format, formatlen, NULL) == -1) { + if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, &r, sizeof(r), recps, (recipients_count - 1) * sizeof(uin_t), format, formatlen, NULL) == -1) { free(recps); return -1; } diff -r 029802981b81 -r 9cbc5967fbfd src/protocols/gg/lib/libgadu.h --- a/src/protocols/gg/lib/libgadu.h Thu Nov 24 21:07:12 2005 +0000 +++ b/src/protocols/gg/lib/libgadu.h Fri Nov 25 00:32:45 2005 +0000 @@ -1,4 +1,4 @@ -/* $Id: libgadu.h 14300 2005-11-08 19:45:09Z datallah $ */ +/* $Id: libgadu.h 14520 2005-11-25 00:32:45Z rlaager $ */ /* * (C) Copyright 2001-2003 Wojtek Kaniewski @@ -214,7 +214,7 @@ struct gg_file_info file_info; /* informacje o pliku */ int established; /* połączenie ustanowione */ - char *voice_buf; /* bufor na pakiet połączenia głosowego */ + uint8_t *voice_buf; /* bufor na pakiet połączenia głosowego */ int incoming; /* połączenie przychodzące */ char *chunk_buf; /* bufor na kawałek danych */ uint32_t remote_addr; /* adres drugiej strony */ @@ -367,7 +367,7 @@ int gg_ping(struct gg_session *sess); int gg_userlist_request(struct gg_session *sess, char type, const char *request); int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32); -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const char *image, int size); +int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size); uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len);