Skip to content

Commit

Permalink
curl.h: reverse the enum/define setup for old symbols
Browse files Browse the repository at this point in the history
We now provide the "real" names in the CINIT() macro setup for CURLOPT_*
symbols, and we provide backwards compatibility defines for the old
symbols as defines instead of vice versa.

This allows us to better use the CINIT() list to check for existing and
current option names.
  • Loading branch information
bagder committed Jun 17, 2014
1 parent 89a2178 commit 5fcef97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions include/curl/curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@ typedef enum {
make programs break */
#define CURLE_ALREADY_COMPLETE 99999

/* Provide defines for really old option names */
#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */

This comment has been minimized.

Copy link
@LocutusOfBorg

LocutusOfBorg Jul 30, 2014

Hi @bagder , this commit probably introduced a fail to build from source on gridsite

-#define CURLOPT_WRITEDATA CURLOPT_FILE
+#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */

was the swap actually a mistake?
We are getting some build failures like this in debian https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755327 and ubuntu

This comment has been minimized.

Copy link
@bagder

bagder Jul 30, 2014

Author Member

Please use the curl-library mailing list for questions, debates, issues or support. That's where the libcurl hackers hang out.

No, I don't think it was a mistake. I think it looks like the program you refer to is doing assumptions it shouldn't do.

This comment has been minimized.

Copy link
@LocutusOfBorg

LocutusOfBorg Jul 31, 2014

thanks for the answer!
We'll fix the sources then ;)

#define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */
#define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA

#endif /*!CURL_NO_OLDIES*/

/* This prototype applies to all conversion callbacks */
Expand Down Expand Up @@ -820,7 +825,7 @@ typedef enum {

typedef enum {
/* This is the FILE * or void * the regular output should be written to. */
CINIT(FILE, OBJECTPOINT, 1),
CINIT(WRITEDATA, OBJECTPOINT, 1),

/* The full URL to get/put */
CINIT(URL, OBJECTPOINT, 2),
Expand All @@ -843,7 +848,7 @@ typedef enum {
/* not used */

/* Specified file stream to upload from (use as input): */
CINIT(INFILE, OBJECTPOINT, 9),
CINIT(READDATA, OBJECTPOINT, 9),

/* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
* bytes big. If this is not used, error messages go to stderr instead: */
Expand Down Expand Up @@ -928,7 +933,7 @@ typedef enum {

/* send FILE * or void * to store headers to, if you use a callback it
is simply passed to the callback unmodified */
CINIT(WRITEHEADER, OBJECTPOINT, 29),
CINIT(HEADERDATA, OBJECTPOINT, 29),

/* point to a file to read the initial cookies from, also enables
"cookie awareness" */
Expand Down Expand Up @@ -1633,9 +1638,6 @@ typedef enum {
#define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */

/* three convenient "aliases" that follow the name scheme better */
#define CURLOPT_WRITEDATA CURLOPT_FILE
#define CURLOPT_READDATA CURLOPT_INFILE
#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER

/* These enums are for use with the CURLOPT_HTTP_VERSION option. */
Expand Down
4 changes: 2 additions & 2 deletions include/curl/typecheck-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, 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
Expand Down Expand Up @@ -291,7 +291,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
(option) == CURLOPT_SOCKOPTDATA || \
(option) == CURLOPT_OPENSOCKETDATA || \
(option) == CURLOPT_PROGRESSDATA || \
(option) == CURLOPT_WRITEHEADER || \
(option) == CURLOPT_HEADERDATA || \
(option) == CURLOPT_DEBUGDATA || \
(option) == CURLOPT_SSL_CTX_DATA || \
(option) == CURLOPT_SEEKDATA || \
Expand Down

0 comments on commit 5fcef97

Please sign in to comment.