Update patches for new cURL version.

This commit is contained in:
LoRd_MuldeR 2023-12-07 01:29:52 +01:00
parent 612ca15de9
commit d1db4a3e39
5 changed files with 35 additions and 39 deletions

View File

@ -8,6 +8,11 @@
set -e set -e
trap 'read -p "Press any key..." x' EXIT trap 'read -p "Press any key..." x' EXIT
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cURL version
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly MY_VERSION=8.5.0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up compiler # Set up compiler
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -52,7 +57,7 @@ wget -4 -O "${LIBS_DIR}/.pkg/nghttp3.tar.gz" https://github.com/ngtcp2/nghttp3/
wget -4 -O "${LIBS_DIR}/.pkg/ngtcp2.tar.gz" https://github.com/ngtcp2/ngtcp2/releases/download/v1.1.0/ngtcp2-1.1.0.tar.gz wget -4 -O "${LIBS_DIR}/.pkg/ngtcp2.tar.gz" https://github.com/ngtcp2/ngtcp2/releases/download/v1.1.0/ngtcp2-1.1.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.4.tar.gz wget -4 -O "${LIBS_DIR}/.pkg/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.4.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz wget -4 -O "${LIBS_DIR}/.pkg/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/curl.tar.gz" https://curl.se/download/curl-8.5.0.tar.gz wget -4 -O "${LIBS_DIR}/.pkg/curl.tar.gz" https://curl.se/download/curl-${MY_VERSION}.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/cacert.pem" https://curl.se/ca/cacert.pem wget -4 -O "${LIBS_DIR}/.pkg/cacert.pem" https://curl.se/ca/cacert.pem
wget -4 -O "${LIBS_DIR}/.pkg/manpage.html" https://curl.se/docs/manpage.html wget -4 -O "${LIBS_DIR}/.pkg/manpage.html" https://curl.se/docs/manpage.html
@ -230,7 +235,6 @@ pushd "${CURL_DIR}"
sed -i -E 's/\bmain[[:space:]]*\(([^\(\)]*)\)/wmain(\1)/g' configure sed -i -E 's/\bmain[[:space:]]*\(([^\(\)]*)\)/wmain(\1)/g' configure
patch -p1 -b < "${BASE_DIR}/patch/curl_getenv.diff" patch -p1 -b < "${BASE_DIR}/patch/curl_getenv.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff" patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_cb_wrt.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff" patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_getparam.diff" patch -p1 -b < "${BASE_DIR}/patch/curl_tool_getparam.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff" patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff"
@ -288,7 +292,7 @@ unix2dos -n "${ZSTD_DIR}/README.md" legal/zstandard.README.md
mkdir -p "${OUT_DIR}/patch" mkdir -p "${OUT_DIR}/patch"
cp -vf "${BASE_DIR}/patch/"*.diff "${OUT_DIR}/patch" cp -vf "${BASE_DIR}/patch/"*.diff "${OUT_DIR}/patch"
find "${OUT_DIR}" -type f -exec chmod 444 "{}" \; find "${OUT_DIR}" -type f -exec chmod 444 "{}" \;
readonly zfile="${BASE_DIR}/curl-windows-${MY_CPU}.$(date +"%Y-%m-%d").zip" readonly zfile="${BASE_DIR}/curl-${MY_VERSION}-windows-${MY_CPU}.$(date +"%Y-%m-%d").zip"
rm -rf "${zfile}" && zip -v -r -9 "${zfile}" "." rm -rf "${zfile}" && zip -v -r -9 "${zfile}" "."
chmod 444 "${zfile}" chmod 444 "${zfile}"
popd popd

View File

