Updated patch for new cURL version.

This commit is contained in:
LoRd_MuldeR 2024-11-12 15:17:57 +01:00
parent fa7e2e34da
commit d506e23a97
6 changed files with 119 additions and 92 deletions

View File

@ -343,6 +343,7 @@ patch -p1 -b < "${BASE_DIR}/patch/curl_threads.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"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_util.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${DEPS_DIR}/include" CPPFLAGS="-DNDEBUG -D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DNGHTTP3_STATICLIB -DNGTCP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-mconsole -Wl,--trace -static -no-pthread -L${DEPS_DIR}/lib" LIBS="-liconv -lcrypt32 -lwinmm -lbrotlicommon" PKG_CONFIG_PATH="${DEPS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --enable-windows-unicode --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${DEPS_DIR}" --with-ngtcp2="${DEPS_DIR}" --with-nghttp3="${DEPS_DIR}" --with-libidn2 --without-ca-bundle CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${DEPS_DIR}/include" CPPFLAGS="-DNDEBUG -D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DNGHTTP3_STATICLIB -DNGTCP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-mconsole -Wl,--trace -static -no-pthread -L${DEPS_DIR}/lib" LIBS="-liconv -lcrypt32 -lwinmm -lbrotlicommon" PKG_CONFIG_PATH="${DEPS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --enable-windows-unicode --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${DEPS_DIR}" --with-ngtcp2="${DEPS_DIR}" --with-nghttp3="${DEPS_DIR}" --with-libidn2 --without-ca-bundle
make V=1 make V=1
strip -s src/curl.exe strip -s src/curl.exe

View File

@ -17,7 +17,7 @@ index 49a2e50..dbf2642 100644
+#if defined(_WIN32) +#if defined(_WIN32)
+static wchar_t *GetEnv(const wchar_t *variable) +static wchar_t *GetEnv(const wchar_t *variable)
{ {
-#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) || \ -#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_UWP) || \
- defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */ - defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
- (void)variable; - (void)variable;
- return NULL; - return NULL;
@ -62,7 +62,7 @@ index 49a2e50..dbf2642 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_UWP) || \
+ defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */ + defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
+ (void)variable; + (void)variable;
+ return NULL; + return NULL;
@ -80,7 +80,7 @@ index 49a2e50..dbf2642 100644
+ return value; + return value;
#else #else
char *env = getenv(variable); char *env = getenv(variable);
return (env && env[0])?strdup(env):NULL; return (env && env[0]) ? strdup(env) : NULL;
#endif #endif
} }
- -

View File

