#
0325e1b9 |
| 22-Oct-2024 |
Sinkevich Artem |
mprintf: treat `%o` as unsigned, add tests for `%o`, `%x`, `%X` `%x` and `%X` were already treated as unsigned, but `%o` was not, even though it was used with unsigned numbers.
mprintf: treat `%o` as unsigned, add tests for `%o`, `%x`, `%X` `%x` and `%X` were already treated as unsigned, but `%o` was not, even though it was used with unsigned numbers. Closes #15348
show more ...
|
#
7ca164fa |
| 21-Oct-2024 |
Sinkevich Artem |
mprintf: do not ignore length modifiers of `%o`, `%x`, `%X` There are uses of `%lx` and `%zx` in the codebase, but `parsefmt` interpreted them as `%x`. Closes #15348
|
#
bcec0840 |
| 02-Oct-2024 |
Daniel Stenberg |
lib: use bool/TRUE/FALSE properly booleans should use the type 'bool' and set the value to TRUE/FALSE non-booleans should not be 'bool' and should not set the value to TRUE/FALS
lib: use bool/TRUE/FALSE properly booleans should use the type 'bool' and set the value to TRUE/FALSE non-booleans should not be 'bool' and should not set the value to TRUE/FALSE Closes #15123
show more ...
|
#
b70e8f4b |
| 22-Sep-2024 |
Gabriel Marin |
cleanup: added space around ternary expressions Closes #14990
|
#
fbf5d507 |
| 18-Sep-2024 |
Daniel Stenberg |
lib/src: white space edits to comply better with code style ... as checksrc now finds and complains about these. Closes #14921
|
#
e512fbfa |
| 22-Aug-2024 |
Viktor Szakats |
printf: fix mingw-w64 format checks Change mingw-w64 printf format checks in public curl headers to use `__MINGW_PRINTF_FORMAT` instead of `gnu_printf`. This syncs the format checker
printf: fix mingw-w64 format checks Change mingw-w64 printf format checks in public curl headers to use `__MINGW_PRINTF_FORMAT` instead of `gnu_printf`. This syncs the format checker with format string macros published via `curl/system.h`. (Also disable format checks for mingw-w64 older than 3.0.0 (2013-09-20) and classic-mingw, which do not support this macro.) This fixes bogus format checker `-Wformat` warnings in 3rd party code using curl format strings with the curl printf functions, when using mingw-w64 7.0.0 (2019-11-10) and older (with GCC, MSVCRT). It also allows to delete two workaounds for this within curl itself: - setting `-D__USE_MINGW_ANSI_STDIO=1` for mingw-w64 via cmake and configure for `docs/examples` and `tests/http/clients`. Ref: c730c8549b5b67e7668ca5d2cd82c3cc183e125d #14640 The format check macro is incompatible (depending on mingw-w64 version and configuration) with the C99 `%z` (`size_t`) format string used internally by curl. To work around this problem, override the format check style in curl public headers to use `gnu_printf`. This is compatible with `%z` in all mingw-w64 versions and allows keeping the C99 format strings internally. Also: - lib/ws.c: add missing space to an error message. - docs/examples/ftpgetinfo.c: fix to use standard printf. Ref: #14643 (take 1) Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489 Closes #14703
show more ...
|
#
c074ba64 |
| 01-Jul-2024 |
Daniel Stenberg |
code: language cleanup in comments Based on the standards and guidelines we use for our documentation. - expand contractions (they're => they are etc) - host name = > hostname
code: language cleanup in comments Based on the standards and guidelines we use for our documentation. - expand contractions (they're => they are etc) - host name = > hostname - file name => filename - user name = username - man page => manpage - run-time => runtime - set-up => setup - back-end => backend - a HTTP => an HTTP - Two spaces after a period => one space after period Closes #14073
show more ...
|
#
03cf1c7b |
| 24-Apr-2024 |
Viktor Szakats |
lib: silence `-Wsign-conversion` in base64, strcase, mprintf Closes #13467
|
#
6e8a6039 |
| 14-Apr-2024 |
Patrick Monnerat |
mprintf: check fputc error rather than matching returned character OS/400 ascii fputc wrapper deviates from the posix standard by the fact that it returns the ebcdic encoding of the orig
mprintf: check fputc error rather than matching returned character OS/400 ascii fputc wrapper deviates from the posix standard by the fact that it returns the ebcdic encoding of the original ascii character. Testing for a matching value for success will then always fail. This commit replaces the chariacter comparison by an explicit error return check. Follow-up to ef2cf58 Closes #13367
show more ...
|
#
2cd78f52 |
| 29-Feb-2024 |
RainRat |
misc: Fix typos in docs and lib This fixes miscellaneous typos and duplicated words in the docs, lib and test comments and a few user facing errorstrings. Author: RainRat on Git
misc: Fix typos in docs and lib This fixes miscellaneous typos and duplicated words in the docs, lib and test comments and a few user facing errorstrings. Author: RainRat on Github Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Dan Fandrich <dan@coneharvesters.com> Closes: #13019
show more ...
|
#
e3a3bb37 |
| 16-Feb-2024 |
Jay Satiro |
mprintf: fix format prefix I32/I64 for windows compilers - Support I32 & I64 (eg: %I64d) for all Win32 builds. Prior to this change mprintf support for the I format prefix, which is
mprintf: fix format prefix I32/I64 for windows compilers - Support I32 & I64 (eg: %I64d) for all Win32 builds. Prior to this change mprintf support for the I format prefix, which is a Microsoft extension, was dependent on the compiler used. When Borland compiler support was removed in fd7ef00f the prefix was then no longer supported for that compiler; however since it's still possible to build with Borland I'm restoring support for the prefix in this way. Reported-by: Paweł Witas Fixes https://github.com/curl/curl/issues/12944 Closes https://github.com/curl/curl/pull/12950
show more ...
|
#
ef2cf58c |
| 22-Dec-2023 |
Daniel Stenberg |
mprintf: overhaul and bugfixes In a test case using lots of snprintf() calls using many commonly used %-codes per call, this version is around 30% faster than previous version.
mprintf: overhaul and bugfixes In a test case using lots of snprintf() calls using many commonly used %-codes per call, this version is around 30% faster than previous version. It also fixes the #12561 bug which made it not behave correctly when given unknown %-sequences. Fixing that flaw required a different take on the problem, which resulted in the new two-arrays model. lib557: extended - Verify the #12561 fix and test more printf features unit1398: fix test: It used a <num>$ only for one argument, which is not supported. Fixes #12561 Closes #12563
show more ...
|
#
2dbe75bd |
| 09-Dec-2023 |
Viktor Szakats |
build: fix some `-Wsign-conversion`/`-Warith-conversion` warnings - enable `-Wsign-conversion` warnings, but also setting them to not raise errors. - fix `-Warith-conversion` warni
build: fix some `-Wsign-conversion`/`-Warith-conversion` warnings - enable `-Wsign-conversion` warnings, but also setting them to not raise errors. - fix `-Warith-conversion` warnings seen in CI. These are triggered by `-Wsign-converion` and causing errors unless explicitly silenced. It makes more sense to fix them, there just a few of them. - fix some `-Wsign-conversion` warnings. - hide `-Wsign-conversion` warnings with a `#pragma`. - add macro `CURL_WARN_SIGN_CONVERSION` to unhide them on a per-build basis. - update a CI job to unhide them with the above macro: https://github.com/curl/curl/actions/workflows/linux.yml -> OpenSSL -O3 Closes #12492
show more ...
|
#
f58e493e |
| 18-Dec-2023 |
Daniel Stenberg |
curl.h: add CURLE_TOO_LARGE A new error code to be used when an internal field grows too large, like when a dynbuf reaches its maximum. Previously it would return CURLE_OUT_OF_MEMORY
curl.h: add CURLE_TOO_LARGE A new error code to be used when an internal field grows too large, like when a dynbuf reaches its maximum. Previously it would return CURLE_OUT_OF_MEMORY for this, which is highly misleading. Ref: #12268 Closes #12269
show more ...
|
#
3829759b |
| 08-Dec-2023 |
Viktor Szakats |
build: enable missing OpenSSF-recommended warnings, with fixes https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html as of 2023-11-29 [1]
build: enable missing OpenSSF-recommended warnings, with fixes https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html as of 2023-11-29 [1]. Enable new recommended warnings (except `-Wsign-conversion`): - enable `-Wformat=2` for clang (in both cmake and autotools). - add `CURL_PRINTF()` internal attribute and mark functions accepting printf arguments with it. This is a copy of existing `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible with redefinting the `printf` symbol: https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94 - fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for mingw-w64 and enable it on this platform. - enable `-Wimplicit-fallthrough`. - enable `-Wtrampolines`. - add `-Wsign-conversion` commented with a FIXME. - cmake: enable `-pedantic-errors` the way we do it with autotools. Follow-up to d5c0351055d5709da8f3e16c91348092fdb481aa #2747 - lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format checks. Previously it was always disabled due to the internal `printf` macro. Fix them: - fix bug where an `set_ipv6_v6only()` call was missed in builds with `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`. - add internal `FALLTHROUGH()` macro. - replace obsolete fall-through comments with `FALLTHROUGH()`. - fix fallthrough markups: Delete redundant ones (showing up as warnings in most cases). Add missing ones. Fix indentation. - silence `-Wformat-nonliteral` warnings with llvm/clang. - fix one `-Wformat-nonliteral` warning. - fix new `-Wformat` and `-Wformat-security` warnings. - fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its definition to `lib/curl_setup.h` allowing use in `tests/server`. - lib: fix two wrongly passed string arguments in log outputs. Co-authored-by: Jay Satiro - fix new `-Wformat` warnings on mingw-w64. [1] https://github.com/ossf/wg-best-practices-os-developers/blob/56c0fde3895bfc55c8a973ef49a2572c507b2ae1/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md Closes #12489
show more ...
|
#
84338c4d |
| 15-Nov-2023 |
Viktor Szakats |
build: add more picky warnings and fix them Enable more picky compiler warnings. I've found these options in the nghttp3 project when implementing the CMake quick picky warning funct
build: add more picky warnings and fix them Enable more picky compiler warnings. I've found these options in the nghttp3 project when implementing the CMake quick picky warning functionality for it [1]. `-Wunused-macros` was too noisy to keep around, but fixed a few issues it revealed while testing. - autotools: reflect the more precisely-versioned clang warnings. Follow-up to 033f8e2a08eb1d3102f08c4d8c8e85470f8b460e #12324 - autotools: sync between clang and gcc the way we set `no-multichar`. - autotools: avoid setting `-Wstrict-aliasing=3` twice. - autotools: disable `-Wmissing-noreturn` for MSYS gcc targets [2]. It triggers in libtool-generated stub code. - lib/timeval: delete a redundant `!MSDOS` guard from a `WIN32` branch. - lib/curl_setup.h: delete duplicate declaration for `fileno`. Added in initial commit ae1912cb0d494b48d514d937826c9fe83ec96c4d (1999-12-29). This suggests this may not be needed anymore, but if it does, we may restore this for those specific (non-Windows) systems. - lib: delete unused macro `FTP_BUFFER_ALLOCSIZE` since c1d6fe2aaa5a26e49a69a4f2495b3cc7a24d9394. - lib: delete unused macro `isxdigit_ascii` since f65f750742068f579f4ee6d8539ed9d5f0afcb85. - lib/mqtt: delete unused macro `MQTT_HEADER_LEN`. - lib/multi: delete unused macro `SH_READ`/`SH_WRITE`. - lib/hostip: add `noreturn` function attribute via new `CURL_NORETURN` macro. - lib/mprintf: delete duplicate declaration for `Curl_dyn_vprintf`. - lib/rand: fix `-Wunreachable-code` and related fallouts [3]. - lib/setopt: fix `-Wunreachable-code-break`. - lib/system_win32 and lib/timeval: fix double declarations for `Curl_freq` and `Curl_isVistaOrGreater` in CMake UNITY mode [4]. - lib/warnless: fix double declarations in CMake UNITY mode [5]. This was due to force-disabling the header guard of `warnless.h` to to reapply it to source code coming after `warnless.c` in UNITY builds. This reapplied declarations too, causing the warnings. Solved by adding a header guard for the lines that actually need to be reapplied. - lib/vauth/digest: fix `-Wunreachable-code-break` [6]. - lib/vssh/libssh2: fix `-Wunreachable-code-break` and delete redundant block. - lib/vtls/sectransp: fix `-Wunreachable-code-break` [7]. - lib/vtls/sectransp: suppress `-Wunreachable-code`. Detected in `else` branches of dynamic feature checks, with results known at compile-time, e.g. ```c if(SecCertificateCopySubjectSummary) /* -> true */ ``` Likely fixable as a separate micro-project, but given SecureTransport is deprecated anyway, let's just silence these locally. - src/tool_help: delete duplicate declaration for `helptext`. - src/tool_xattr: fix `-Wunreachable-code`. - tests: delete duplicate declaration for `unitfail` [8]. - tests: delete duplicate declaration for `strncasecompare`. - tests/libtest: delete duplicate declaration for `gethostname`. Originally added in 687df5c8c39c370a59999b9afc0917d808d978b7 (2010-08-02). Got complicated later: c49e9683b85ba9d12cbb6eebc4ab2c8dba68fbdc If there are still systems around with warnings, we may restore the prototype, but limited for those systems. - tests/lib2305: delete duplicate declaration for `libtest_debug_config`. - tests/h2-download: fix `-Wunreachable-code-break`. [1] https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056f8bf9f/cmake/PickyWarningsC.cmake [2] https://ci.appveyor.com/project/curlorg/curl/builds/48553586/job/3qkgjauiqla5fj45?fullLog=true#L1675 [3] https://github.com/curl/curl/actions/runs/6880886309/job/18716044703?pr=12331#step:7:72 https://github.com/curl/curl/actions/runs/6883016087/job/18722707368?pr=12331#step:7:109 [4] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L204 [5] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L218 [6] https://github.com/curl/curl/actions/runs/6880886309/job/18716042927?pr=12331#step:7:290 [7] https://github.com/curl/curl/actions/runs/6891484996/job/18746659406?pr=12331#step:9:1193 [8] https://github.com/curl/curl/actions/runs/6882803986/job/18722082562?pr=12331#step:33:1870 Closes #12331
show more ...
|
#
fd7ef00f |
| 28-Oct-2023 |
Viktor Szakats |
build: delete support bits for obsolete Windows compilers - Pelles C: Unclear status, failed to obtain a fresh copy a few months ago. Possible website is HTTP-only. ~10 years ago I lef
build: delete support bits for obsolete Windows compilers - Pelles C: Unclear status, failed to obtain a fresh copy a few months ago. Possible website is HTTP-only. ~10 years ago I left this compiler dealing with crashes and other issues with no response on the forum for years. It has seen some activity in curl back in 2021. - LCC: Last stable release in September 2002. - Salford C: Misses winsock2 support, possibly abandoned? Last mentioned in 2006. - Borland C++: We dropped Borland C++ support in 2018. - MS Visual C++ 6.0: Released in 1998. curl already requires VS 2010 (or possibly 2008) as a minimum. Closes #12222
show more ...
|
#
f198d33e |
| 18-May-2023 |
Emanuele Torre |
checksrc: disallow spaces before labels Out of 415 labels throughout the code base, 86 of those labels were not at the start of the line. Which means labels always at the start of th
checksrc: disallow spaces before labels Out of 415 labels throughout the code base, 86 of those labels were not at the start of the line. Which means labels always at the start of the line is the favoured style overall with 329 instances. Out of the 86 labels not at the start of the line: * 75 were indented with the same indentation level of the following line * 8 were indented with exactly one space * 2 were indented with one fewer indentation level then the following line * 1 was indented with the indentation level of the following line minus three space (probably unintentional) Co-Authored-By: Viktor Szakats Closes #11134
show more ...
|
#
d567cca1 |
| 27-Apr-2023 |
Daniel Stenberg |
checksrc: fix SPACEBEFOREPAREN for conditions starting with "*" The open paren check wants to warn for spaces before open parenthesis for if/while/for but also for any function call. In
checksrc: fix SPACEBEFOREPAREN for conditions starting with "*" The open paren check wants to warn for spaces before open parenthesis for if/while/for but also for any function call. In order to avoid catching function pointer declarations, the logic allows a space if the first character after the open parenthesis is an asterisk. I also spotted what we did not include "switch" in the check but we should. This check is a little lame, but we reduce this problem by not allowing that space for if/while/for/switch. Reported-by: Emanuele Torre Closes #11044
show more ...
|
#
2bc1d775 |
| 02-Jan-2023 |
Daniel Stenberg |
copyright: update all copyright lines and remove year ranges - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - save
copyright: update all copyright lines and remove year ranges - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
show more ...
|
#
dae84805 |
| 17-Oct-2022 |
Daniel Stenberg |
mprintf: reject two kinds of precision for the same argument An input like "%.*1$.9999d" would first use the precision taken as an argument *and* then the precision specified in the stri
mprintf: reject two kinds of precision for the same argument An input like "%.*1$.9999d" would first use the precision taken as an argument *and* then the precision specified in the string, which is confusing and wrong. pass1 will now instead return error on this double use. Adjusted unit test 1398 to verify Reported-by: Peter Goodman Closes #9754
show more ...
|
#
935b1bd4 |
| 22-Sep-2022 |
Daniel Stenberg |
mprintf: use snprintf if available This is the single place in libcurl code where it uses the "native" s(n)printf() function. Used for writing floats. The use has been reviewed and v
mprintf: use snprintf if available This is the single place in libcurl code where it uses the "native" s(n)printf() function. Used for writing floats. The use has been reviewed and vetted and uses a HUGE target buffer, but switching to snprintf() still makes this safer and removes build-time warnings. Reported-by: Philip Heiduck Fixes #9569 Closes #9570
show more ...
|
#
307b7543 |
| 17-Sep-2022 |
Daniel Stenberg |
misc: null-terminate Make use of this term consistently. Closes #9527
|
#
7935972b |
| 19-Jul-2022 |
Daniel Stenberg |
mprintf: fix *dyn_vprintf() when out-of-memory Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory leak otherwise. Closes #9185
|
#
0e48ac1f |
| 13-Jul-2022 |
Daniel Stenberg |
mprintf: make dprintf_formatf never return negative This function no longer returns a negative value if the formatting string is bad since the return value would sometimes be propagated
mprintf: make dprintf_formatf never return negative This function no longer returns a negative value if the formatting string is bad since the return value would sometimes be propagated as a return code from the mprintf* functions and they are documented to return the length of the output. Which cannot be negative. Fixes #9149 Closes #9151 Reported-by: yiyuaner on github
show more ...
|