@ -1,11 +1,11 @@
lib/getenv.c | 49 +++++++++++++++++++++++++++++++++---------------- lib/getenv.c | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 16 deletions(-) 1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/lib/getenv.c b/lib/getenv.c diff --git a/lib/getenv.c b/lib/getenv.c
index 5f00fd1..3eff07a 100644 index 48ee972..fe27a24 100644
--- a/lib/getenv.c --- a/lib/getenv.c
+++ b/lib/getenv.c +++ b/lib/getenv.c
@@ -26,25 +26,23 @@ @@ -26,26 +26,23 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "curl_memory.h" #include "curl_memory.h"
@ -14,35 +14,36 @@ index 5f00fd1..3eff07a 100644
#include "memdebug.h" #include "memdebug.h"
-static char *GetEnv(const char *variable) -static char *GetEnv(const char *variable)
+#ifdef WIN32 +#if defined(_WIN32)
+static TCHAR *GetEnv(const TCHAR *variable) +static wchar_t *GetEnv(const wchar_t *variable)
{ {
-#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) -#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) || \
- defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
- (void)variable; - (void)variable;
- return NULL; - return NULL;
-#elif defined(WIN32) -#elif defined(_WIN32)
/* This uses Windows API instead of C runtime getenv() to get the environment /* This uses Windows API instead of C runtime getenv() to get the environment
variable since some changes aren't always visible to the latter. #4774 */ variable since some changes aren't always visible to the latter. #4774 */
- char *buf = NULL; - char *buf = NULL;
- char *tmp; - char *tmp;
+ TCHAR *buf = NULL; + wchar_t *buf = NULL;
+ TCHAR *tmp; + wchar_t *tmp;
DWORD bufsize; DWORD bufsize;
DWORD rc = 1; DWORD rc = 1;
const DWORD max = 32768; /* max env var size from MSCRT source */ const DWORD max = 32768; /* max env var size from MSCRT source */
for(;;) { for(;;) {
- tmp = realloc(buf, rc); - tmp = realloc(buf, rc);
+ tmp = (TCHAR*)realloc(buf, rc * sizeof(TCHAR)); + tmp = (wchar_t*)realloc(buf, rc * sizeof(wchar_t));
if(!tmp) { if(!tmp) {
free(buf); free(buf);
return NULL; return NULL;
@@ -55,25 +53,44 @@ static char *GetEnv(const char *variable) @@ -56,25 +53,41 @@ static char *GetEnv(const char *variable)
/* It's possible for rc to be 0 if the variable was found but empty. /* It's possible for rc to be 0 if the variable was found but empty.
Since getenv doesn't make that distinction we ignore it as well. */ Since getenv doesn't make that distinction we ignore it as well. */
- rc = GetEnvironmentVariableA(variable, buf, bufsize); - rc = GetEnvironmentVariableA(variable, buf, bufsize);
+ rc = GetEnvironmentVariable(variable, buf, bufsize); + rc = GetEnvironmentVariableW(variable, buf, bufsize);
if(!rc || rc == bufsize || rc > max) { if(!rc || rc == bufsize || rc > max) {
free(buf); free(buf);
return NULL; return NULL;
@ -61,11 +62,11 @@ index 5f00fd1..3eff07a 100644
+ +
+char *curl_getenv(const char *variable) +char *curl_getenv(const char *variable)
+{ +{
+#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) +#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) || \
+ defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
+ (void)variable; + (void)variable;
+ return NULL; + return NULL;
+#elif defined(WIN32) +#elif defined(_WIN32)
+#ifdef UNICODE
+ char *value = NULL; + char *value = NULL;
+ wchar_t *variable_w = curlx_convert_UTF8_to_wchar(variable); + wchar_t *variable_w = curlx_convert_UTF8_to_wchar(variable);
+ if(variable_w) { + if(variable_w) {
@ -77,9 +78,6 @@ index 5f00fd1..3eff07a 100644
+ free(variable_w); + free(variable_w);
+ } + }
+ return value; + return value;
+#else
+ return GetEnv(variable);
+#endif
#else #else
char *env = getenv(variable); char *env = getenv(variable);
return (env && env[0])?strdup(env):NULL; return (env && env[0])?strdup(env):NULL;

View File

@ -1,11 +1,8 @@
src/tool_getparam.c | 5 +++++ diff --git "a/src/tool_getparam.c" "b/src/tool_getparam.c"
1 file changed, 5 insertions(+) index 5fa1ace..a1b54f4 100644
--- "a/src/tool_getparam.c"
diff --git a/src/tool_getparam.c b/src/tool_getparam.c +++ "b/src/tool_getparam.c"
index e446762..a3be6ac 100644 @@ -563,8 +563,13 @@ static void cleanarg(argv_item_t str)
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -562,8 +562,13 @@ static void cleanarg(argv_item_t str)
* argument out so that the username:password isn't displayed in the * argument out so that the username:password isn't displayed in the
* system process list */ * system process list */
if(str) { if(str) {

View File

@ -1,14 +1,11 @@
src/tool_parsecfg.c | 42 ++++++++++++++++-------------------------- diff --git "a/src/tool_parsecfg.c" "b/src/tool_parsecfg.c"
1 file changed, 16 insertions(+), 26 deletions(-) index da48700..60e7b44 100644
--- "a/src/tool_parsecfg.c"
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c +++ "b/src/tool_parsecfg.c"
index a166757..6a00b80 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -47,29 +47,20 @@ static const char *unslashquote(const char *line, char *param); @@ -47,29 +47,20 @@ static const char *unslashquote(const char *line, char *param);
static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error); static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error);
#ifdef WIN32 #ifdef _WIN32
-static FILE *execpath(const char *filename, char **pathp) -static FILE *execpath(const char *filename, char **pathp)
+static FILE *execpath(const TCHAR *filename) +static FILE *execpath(const TCHAR *filename)
{ {
@ -58,7 +55,7 @@ index a166757..6a00b80 100644
if(!file) { if(!file) {
@@ -100,14 +91,13 @@ int parseconfig(const char *filename, struct GlobalConfig *global) @@ -100,14 +91,13 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
} }
#ifdef WIN32 /* Windows */ #ifdef _WIN32 /* Windows */
else { else {
- char *fullp; - char *fullp;
/* check for .curlrc then _curlrc in the dir of the executable */ /* check for .curlrc then _curlrc in the dir of the executable */