summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-08-02 10:30:03 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-08-02 10:30:03 +0000
commitcbbd3c6607570835250e8f9d9915573ca55b1a96 (patch)
treeff29db33bf1edc1978af6844e2868795b68e7425 /protocols/Gadu-Gadu/src
parentec3212a5f6f4bd7b40cff164ed46c23992943bbe (diff)
c files renamed to cpp
git-svn-id: http://svn.miranda-ng.org/main/trunk@10014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r--protocols/Gadu-Gadu/src/gg.h2
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/common.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/common.c)18
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/dcc.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/dcc.c)19
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/dcc7.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/dcc7.c)28
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/events.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/events.c)122
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/http.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/http.c)10
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/libgadu.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/libgadu.c)28
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/libgadu.h12
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/obsolete.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/obsolete.c)0
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/pthread.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/pthread.c)0
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/pubdir.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/pubdir.c)6
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/pubdir50.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/pubdir50.c)6
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/resolver.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/resolver.c)8
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/sha1.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/sha1.c)0
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/win32.cpp (renamed from protocols/Gadu-Gadu/src/libgadu/win32.c)2
15 files changed, 126 insertions, 135 deletions
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index 9240ef7e09..451555773b 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -88,10 +88,8 @@
#include "resource.h"
// libgadu headers
-extern "C" {
#include "libgadu/libgadu.h"
#include "dynstuff.h"
-};
// Search
// Extended search result structure, used for all searches
diff --git a/protocols/Gadu-Gadu/src/libgadu/common.c b/protocols/Gadu-Gadu/src/libgadu/common.cpp
index f1db6c4b7f..b115aa0df4 100644
--- a/protocols/Gadu-Gadu/src/libgadu/common.c
+++ b/protocols/Gadu-Gadu/src/libgadu/common.cpp
@@ -217,7 +217,7 @@ char *gg_vsaprintf(const char *format, va_list ap)
size = 128;
do {
size *= 2;
- if (!(tmp = realloc(buf, size))) {
+ if (!(tmp = (char*)realloc(buf, size))) {
free(buf);
return NULL;
}
@@ -375,7 +375,7 @@ SOCKET gg_connect(void *addr, int port, int async)
SOCKET sock;
int one = 1, errno2;
struct sockaddr_in sin;
- struct in_addr *a = addr;
+ struct in_addr *a = (in_addr*)addr;
struct sockaddr_in myaddr;
gg_debug(GG_DEBUG_FUNCTION, "** gg_connect(%s, %d, %d);\n", inet_ntoa(*a), port, async);
@@ -493,7 +493,7 @@ char *gg_urlencode(const char *str)
size += 2;
}
- if (!(buf = malloc(size + 1)))
+ if (!(buf = (char*)malloc(size + 1)))
return NULL;
for (p = str, q = buf; *p; p++, q++) {
@@ -582,7 +582,7 @@ char *gg_base64_encode(const char *buf)
char *out, *res;
unsigned int i = 0, j = 0, k = 0, len = (unsigned int)strlen(buf);
- res = out = malloc((len / 3 + 1) * 4 + 2);
+ res = out = (char*)malloc((len / 3 + 1) * 4 + 2);
if (!res)
return NULL;
@@ -645,7 +645,7 @@ char *gg_base64_decode(const char *buf)
if (!buf)
return NULL;
- save = res = calloc(1, (strlen(buf) / 4 + 1) * 3 + 2);
+ save = res = (char*)calloc(1, (strlen(buf) / 4 + 1) * 3 + 2);
if (!save)
return NULL;
@@ -702,7 +702,7 @@ char *gg_proxy_auth()
if (!gg_proxy_enabled || !gg_proxy_username || !gg_proxy_password)
return NULL;
- if (!(tmp = malloc((tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2))))
+ if (!(tmp = (char*)malloc((tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2))))
return NULL;
snprintf(tmp, tmp_size, "%s:%s", gg_proxy_username, gg_proxy_password);
@@ -714,7 +714,7 @@ char *gg_proxy_auth()
free(tmp);
- if (!(out = malloc(strlen(enc) + 40))) {
+ if (!(out = (char*)malloc(strlen(enc) + 40))) {
free(enc);
return NULL;
}
@@ -827,7 +827,7 @@ char *gg_cp_to_utf8(const char *b)
else newlen += 3;
}
- if (!(newbuf = malloc(newlen+1))) {
+ if (!(newbuf = (char*)malloc(newlen + 1))) {
gg_debug(GG_DEBUG_MISC, "// gg_cp_to_utf8() not enough memory\n");
return NULL;
}
@@ -927,7 +927,7 @@ char *gg_utf8_to_cp(const char *b)
i++;
}
- if (!(newbuf = malloc(newlen+1))) {
+ if (!(newbuf = (char*)malloc(newlen + 1))) {
gg_debug(GG_DEBUG_MISC, "// gg_utf8_to_cp() not enough memory\n");
return NULL;
}
diff --git a/protocols/Gadu-Gadu/src/libgadu/dcc.c b/protocols/Gadu-Gadu/src/libgadu/dcc.cpp
index 2fbe1b430c..5c89476efc 100644
--- a/protocols/Gadu-Gadu/src/libgadu/dcc.c
+++ b/protocols/Gadu-Gadu/src/libgadu/dcc.cpp
@@ -287,7 +287,7 @@ static struct gg_dcc *gg_dcc_transfer(uint32_t ip, uint16_t port, uin_t my_uin,
return NULL;
}
- if (!(d = (void*) calloc(1, sizeof(*d)))) {
+ if (!(d = (gg_dcc*)calloc(1, sizeof(*d)))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() not enough memory\n");
return NULL;
}
@@ -468,7 +468,7 @@ struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port)
gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() bound to port %d\n", port);
- if (!(c = malloc(sizeof(*c)))) {
+ if (!(c = (gg_dcc*)malloc(sizeof(*c)))) {
gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() not enough memory for struct\n");
gg_sock_close(sock);
return NULL;
@@ -608,7 +608,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
return NULL;
}
- if (!(e = (void*) calloc(1, sizeof(*e)))) {
+ if (!(e = (gg_event*)calloc(1, sizeof(*e)))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory\n");
return NULL;
}
@@ -620,7 +620,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
struct gg_dcc *c;
SOCKET fd;
int one = 1;
- unsigned int sin_len = sizeof(sin);
+ int sin_len = sizeof(sin);
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));
@@ -641,7 +641,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
return e;
}
- if (!(c = (void*) calloc(1, sizeof(*c)))) {
+ if (!(c = (gg_dcc*)calloc(1, sizeof(*c)))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory for client data\n");
free(e);
@@ -667,7 +667,8 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
struct gg_dcc_small_packet small;
struct gg_dcc_big_packet big;
int size, tmp, res;
- unsigned int utmp, res_size = sizeof(res);
+ unsigned int utmp;
+ int res_size = sizeof(res);
char buf[1024], ack[] = "UDAG";
struct gg_dcc_file_info_packet {
@@ -813,7 +814,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
h->state = GG_STATE_READING_FILE_HEADER;
h->chunk_size = sizeof(big);
h->chunk_offset = 0;
- if (!(h->chunk_buf = malloc(sizeof(big)))) {
+ if (!(h->chunk_buf = (char*)malloc(sizeof(big)))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n");
free(e);
return NULL;
@@ -926,7 +927,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
h->chunk_size = small.type;
h->chunk_offset = 0;
- if (!(h->voice_buf = malloc(h->chunk_size))) {
+ if (!(h->voice_buf = (char*)malloc(h->chunk_size))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory for voice frame\n");
free(e);
return NULL;
@@ -1305,7 +1306,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h)
h->timeout = GG_DEFAULT_TIMEOUT;
h->chunk_offset = 0;
h->chunk_size = sizeof(big);
- if (!(h->chunk_buf = malloc(sizeof(big)))) {
+ if (!(h->chunk_buf = (char*)malloc(sizeof(big)))) {
gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n");
free(e);
return NULL;
diff --git a/protocols/Gadu-Gadu/src/libgadu/dcc7.c b/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp
index fcfefa0500..058177f353 100644
--- a/protocols/Gadu-Gadu/src/libgadu/dcc7.c
+++ b/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp
@@ -425,7 +425,7 @@ static struct gg_dcc7 *gg_dcc7_send_file_common(struct gg_session *sess, uin_t r
goto fail;
}
- if (!(dcc = malloc(sizeof(struct gg_dcc7)))) {
+ if (!(dcc = (gg_dcc7*)malloc(sizeof(struct gg_dcc7)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_dcc7_send_file_common() not enough memory\n");
goto fail;
}
@@ -674,7 +674,7 @@ int gg_dcc7_abort(struct gg_dcc7 *dcc)
*/
int gg_dcc7_handle_id(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_id_reply *p = payload;
+ struct gg_dcc7_id_reply *p = (gg_dcc7_id_reply*)payload;
struct gg_dcc7 *tmp;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_dcc7_handle_id(%p, %p, %p, %d)\n", sess, e, payload, len);
@@ -724,7 +724,7 @@ int gg_dcc7_handle_id(struct gg_session *sess, struct gg_event *e, void *payload
*/
int gg_dcc7_handle_accept(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_accept *p = payload;
+ struct gg_dcc7_accept *p = (struct gg_dcc7_accept*)payload;
struct gg_dcc7 *dcc;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_dcc7_handle_accept(%p, %p, %p, %d)\n", sess, e, payload, len);
@@ -766,7 +766,7 @@ int gg_dcc7_handle_accept(struct gg_session *sess, struct gg_event *e, void *pay
*/
int gg_dcc7_handle_info(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_info *p = payload;
+ struct gg_dcc7_info *p = (gg_dcc7_info*)payload;
struct gg_dcc7 *dcc;
char *tmp;
@@ -916,7 +916,7 @@ int gg_dcc7_handle_info(struct gg_session *sess, struct gg_event *e, void *paylo
*/
int gg_dcc7_handle_reject(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_reject *p = payload;
+ struct gg_dcc7_reject *p = (struct gg_dcc7_reject*)payload;
struct gg_dcc7 *dcc;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_dcc7_handle_reject(%p, %p, %p, %d)\n", sess, e, payload, len);
@@ -955,7 +955,7 @@ int gg_dcc7_handle_reject(struct gg_session *sess, struct gg_event *e, void *pay
*/
int gg_dcc7_handle_abort(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_aborted *p = payload;
+ struct gg_dcc7_aborted *p = (gg_dcc7_aborted*)payload;
struct gg_dcc7 *dcc;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_dcc7_handle_abort(%p, %p, %p, %d)\n", sess, e, payload, len);
@@ -996,14 +996,14 @@ int gg_dcc7_handle_abort(struct gg_session *sess, struct gg_event *e, void *payl
*/
int gg_dcc7_handle_new(struct gg_session *sess, struct gg_event *e, void *payload, int len)
{
- struct gg_dcc7_new *p = payload;
+ struct gg_dcc7_new *p = (gg_dcc7_new*)payload;
struct gg_dcc7 *dcc;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_dcc7_handle_new(%p, %p, %p, %d)\n", sess, e, payload, len);
switch (gg_fix32(p->type)) {
case GG_DCC7_TYPE_FILE:
- if (!(dcc = malloc(sizeof(struct gg_dcc7)))) {
+ if (!(dcc = (gg_dcc7*)malloc(sizeof(struct gg_dcc7)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_dcc7_handle_new() not enough memory\n");
return -1;
}
@@ -1035,7 +1035,7 @@ int gg_dcc7_handle_new(struct gg_session *sess, struct gg_event *e, void *payloa
break;
case GG_DCC7_TYPE_VOICE:
- if (!(dcc = malloc(sizeof(struct gg_dcc7)))) {
+ if (!(dcc = (gg_dcc7*)malloc(sizeof(struct gg_dcc7)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_dcc7_handle_packet() not enough memory\n");
return -1;
}
@@ -1136,7 +1136,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc)
return NULL;
}
- if (!(e = malloc(sizeof(struct gg_event)))) {
+ if (!(e = (gg_event*)malloc(sizeof(struct gg_event)))) {
gg_debug_session((dcc) ? (dcc)->sess : NULL, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() not enough memory\n");
return NULL;
}
@@ -1150,7 +1150,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc)
struct sockaddr_in sin;
SOCKET fd;
int one = 1;
- unsigned int sin_len = sizeof(sin);
+ int sin_len = sizeof(sin);
gg_debug_session((dcc) ? (dcc)->sess : NULL, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_LISTENING\n");
@@ -1194,7 +1194,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc)
case GG_STATE_CONNECTING:
{
int res = 0, error = 0;
- unsigned int error_size = sizeof(error);
+ int error_size = sizeof(error);
gg_debug_session((dcc) ? (dcc)->sess : NULL, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING\n");
@@ -1495,7 +1495,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc)
case GG_STATE_CONNECTING_RELAY:
{
int res;
- unsigned int res_size = sizeof(res);
+ int res_size = sizeof(res);
struct gg_dcc7_relay_req pkt;
gg_debug_session((dcc) ? (dcc)->sess : NULL, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING_RELAY\n");
@@ -1569,7 +1569,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc)
dcc->relay_index = 0;
dcc->relay_count = gg_fix32(pkt->rcount);
- dcc->relay_list = malloc(dcc->relay_count * sizeof(gg_dcc7_relay_t));
+ dcc->relay_list = (gg_dcc7_relay*)malloc(dcc->relay_count * sizeof(gg_dcc7_relay_t));
if (dcc->relay_list == NULL) {
gg_debug_session((dcc) ? (dcc)->sess : NULL, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() not enough memory");
diff --git a/protocols/Gadu-Gadu/src/libgadu/events.c b/protocols/Gadu-Gadu/src/libgadu/events.cpp
index af421f93ff..2a24b77e3c 100644
--- a/protocols/Gadu-Gadu/src/libgadu/events.c
+++ b/protocols/Gadu-Gadu/src/libgadu/events.cpp
@@ -317,7 +317,7 @@ static int gg_handle_recv_msg_options(struct gg_session *sess, struct gg_event *
switch (*p) {
case 0x01: /* konferencja */
{
- struct gg_msg_recipients *m = (void*) p;
+ struct gg_msg_recipients *m = (gg_msg_recipients*)p;
uint32_t i, count;
if (p + sizeof(*m) > packet_end) {
@@ -339,7 +339,7 @@ static int gg_handle_recv_msg_options(struct gg_session *sess, struct gg_event *
goto malformed;
}
- e->event.msg.recipients = malloc(count * sizeof(uin_t));
+ e->event.msg.recipients = (uin_t*)malloc(count * sizeof(uin_t));
if (e->event.msg.recipients == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg_options() not enough memory for recipients data\n");
@@ -375,7 +375,7 @@ static int gg_handle_recv_msg_options(struct gg_session *sess, struct gg_event *
goto malformed;
}
- buf = malloc(len);
+ buf = (char*)malloc(len);
if (buf == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg_options() not enough memory for richtext data\n");
@@ -402,7 +402,7 @@ static int gg_handle_recv_msg_options(struct gg_session *sess, struct gg_event *
case 0x04: /* image_request */
{
- struct gg_msg_image_request *i = (void*) p;
+ struct gg_msg_image_request *i = (gg_msg_image_request*)p;
if (p + sizeof(*i) > packet_end) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg_options() packet out of bounds (3.5)\n");
@@ -429,7 +429,7 @@ static int gg_handle_recv_msg_options(struct gg_session *sess, struct gg_event *
case 0x05: /* image_reply */
case 0x06:
{
- struct gg_msg_image_reply *rep = (void*) p;
+ struct gg_msg_image_reply *rep = (gg_msg_image_reply*)p;
uint32_t size;
uint32_t crc32;
@@ -549,9 +549,9 @@ static int gg_handle_recv_msg(struct gg_header *h, struct gg_event *e, struct gg
e->event.msg.time = gg_fix32(r->time);
e->event.msg.seq = gg_fix32(r->seq);
if (ctcp)
- e->event.msg.message = (unsigned char*) strdup("\x02");
+ e->event.msg.message = (char*) strdup("\x02");
else
- e->event.msg.message = (unsigned char*) strdup((char*) r + sizeof(*r));
+ e->event.msg.message = (char*) strdup((char*) r + sizeof(*r));
return 0;
@@ -731,21 +731,21 @@ static int gg_handle_recv_msg80(struct gg_header *h, struct gg_event *e, struct
}
if (sess->encoding == GG_ENCODING_CP1250) {
- e->event.msg.message = (unsigned char*) strdup(packet + offset_plain);
+ e->event.msg.message = (char*) strdup(packet + offset_plain);
} else {
if (offset_plain > sizeof(struct gg_recv_msg80)) {
int len;
len = gg_convert_from_html(NULL, packet + sizeof(struct gg_recv_msg80));
- e->event.msg.message = malloc(len + 1);
+ e->event.msg.message = (char*)malloc(len + 1);
if (e->event.msg.message == NULL)
goto fail;
gg_convert_from_html((char*) e->event.msg.message, packet + sizeof(struct gg_recv_msg80));
} else {
- e->event.msg.message = (unsigned char*) gg_cp_to_utf8(packet + offset_plain);
+ e->event.msg.message = (char*) gg_cp_to_utf8(packet + offset_plain);
}
}
@@ -838,7 +838,7 @@ static int gg_handle_user_data(struct gg_session *sess, struct gg_event *e, void
}
if (d.user_count > 0) {
- users = calloc(d.user_count, sizeof(struct gg_event_user_data_user));
+ users = (gg_event_user_data_user*)calloc(d.user_count, sizeof(struct gg_event_user_data_user));
if (users == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_user_data() out of memory (%d*%d)\n", d.user_count, sizeof(struct gg_event_user_data_user));
@@ -876,7 +876,7 @@ static int gg_handle_user_data(struct gg_session *sess, struct gg_event *e, void
}
if (u.attr_count > 0) {
- attrs = calloc(u.attr_count, sizeof(struct gg_event_user_data_attr));
+ attrs = (gg_event_user_data_attr*)calloc(u.attr_count, sizeof(struct gg_event_user_data_attr));
if (attrs == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_user_data() out of memory (%d*%d)\n", u.attr_count, sizeof(struct gg_event_user_data_attr));
@@ -914,7 +914,7 @@ static int gg_handle_user_data(struct gg_session *sess, struct gg_event *e, void
goto malformed;
}
- key = malloc(key_size + 1);
+ key = (char*)malloc(key_size + 1);
if (key == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_user_data() out of memory (%d)\n", key_size + 1);
@@ -946,7 +946,7 @@ static int gg_handle_user_data(struct gg_session *sess, struct gg_event *e, void
goto malformed;
}
- value = malloc(value_size + 1);
+ value = (char*)malloc(value_size + 1);
if (value == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_user_data() out of memory (%d)\n", value_size + 1);
@@ -1015,7 +1015,7 @@ static int gg_handle_multilogon_info(struct gg_session *sess, struct gg_event *e
goto malformed;
}
- sessions = calloc(count, sizeof(struct gg_multilogon_session));
+ sessions = (gg_multilogon_session*)calloc(count, sizeof(struct gg_multilogon_session));
if (sessions == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_multilogon_info() out of memory (%d*%d)\n", count, sizeof(struct gg_multilogon_session));
@@ -1052,7 +1052,7 @@ static int gg_handle_multilogon_info(struct gg_session *sess, struct gg_event *e
goto malformed;
}
- sessions[i].name = malloc(name_size + 1);
+ sessions[i].name = (char*)malloc(name_size + 1);
if (sessions[i].name == NULL) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_multilogon_info() out of memory (%d)\n", name_size);
@@ -1103,7 +1103,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
return -1;
}
- if (!(h = gg_recv_packet(sess))) {
+ if (!(h = (gg_header*)gg_recv_packet(sess))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() gg_recv_packet failed (errno=%d, %s)\n", errno, strerror(errno));
goto fail;
}
@@ -1147,7 +1147,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_NOTIFY_REPLY:
{
- struct gg_notify_reply *n = (void*) p;
+ struct gg_notify_reply *n = (gg_notify_reply*)p;
unsigned int count, i;
char *tmp;
@@ -1162,7 +1162,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
if (gg_fix32(n->status) == GG_STATUS_BUSY_DESCR || gg_fix32(n->status) == GG_STATUS_NOT_AVAIL_DESCR || gg_fix32(n->status) == GG_STATUS_AVAIL_DESCR) {
e->type = GG_EVENT_NOTIFY_DESCR;
- if (!(e->event.notify_descr.notify = (void*) malloc(sizeof(*n) * 2))) {
+ if (!(e->event.notify_descr.notify = (gg_notify_reply*)malloc(sizeof(*n) * 2))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1174,7 +1174,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
e->event.notify_descr.notify[0].version = gg_fix32(e->event.notify_descr.notify[0].version);
count = h->length - sizeof(*n);
- if (!(tmp = malloc(count + 1))) {
+ if (!(tmp = (char*)malloc(count + 1))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1185,7 +1185,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
} else {
e->type = GG_EVENT_NOTIFY;
- if (!(e->event.notify = (void*) malloc(h->length + 2 * sizeof(*n)))) {
+ if (!(e->event.notify = (gg_notify_reply*)malloc(h->length + 2 * sizeof(*n)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1207,7 +1207,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_STATUS:
{
- struct gg_status *s = (void*) p;
+ struct gg_status *s = (gg_status*)p;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n");
@@ -1218,7 +1218,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
e->event.status.status = gg_fix32(e->event.status.status);
if (h->length > sizeof(*s)) {
int len = h->length - sizeof(*s);
- char *buf = malloc(len + 1);
+ char *buf = (char*)malloc(len + 1);
if (buf) {
memcpy(buf, p + sizeof(*s), len);
buf[len] = 0;
@@ -1234,13 +1234,13 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_NOTIFY_REPLY77:
case GG_NOTIFY_REPLY80BETA:
{
- struct gg_notify_reply77 *n = (void*) p;
+ struct gg_notify_reply77 *n = (gg_notify_reply77*)p;
unsigned int length = h->length, i = 0;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n");
e->type = GG_EVENT_NOTIFY60;
- e->event.notify60 = malloc(sizeof(*e->event.notify60));
+ e->event.notify60 = (gg_event_notify60*)malloc(sizeof(*e->event.notify60));
if (!e->event.notify60) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
@@ -1275,7 +1275,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
if (sizeof(struct gg_notify_reply77) + descr_len <= length) {
char *descr;
- if (!(descr = malloc(descr_len + 1))) {
+ if (!(descr = (char*)malloc(descr_len + 1))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1301,23 +1301,23 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
/* XXX czas */
length -= sizeof(struct gg_notify_reply77) + descr_len + 1;
- n = (void*) ((char*) n + sizeof(struct gg_notify_reply77) + descr_len + 1);
+ n = (gg_notify_reply77*)((char*)n + sizeof(struct gg_notify_reply77) + descr_len + 1);
} else {
length = 0;
}
} else {
length -= sizeof(struct gg_notify_reply77);
- n = (void*) ((char*) n + sizeof(struct gg_notify_reply77));
+ n = (gg_notify_reply77*)((char*)n + sizeof(struct gg_notify_reply77));
}
- if (!(tmp = realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
+ if (!(tmp = (char*)realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
free(e->event.notify60);
goto fail;
}
- e->event.notify60 = (void*) tmp;
+ e->event.notify60 = (gg_event_notify60*)tmp;
e->event.notify60[++i].uin = 0;
}
@@ -1327,7 +1327,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_STATUS77:
case GG_STATUS80BETA:
{
- struct gg_status77 *s = (void*) p;
+ struct gg_status77 *s = (gg_status77*)p;
uint32_t uin;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n");
@@ -1356,7 +1356,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
if (h->length > sizeof(*s)) {
int len = h->length - sizeof(*s);
- char *buf = malloc(len + 1);
+ char *buf = (char*)malloc(len + 1);
/* XXX, jesli malloc() sie nie uda to robic tak samo jak przy GG_NOTIFY_REPLY* ?
* - goto fail; (?)
@@ -1386,13 +1386,13 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_NOTIFY_REPLY60:
{
- struct gg_notify_reply60 *n = (void*) p;
+ struct gg_notify_reply60 *n = (gg_notify_reply60*)p;
unsigned int length = h->length, i = 0;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n");
e->type = GG_EVENT_NOTIFY60;
- e->event.notify60 = malloc(sizeof(*e->event.notify60));
+ e->event.notify60 = (gg_event_notify60*)malloc(sizeof(*e->event.notify60));
if (!e->event.notify60) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
@@ -1423,7 +1423,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
unsigned char descr_len = *((char*) n + sizeof(struct gg_notify_reply60));
if (sizeof(struct gg_notify_reply60) + descr_len <= length) {
- if (!(e->event.notify60[i].descr = malloc(descr_len + 1))) {
+ if (!(e->event.notify60[i].descr = (char*)malloc(descr_len + 1))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1434,23 +1434,23 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
/* XXX czas */
length -= sizeof(struct gg_notify_reply60) + descr_len + 1;
- n = (void*) ((char*) n + sizeof(struct gg_notify_reply60) + descr_len + 1);
+ n = (gg_notify_reply60*)((char*)n + sizeof(struct gg_notify_reply60) + descr_len + 1);
} else {
length = 0;
}
} else {
length -= sizeof(struct gg_notify_reply60);
- n = (void*) ((char*) n + sizeof(struct gg_notify_reply60));
+ n = (gg_notify_reply60*)((char*)n + sizeof(struct gg_notify_reply60));
}
- if (!(tmp = realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
+ if (!(tmp = (char*)realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
free(e->event.notify60);
goto fail;
}
- e->event.notify60 = (void*) tmp;
+ e->event.notify60 = (gg_event_notify60*)tmp;
e->event.notify60[++i].uin = 0;
}
@@ -1459,7 +1459,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_STATUS60:
{
- struct gg_status60 *s = (void*) p;
+ struct gg_status60 *s = (gg_status60*)p;
uint32_t uin;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n");
@@ -1486,7 +1486,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
if (h->length > sizeof(*s)) {
int len = h->length - sizeof(*s);
- char *buf = malloc(len + 1);
+ char *buf = (char*)malloc(len + 1);
if (buf) {
memcpy(buf, (char*) p + sizeof(*s), len);
@@ -1507,7 +1507,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_STATUS80:
{
- struct gg_notify_reply80 *s = (void*) p;
+ struct gg_notify_reply80 *s = (gg_notify_reply80*)p;
uint32_t descr_len;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n");
@@ -1528,7 +1528,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
descr_len = gg_fix32(s->descr_len);
if (descr_len > 0 && h->length-sizeof(*s) >= descr_len) {
- char *buf = malloc(descr_len + 1);
+ char *buf = (char*)malloc(descr_len + 1);
if (buf) {
memcpy(buf, (char*) p + sizeof(*s), descr_len);
@@ -1548,13 +1548,13 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_NOTIFY_REPLY80:
{
- struct gg_notify_reply80 *n = (void*) p;
+ struct gg_notify_reply80 *n = (gg_notify_reply80*)p;
unsigned int length = h->length, i = 0;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n");
e->type = GG_EVENT_NOTIFY60;
- e->event.notify60 = malloc(sizeof(*e->event.notify60));
+ e->event.notify60 = (gg_event_notify60*)malloc(sizeof(*e->event.notify60));
if (!e->event.notify60) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
@@ -1579,14 +1579,14 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
descr_len = gg_fix32(n->descr_len);
length -= sizeof(struct gg_notify_reply80);
- n = (void*) ((char*) n + sizeof(struct gg_notify_reply80));
+ n = (gg_notify_reply80*)((char*)n + sizeof(struct gg_notify_reply80));
if (descr_len) {
if (length >= descr_len) {
/* XXX, GG_S_D(n->status) */
char *descr;
- if (!(descr = malloc(descr_len + 1))) {
+ if (!(descr = (char*)malloc(descr_len + 1))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
goto fail;
}
@@ -1609,18 +1609,18 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
e->event.notify60[i].descr = descr;
length -= descr_len;
- n = (void*) ((char*) n + descr_len);
+ n = (gg_notify_reply80*)((char*)n + descr_len);
} else
length = 0;
}
- if (!(tmp = realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
+ if (!(tmp = (char*)realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
free(e->event.notify60);
goto fail;
}
- e->event.notify60 = (void*) tmp;
+ e->event.notify60 = (gg_event_notify60*)tmp;
e->event.notify60[++i].uin = 0;
}
break;
@@ -1628,7 +1628,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_SEND_MSG_ACK:
{
- struct gg_send_msg_ack *s = (void*) p;
+ struct gg_send_msg_ack *s = (gg_send_msg_ack*)p;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a message ack\n");
@@ -1723,7 +1723,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
gg_debug_session(sess, GG_DEBUG_MISC, "userlist_reply=%p, len=%d\n", sess->userlist_reply, len);
- if (!(tmp = realloc(sess->userlist_reply, len + h->length))) {
+ if (!(tmp = (char*)realloc(sess->userlist_reply, len + h->length))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for userlist reply\n");
free(sess->userlist_reply);
sess->userlist_reply = NULL;
@@ -1839,7 +1839,7 @@ static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e)
case GG_TYPING_NOTIFICATION:
{
- struct gg_typing_notification *n = (void*) p;
+ struct gg_typing_notification *n = (struct gg_typing_notification*)p;
uin_t uin;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received typing notification\n");
@@ -1910,7 +1910,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
return NULL;
}
- if (!(e = (void*) calloc(1, sizeof(*e)))) {
+ if (!(e = (gg_event*)calloc(1, sizeof(*e)))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() not enough memory for event data\n");
return NULL;
}
@@ -2017,7 +2017,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
{
char buf[1024], *client, *auth;
int res = 0;
- unsigned int res_size = sizeof(res);
+ int res_size = sizeof(res);
const char *host;
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n");
@@ -2140,7 +2140,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
int len = 0;
while (gg_read_line(sess->fd, tmp, sizeof(tmp) - 1)) {
- if (!(foo = realloc(sysmsg_buf, len + strlen(tmp) + 2))) {
+ if (!(foo = (char*)realloc(sysmsg_buf, len + strlen(tmp) + 2))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() out of memory for system message, ignoring\n");
break;
}
@@ -2158,7 +2158,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
e->type = GG_EVENT_MSG;
e->event.msg.msgclass = atoi(buf);
e->event.msg.sender = 0;
- e->event.msg.message = (unsigned char*) sysmsg_buf;
+ e->event.msg.message = (char*) sysmsg_buf;
}
gg_sock_close(sess->fd);
@@ -2299,7 +2299,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
case GG_STATE_CONNECTING_GG:
{
int res = 0;
- unsigned int res_size = sizeof(res);
+ int res_size = sizeof(res);
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n");
@@ -2569,7 +2569,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
}
/* czytaj pierwszy pakiet. */
- if (!(h = gg_recv_packet(sess))) {
+ if (!(h = (gg_header*)gg_recv_packet(sess))) {
if (errno == EAGAIN) {
sess->check = GG_CHECK_READ;
break;
@@ -2631,7 +2631,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) {
struct sockaddr_in sin;
- unsigned int sin_len = sizeof(sin);
+ int sin_len = sizeof(sin);
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n");
@@ -2737,7 +2737,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess)
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_REPLY\n");
- if (!(h = gg_recv_packet(sess))) {
+ if (!(h = (gg_header*)gg_recv_packet(sess))) {
if (errno == EAGAIN) {
sess->check = GG_CHECK_READ;
break;
diff --git a/protocols/Gadu-Gadu/src/libgadu/http.c b/protocols/Gadu-Gadu/src/libgadu/http.cpp
index c070b3ee53..d07dca27d3 100644
--- a/protocols/Gadu-Gadu/src/libgadu/http.c
+++ b/protocols/Gadu-Gadu/src/libgadu/http.cpp
@@ -88,7 +88,7 @@ struct gg_http *gg_http_connect(const char *hostname, int port, int async, const
return NULL;
}
- if (!(h = malloc(sizeof(*h))))
+ if (!(h = (gg_http*)malloc(sizeof(*h))))
return NULL;
memset(h, 0, sizeof(*h));
@@ -239,7 +239,7 @@ int gg_http_watch_fd(struct gg_http *h)
if (h->state == GG_STATE_CONNECTING) {
int res = 0;
- unsigned int res_size = sizeof(res);
+ int res_size = sizeof(res);
if (h->async && (gg_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));
@@ -309,7 +309,7 @@ int gg_http_watch_fd(struct gg_http *h)
gg_debug(GG_DEBUG_MISC, "=> http, read %d bytes of header\n", res);
- if (!(tmp = realloc(h->header, h->header_size + res + 1))) {
+ if (!(tmp = (char*)realloc(h->header, h->header_size + res + 1))) {
gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for header\n");
free(h->header);
h->header = NULL;
@@ -371,7 +371,7 @@ int gg_http_watch_fd(struct gg_http *h)
gg_debug(GG_DEBUG_MISC, "=> http, body_size=%d\n", h->body_size);
- if (!(h->body = malloc(h->body_size + 1))) {
+ if (!(h->body = (char*)malloc(h->body_size + 1))) {
gg_debug(GG_DEBUG_MISC, "=> http, not enough memory (%d bytes for body_buf)\n", h->body_size + 1);
free(h->header);
h->header = NULL;
@@ -431,7 +431,7 @@ int gg_http_watch_fd(struct gg_http *h)
gg_debug(GG_DEBUG_MISC, "=> http, too much data (%d bytes, %d needed), enlarging buffer\n", h->body_done + res, h->body_size);
- if (!(tmp = realloc(h->body, h->body_done + res + 1))) {
+ if (!(tmp = (char*)realloc(h->body, h->body_done + res + 1))) {
gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for data (%d needed)\n", h->body_done + res + 1);
free(h->body);
h->body = NULL;
diff --git a/protocols/Gadu-Gadu/src/libgadu/libgadu.c b/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp
index f06f8a5b84..a827b261e1 100644
--- a/protocols/Gadu-Gadu/src/libgadu/libgadu.c
+++ b/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp
@@ -445,7 +445,7 @@ int gg_write(struct gg_session *sess, const char *buf, int length)
if (res < length) {
char *tmp;
- if (!(tmp = realloc(sess->send_buf, sess->send_left + length - res))) {
+ if (!(tmp = (char*)realloc(sess->send_buf, sess->send_left + length - res))) {
errno = ENOMEM;
return -1;
}
@@ -513,7 +513,7 @@ void *gg_recv_packet(struct gg_session *sess)
if (errno == EAGAIN) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_recv_packet() header recv() incomplete header received\n");
- if (!(sess->header_buf = malloc(sess->header_done))) {
+ if (!(sess->header_buf = (char*)malloc(sess->header_done))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_recv_packet() header recv() not enough memory\n");
return NULL;
}
@@ -552,7 +552,7 @@ void *gg_recv_packet(struct gg_session *sess)
offset = sess->recv_done;
buf = sess->recv_buf;
} else {
- if (!(buf = malloc(sizeof(h) + h.length + 1))) {
+ if (!(buf = (char*)malloc(sizeof(h) + h.length + 1))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_recv_packet() not enough memory for packet data\n");
return NULL;
}
@@ -625,7 +625,7 @@ int gg_send_packet(struct gg_session *sess, int type, ...)
tmp_length = sizeof(struct gg_header);
- if (!(tmp = malloc(tmp_length))) {
+ if (!(tmp = (char*)malloc(tmp_length))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_send_packet() not enough memory for packet header\n");
return -1;
}
@@ -639,7 +639,7 @@ int gg_send_packet(struct gg_session *sess, int type, ...)
payload_length = va_arg(ap, unsigned int);
- if (!(tmp2 = realloc(tmp, tmp_length + payload_length))) {
+ if (!(tmp2 = (char*)realloc(tmp, tmp_length + payload_length))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_send_packet() not enough memory for payload\n");
free(tmp);
va_end(ap);
@@ -732,9 +732,9 @@ static int gg_session_callback(struct gg_session *sess)
*
* \ingroup login
*/
-#ifdef GG_CONFIG_MIRANDA
-struct gg_session *gg_login(const struct gg_login_params *p, SOCKET *gg_sock, int *gg_failno)
-#else
+#ifdef GG_CONFIG_MIRANDA
+struct gg_session *gg_login(const struct gg_login_params *p, SOCKET *gg_sock, int *gg_failno)
+#else
struct gg_session *gg_login(const struct gg_login_params *p)
#endif
{
@@ -750,7 +750,7 @@ struct gg_session *gg_login(const struct gg_login_params *p)
gg_debug(GG_DEBUG_FUNCTION, "** gg_login(%p: [uin=%u, async=%d, ...]);\n", p, p->uin, p->async);
- if (!(sess = malloc(sizeof(struct gg_session)))) {
+ if (!(sess = (gg_session*)malloc(sizeof(struct gg_session)))) {
gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for session data\n");
goto fail;
}
@@ -1692,7 +1692,7 @@ int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int r
len = gg_convert_to_html(NULL, utf_msg, format + 3, formatlen - 3);
- html_msg = malloc(len + 1);
+ html_msg = (char*)malloc(len + 1);
if (html_msg == NULL) {
seq_no = -1;
@@ -1711,7 +1711,7 @@ int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int r
r.flag = 0x01;
r.count = gg_fix32(recipients_count - 1);
- recps = malloc(sizeof(uin_t) * recipients_count);
+ recps = (uin_t*)malloc(sizeof(uin_t) * recipients_count);
if (!recps) {
seq_no = -1;
@@ -1858,7 +1858,7 @@ int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_
res = gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), &dummy, 1, &r, sizeof(r), NULL);
if (!res) {
- struct gg_image_queue *q = malloc(sizeof(*q));
+ struct gg_image_queue *q = (gg_image_queue*)malloc(sizeof(*q));
char *buf;
if (!q) {
@@ -1866,7 +1866,7 @@ int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_
return -1;
}
- buf = malloc(size);
+ buf = (char*)malloc(size);
if (size && !buf)
{
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_image_request() not enough memory for image\n");
@@ -1948,7 +1948,7 @@ int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filenam
s.msgclass = gg_fix32(GG_CLASS_MSG);
buf[0] = 0;
- r = (void*) &buf[1];
+ r = (gg_msg_image_reply*)&buf[1];
r->flag = 0x05;
r->size = gg_fix32(size);
diff --git a/protocols/Gadu-Gadu/src/libgadu/libgadu.h b/protocols/Gadu-Gadu/src/libgadu/libgadu.h
index 82214e65ed..6d2db69f96 100644
--- a/protocols/Gadu-Gadu/src/libgadu/libgadu.h
+++ b/protocols/Gadu-Gadu/src/libgadu/libgadu.h
@@ -45,10 +45,6 @@
#pragma pack(push, 1)
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
@@ -169,8 +165,8 @@ typedef signed int int32_t;
# define GG_CONFIG_HAVE_STRTOULL
# define strtoull _strtoui64
# endif
-# define gg_sock_write(sock,buf,len) send(sock,(void *)(buf),len,0)
-# define gg_sock_read(sock,buf,len) recv(sock,(void *)(buf),len,0)
+# define gg_sock_write(sock,buf,len) send(sock,(const char*)(buf),len,0)
+# define gg_sock_read(sock,buf,len) recv(sock,(char*)(buf),len,0)
# define gg_sock_close(sock) closesocket(sock)
# define gg_getsockopt(sock,level,name,val,len) getsockopt(sock,level,name,(char *)val,len)
#else
@@ -2288,10 +2284,6 @@ struct gg_dcc7_aborted {
#define GG_DCC7_TIMEOUT_FILE_ACK 300 /* 5 minut */
#define GG_DCC7_TIMEOUT_VOICE_ACK 300 /* 5 minut */
-#ifdef __cplusplus
-}
-#endif
-
#if defined(__cplusplus) || defined(_WIN32)
#ifdef _WIN32
#pragma pack(pop)
diff --git a/protocols/Gadu-Gadu/src/libgadu/obsolete.c b/protocols/Gadu-Gadu/src/libgadu/obsolete.cpp
index f8fe4dc5de..f8fe4dc5de 100644
--- a/protocols/Gadu-Gadu/src/libgadu/obsolete.c
+++ b/protocols/Gadu-Gadu/src/libgadu/obsolete.cpp
diff --git a/protocols/Gadu-Gadu/src/libgadu/pthread.c b/protocols/Gadu-Gadu/src/libgadu/pthread.cpp
index 11362add17..11362add17 100644
--- a/protocols/Gadu-Gadu/src/libgadu/pthread.c
+++ b/protocols/Gadu-Gadu/src/libgadu/pthread.cpp
diff --git a/protocols/Gadu-Gadu/src/libgadu/pubdir.c b/protocols/Gadu-Gadu/src/libgadu/pubdir.cpp
index c74ff4f309..2b2fdacece 100644
--- a/protocols/Gadu-Gadu/src/libgadu/pubdir.c
+++ b/protocols/Gadu-Gadu/src/libgadu/pubdir.cpp
@@ -607,7 +607,7 @@ int gg_pubdir_watch_fd(struct gg_http *h)
h->state = GG_STATE_DONE;
- if (!(h->data = p = malloc(sizeof(struct gg_pubdir)))) {
+ if (!(h->data = p = (gg_pubdir*)malloc(sizeof(struct gg_pubdir)))) {
gg_debug(GG_DEBUG_MISC, "=> pubdir, not enough memory for results\n");
return -1;
}
@@ -812,7 +812,7 @@ int gg_token_watch_fd(struct gg_http *h)
if (!h->async)
gg_token_watch_fd(h);
- if (!(h->data = t = malloc(sizeof(struct gg_token)))) {
+ if (!(h->data = t = (struct gg_token*)malloc(sizeof(struct gg_token)))) {
gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token data\n");
free(tokenid);
return -1;
@@ -844,7 +844,7 @@ void gg_token_free(struct gg_http *h)
if (!h)
return;
- if ((t = h->data))
+ if (t = (struct gg_token*)h->data)
free(t->tokenid);
free(h->data);
diff --git a/protocols/Gadu-Gadu/src/libgadu/pubdir50.c b/protocols/Gadu-Gadu/src/libgadu/pubdir50.cpp
index 6914cbd01a..4255192923 100644
--- a/protocols/Gadu-Gadu/src/libgadu/pubdir50.c
+++ b/protocols/Gadu-Gadu/src/libgadu/pubdir50.cpp
@@ -53,7 +53,7 @@
*/
gg_pubdir50_t gg_pubdir50_new(int type)
{
- gg_pubdir50_t res = malloc(sizeof(struct gg_pubdir50_s));
+ gg_pubdir50_t res = (gg_pubdir50_t)malloc(sizeof(struct gg_pubdir50_s));
gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_new(%d);\n", type);
@@ -109,7 +109,7 @@ static int gg_pubdir50_add_n(gg_pubdir50_t req, int num, const char *field, cons
return -1;
}
- if (!(tmp = realloc(req->entries, sizeof(struct gg_pubdir50_entry) * (req->entries_count + 1)))) {
+ if (!(tmp = (gg_pubdir50_entry*)realloc(req->entries, sizeof(struct gg_pubdir50_entry) * (req->entries_count + 1)))) {
gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n");
free(dupfield);
free(dupvalue);
@@ -255,7 +255,7 @@ uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req)
}
}
- if (!(buf = malloc(size))) {
+ if (!(buf = (char*)malloc(size))) {
gg_debug_session(sess, GG_DEBUG_MISC, "// gg_pubdir50() out of memory (%d bytes)\n", size);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/libgadu/resolver.c b/protocols/Gadu-Gadu/src/libgadu/resolver.cpp
index 1adef3ef9d..9b3ab79147 100644
--- a/protocols/Gadu-Gadu/src/libgadu/resolver.c
+++ b/protocols/Gadu-Gadu/src/libgadu/resolver.cpp
@@ -206,7 +206,7 @@ struct in_addr *gg_gethostbyname(const char *hostname)
{
struct in_addr *addr;
- if (!(addr = malloc(sizeof(struct in_addr))))
+ if (!(addr = (in_addr*)malloc(sizeof(struct in_addr))))
return NULL;
if (gg_gethostbyname_real(hostname, addr, 0)) {
@@ -255,7 +255,7 @@ static int gg_resolver_fork_start(SOCKET *fd, void **priv_data, const char *host
return -1;
}
- data = malloc(sizeof(struct gg_resolver_fork_data));
+ data = (gg_resolver_fork_data*)malloc(sizeof(struct gg_resolver_fork_data));
if (data == NULL) {
gg_debug(GG_DEBUG_MISC, "// gg_resolver_fork_start() out of memory for resolver data\n");
@@ -393,7 +393,7 @@ static void gg_resolver_pthread_cleanup(void **priv_data, int force)
*/
static void *__stdcall gg_resolver_pthread_thread(void *arg)
{
- struct gg_resolver_pthread_data *data = arg;
+ struct gg_resolver_pthread_data *data = (gg_resolver_pthread_data*)arg;
struct in_addr addr;
pthread_detach(pthread_self());
@@ -442,7 +442,7 @@ static int gg_resolver_pthread_start(SOCKET *fd, void **priv_data, const char *h
return -1;
}
- data = malloc(sizeof(struct gg_resolver_pthread_data));
+ data = (gg_resolver_pthread_data*)malloc(sizeof(struct gg_resolver_pthread_data));
if (data == NULL) {
gg_debug(GG_DEBUG_MISC, "// gg_resolver_pthread_start() out of memory for resolver data\n");
diff --git a/protocols/Gadu-Gadu/src/libgadu/sha1.c b/protocols/Gadu-Gadu/src/libgadu/sha1.cpp
index b01b77a00c..b01b77a00c 100644
--- a/protocols/Gadu-Gadu/src/libgadu/sha1.c
+++ b/protocols/Gadu-Gadu/src/libgadu/sha1.cpp
diff --git a/protocols/Gadu-Gadu/src/libgadu/win32.c b/protocols/Gadu-Gadu/src/libgadu/win32.cpp
index 4f5ad3ff5d..55da0d8e0d 100644
--- a/protocols/Gadu-Gadu/src/libgadu/win32.c
+++ b/protocols/Gadu-Gadu/src/libgadu/win32.cpp
@@ -26,7 +26,7 @@ int sockpipe(SOCKET filedes[2])
{
SOCKET sock;
struct sockaddr_in sin;
- unsigned int len = sizeof(sin);
+ int len = sizeof(sin);
filedes[0] = filedes[1] = INVALID_SOCKET;