diff options
author | Yang Tse <yangsita@gmail.com> | 2008-10-23 14:07:28 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-10-23 14:07:28 +0000 |
commit | 4d10c96aa62c8686fca53f1b412a5c00e0687d31 (patch) | |
tree | b1594bf15e53a237736e529bd4dfa3767d3fc853 /tests | |
parent | b701ea36a723b2d7700e23ae53e2c3145dfe7bda (diff) |
fix compiler warning
Diffstat (limited to 'tests')
-rw-r--r-- | tests/server/getpart.c | 9 | ||||
-rw-r--r-- | tests/server/tftp.h | 14 | ||||
-rw-r--r-- | tests/server/tftpd.c | 22 |
3 files changed, 27 insertions, 18 deletions
diff --git a/tests/server/getpart.c b/tests/server/getpart.c index 1a2a3ca12..448cdc143 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -34,6 +34,7 @@ struct SessionHandle { }; #include "curl_base64.h" +#include "memory.h" /* include memdebug.h last */ #include "memdebug.h" @@ -48,12 +49,20 @@ struct SessionHandle { #define show(x) #endif +#if defined(_MSC_VER) && defined(_DLL) +# pragma warning(disable:4232) /* MSVC extension, dllimport identity */ +#endif + curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc; curl_free_callback Curl_cfree = (curl_free_callback)free; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup; curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; +#if defined(_MSC_VER) && defined(_DLL) +# pragma warning(default:4232) /* MSVC extension, dllimport identity */ +#endif + static char *appendstring(char *string, /* original string */ char *buffer, /* to append */ diff --git a/tests/server/tftp.h b/tests/server/tftp.h index 6a11f6a80..b991875cc 100644 --- a/tests/server/tftp.h +++ b/tests/server/tftp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,7 +26,7 @@ /* This file is a rewrite/clone of the arpa/tftp.h file for systems without it. */ -#define SEGSIZE 512 /* data segment size */ +#define SEGSIZE 512 /* data segment size */ #ifndef __GNUC__ #define __attribute__(x) @@ -46,11 +46,11 @@ struct tftphdr { #define th_code th_block #define th_msg th_data -#define RRQ 1 -#define WRQ 2 -#define DATA 3 -#define ACK 4 -#define ERROR 5 +#define opcode_RRQ 1 +#define opcode_WRQ 2 +#define opcode_DATA 3 +#define opcode_ACK 4 +#define opcode_ERROR 5 #define EUNDEF 0 #define ENOTFOUND 1 diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 452641cc1..867567560 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -552,7 +552,7 @@ int main(int argc, char **argv) tp = (struct tftphdr *)buf; tp->th_opcode = ntohs(tp->th_opcode); - if (tp->th_opcode == RRQ || tp->th_opcode == WRQ) { + if (tp->th_opcode == opcode_RRQ || tp->th_opcode == opcode_WRQ) { memset(&test, 0, sizeof(test)); if (tftp(&test, tp, n) < 0) break; @@ -635,7 +635,7 @@ again: nak(ecode); return 1; } - if (tp->th_opcode == WRQ) + if (tp->th_opcode == opcode_WRQ) recvtftp(test, pf); else sendtftp(test, pf); @@ -777,7 +777,7 @@ static void sendtftp(struct testcase *test, struct formats *pf) nak(ERRNO + 100); return; } - sdp->th_opcode = htons((u_short)DATA); + sdp->th_opcode = htons((u_short)opcode_DATA); sdp->th_block = htons((u_short)sendblock); timeout = 0; #ifdef HAVE_SIGSETJMP @@ -804,12 +804,12 @@ static void sendtftp(struct testcase *test, struct formats *pf) sap->th_opcode = ntohs((u_short)sap->th_opcode); sap->th_block = ntohs((u_short)sap->th_block); - if (sap->th_opcode == ERROR) { + if (sap->th_opcode == opcode_ERROR) { logmsg("got ERROR"); return; } - if (sap->th_opcode == ACK) { + if (sap->th_opcode == opcode_ACK) { if (sap->th_block == sendblock) { break; } @@ -848,7 +848,7 @@ static void recvtftp(struct testcase *test, struct formats *pf) rap = (struct tftphdr *)ackbuf; do { timeout = 0; - rap->th_opcode = htons((u_short)ACK); + rap->th_opcode = htons((u_short)opcode_ACK); rap->th_block = htons((u_short)recvblock); recvblock++; #ifdef HAVE_SIGSETJMP @@ -874,9 +874,9 @@ send_ack: } rdp->th_opcode = ntohs((u_short)rdp->th_opcode); rdp->th_block = ntohs((u_short)rdp->th_block); - if (rdp->th_opcode == ERROR) + if (rdp->th_opcode == opcode_ERROR) goto abort; - if (rdp->th_opcode == DATA) { + if (rdp->th_opcode == opcode_DATA) { if (rdp->th_block == recvblock) { break; /* normal */ } @@ -898,7 +898,7 @@ send_ack: } while (size == SEGSIZE); write_behind(test, pf->f_convert); - rap->th_opcode = htons((u_short)ACK); /* send the "final" ack */ + rap->th_opcode = htons((u_short)opcode_ACK); /* send the "final" ack */ rap->th_block = htons((u_short)recvblock); (void) swrite(peer, ackbuf, 4); #if defined(HAVE_ALARM) && defined(SIGALRM) @@ -910,7 +910,7 @@ send_ack: alarm(0); #endif if (n >= 4 && /* if read some data */ - rdp->th_opcode == DATA && /* and got a data block */ + rdp->th_opcode == opcode_DATA && /* and got a data block */ recvblock == rdp->th_block) { /* then my last ack was lost */ (void) swrite(peer, ackbuf, 4); /* resend final ack */ } @@ -945,7 +945,7 @@ static void nak(int error) struct errmsg *pe; tp = (struct tftphdr *)buf; - tp->th_opcode = htons((u_short)ERROR); + tp->th_opcode = htons((u_short)opcode_ERROR); tp->th_code = htons((u_short)error); for (pe = errmsgs; pe->e_code >= 0; pe++) if (pe->e_code == error) |