]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tidy-up: misc
authorViktor Szakats <commit@vsz.me>
Sat, 14 Dec 2024 22:52:38 +0000 (23:52 +0100)
committerViktor Szakats <commit@vsz.me>
Tue, 24 Dec 2024 00:27:26 +0000 (01:27 +0100)
- lib1531: fix to use `curl_off_t`.
- src/tool_doswin: merge `_WIN32` guards.
- src/tool_doswin: limit `S_ISCHR()` to MS-DOS.
- src: dedupe `CURL_O_BINARY` macro into `tool_setup.h`.
- CMake/CurlTests.c: cleanup/formatting `HAVE_FILE_OFFSET_BITS` test.
- examples/httpput-postfields: delete unused include.
- spelling: MultiSSL.
- whitespace.

Ref: #15652
Closes #15799

CMake/CurlTests.c
docs/HISTORY.md
docs/examples/httpput-postfields.c
lib/curl_setup.h
lib/socketpair.c
src/tool_cb_wrt.c
src/tool_doswin.c
src/tool_operate.c
src/tool_setup.h
tests/libtest/lib1531.c
tests/libtest/test.h

index 2118f3ca44d3297eca922c5fcde1ae7c7895c439..bf07aed63cef8d0d3cf057a23b716d0f644c18f9 100644 (file)
@@ -147,19 +147,17 @@ int main(void) { return 0; }
 #endif
 
 #ifdef HAVE_FILE_OFFSET_BITS
-#ifdef _FILE_OFFSET_BITS
 #undef _FILE_OFFSET_BITS
-#endif
 #define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We cannot simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
+/* Check that off_t can represent 2**63 - 1 correctly.
+   We cannot simply define LARGE_OFF_T to be 9223372036854775807,
+   since some C++ compilers masquerading as C compilers
+   incorrectly reject 9223372036854775807. */
 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
+int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                     && LARGE_OFF_T % 2147483647 == 1)
+                    ? 1 : -1];
 int main(void) { return 0; }
 #endif
 
index 0ec3cd1599d912634bfeadbf126c7aa424ca0437..cd9e735de571d2d222429eac76390a2bacb9fe88 100644 (file)
@@ -342,7 +342,7 @@ April: added the cyassl backend (later renamed to wolfSSL)
 
  July: OSS-Fuzz started fuzzing libcurl
 
- September: Added Multi-SSL support
+ September: Added MultiSSL support
 
  The website serves 3100 GB/month
 
index c0436749fd5e5be450841ccd1d7ccfb4059fb26b..fdd6ffe0dd0aedf3ba048fe79ffe92d15818bc0f 100644 (file)
@@ -27,7 +27,6 @@
  */
 #include <stdio.h>
 #include <fcntl.h>
-#include <sys/stat.h>
 #include <curl/curl.h>
 
 static const char olivertwist[]=
index 43da46ac19146111218f1cd8e687120559a83d76..18d52cc301c34f7d306f4dbd88d5900731d67339 100644 (file)
@@ -948,7 +948,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
     defined(USE_QUICHE) || defined(USE_MSH3)
 
 #ifdef CURL_WITH_MULTI_SSL
-#error "Multi-SSL combined with QUIC is not supported"
+#error "MultiSSL combined with QUIC is not supported"
 #endif
 
 #define USE_HTTP3
index b14f5a5f145ded3d5da33adbad68c80cb5d8be5e..c4f558ea6b889bbcf7ddd9c799e4ebe1e8813ea2 100644 (file)
@@ -53,7 +53,7 @@ int Curl_pipe(curl_socket_t socks[2], bool nonblocking)
     return -1;
 #ifdef HAVE_FCNTL
   if(fcntl(socks[0], F_SETFD, FD_CLOEXEC) ||
-     fcntl(socks[1], F_SETFD, FD_CLOEXEC) ) {
+     fcntl(socks[1], F_SETFD, FD_CLOEXEC)) {
     close(socks[0]);
     close(socks[1]);
     socks[0] = socks[1] = CURL_SOCKET_BAD;
index cbf1f0a52c9d141a8767c9751cb7f7191a97027a..f5293094e1548d74d645e400562d08c8d4e98128 100644 (file)
 
 #include "memdebug.h" /* keep this as LAST include */
 
-#ifdef O_BINARY
-#define CURL_O_BINARY O_BINARY
-#else
-#define CURL_O_BINARY 0
-#endif
 #ifdef _WIN32
 #define OPENMODE S_IREAD | S_IWRITE
 #else
index 31490cc4c12f6c6c6bfddf4617ebb5836ab9a271..93e4c6ae5e63e277badff1be5ca2231bfa0cab9f 100644 (file)
 #ifdef _WIN32
 #  undef  PATH_MAX
 #  define PATH_MAX MAX_PATH
+
+#  define _use_lfn(f) (1)  /* long filenames always available */
+#elif !defined(__DJGPP__) || (__DJGPP__ < 2)  /* DJGPP 2.0 has _use_lfn() */
+#  define _use_lfn(f) (0)  /* long filenames never available */
+#elif defined(__DJGPP__)
+#  include <fcntl.h>       /* _use_lfn(f) prototype */
 #endif
 
+#ifdef MSDOS
+
 #ifndef S_ISCHR
 #  ifdef S_IFCHR
 #    define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
 #  endif
 #endif
 
-#ifdef _WIN32
-#  define _use_lfn(f) (1)   /* long filenames always available */
-#elif !defined(__DJGPP__) || (__DJGPP__ < 2)  /* DJGPP 2.0 has _use_lfn() */
-#  define _use_lfn(f) (0)  /* long filenames never available */
-#elif defined(__DJGPP__)
-#  include <fcntl.h>                /* _use_lfn(f) prototype */
-#endif
-
-#ifdef MSDOS
 /* only used by msdosify() */
 static SANITIZEcode truncate_dryrun(const char *path,
                                     const size_t truncate_pos);
index 14b559b65664420004e50e91c1aa176d80d67ee8..1bba71f829ea9f647a4d46bde144f00f587f060a 100644 (file)
@@ -111,14 +111,6 @@ extern const unsigned char curl_ca_embed[];
 #endif
 #endif
 
-/* since O_BINARY is used in bitmasks, setting it to zero makes it usable in
-   source code but yet it does not ruin anything */
-#ifdef O_BINARY
-#define CURL_O_BINARY O_BINARY
-#else
-#define CURL_O_BINARY 0
-#endif
-
 #ifndef SOL_IP
 #  define SOL_IP IPPROTO_IP
 #endif
index 8c89e60275978344d74ceb6cba8a554730d2eca7..1e0488045544173ef57f7d3fb57d6d66d0602701 100644 (file)
@@ -66,6 +66,14 @@ extern FILE *tool_stderr;
 #  include "tool_strdup.h"
 #endif
 
+/* since O_BINARY is used in bitmasks, setting it to zero makes it usable in
+   source code but yet it does not ruin anything */
+#ifdef O_BINARY
+#define CURL_O_BINARY O_BINARY
+#else
+#define CURL_O_BINARY 0
+#endif
+
 #if defined(_WIN32)
 #  define CURL_STRICMP(p1, p2)  _stricmp(p1, p2)
 #elif defined(HAVE_STRCASECMP)
index ec40f6a1c858169ae3f55bd1a8e7f3a7354849d1..de9d6f802a3180e92cfe44936dc2822344a77d82 100644 (file)
@@ -31,7 +31,7 @@
 #define TEST_HANG_TIMEOUT 60 * 1000
 
 static char const testData[] = ".abc\0xyz";
-static off_t const testDataSize = sizeof(testData) - 1;
+static curl_off_t const testDataSize = sizeof(testData) - 1;
 
 CURLcode test(char *URL)
 {
@@ -57,8 +57,7 @@ CURLcode test(char *URL)
 
   /* set the options (I left out a few, you'll get the point anyway) */
   curl_easy_setopt(easy, CURLOPT_URL, URL);
-  curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE,
-                   (curl_off_t)testDataSize);
+  curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, testDataSize);
   curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData);
 
   /* we start some action by calling perform right away */
index 28673c6f9d27a834ddca7b58f43ee9fb8811efe9..8b50d553787f0f85f2f8441f37a5bfab63c1a1ba 100644 (file)
@@ -45,7 +45,7 @@
 #include "curl_printf.h"
 
 #ifdef _WIN32
-#define sleep(sec) Sleep ((sec)*1000)
+#define sleep(sec) Sleep((sec)*1000)
 #endif
 
 #define test_setopt(A,B,C)                                      \