cURL / Mailing Lists / curl-library / Single Mail

curl-library

4 minor patches more

From: Yang Tse <yangsita_at_gmail.com>
Date: Fri, 2 Dec 2005 10:40:42 +0100

First one picks flags for sendto() in tftp from setup.h just in case
some day 4th arg is something besides MSG_NOSIGNAL.

diff -urp c:\f\curl-old/curl/lib/tftp.c c:\f\curl-new/curl/lib/tftp.c
--- c:\f\curl-old/curl/lib/tftp.c 2005-11-23 23:59:24.000000000 +0100
+++ c:\f\curl-new/curl/lib/tftp.c 2005-12-02 09:55:13.536881600 +0100
@@ -86,10 +86,6 @@
 /* The last #include file should be: */
 #include "memdebug.h"

-#ifndef MSG_NOSIGNAL
-#define MSG_NOSIGNAL 0
-#endif
-
 typedef enum {
   TFTP_MODE_NETASCII=0,
   TFTP_MODE_OCTET
@@ -347,7 +343,7 @@ static void tftp_rx(tftp_state_data_t *s
     state->spacket.event = htons(TFTP_EVENT_ACK);
     state->spacket.u.ack.block = htons(state->block);
     sbytes = sendto(state->sockfd, (void *)&state->spacket,
- 4, MSG_NOSIGNAL,
+ 4, SEND_4TH_ARG,
                     (struct sockaddr *)&state->remote_addr,
                     state->remote_addrlen);
     if(sbytes < 0) {
@@ -374,7 +370,7 @@ static void tftp_rx(tftp_state_data_t *s
     } else {
       /* Resend the previous ACK */
       sbytes = sendto(state->sockfd, (void *)&state->spacket,
- 4, MSG_NOSIGNAL,
+ 4, SEND_4TH_ARG,
                       (struct sockaddr *)&state->remote_addr,
                       state->remote_addrlen);
       /* Check all sbytes were sent */
@@ -440,7 +436,7 @@ static void tftp_tx(tftp_state_data_t *s
     }
     Curl_fillreadbuffer(state->conn, 512, &state->sbytes);
     sbytes = sendto(state->sockfd, (void *)&state->spacket,
- 4+state->sbytes, MSG_NOSIGNAL,
+ 4+state->sbytes, SEND_4TH_ARG,
                     (struct sockaddr *)&state->remote_addr,
                     state->remote_addrlen);
     /* Check all sbytes were sent */
@@ -461,7 +457,7 @@ static void tftp_tx(tftp_state_data_t *s
     } else {
       /* Re-send the data packet */
       sbytes = sendto(state->sockfd, (void *)&state->spacket,
- 4+state->sbytes, MSG_NOSIGNAL,
+ 4+state->sbytes, SEND_4TH_ARG,
                       (struct sockaddr *)&state->remote_addr,
                       state->remote_addrlen);
       /* Check all sbytes were sent */

Second one makes sure that strerror_r() is only declared when we have
HAVE_STRERROR_R and no prototype available.

diff -urp c:\f\curl-old/curl/lib/strerror.c c:\f\curl-new/curl/lib/strerror.c
--- c:\f\curl-old/curl/lib/strerror.c 2005-09-02 17:11:09.000000000 +0200
+++ c:\f\curl-new/curl/lib/strerror.c 2005-12-02 06:56:05.652182400 +0100
@@ -42,7 +42,7 @@
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>

-#ifdef HAVE_NO_STRERROR_R_DECL
+#if defined(HAVE_STRERROR_R) && defined(HAVE_NO_STRERROR_R_DECL)
 #ifdef HAVE_POSIX_STRERROR_R
 /* seen on AIX 5100-02 gcc 2.9 */
 extern int strerror_r(int errnum, char *strerrbuf, size_t buflen);

Third one changes the multiple header inclusion prevention definition
H_MPRINTF to our more used style __CURL_MPRINTF_H.

diff -urp c:\f\curl-old/curl/include/curl/mprintf.h
c:\f\curl-new/curl/include/curl/mprintf.h
--- c:\f\curl-old/curl/include/curl/mprintf.h 2004-11-11
09:03:43.000000000 +0100
+++ c:\f\curl-new/curl/include/curl/mprintf.h 2005-12-02
09:47:19.465200000 +0100
@@ -1,3 +1,5 @@
+#ifndef __CURL_MPRINTF_H
+#define __CURL_MPRINTF_H
 /***************************************************************************
  * _ _ ____ _
  * Project ___| | | | _ \| |
@@ -21,9 +23,6 @@
  * $Id: mprintf.h,v 1.10 2004/11/11 08:03:43 bagder Exp $
  ***************************************************************************/

-#ifndef H_MPRINTF
-#define H_MPRINTF
-
 #include <stdarg.h>
 #include <stdio.h> /* needed for FILE */

@@ -53,4 +52,4 @@ CURL_EXTERN char *curl_mvaprintf(const c
 # define vaprintf curl_mvaprintf
 #endif

-#endif /* H_MPRINTF */
+#endif /* __CURL_MPRINTF_H */

And finally the fourth one avoids a problem with dumb preprocessors.

diff -urp c:\f\curl-old/curl/include/curl/curl.h
c:\f\curl-new/curl/include/curl/curl.h
--- c:\f\curl-old/curl/include/curl/curl.h 2005-11-29 00:06:00.000000000 +0100
+++ c:\f\curl-new/curl/include/curl/curl.h 2005-12-01 08:54:06.684296000 +0100
@@ -327,8 +327,9 @@ typedef CURLcode (*curl_ssl_ctx_callback
 /* Make a spelling correction for the operation timed-out define */
 #define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED

-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
+/* define this to test if your app builds with all the obsolete stuff
removed! */
+#ifndef CURL_NO_OLDIES
+
 /* backwards compatibility with older names */
 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
@@ -348,8 +349,9 @@ typedef enum {
 #define CURLAUTH_ANY ~0 /* all types set */
 #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)

-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
+/* define this to test if your app builds with all the obsolete stuff
removed! */
+#ifndef CURL_NO_OLDIES
+
 /* this was the error code 50 in 7.7.3 and a few earlier versions, this
    is no longer used by libcurl but is instead #defined here only to not
    make programs break */
@@ -928,8 +930,9 @@ typedef enum {
 #define CURLOPT_READDATA CURLOPT_INFILE
 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER

-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
+/* define this to test if your app builds with all the obsolete stuff
removed! */
+#ifndef CURL_NO_OLDIES
+
 #define CURLOPT_HTTPREQUEST -1
 #define CURLOPT_FTPASCII CURLOPT_TRANSFERTEXT
 #define CURLOPT_MUTE -2

Regards,
Yang
Received on 2005-12-02