--- a/libpurple/protocols/gg/lib/events.c Tue Apr 01 00:00:26 2014 +0200
+++ b/libpurple/protocols/gg/lib/events.c Thu Apr 03 14:48:56 2014 +0200
@@ -588,6 +588,7 @@
res = gg_resolver_recv(sess->fd, buf, sizeof(buf));
@@ -622,8 +623,10 @@
/* Sprawdź, czy mamy listę zakończoną INADDR_NONE */
+ addrs = (struct in_addr *)(void *)sess->recv_buf; for (i = 0; i < sess->recv_done / sizeof(struct in_addr); i++) {
- if (((struct in_addr*) sess->recv_buf)[i].s_addr == INADDR_NONE) {
+ if (addrs[i].s_addr == INADDR_NONE) { @@ -661,7 +664,7 @@
- len += strlen(inet_ntoa(((struct in_addr*) sess->recv_buf)[i]));
+ len += strlen(inet_ntoa(addrs[i])); @@ -675,7 +678,7 @@
- strcat(list, inet_ntoa(((struct in_addr*) sess->recv_buf)[i]));
+ strcat(list, inet_ntoa(addrs[i])); gg_debug_session(sess, GG_DEBUG_DUMP, "// gg_watch_fd() resolved: %s\n", list);
@@ -687,7 +690,7 @@
sess->state = next_state;
- sess->resolver_result = (struct in_addr*) sess->recv_buf;
+ sess->resolver_result = addrs; sess->resolver_count = count;
sess->resolver_index = 0;
--- a/libpurple/protocols/gg/lib/libgadu.h Tue Apr 01 00:00:26 2014 +0200
+++ b/libpurple/protocols/gg/lib/libgadu.h Thu Apr 03 14:48:56 2014 +0200
@@ -283,7 +283,7 @@
int initial_status; /**< Początkowy status */
int status; /**< Aktualny status */
- char *recv_buf; /**< Bufor na odbierany pakiety */
+ char *recv_buf; /**< Bufor na odbierane pakiety. Wskaźnik zawsze maksymalnie wyrównany, tak jak w wyniku działania \c malloc(). */ int recv_done; /**< Liczba wczytanych bajtów pakietu */
int recv_left; /**< Liczba pozostałych do wczytania bajtów pakietu */
--- a/libpurple/protocols/gg/lib/protobuf-c.c Tue Apr 01 00:00:26 2014 +0200
+++ b/libpurple/protocols/gg/lib/protobuf-c.c Thu Apr 03 14:48:56 2014 +0200
@@ -919,7 +919,7 @@
- char *array = * (char * const *) member;
+ void *array = * (char * const *) member; @@ -1024,7 +1024,7 @@
for (i = 0; i < count; i++)
rv += required_field_pack (field, array, out + rv);
+ array = ((char*)array) + siz; @@ -1902,7 +1902,7 @@
const ProtobufCFieldDescriptor *field = scanned_member->field;
size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset);
size_t siz = sizeof_elt_in_repeated_array (field->type);
- char *array = *(char**)member + siz * (*p_n);
+ void *array = *(char**)member + siz * (*p_n); const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len;
size_t rem = scanned_member->len - scanned_member->length_prefix_len;
--- a/libpurple/protocols/gg/lib/sha1.c Tue Apr 01 00:00:26 2014 +0200
+++ b/libpurple/protocols/gg/lib/sha1.c Thu Apr 03 14:48:56 2014 +0200
@@ -88,13 +88,13 @@
/* blk0() and blk() perform the initial expand. */
/* I got the idea of expanding during the round function from SSLeay */
#ifndef GG_CONFIG_BIGENDIAN
-#define blk0(i) (block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) \
- |(rol(block->l[i], 8) & 0x00FF00FF))
+#define blk0(i) (block.l[i] = (rol(block.l[i], 24) & 0xFF00FF00) \ + |(rol(block.l[i], 8) & 0x00FF00FF)) -#define blk0(i) block->l[i]
+#define blk0(i) block.l[i] -#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
- ^block->l[(i+2)&15]^block->l[i&15], 1))
+#define blk(i) (block.l[i&15] = rol(block.l[(i+13)&15]^block.l[(i+8)&15] \ + ^block.l[(i+2)&15]^block.l[i&15], 1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
/* style:comma:start-ignore */
@@ -115,10 +115,8 @@
-static unsigned char workspace[64];
- block = (CHAR64LONG16*)workspace;
- memcpy(block, buffer, 64);
+ memcpy(&block, buffer, sizeof(block)); /* Copy context->state[] to working vars */