1 --- cDonkey-0.9.0/misc.h.orig 2003-05-03 19:48:49.000000000 +0000
2 +++ cDonkey-0.9.0/misc.h 2003-11-18 14:58:29.000000000 +0000
4 unsigned cntFiles (void);
5 unsigned cntSource (void);
6 unsigned cntServer (void);
7 -bool encode64(const char *_in, unsigned inlen, char *_out, size_t outmax, size_t *outlen);
8 +bool encode64(const char *_in, size_t inlen, char *_out, size_t outmax, size_t *outlen);
9 bool decode64(const char * in, unsigned inlen, char * out, size_t *outlen);
12 --- cDonkey-0.9.0/sCommand.cpp.orig 2003-03-31 23:01:10.000000000 +0000
13 +++ cDonkey-0.9.0/sCommand.cpp 2003-11-18 14:42:51.000000000 +0000
15 if (0 == strncasecmp ("mcon " , text, strlen ("mcon " ))) {{{
16 TCP_CLIENT_COUNT = atoi (text + strlen("mcon "));
17 TCP_SERVER_COUNT = atoi (text + strlen("mcon "));
18 - len = snprintf(out, 128, "max connection = %i\n", TCP_CLIENT_COUNT);
19 + len = snprintf(out, 128, "max connection = %zi\n", TCP_CLIENT_COUNT);
22 if (0 == strncasecmp ("TCP_CLIENT_COUNT ", text, strlen ("TCP_CLIENT_COUNT "))) {{{
23 TCP_CLIENT_COUNT = atoi (text + strlen("TCP_CLIENT_COUNT "));
24 - len = snprintf(out, 128, "TCP client count = %i\n", TCP_CLIENT_COUNT);
25 + len = snprintf(out, 128, "TCP client count = %zi\n", TCP_CLIENT_COUNT);
28 if (0 == strncasecmp ("TCP_SERVER_COUNT ", text, strlen ("TCP_SERVER_COUNT "))) {{{
32 if (0 == strncasecmp ("vc " , text, strlen ("vc" ))) {{{
33 - len = snprintf(out, 128, "%u contacts", overnet.getNumContacts());
34 + len = snprintf(out, 128, "%zu contacts", overnet.getNumContacts());
37 if (0 == strncasecmp ("s " , text, strlen ("s" ))) {{{
38 --- cDonkey-0.9.0/kademlia.cpp.orig 2003-05-07 18:21:34.000000000 +0000
39 +++ cDonkey-0.9.0/kademlia.cpp 2003-11-18 14:53:10.000000000 +0000
41 if (boot_done) return;
42 size_t cnt = overnet.getNumContacts();
44 - printf("Read %u from contact.dat\n", cnt);
45 + printf("Read %zu from contact.dat\n", cnt);
50 logSend('>', OVERNET_CONNECT, 24 );
51 unsigned char BUF[24];
52 unsigned char *buf = BUF;
53 - unsigned int len = 24;
55 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
56 ADD_U1 (&buf, &len, OVERNET_CONNECT);
57 ADD_HASH(&buf, &len, seek_hash);
59 logSend('>', OVERNET_HELLO_ACK, 2 );
61 unsigned char *buf = BUF;
64 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
65 ADD_U1 (&buf, &len, OVERNET_HELLO_ACK);
68 logSend('>', OVERNET_REQUEST, 19 );
69 unsigned char BUF[19];
70 unsigned char *buf = BUF;
71 - unsigned int len, LEN = len = 19;
72 + size_t len, LEN = len = 19;
73 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
74 ADD_U1 (&buf, &len, OVERNET_REQUEST);
75 ADD_U1 (&buf, &len, for_type);
77 logSend('>', OVERNET_SEARCH_END, 22);
78 unsigned char BUF[22];
79 unsigned char *buf = BUF;
82 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
83 ADD_U1 (&buf, &len, OVERNET_SEARCH_END);
84 ADD_HASH (&buf, &len, p_hash);
86 bool cKademlia::send_Publish (const uint8_t *key, size_t size, const char* name) {{{ // (0x13) Publish an meta description
89 - unsigned len, LEN = len = 52+strlen(name);
90 + size_t len, LEN = len = 52+strlen(name);
91 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
92 logSend('>', OVERNET_PUBLISH_REQ, len);
93 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
97 bool cKademlia::send_Publish_ack (const uint8_t * p_hash ) {{{ // (0x14) acknowlegde the send_Publish
98 - unsigned len, LEN = len = 18;
99 + size_t len, LEN = len = 18;
100 unsigned char BUF[18], *buf = BUF;
101 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
102 ADD_U1 (&buf, &len, OVERNET_PUBLISH_ACK);
105 bool cKademlia::send_Identify_reply (void) {{{ // (0x15)
106 logSend('>', OVERNET_IDENTIFY_RES, 25);
107 - unsigned int len = 25;
109 unsigned char BUF[25];
110 unsigned char *buf = BUF;
111 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
114 bool cKademlia::send_Identify_ack (void) {{{ // (0x16)
115 logSend('>',OVERNET_IDENTIFY_ACK, 4);
116 - unsigned int len = 4;
118 unsigned char BUF[4];
119 unsigned char *buf = BUF;
120 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
122 bool cKademlia::send_IP_query (void) {{{ // (0x1B) Ask after BOOT what the other see as my ip
123 unsigned char BUF[4];
124 unsigned char *buf = BUF;
125 - unsigned len, LEN = len = 4;
126 + size_t len, LEN = len = 4;
127 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
128 ADD_U1 (&buf, &len, OVERNET_IP_REQ);
129 ADD_U2 (&buf, &len, pref.ports.client);
131 bool cKademlia::send_IP_answer (void) {{{ // (0x1C) Answer for send_IP_query
132 unsigned char BUF[6];
133 unsigned char *buf = BUF;
134 - unsigned len, LEN = len = 6;
135 + size_t len, LEN = len = 6;
136 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
137 ADD_U1 (&buf, &len, OVERNET_IP_RES);
138 ADD_U4 (&buf, &len, peer_ip.s_addr);
140 bool cKademlia::send_IP_end (void) {{{ // (0x1D) returned after send_IP_answer
141 unsigned char BUF[2];
142 unsigned char *buf = BUF;
143 - unsigned len, LEN = len = 2;
144 + size_t len, LEN = len = 2;
145 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
146 ADD_U1 (&buf, &len, OVERNET_IP_ACK);
147 logSend('>', OVERNET_IP_ACK, LEN);
149 bool cKademlia::send_Identify (void) {{{ // (0x1E)
150 unsigned char BUF[2];
151 unsigned char *buf = BUF;
152 - unsigned len, LEN = len = 2;
153 + size_t len, LEN = len = 2;
154 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
155 ADD_U1 (&buf, &len, OVERNET_SEARCH_END);
156 // logSend('>', 0x1E, LEN);
161 -void cKademlia::parsePeer_lst (unsigned char **buf , unsigned *len, unsigned cnt) {{{
162 +void cKademlia::parsePeer_lst (unsigned char **buf , size_t *len, unsigned cnt) {{{
163 for (unsigned i = 0; i < cnt && *len >= 23; i++) {
164 uint8_t p_hash[KAD_HASH_LEN];
165 GET_HASH (buf, len, p_hash);
170 - printf("%s %c 0x%04X overnet [%15s](%9u) %-15s [%3u]", currentTime_str, dir, cmd, inet_ntoa(peer_ip), peer_port, op2str(cmd), len);
171 + printf("%s %c 0x%04X overnet [%15s](%9u) %-15s [%3zu]", currentTime_str, dir, cmd, inet_ntoa(peer_ip), peer_port, op2str(cmd), len);
172 if (!extra) printf("\n");
176 case 0x21 : break; // TODO WARNING unclear if this opcode is real or an bug
177 default : printf("Protocol %3u (0x%0X) (overnet) (%15s:%5u)\n", proto , proto, inet_ntoa(peer_ip), peer_port);
178 printf("Command %3u (0x%0X) (overnet)\n", cmd, cmd);
179 - printf("len: %u\n", LEN);
180 + printf("len: %zu\n", LEN);
184 --- cDonkey-0.9.0/protocol.cpp.orig 2003-05-03 19:48:50.000000000 +0000
185 +++ cDonkey-0.9.0/protocol.cpp 2003-11-18 14:18:18.000000000 +0000
188 class sTag *parseTag (class sPacket *packet) {{{
189 unsigned char *data = packet->DATA();
190 - unsigned len = packet->Unused();
191 + size_t len = packet->Unused();
192 sTag *ret = parse_tag(data, &len);
193 packet->GET_BLIND(len);
195 --- cDonkey-0.9.0/cZone.cpp.orig 2003-05-07 18:21:34.000000000 +0000
196 +++ cDonkey-0.9.0/cZone.cpp 2003-11-18 14:53:53.000000000 +0000
197 @@ -369,12 +369,12 @@
198 sprintf(ZoneIndex, "%32s", hash_bin2hex(m_zoneIndex));
199 if (prefix == NULL) printf("------------------------------------------------------\n");
201 - printf("Zone level: %i\tZone prefix: %s\tContacts: %i\tZoneIndex: %s\n",
202 + printf("Zone level: %i\tZone prefix: %s\tContacts: %zi\tZoneIndex: %s\n",
203 m_level, (prefix == NULL) ? "ROOT" : prefix, getNumContacts(), ZoneIndex);
204 m_bin->dumpContents();
207 - printf("Zone level: %i\tZone prefix: %s\tContacts: %i\tZoneIndex: %s NODE\n",
208 + printf("Zone level: %i\tZone prefix: %s\tContacts: %zi\tZoneIndex: %s NODE\n",
209 m_level, (prefix == NULL) ? "ROOT" : prefix, getNumContacts(), ZoneIndex);
211 sprintf(msg, "%s0", (prefix == NULL) ? "" : prefix);
212 --- cDonkey-0.9.0/sTag.cpp.orig 2003-04-05 18:06:46.000000000 +0000
213 +++ cDonkey-0.9.0/sTag.cpp 2003-11-18 14:43:57.000000000 +0000
218 -sTag *parse_tag (unsigned char *data, unsigned *len) {{{
219 +sTag *parse_tag (unsigned char *data, size_t *len) {{{
220 ASSERT (NULL != data);
221 ASSERT (NULL != len );
222 if (data == NULL) {{{
223 --- cDonkey-0.9.0/donkey.cpp.orig 2003-05-07 18:26:57.000000000 +0000
224 +++ cDonkey-0.9.0/donkey.cpp 2003-11-18 14:13:22.000000000 +0000
226 printf("sSource::count => %i\n", sSource::count);
227 printf("sSource::count0=> %i\n", sSource::count0);
228 printf("sSource::count1=> %i\n", sSource::count1);
229 - printf("cSocket::count => %i\n", cSocket::count);
230 + printf("cSocket::count => %zi\n", cSocket::count);
231 printf("sTag ::count => %i\n", sTag::count);
234 --- cDonkey-0.9.0/sPacket.cpp.orig 2003-04-29 15:33:39.000000000 +0000
235 +++ cDonkey-0.9.0/sPacket.cpp 2003-11-18 14:17:44.000000000 +0000
238 void sPacket::Dump (void) const {{{
239 printf("\r\nprotokol:%02x\r\n", proto);
240 - printf("length : %u\r\n" , pay_len);
241 - printf("position : %#08X\r\n", pos);
242 + printf("length : %zu\r\n" , pay_len);
243 + printf("position : %#08zX\r\n", pos);
244 unsigned tmp = opcode;
245 printf("command : 0x%02hx\r\n", tmp);
246 for (uint32_t i=0; i < pay_len - 1; i++) {
247 --- cDonkey-0.9.0/sGui.cpp.orig 2003-05-07 18:21:34.000000000 +0000
248 +++ cDonkey-0.9.0/sGui.cpp 2003-11-18 14:15:47.000000000 +0000
250 unsigned limit = max_cnt * (78 + sizeof(s->name) + sizeof(s->desc));
251 unsigned char *buffer, *BUFFER = buffer = reinterpret_cast<unsigned char*>(alloca (limit));
252 s = nextServers (true);
253 - unsigned unused = limit;
254 + size_t unused = limit;
256 while (s != NULL) { // we have reserved the maximum possible size
260 unsigned limit = 3000; // hardcoded ! BAD
261 unsigned char *buffer, *BUFFER = buffer = reinterpret_cast<unsigned char*>(alloca (limit));
262 - unsigned unused = limit;
263 + size_t unused = limit;
266 if ( ! akt->get_Completed() ) continue;
268 ADD_U4 (&buf, &len, TCP_CLIENT_COUNT); // max connections
269 ADD_U4 (&buf, &len, 0x020c0800); // core build date
270 ADD_F4 (&buf, &len, (dlSecond + ulSecond) / 1024.0); // line download speed
271 - if (len != 0) printf("len = %i\n", len);
272 + if (len != 0) printf("len = %zi\n", len);
276 --- cDonkey-0.9.0/kademlia.h.orig 2003-04-27 21:04:24.000000000 +0000
277 +++ cDonkey-0.9.0/kademlia.h 2003-11-18 14:52:23.000000000 +0000
281 bool logSend (char dir, unsigned cmd, size_t len, bool extra = false);
282 - void parsePeer_lst (unsigned char **buf , unsigned *len, unsigned cnt);
283 + void parsePeer_lst (unsigned char **buf , size_t *len, unsigned cnt);
284 void Init_Search (void);
286 bool send_Connect (void ); // (0x0A) request boot list
287 --- cDonkey-0.9.0/sSource.cpp.orig 2003-05-07 18:21:35.000000000 +0000
288 +++ cDonkey-0.9.0/sSource.cpp 2003-11-18 14:27:57.000000000 +0000
293 -static int res_sources (sSource *, unsigned char *buf, unsigned len) {{{
294 +static int res_sources (sSource *, unsigned char *buf, size_t len) {{{
297 GET_HASH(&buf, &len, hash);
298 count = GET_U2(&buf, &len);
299 if (len != count * 12) {{{
300 - printf("%s %i len %i count %i USED %i\n", __FILE__, __LINE__, len, count, count*(4+2+4+2));
301 + printf("%s %i len %zi count %i USED %i\n", __FILE__, __LINE__, len, count, count*(4+2+4+2));
304 for (unsigned i = 0; i < count; i++) {{{
306 ADD_U4 (&tcp.buf, &tcp.len, 0);
307 // ADD_U2 (&tcp.buf, &tcp.len, 0);
309 - printf("tcp.len = %u\n", tcp.len);
310 + printf("tcp.len = %zu\n", tcp.len);
311 ASSERT(tcp.len == 0);
313 Write(tcp.BUF, tcp.LEN);
317 if (logSend ('>', this, 0xC540, true))
318 - printf("%32s (0x40) (%9u-%9lu) %3lu\n", hash_bin2hex(file->hash), von, pack_len, (pack_len*100)/cnt);
319 + printf("%32s (0x40) (%9zu-%9lu) %3lu\n", hash_bin2hex(file->hash), von, pack_len, (pack_len*100)/cnt);
320 size_t len_real = 6 + HASH_LEN + 4 + 4 + pack_len;
321 ADD_U1 (&buf1, &len1, OP_EMULEPROT);
322 ADD_U4 (&buf1, &len1, len_real - PACKET_LEN_SUB);
324 file->compress_failed ++;
326 // Not Compressed Handling
327 - if (logSend ('>', this, OP_SENDINGPART, true)) printf("%32s (%9i-%9i)\n", hash_bin2hex(file->hash), von, bis-von);
328 + if (logSend ('>', this, OP_SENDINGPART, true)) printf("%32s (%9zi-%9zi)\n", hash_bin2hex(file->hash), von, bis-von);
333 return 0; // if first is always set
336 - printf("[%9i-%9i][%9i-%9i][%9i-%9i]\n", dl_von[0], dl_bis[0], dl_von[1], dl_bis[1], dl_von[2], dl_bis[2]);
337 + printf("[%9zi-%9zi][%9zi-%9zi][%9zi-%9zi]\n", dl_von[0], dl_bis[0], dl_von[1], dl_bis[1], dl_von[2], dl_bis[2]);
338 size_t len, LEN = len = 46;
339 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
340 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
343 int sSource::no_such_file (const tHash &hash ) {{{ // (0x48)
344 logSend ('>', this, OP_FILEREQANSNOFIL, false);
345 - unsigned LEN , len = LEN = 22;
346 + size_t LEN , len = LEN = 22;
347 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
348 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
349 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
352 int sSource::end_of_download (void ) {{{ // (0x49) o.p.
353 logSend ('>', this, OP_END_OF_DOWNLOAD, false);
354 - unsigned LEN , len = LEN = 22;
355 + size_t LEN , len = LEN = 22;
356 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
357 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
358 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
362 if (logSend('>', this, OP_SETREQFILEID, true)) printf("%32s\n", hash_bin2hex(hash));
363 - unsigned LEN , len = LEN = 22;
364 + size_t LEN , len = LEN = 22;
365 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
366 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
367 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
370 int sSource::req_part_hash (const tHash &hash ) {{{ // (0x51) o.p. <HASH>
371 if (logSend('>', this, OP_HASHSETREQUEST, true)) printf("%32s\n", hash_bin2hex(hash));
372 - unsigned LEN , len = LEN = 22;
373 + size_t LEN , len = LEN = 22;
374 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
375 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
376 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
378 if (next_slot >= currentTime) return 1;
379 next_slot = currentTime + 300;
380 logSend('>', this, OP_STARTUPLOADREQ, false);
381 - unsigned LEN, len = LEN = 22;
382 + size_t LEN, len = LEN = 22;
383 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
384 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
385 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
388 int sSource::CMD_slot_available (void ) {{{ // (0x55) o.p. (null)
389 logSend('>', this, OP_ACCEPTUPLOADREQ, false);
390 - unsigned LEN, len = LEN = 6;
391 + size_t LEN, len = LEN = 6;
392 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
393 ADD_U1(&buf, &len, OP_EDONKEYHEADER);
394 ADD_U4(&buf, &len, LEN - PACKET_LEN_SUB);
397 int sSource::res_slot_close (void ) {{{ // (0x57) o.p. (null)
398 logSend('>', this, OP_OUTOFPARTREQS, false);
399 - unsigned LEN, len = LEN = 6;
400 + size_t LEN, len = LEN = 6;
401 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
402 ADD_U1(&buf, &len, OP_EDONKEYHEADER);
403 ADD_U4(&buf, &len, LEN - PACKET_LEN_SUB);
407 if (logSend('>', this, OP_FILEREQUEST, true)) printf("%32s\n", hash_bin2hex(hash));
408 - unsigned LEN , len = LEN = 22;
409 + size_t LEN , len = LEN = 22;
410 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
411 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
412 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
415 int sSource::C5_res_rang (uint8_t rang ) {{{ // (0x60) o.p. <RANG(2)><padding(10)>
416 if (logSend ('>', this,0xC560, true)) printf("%hi\n", rang);
417 - unsigned LEN , len = LEN = 18;
418 + size_t LEN , len = LEN = 18;
419 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
420 ADD_U1 (&buf, &len, OP_EMULEPROT);
421 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
423 nextFile (hash, true); // <- set cursor_count
424 if (cursor_count > 512) return 1;
425 if(logSend ('>', this , 0xC581, true)) printf("%32s\n", hash_bin2hex(hash));
426 - unsigned LEN , len = LEN = 22;
427 + size_t LEN , len = LEN = 22;
428 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
429 ADD_U1 (&buf, &len, OP_EMULEPROT);
430 ADD_U4 (&buf, &len, LEN - PACKET_LEN_SUB);
433 if (name == NULL) Name ("(null)");
434 if (log) printf("v.%4u NAME: %s e:%i", version, name, eMule);
435 - if (log) printf(" LEN: %i\n", packet->Unused());
436 + if (log) printf(" LEN: %zi\n", packet->Unused());
438 if (status == WAIT_HELLO) {
440 @@ -1002,7 +1002,7 @@
441 if (tag->version == 43) overnet = true;
442 if (tag->version == 1044) overnet = true;
443 if (tag->name != NULL) Name (tag->name);
444 - if (log) printf("v.%4u NAME %s LEN: %i\n", tag->version, tag->name, packet->Unused());
445 + if (log) printf("v.%4u NAME %s LEN: %zi\n", tag->version, tag->name, packet->Unused());
448 else printf("(noTag)\n");
449 @@ -1044,7 +1044,7 @@
453 - if(logSend ('<', this, OP_SETREQFILEID, true)) printf("%32s OK len:%i\n", hash_bin2hex(hash),packet->Unused());
454 + if(logSend ('<', this, OP_SETREQFILEID, true)) printf("%32s OK len:%zi\n", hash_bin2hex(hash),packet->Unused());
455 res_part_status (hash);
458 @@ -1052,12 +1052,12 @@
459 int sSource::RES_status (sPacket *packet) {{{ // (0x50) Return file Status
460 if (ftp_aktive) return 1;
461 if (packet->Unused() <= 18) {{{
462 - printf("MALFORMED PACKET 0x50 from %s LEN %u\n", inet_ntoa(peer_ip), packet->Unused());
463 + printf("MALFORMED PACKET 0x50 from %s LEN %zu\n", inet_ntoa(peer_ip), packet->Unused());
467 if (packet->Unused() < 18) {{{
468 - printf("MALFORMED PACKET 0x50 from %15s LEN %5u VERSION %4u NAME %s\n", inet_ntoa(peer_ip), packet->Unused(), version, name);
469 + printf("MALFORMED PACKET 0x50 from %15s LEN %5zu VERSION %4u NAME %s\n", inet_ntoa(peer_ip), packet->Unused(), version, name);
473 @@ -1165,7 +1165,7 @@
476 int sSource::REQ_slot (sPacket *packet) {{{ // (0x54)
477 - if (logSend('<', this, OP_STARTUPLOADREQ, true)) printf("len %i\n", packet->Unused());
478 + if (logSend('<', this, OP_STARTUPLOADREQ, true)) printf("len %zi\n", packet->Unused());
479 extraSend (OP_ACCEPTUPLOADREQ);
482 --- cDonkey-0.9.0/sServer.cpp.orig 2003-05-07 18:21:34.000000000 +0000
483 +++ cDonkey-0.9.0/sServer.cpp 2003-11-18 14:34:14.000000000 +0000
487 unsigned char *ende = packet->DATA();
488 - printf("Got file info_lei = %i\n", ende - start);
489 + printf("Got file info_lei = %ti\n", (ptrdiff_t)(ende - start));
490 insertFiles (hash, peer_ip, ende - start, start);
494 // printf ("ed2k://|file|%s|%u|%s|\n", tag->name, tag->size, hash_bin2hex (hash));
496 unsigned char *ende = packet->DATA();
497 - printf("Got file info_len = %i\n", ende - start);
498 + printf("Got file info_len = %ti\n", (ptrdiff_t)(ende - start));
499 insertFiles (hash, peer_ip, ende - start, start);
506 - bool Parse (unsigned char *data, unsigned len);
507 + bool Parse (unsigned char *data, size_t len);
508 bool Match (void) { return false; }
510 cTreeSearch:: cTreeSearch(void) {{{
512 if (val_str != NULL) Free2 (val_str);
513 if (key != NULL) Free2 (key );
515 -bool cTreeSearch::Parse (unsigned char *data, unsigned len) {{{
516 +bool cTreeSearch::Parse (unsigned char *data, size_t len) {{{
518 unsigned new_op = GET_U1 (&data, &len);
521 if (NULL != strstr(tag->name, search->val_str)) {
523 memcpy (hash, f->hash, 16);
524 - printf("MATCH (%3i) for Search %32s - %9u - %s\n", f->info_len, hash_bin2hex(hash), tag->size, tag->name);
525 + printf("MATCH (%3zi) for Search %32s - %9u - %s\n", f->info_len, hash_bin2hex(hash), tag->size, tag->name);
527 ADD_HASH(&buffer, &size, hash);
528 ADD_U4 (&buffer, &size, 0);
529 --- cDonkey-0.9.0/sFile.cpp.orig 2003-05-07 18:21:34.000000000 +0000
530 +++ cDonkey-0.9.0/sFile.cpp 2003-11-18 14:40:16.000000000 +0000
532 if (part_count == 0) part_count = (size + PARTSIZE - 1) / PARTSIZE;
533 ASSERT (version == 0xE0);
534 if (part_count != (size + PARTSIZE - 1) / PARTSIZE) {
535 - printf("%u != %u\n", part_count, (size + PARTSIZE - 1) / PARTSIZE);
536 + printf("%zu != %u\n", part_count, (size + PARTSIZE - 1) / PARTSIZE);
537 printf("Size %9u\n", size);
538 printf("Hash %s\n", hash_bin2hex(hash));
541 for (it = tree->begin(); it != tree->end(); it++) {{{
542 if (it->second->stat == BLOCK_RECIVE || it->second->stat == BLOCK_VERIFY) continue;
544 - snprintf(tag, 20, "%c%u", 9, gap_idx);
545 + snprintf(tag, 20, "%c%zu", 9, gap_idx);
546 add_intTag(&buf, &len, tag, it->second->von);
547 - snprintf(tag, 20, "%c%u", 10, gap_idx);
548 + snprintf(tag, 20, "%c%zu", 10, gap_idx);
549 add_intTag(&buf, &len, tag, it->second->bis+1);
554 bool sFile::partStatus (uint32_t idx) const {{{
555 if (idx >= part_count) {
556 - printf("sFile::partStatus(%u) => part_count=%u\n", idx, part_count);
557 + printf("sFile::partStatus(%u) => part_count=%zu\n", idx, part_count);
560 ASSERT( idx < part_count);
562 bool Assert = (ok && (check->stat == BLOCK_VERIFY || check->stat == BLOCK_RECIVE)) || (!ok && check->stat != BLOCK_VERIFY);
564 printf("ok %i\n", ok);
565 - printf("check->stat %i\n", check->stat);
566 + printf("check->stat %zi\n", check->stat);
569 return (part_status [pos] & flag) != 0;
570 @@ -744,12 +744,12 @@
571 memcpy(&akt, it1->second, sizeof(dtype));
572 if (!running) return;
573 if (akt.bis >= size) {
574 - printf("akt.bis %i\n", akt.bis);
575 + printf("akt.bis %zi\n", akt.bis);
576 printf("size %u\n", size);
579 ASSERT (akt.bis < size);
580 - if (akt.von > akt.bis) printf("akt.von , akt.bis = %9u - %9u\n", akt.von , akt.bis);
581 + if (akt.von > akt.bis) printf("akt.von , akt.bis = %9zu - %9zu\n", akt.von , akt.bis);
582 ASSERT (akt.von <= akt.bis); // Check that there is no "defekt" entry
583 if (akt.stat == BLOCK_RECIVE) { // Only care about recived blocks
584 ASSERT(akt.bis >= akt.von);
585 --- cDonkey-0.9.0/cServer_udp.cpp.orig 2003-05-07 18:21:33.000000000 +0000
586 +++ cDonkey-0.9.0/cServer_udp.cpp 2003-11-18 14:48:47.000000000 +0000
588 peer_ip.s_addr = ip.s_addr;
590 if (logSend('>', this, OP_REASKFILEPING, true)) printf("%32s\n", hash_bin2hex(file_hash));
591 - unsigned len, LEN = len = 18;
592 + size_t len, LEN = len = 18;
593 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
594 ADD_U1 (&buf, &len, OP_EMULEPROT);
595 ADD_U1 (&buf, &len, OP_REASKFILEPING);
597 if (!nextPing (&peer_ip, &peer_port, &quest)) return false;
599 if (logSend('>', this, OP_GLOBSERVSTATREQ, false));
600 - unsigned len, LEN = len = 6;
601 + size_t len, LEN = len = 6;
602 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
603 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
604 ADD_U1 (&buf, &len, OP_GLOBSERVSTATREQ);
606 printf("Extending search to %s %u\n", inet_ntoa(ip), peer_port);
608 if (logSend('>', this, OP_GLOBSEARCHREQ, false));
609 - unsigned len, LEN = len = 2 + gui->searchLen();
610 + size_t len, LEN = len = 2 + gui->searchLen();
611 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
612 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
613 ADD_U1 (&buf, &len, OP_GLOBSEARCHREQ);
615 if (!IP_is_OK (ip)) return false;
616 if (logSend('>', this, OP_GLOBGETSOURCES, true)) printf("%32s\n", hash_bin2hex(Hash));
617 actionServer (ip, port);
618 - unsigned len, LEN = len = 18;
619 + size_t len, LEN = len = 18;
620 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
621 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
622 ADD_U1 (&buf, &len, OP_GLOBGETSOURCES);
625 bool cServer_udp::UDP_req_callback (uint32_t idx) {{{ // (0x9C)
626 if (logSend('>', this, OP_GLOBCALLBACKREQ, true)) printf("%u\n", idx);
627 - unsigned len, LEN = len = 12;
628 + size_t len, LEN = len = 12;
629 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
630 ADD_U1 (&buf, &len, OP_EDONKEYHEADER );
631 ADD_U1 (&buf, &len, OP_GLOBCALLBACKREQ );
634 peer_port = port + 4;
635 if (logSend('>', this, OP_SERVER_DESC_REQ, false));
636 - unsigned len, LEN = len = 2;
637 + size_t len, LEN = len = 2;
638 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
639 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
640 ADD_U1 (&buf, &len, OP_SERVER_DESC_REQ);
642 peer_port = port + 4;
644 if (logSend('>', this, OP_SERVER_LIST_REQ, false));
645 - unsigned len, LEN = len = 2;
646 + size_t len, LEN = len = 2;
647 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
648 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
649 ADD_U1 (&buf, &len, OP_SERVER_LIST_REQ);
651 GET_U2 (&data, &len);
652 class sTag *tag = parse_tag (data, &len);
653 if (tag == NULL) return 0;
654 - printf("Found file with %i info len %s\n", len, tag->name);
655 + printf("Found file with %zi info len %s\n", len, tag->name);
656 insertFiles (hash, peer_ip, len, data);
660 GET_HASH(&data, &in_len, hash);
661 sFile *file = forHash(hash);
663 - unsigned len, LEN = len = 2;
664 + size_t len, LEN = len = 2;
665 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
666 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
667 ADD_U1 (&buf, &len, OP_FILENOTFOUND);
672 - unsigned len, LEN = len = 4;
673 + size_t len, LEN = len = 4;
674 unsigned char *buf, *BUF = buf = reinterpret_cast<unsigned char*>(alloca(LEN));
675 ADD_U1 (&buf, &len, OP_EDONKEYHEADER);
676 ADD_U1 (&buf, &len, OP_REASKACK);
677 --- cDonkey-0.9.0/cSocket.cpp.orig 2003-11-18 14:05:47.000000000 +0000
678 +++ cDonkey-0.9.0/cSocket.cpp 2003-11-18 14:47:05.000000000 +0000
680 srv_addr.sin_port = htons(0);
681 if (0 != bind(fd, reinterpret_cast<struct sockaddr*>(&srv_addr), sizeof(srv_addr))) {{{
682 int err = GetErrno();
683 - printf("bind(%i, %15s:%5u <%u>, %u) => %s\n", fd, inet_ntoa(srv_addr.sin_addr), htons(srv_addr.sin_port), type,
684 + printf("bind(%i, %15s:%5u <%u>, %zu) => %s\n", fd, inet_ntoa(srv_addr.sin_addr), htons(srv_addr.sin_port), type,
685 sizeof(srv_addr),cSocket::Strerror(err));
690 if (0 != bind(fd, reinterpret_cast<struct sockaddr*>(&client_addr), sizeof(client_addr))) {
691 int err = GetErrno();
692 - printf("bind(%i, %15s:%5u <%u>, %u) => %s\n", fd, inet_ntoa(client_addr.sin_addr), htons(client_addr.sin_port), type,
693 + printf("bind(%i, %15s:%5u <%u>, %zu) => %s\n", fd, inet_ntoa(client_addr.sin_addr), htons(client_addr.sin_port), type,
694 sizeof(client_addr),cSocket::Strerror(err));
699 if (fd != INVALID_SOCKET) g_SocketMap.erase(fd);
700 if (g_SocketMap.size() != count)
701 - printf("WARNING: SocketMap: %d count: %d\n", g_SocketMap.size(),count);
702 + printf("WARNING: SocketMap: %zd count: %zd\n", g_SocketMap.size(),count);
704 printf("(destr.)closing fd: %u this: %p:\n", fd, this);
709 printf("IP 13 %s\n", inet_ntoa(addr.sin_addr));
710 - printf("LEN %i\n", len);
711 + printf("LEN %zi\n", len);
712 if (err == 13) printf("IP 13 %s\n", inet_ntoa(addr.sin_addr));
713 printf("fd: %u this %p:\n", fd, this);
715 --- cDonkey-0.9.0/cHTTP.cpp.orig 2003-05-03 19:48:49.000000000 +0000
716 +++ cDonkey-0.9.0/cHTTP.cpp 2003-11-18 14:56:49.000000000 +0000
718 "<td class=hash >%s</td>"
719 "<td class=name >%s</td>"
720 "<td class=size >%u</td>"
721 - "<td class=transfered >%u</td>"
722 + "<td class=transfered >%zu</td>"
723 "</div>", cnt, hash_bin2hex(akt->hash),akt->Name(), akt->size, akt->transfered
726 --- cDonkey-0.9.0/misc.cpp.orig 2003-05-07 18:21:34.000000000 +0000
727 +++ cDonkey-0.9.0/misc.cpp 2003-11-18 14:34:46.000000000 +0000
729 ADD_U4 (&cnt_idx, &cnt_len, tag_count);
732 - if (count != 0) printf("Wrong count %u\n", count);
733 + if (count != 0) printf("Wrong count %zu\n", count);
734 int fd = FD_create ("server.met.new", O_WRONLY|O_BINARY|O_TRUNC|O_CREAT,0600);
736 printf ("server.met.new not open\n");
737 --- cDonkey-0.9.0/donkey.h.orig 2003-05-01 15:21:23.000000000 +0000
738 +++ cDonkey-0.9.0/donkey.h 2003-11-18 15:04:45.000000000 +0000
740 #define LOG_ZEILE printf("%s %i\n", __FILE__, __LINE__); fflush(stdout);
741 // #define LOG_ZEILE ;
743 -extern unsigned int TCP_CLIENT_COUNT;
744 +extern size_t TCP_CLIENT_COUNT;
745 extern unsigned int TCP_SERVER_COUNT;
746 extern unsigned int CLIENT_COUNT;