@ -1,14 +1,14 @@
src/tool_doswin.c | 57 ++++++++++++++++++++++++++++++++++++++++--------------- src/tool_doswin.c | 60 +++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 42 insertions(+), 15 deletions(-) 1 file changed, 43 insertions(+), 17 deletions(-)
diff --git a/src/tool_doswin.c b/src/tool_doswin.c diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index 38ef0a0..8e976e9 100644 index 70b263113..399d49a7b 100644
--- a/src/tool_doswin.c --- a/src/tool_doswin.c
+++ b/src/tool_doswin.c +++ b/src/tool_doswin.c
@@ -615,6 +615,37 @@ char **__crt0_glob_function(char *arg) @@ -586,28 +586,46 @@ char **__crt0_glob_function(char *arg)
* For WinXP and later search order actually depends on registry value:
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode * HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/ */
+static BOOL check_file_exists(const TCHAR *filename) +static BOOL check_file_exists(const TCHAR *filename)
+{ +{
+ const DWORD attr = GetFileAttributes(filename); + const DWORD attr = GetFileAttributes(filename);
@ -41,12 +41,9 @@ index 38ef0a0..8e976e9 100644
+} +}
+ +
CURLcode FindWin32CACert(struct OperationConfig *config, CURLcode FindWin32CACert(struct OperationConfig *config,
curl_sslbackend backend,
const TCHAR *bundle_file) const TCHAR *bundle_file)
@@ -634,21 +665,9 @@ CURLcode FindWin32CACert(struct OperationConfig *config, {
*/ - CURLcode result = CURLE_OK;
if(feature_ssl && backend != CURLSSLBACKEND_SCHANNEL) {
- DWORD res_len; - DWORD res_len;
- TCHAR buf[PATH_MAX]; - TCHAR buf[PATH_MAX];
- TCHAR *ptr = NULL; - TCHAR *ptr = NULL;
@ -66,9 +63,13 @@ index 38ef0a0..8e976e9 100644
+ if (cacert) { + if (cacert) {
+ config->cacert = cacert; + config->cacert = cacert;
} }
- return result;
+ return CURLE_OK;
} }
#endif #endif
@@ -785,6 +804,8 @@ bool tool_isVistaOrGreater;
@@ -739,6 +757,8 @@ bool tool_isVistaOrGreater;
CURLcode win32_init(void) CURLcode win32_init(void)
{ {
@ -77,7 +78,7 @@ index 38ef0a0..8e976e9 100644
/* curlx_verify_windows_version must be called during init at least once /* curlx_verify_windows_version must be called during init at least once
because it has its own initialization routine. */ because it has its own initialization routine. */
if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT, if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
@@ -799,6 +820,12 @@ CURLcode win32_init(void) @@ -753,6 +773,12 @@ CURLcode win32_init(void)
init_terminal(); init_terminal();
#endif #endif

View File

@ -1,10 +1,7 @@
src/tool_getparam.c | 9 +++++++++ diff --git "a/src/tool_getparam.c" "b/src/tool_getparam.c"
1 file changed, 9 insertions(+) index 1231b3bd6..434e9ddd3 100644
--- "a/src/tool_getparam.c"
diff --git a/src/tool_getparam.c b/src/tool_getparam.c +++ "b/src/tool_getparam.c"
index be41aa35d..b1b032b9f 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -23,6 +23,10 @@ @@ -23,6 +23,10 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
@ -16,7 +13,7 @@ index be41aa35d..b1b032b9f 100644
#include "strcase.h" #include "strcase.h"
#include "curlx.h" #include "curlx.h"
@@ -551,8 +555,13 @@ static void cleanarg(argv_item_t str) @@ -554,8 +558,13 @@ static void cleanarg(argv_item_t str)
* argument out so that the username:password is not displayed in the * argument out so that the username:password is not displayed in the
* system process list */ * system process list */
if(str) { if(str) {

View File

@ -1,53 +1,11 @@
src/tool_parsecfg.c | 42 ++++++++++++++++-------------------------- src/tool_parsecfg.c | 16 +++++++++-------
1 file changed, 16 insertions(+), 26 deletions(-) 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index 6da5a9250..e6f7ad786 100644 index d79e869f0..93eb2a428 100644
--- a/src/tool_parsecfg.c --- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c
@@ -45,29 +45,20 @@ static const char *unslashquote(const char *line, char *param); @@ -57,7 +57,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error);
#ifdef _WIN32
-static FILE *execpath(const char *filename, char **pathp)
+static FILE *execpath(const TCHAR *filename)
{
- static char filebuffer[512];
- /* Get the filename of our executable. GetModuleFileName is already declared
- * via inclusions done in setup header file. We assume that we are using
- * the ASCII version here.
- */
- unsigned long len = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
- if(len > 0 && len < sizeof(filebuffer)) {
- /* We got a valid filename - get the directory part */
- char *lastdirchar = strrchr(filebuffer, '\\');
+ static const size_t BUFFSIZE = 512;
+ TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if((len > 0) && (len < BUFFSIZE)) {
+ TCHAR *lastdirchar = _tcsrchr(filebuffer, TEXT('\\'));
if(lastdirchar) {
- size_t remaining;
- *lastdirchar = 0;
- /* If we have enough space, build the RC filename */
- remaining = sizeof(filebuffer) - strlen(filebuffer);
- if(strlen(filename) < remaining - 1) {
- FILE *f;
- msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
- *pathp = filebuffer;
- f = fopen(filebuffer, FOPEN_READTEXT);
- return f;
- }
+ *lastdirchar = TEXT('\0');
+ }
+ if (_tcslen(filebuffer) + _tcslen(filename) + 2U < BUFFSIZE) {
+ _tcscat(filebuffer, TEXT("\\"));
+ _tcscat(filebuffer, filename);
+ return _tfopen(filebuffer, TEXT(FOPEN_READTEXT));
}
}
@@ -87,7 +78,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
if(!filename) { if(!filename) {
/* NULL means load .curlrc from homedir! */ /* NULL means load .curlrc from homedir! */
@ -56,21 +14,26 @@ index 6da5a9250..e6f7ad786 100644
if(curlrc) { if(curlrc) {
file = fopen(curlrc, FOPEN_READTEXT); file = fopen(curlrc, FOPEN_READTEXT);
if(!file) { if(!file) {
@@ -98,14 +89,13 @@ int parseconfig(const char *filename, struct GlobalConfig *global) @@ -68,14 +68,16 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
} }
#ifdef _WIN32 /* Windows */ #ifdef _WIN32 /* Windows */
else { else {
- char *fullp; - char *fullp;
+ TCHAR *fullp;
/* check for .curlrc then _curlrc in the dir of the executable */ /* check for .curlrc then _curlrc in the dir of the executable */
- file = execpath(".curlrc", &fullp); - file = Curl_execpath(".curlrc", &fullp);
+ file = execpath(TEXT(".curlrc") /*,&fullp*/); - if(!file)
if(!file) - file = Curl_execpath("_curlrc", &fullp);
- file = execpath("_curlrc", &fullp); + file = Curl_execpath(TEXT(".curlrc"), &fullp);
+ file = execpath(TEXT("_curlrc") /*,&fullp*/);
if(file) if(file)
/* this is the filename we read from */ - /* this is the filename we read from */
- filename = fullp; - filename = fullp;
+ filename = ".curlrc"; + filename = ".curlrc";
+ else {
+ file = Curl_execpath(TEXT("_curlrc"), &fullp);
+ if(file)
+ filename = "_curlrc";
+ }
} }
#endif #endif
} }

65
patch/curl_tool_util.diff Normal file
View File

@ -0,0 +1,65 @@
src/tool_util.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/tool_util.c b/src/tool_util.c
index e657dacf0..926e43644 100644
--- a/src/tool_util.c
+++ b/src/tool_util.c
@@ -191,28 +191,21 @@ int tool_ftruncate64(int fd, curl_off_t where)
#endif /* USE_TOOL_FTRUNCATE */
#ifdef _WIN32
-FILE *Curl_execpath(const char *filename, char **pathp)
+FILE *Curl_execpath(const TCHAR *filename, TCHAR **pathp)
{
- static char filebuffer[512];
- unsigned long len;
- /* Get the filename of our executable. GetModuleFileName is already declared
- * via inclusions done in setup header file. We assume that we are using
- * the ASCII version here.
- */
- len = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
- if(len > 0 && len < sizeof(filebuffer)) {
- /* We got a valid filename - get the directory part */
- char *lastdirchar = strrchr(filebuffer, DIR_CHAR[0]);
+ static const size_t BUFFSIZE = 512;
+ TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if((len > 0) && (len < BUFFSIZE)) {
+ TCHAR *lastdirchar = _tcsrchr(filebuffer, TEXT('\\'));
if(lastdirchar) {
- size_t remaining;
- *lastdirchar = 0;
- /* If we have enough space, build the RC filename */
- remaining = sizeof(filebuffer) - strlen(filebuffer);
- if(strlen(filename) < remaining - 1) {
- msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
- *pathp = filebuffer;
- return fopen(filebuffer, FOPEN_READTEXT);
- }
+ *lastdirchar = TEXT('\0');
+ }
+ if (_tcslen(filebuffer) + _tcslen(filename) + 2U < BUFFSIZE) {
+ _tcscat(filebuffer, TEXT("\\"));
+ _tcscat(filebuffer, filename);
+ *pathp = filebuffer;
+ return _tfopen(filebuffer, TEXT(FOPEN_READTEXT));
}
}
src/tool_util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tool_util.h b/src/tool_util.h
index 9fec7e873..93d7ef9fc 100644
--- a/src/tool_util.h
+++ b/src/tool_util.h
@@ -40,7 +40,7 @@ int struplocompare(const char *p1, const char *p2);
int struplocompare4sort(const void *p1, const void *p2);
#ifdef _WIN32
-FILE *Curl_execpath(const char *filename, char **pathp);
+FILE *Curl_execpath(const TCHAR *filename, TCHAR **pathp);
#endif
#endif /* HEADER_CURL_TOOL_UTIL_H */