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
trap 'read -p "Press any key..." x' EXIT
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cURL version
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly MY_VERSION=8.5.0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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/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/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/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
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_tool_cb_wrt.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_parsecfg.diff"
@ -288,7 +292,7 @@ unix2dos -n "${ZSTD_DIR}/README.md" legal/zstandard.README.md
mkdir -p "${OUT_DIR}/patch"
cp -vf "${BASE_DIR}/patch/"*.diff "${OUT_DIR}/patch"
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}" "."
chmod 444 "${zfile}"
popd

View File

@ -1,11 +1,11 @@
lib/getenv.c | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
lib/getenv.c | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/lib/getenv.c b/lib/getenv.c
index 5f00fd1..3eff07a 100644
index 48ee972..fe27a24 100644
--- a/lib/getenv.c
+++ b/lib/getenv.c
@@ -26,25 +26,23 @@
@@ -26,26 +26,23 @@
#include <curl/curl.h>
#include "curl_memory.h"
@ -14,35 +14,36 @@ index 5f00fd1..3eff07a 100644
#include "memdebug.h"
-static char *GetEnv(const char *variable)
+#ifdef WIN32
+static TCHAR *GetEnv(const TCHAR *variable)
+#if defined(_WIN32)
+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;
- return NULL;
-#elif defined(WIN32)
-#elif defined(_WIN32)
/* 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 */
- char *buf = NULL;
- char *tmp;
+ TCHAR *buf = NULL;
+ TCHAR *tmp;
+ wchar_t *buf = NULL;
+ wchar_t *tmp;
DWORD bufsize;
DWORD rc = 1;
const DWORD max = 32768; /* max env var size from MSCRT source */
for(;;) {
- tmp = realloc(buf, rc);
+ tmp = (TCHAR*)realloc(buf, rc * sizeof(TCHAR));
+ tmp = (wchar_t*)realloc(buf, rc * sizeof(wchar_t));
if(!tmp) {
free(buf);
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.
Since getenv doesn't make that distinction we ignore it as well. */
- rc = GetEnvironmentVariableA(variable, buf, bufsize);
+ rc = GetEnvironmentVariable(variable, buf, bufsize);
+ rc = GetEnvironmentVariableW(variable, buf, bufsize);
if(!rc || rc == bufsize || rc > max) {
free(buf);
return NULL;
@ -61,11 +62,11 @@ index 5f00fd1..3eff07a 100644
+
+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;
+ return NULL;
+#elif defined(WIN32)
+#ifdef UNICODE
+#elif defined(_WIN32)
+ char *value = NULL;
+ wchar_t *variable_w = curlx_convert_UTF8_to_wchar(variable);
+ if(variable_w) {
@ -77,9 +78,6 @@ index 5f00fd1..3eff07a 100644
+ free(variable_w);
+ }
+ return value;
+#else
+ return GetEnv(variable);
+#endif
#else
char *env = getenv(variable);
return (env && env[0])?strdup(env):NULL;

View File

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

View File

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