Skip to content
Snippets Groups Projects
Commit 4d10c96a authored by Yang Tse's avatar Yang Tse
Browse files

fix compiler warning

parent b701ea36
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ struct SessionHandle { ...@@ -34,6 +34,7 @@ struct SessionHandle {
}; };
#include "curl_base64.h" #include "curl_base64.h"
#include "memory.h"
/* include memdebug.h last */ /* include memdebug.h last */
#include "memdebug.h" #include "memdebug.h"
...@@ -48,12 +49,20 @@ struct SessionHandle { ...@@ -48,12 +49,20 @@ struct SessionHandle {
#define show(x) #define show(x)
#endif #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_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;
curl_free_callback Curl_cfree = (curl_free_callback)free; curl_free_callback Curl_cfree = (curl_free_callback)free;
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup;
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; 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 static
char *appendstring(char *string, /* original string */ char *appendstring(char *string, /* original string */
char *buffer, /* to append */ char *buffer, /* to append */
......
...@@ -7,7 +7,7 @@ ...@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/* This file is a rewrite/clone of the arpa/tftp.h file for systems without /* This file is a rewrite/clone of the arpa/tftp.h file for systems without
it. */ it. */
#define SEGSIZE 512 /* data segment size */ #define SEGSIZE 512 /* data segment size */
#ifndef __GNUC__ #ifndef __GNUC__
#define __attribute__(x) #define __attribute__(x)
...@@ -46,11 +46,11 @@ struct tftphdr { ...@@ -46,11 +46,11 @@ struct tftphdr {
#define th_code th_block #define th_code th_block
#define th_msg th_data #define th_msg th_data
#define RRQ 1 #define opcode_RRQ 1
#define WRQ 2 #define opcode_WRQ 2
#define DATA 3 #define opcode_DATA 3
#define ACK 4 #define opcode_ACK 4
#define ERROR 5 #define opcode_ERROR 5
#define EUNDEF 0 #define EUNDEF 0
#define ENOTFOUND 1 #define ENOTFOUND 1
......
...@@ -552,7 +552,7 @@ int main(int argc, char **argv) ...@@ -552,7 +552,7 @@ int main(int argc, char **argv)
tp = (struct tftphdr *)buf; tp = (struct tftphdr *)buf;
tp->th_opcode = ntohs(tp->th_opcode); 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)); memset(&test, 0, sizeof(test));
if (tftp(&test, tp, n) < 0) if (tftp(&test, tp, n) < 0)
break; break;
...@@ -635,7 +635,7 @@ again: ...@@ -635,7 +635,7 @@ again:
nak(ecode); nak(ecode);
return 1; return 1;
} }
if (tp->th_opcode == WRQ) if (tp->th_opcode == opcode_WRQ)
recvtftp(test, pf); recvtftp(test, pf);
else else
sendtftp(test, pf); sendtftp(test, pf);
...@@ -777,7 +777,7 @@ static void sendtftp(struct testcase *test, struct formats *pf) ...@@ -777,7 +777,7 @@ static void sendtftp(struct testcase *test, struct formats *pf)
nak(ERRNO + 100); nak(ERRNO + 100);
return; return;
} }
sdp->th_opcode = htons((u_short)DATA); sdp->th_opcode = htons((u_short)opcode_DATA);
sdp->th_block = htons((u_short)sendblock); sdp->th_block = htons((u_short)sendblock);
timeout = 0; timeout = 0;
#ifdef HAVE_SIGSETJMP #ifdef HAVE_SIGSETJMP
...@@ -804,12 +804,12 @@ static void sendtftp(struct testcase *test, struct formats *pf) ...@@ -804,12 +804,12 @@ static void sendtftp(struct testcase *test, struct formats *pf)
sap->th_opcode = ntohs((u_short)sap->th_opcode); sap->th_opcode = ntohs((u_short)sap->th_opcode);
sap->th_block = ntohs((u_short)sap->th_block); sap->th_block = ntohs((u_short)sap->th_block);
if (sap->th_opcode == ERROR) { if (sap->th_opcode == opcode_ERROR) {
logmsg("got ERROR"); logmsg("got ERROR");
return; return;
} }
if (sap->th_opcode == ACK) { if (sap->th_opcode == opcode_ACK) {
if (sap->th_block == sendblock) { if (sap->th_block == sendblock) {
break; break;
} }
...@@ -848,7 +848,7 @@ static void recvtftp(struct testcase *test, struct formats *pf) ...@@ -848,7 +848,7 @@ static void recvtftp(struct testcase *test, struct formats *pf)
rap = (struct tftphdr *)ackbuf; rap = (struct tftphdr *)ackbuf;
do { do {
timeout = 0; timeout = 0;
rap->th_opcode = htons((u_short)ACK); rap->th_opcode = htons((u_short)opcode_ACK);
rap->th_block = htons((u_short)recvblock); rap->th_block = htons((u_short)recvblock);
recvblock++; recvblock++;
#ifdef HAVE_SIGSETJMP #ifdef HAVE_SIGSETJMP
...@@ -874,9 +874,9 @@ send_ack: ...@@ -874,9 +874,9 @@ send_ack:
} }
rdp->th_opcode = ntohs((u_short)rdp->th_opcode); rdp->th_opcode = ntohs((u_short)rdp->th_opcode);
rdp->th_block = ntohs((u_short)rdp->th_block); rdp->th_block = ntohs((u_short)rdp->th_block);
if (rdp->th_opcode == ERROR) if (rdp->th_opcode == opcode_ERROR)
goto abort; goto abort;
if (rdp->th_opcode == DATA) { if (rdp->th_opcode == opcode_DATA) {
if (rdp->th_block == recvblock) { if (rdp->th_block == recvblock) {
break; /* normal */ break; /* normal */
} }
...@@ -898,7 +898,7 @@ send_ack: ...@@ -898,7 +898,7 @@ send_ack:
} while (size == SEGSIZE); } while (size == SEGSIZE);
write_behind(test, pf->f_convert); 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); rap->th_block = htons((u_short)recvblock);
(void) swrite(peer, ackbuf, 4); (void) swrite(peer, ackbuf, 4);
#if defined(HAVE_ALARM) && defined(SIGALRM) #if defined(HAVE_ALARM) && defined(SIGALRM)
...@@ -910,7 +910,7 @@ send_ack: ...@@ -910,7 +910,7 @@ send_ack:
alarm(0); alarm(0);
#endif #endif
if (n >= 4 && /* if read some data */ 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 */ recvblock == rdp->th_block) { /* then my last ack was lost */
(void) swrite(peer, ackbuf, 4); /* resend final ack */ (void) swrite(peer, ackbuf, 4); /* resend final ack */
} }
...@@ -945,7 +945,7 @@ static void nak(int error) ...@@ -945,7 +945,7 @@ static void nak(int error)
struct errmsg *pe; struct errmsg *pe;
tp = (struct tftphdr *)buf; 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); tp->th_code = htons((u_short)error);
for (pe = errmsgs; pe->e_code >= 0; pe++) for (pe = errmsgs; pe->e_code >= 0; pe++)
if (pe->e_code == error) if (pe->e_code == error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment