diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-10-31 22:48:21 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-10-31 22:51:20 +0100 |
commit | 49a991346e9c6f334d014f16944744a1dac11c64 (patch) | |
tree | f88991c03ae10f47c6208402e77c858c863a012d | |
parent | fbf09b77752930b0a9f6758bd97d7064ff835d3d (diff) |
curl.h: s/HTTPPOST_/CURL_HTTPOST_
Fixes a name space pollution at the cost of programs using one of these
defines will no longer compile. However, the vast majority of libcurl
programs that do multipart formposts use curl_formadd() to build this
list.
Closes #506
-rw-r--r-- | include/curl/curl.h | 28 | ||||
-rw-r--r-- | lib/formdata.c | 8 | ||||
-rw-r--r-- | src/tool_setopt.c | 6 |
3 files changed, 27 insertions, 15 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index 86692bbb7..24b9195de 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -136,18 +136,22 @@ struct curl_httppost { file, this link should link to following files */ long flags; /* as defined below */ -#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ -#define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ -#define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer - do not free in formfree */ -#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer - do not free in formfree */ -#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ -#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ -#define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the - regular read callback to get the data - and pass the given pointer as custom - pointer */ + +/* specified content is a file name */ +#define CURL_HTTPPOST_FILENAME (1<<0) +/* specified content is a file name */ +#define CURL_HTTPPOST_READFILE (1<<1) +/* name is only stored pointer do not free in formfree */ +#define CURL_HTTPPOST_PTRNAME (1<<2) +/* contents is only stored pointer do not free in formfree */ +#define CURL_HTTPPOST_PTRCONTENTS (1<<3) +/* upload file from buffer */ +#define CURL_HTTPPOST_BUFFER (1<<4) +/* upload file from pointer contents */ +#define CURL_HTTPPOST_PTRBUFFER (1<<5) +/* upload file contents by using the regular read callback to get the data and + pass the given pointer as custom pointer */ +#define CURL_HTTPPOST_CALLBACK (1<<6) char *showfilename; /* The file name to show. If not set, the actual file name will be used (if this diff --git a/lib/formdata.c b/lib/formdata.c index 66449b982..a4e6ab35d 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -57,6 +57,14 @@ static char *formboundary(struct SessionHandle *data); #define FORM_FILE_SEPARATOR ',' #define FORM_TYPE_SEPARATOR ';' +#define HTTPPOST_PTRNAME CURL_HTTPPOST_PTRNAME +#define HTTPPOST_FILENAME CURL_HTTPPOST_FILENAME +#define HTTPPOST_PTRCONTENTS CURL_HTTPPOST_PTRCONTENTS +#define HTTPPOST_READFILE CURL_HTTPPOST_READFILE +#define HTTPPOST_PTRBUFFER CURL_HTTPPOST_PTRBUFFER +#define HTTPPOST_CALLBACK CURL_HTTPPOST_CALLBACK +#define HTTPPOST_BUFFER CURL_HTTPPOST_BUFFER + /*************************************************************************** * * AddHttpPost() diff --git a/src/tool_setopt.c b/src/tool_setopt.c index 2ed68e5eb..e11f527ac 100644 --- a/src/tool_setopt.c +++ b/src/tool_setopt.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2015, 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 @@ -392,11 +392,11 @@ CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config, ret = CURLE_OUT_OF_MEMORY; goto nomem; } - if(pp->flags & HTTPPOST_FILENAME) { + if(pp->flags & CURL_HTTPPOST_FILENAME) { /* file upload as for -F @filename */ DATA1(" CURLFORM_FILE, \"%s\",", escaped); } - else if(pp->flags & HTTPPOST_READFILE) { + else if(pp->flags & CURL_HTTPPOST_READFILE) { /* content from file as for -F <filename */ DATA1(" CURLFORM_FILECONTENT, \"%s\",", escaped); } |