[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 180/264: tool: do not declare functions with Curl_ prefix
From: |
gnunet |
Subject: |
[gnurl] 180/264: tool: do not declare functions with Curl_ prefix |
Date: |
Thu, 30 Apr 2020 16:08:03 +0200 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 878214df44a41eef49b65039ab0cdfdbf847a5fe
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon Apr 13 23:46:18 2020 +0200
tool: do not declare functions with Curl_ prefix
To avoid collision risks with private libcurl symbols when linked with
static versions (or just versions not hiding internal symbols).
Reported-by: hydra3333 on github
Fixes #5219
Closes #5234
---
src/tool_doswin.c | 10 +++++-----
src/tool_metalink.c | 38 +++++++++++++++++++-------------------
src/tool_metalink.h | 28 +++++++++++-----------------
src/tool_util.c | 12 ++++++------
4 files changed, 41 insertions(+), 47 deletions(-)
diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index 221e3864b..b7df3e615 100644
--- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
@@ -697,8 +697,8 @@ cleanup:
return slist;
}
-LARGE_INTEGER Curl_freq;
-bool Curl_isVistaOrGreater;
+LARGE_INTEGER tool_freq;
+bool tool_isVistaOrGreater;
CURLcode win32_init(void)
{
@@ -713,13 +713,13 @@ CURLcode win32_init(void)
VER_SET_CONDITION(mask, VER_MINORVERSION, op);
if(VerifyVersionInfoA(&osvi, (VER_MAJORVERSION | VER_MINORVERSION), mask))
- Curl_isVistaOrGreater = true;
+ tool_isVistaOrGreater = true;
else if(GetLastError() == ERROR_OLD_WIN_VERSION)
- Curl_isVistaOrGreater = false;
+ tool_isVistaOrGreater = false;
else
return CURLE_FAILED_INIT;
- QueryPerformanceFrequency(&Curl_freq);
+ QueryPerformanceFrequency(&tool_freq);
return CURLE_OK;
}
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index e8629353f..fce18d5a4 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -401,9 +401,9 @@ static void SHA256_Final(unsigned char digest[32],
SHA256_CTX *ctx)
const digest_params MD5_DIGEST_PARAMS[] = {
{
- CURLX_FUNCTION_CAST(Curl_digest_init_func, MD5_Init),
- CURLX_FUNCTION_CAST(Curl_digest_update_func, MD5_Update),
- CURLX_FUNCTION_CAST(Curl_digest_final_func, MD5_Final),
+ CURLX_FUNCTION_CAST(digest_init_func, MD5_Init),
+ CURLX_FUNCTION_CAST(digest_update_func, MD5_Update),
+ CURLX_FUNCTION_CAST(digest_final_func, MD5_Final),
sizeof(MD5_CTX),
16
}
@@ -411,9 +411,9 @@ const digest_params MD5_DIGEST_PARAMS[] = {
const digest_params SHA1_DIGEST_PARAMS[] = {
{
- CURLX_FUNCTION_CAST(Curl_digest_init_func, SHA1_Init),
- CURLX_FUNCTION_CAST(Curl_digest_update_func, SHA1_Update),
- CURLX_FUNCTION_CAST(Curl_digest_final_func, SHA1_Final),
+ CURLX_FUNCTION_CAST(digest_init_func, SHA1_Init),
+ CURLX_FUNCTION_CAST(digest_update_func, SHA1_Update),
+ CURLX_FUNCTION_CAST(digest_final_func, SHA1_Final),
sizeof(SHA_CTX),
20
}
@@ -421,9 +421,9 @@ const digest_params SHA1_DIGEST_PARAMS[] = {
const digest_params SHA256_DIGEST_PARAMS[] = {
{
- CURLX_FUNCTION_CAST(Curl_digest_init_func, SHA256_Init),
- CURLX_FUNCTION_CAST(Curl_digest_update_func, SHA256_Update),
- CURLX_FUNCTION_CAST(Curl_digest_final_func, SHA256_Final),
+ CURLX_FUNCTION_CAST(digest_init_func, SHA256_Init),
+ CURLX_FUNCTION_CAST(digest_update_func, SHA256_Update),
+ CURLX_FUNCTION_CAST(digest_final_func, SHA256_Final),
sizeof(SHA256_CTX),
32
}
@@ -457,7 +457,7 @@ static const metalink_digest_alias digest_aliases[] = {
{NULL, NULL}
};
-digest_context *Curl_digest_init(const digest_params *dparams)
+static digest_context *digest_init(const digest_params *dparams)
{
digest_context *ctxt;
@@ -485,16 +485,16 @@ digest_context *Curl_digest_init(const digest_params
*dparams)
return ctxt;
}
-int Curl_digest_update(digest_context *context,
- const unsigned char *data,
- unsigned int len)
+static int digest_update(digest_context *context,
+ const unsigned char *data,
+ unsigned int len)
{
(*context->digest_hash->digest_update)(context->digest_hashctx, data, len);
return 0;
}
-int Curl_digest_final(digest_context *context, unsigned char *result)
+static int digest_final(digest_context *context, unsigned char *result)
{
if(result)
(*context->digest_hash->digest_final)(result, context->digest_hashctx);
@@ -551,7 +551,7 @@ static int check_hash(const char *filename,
return -1;
}
- dctx = Curl_digest_init(digest_def->dparams);
+ dctx = digest_init(digest_def->dparams);
if(!dctx) {
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
digest_def->hash_name, "failed to initialize hash algorithm");
@@ -562,7 +562,7 @@ static int check_hash(const char *filename,
result = malloc(digest_def->dparams->digest_resultlen);
if(!result) {
close(fd);
- Curl_digest_final(dctx, NULL);
+ digest_final(dctx, NULL);
return -1;
}
while(1) {
@@ -574,13 +574,13 @@ static int check_hash(const char *filename,
else if(len == -1) {
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
digest_def->hash_name, strerror(errno));
- Curl_digest_final(dctx, result);
+ digest_final(dctx, result);
close(fd);
return -1;
}
- Curl_digest_update(dctx, buf, (unsigned int)len);
+ digest_update(dctx, buf, (unsigned int)len);
}
- Curl_digest_final(dctx, result);
+ digest_final(dctx, result);
check_ok = memcmp(result, digest,
digest_def->dparams->digest_resultlen) == 0;
/* sha*sum style verdict output */
diff --git a/src/tool_metalink.h b/src/tool_metalink.h
index f5ec306f7..db2f702e5 100644
--- a/src/tool_metalink.h
+++ b/src/tool_metalink.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, 2019, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -28,19 +28,19 @@ struct GlobalConfig;
struct OperationConfig;
/* returns 1 for success, 0 otherwise (we use OpenSSL *_Init fncs directly) */
-typedef int (* Curl_digest_init_func)(void *context);
+typedef int (*digest_init_func)(void *context);
-typedef void (* Curl_digest_update_func)(void *context,
- const unsigned char *data,
- unsigned int len);
-typedef void (* Curl_digest_final_func)(unsigned char *result, void *context);
+typedef void (*digest_update_func)(void *context,
+ const unsigned char *data,
+ unsigned int len);
+typedef void (*digest_final_func)(unsigned char *result, void *context);
typedef struct {
- Curl_digest_init_func digest_init; /* Initialize context procedure */
- Curl_digest_update_func digest_update; /* Update context with data */
- Curl_digest_final_func digest_final; /* Get final result procedure */
- unsigned int digest_ctxtsize; /* Context structure size */
- unsigned int digest_resultlen; /* Result length (bytes) */
+ digest_init_func digest_init; /* Initialize context procedure */
+ digest_update_func digest_update; /* Update context with data */
+ digest_final_func digest_final; /* Get final result procedure */
+ unsigned int digest_ctxtsize; /* Context structure size */
+ unsigned int digest_resultlen; /* Result length (bytes) */
} digest_params;
typedef struct {
@@ -48,12 +48,6 @@ typedef struct {
void *digest_hashctx; /* Hash function context */
} digest_context;
-digest_context * Curl_digest_init(const digest_params *dparams);
-int Curl_digest_update(digest_context *context,
- const unsigned char *data,
- unsigned int len);
-int Curl_digest_final(digest_context *context, unsigned char *result);
-
typedef struct {
const char *hash_name;
const digest_params *dparams;
diff --git a/src/tool_util.c b/src/tool_util.c
index 8bbfae03e..3ca13e7cb 100644
--- a/src/tool_util.c
+++ b/src/tool_util.c
@@ -28,19 +28,19 @@
#if defined(WIN32) && !defined(MSDOS)
/* set in win32_init() */
-extern LARGE_INTEGER Curl_freq;
-extern bool Curl_isVistaOrGreater;
+extern LARGE_INTEGER tool_freq;
+extern bool tool_isVistaOrGreater;
/* In case of bug fix this function has a counterpart in timeval.c */
struct timeval tvnow(void)
{
struct timeval now;
- if(Curl_isVistaOrGreater) { /* QPC timer might have issues pre-Vista */
+ if(tool_isVistaOrGreater) { /* QPC timer might have issues pre-Vista */
LARGE_INTEGER count;
QueryPerformanceCounter(&count);
- now.tv_sec = (long)(count.QuadPart / Curl_freq.QuadPart);
- now.tv_usec = (long)((count.QuadPart % Curl_freq.QuadPart) * 1000000 /
- Curl_freq.QuadPart);
+ now.tv_sec = (long)(count.QuadPart / tool_freq.QuadPart);
+ now.tv_usec = (long)((count.QuadPart % tool_freq.QuadPart) * 1000000 /
+ tool_freq.QuadPart);
}
else {
/* Disable /analyze warning that GetTickCount64 is preferred */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 213/264: tests/FILEFORMAT: converted to markdown and extended, (continued)
- [gnurl] 213/264: tests/FILEFORMAT: converted to markdown and extended, gnunet, 2020/04/30
- [gnurl] 259/264: doh: Constify some input pointers, gnunet, 2020/04/30
- [gnurl] 161/264: release-notes.pl: detect the start of the references in cleanup mode, gnunet, 2020/04/30
- [gnurl] 214/264: mime: properly check Content-Type even if it has parameters, gnunet, 2020/04/30
- [gnurl] 164/264: tests: add Windows compatible pidwait like pidkill and pidterm, gnunet, 2020/04/30
- [gnurl] 166/264: tests/server/util.c: use curl_off_t instead of long for pid, gnunet, 2020/04/30
- [gnurl] 167/264: compressed.d: stress that the headers are not modified, gnunet, 2020/04/30
- [gnurl] 165/264: tests: use Cygwin/msys PIDs for stunnel and sshd on Windows, gnunet, 2020/04/30
- [gnurl] 264/264: make gnurl-aux, gnunet, 2020/04/30
- [gnurl] 177/264: cirrus: no longer ignore test 504 which is working again, gnunet, 2020/04/30
- [gnurl] 180/264: tool: do not declare functions with Curl_ prefix,
gnunet <=
- [gnurl] 229/264: http: free memory when Alt-Used header creation fails due to OOM, gnunet, 2020/04/30
- [gnurl] 162/264: RELEASE-NOTES: synced, gnunet, 2020/04/30
- [gnurl] 157/264: sshserver.pl: use cached Win32 environment check variable, gnunet, 2020/04/30
- [gnurl] 175/264: test1908: avoid using fixed port number in test data, gnunet, 2020/04/30
- [gnurl] 183/264: tests: support hex encoded data and mqtt server, gnunet, 2020/04/30
- [gnurl] 156/264: appveyor: partially revert 3413a110 to keep build without proxy, gnunet, 2020/04/30
- [gnurl] 173/264: socks: Fix blocking timeout logic, gnunet, 2020/04/30
- [gnurl] 190/264: RELEASE-NOTES: synced, gnunet, 2020/04/30
- [gnurl] 188/264: github/workflow: enable MQTT in the macOS debug build, gnunet, 2020/04/30
- [gnurl] 186/264: travis: add mqtt job on Linux, gnunet, 2020/04/30