summaryrefslogtreecommitdiff
path: root/src/utils/cpp
AgeCommit message (Collapse)Author
2024-10-08Name local variables using lower_caseMaksim Denisov
...and private members using lower_case_
2024-10-08Name value template parameters using kCamelCase.Maksim Denisov
2024-10-08Name constexpr variables using kCamelCase.Maksim Denisov
2024-10-08Name classes, structs and enums using CamelCase.Maksim Denisov
2024-10-07Disable misc-no-recursion checkMaksim Denisov
...since we use recursion for trees a lot, but skip this check manually.
2024-10-07Enable readability-* checks.Maksim Denisov
2024-10-07Enable readability-redundant-member-init check.Maksim Denisov
2024-10-07Enable modernize-* checks.Maksim Denisov
2024-09-23Reorder dependencies and remove duplicates in OSSMaksim Denisov
2024-09-18Add cast of TransformedRange to std::vectorMaksim Denisov
2024-09-18Add missing #endif comments in headersMaksim Denisov
2024-09-09Remove verify_hash libraryMaksim Denisov
...that is fully replaced by hash_info
2024-09-09Implement HashInfo classMaksim Denisov
...that validates hashes and stores some additional information about them.
2024-08-29async_map_utils: Pass key_printer also for reporting pending tasks...Paul Cristian Sarbu
...in async map instances, same as for reporting cycles. This removes the restriction that the key object has to posses the ToString method, allowing it to be used, e.g., with just-mr maps. The now obsolete HasToString concept is removed.
2024-08-27Reformat code to comply with clang-format 18Klaus Aehlig
... while keeping our .clang-format file.
2024-08-07Replace classic C boolean operators with keywordsMaksim Denisov
! => not; && => and, || => or
2024-08-05When using errno, log the actual error messagePaul Cristian Sarbu
For the user it is more useful to see the actual error message, provided by strerror(), than the pure error code.
2024-08-05Add missing cerrno includesPaul Cristian Sarbu
2024-08-01Add a utility function to rewrite path strings relative to a subdirectoryKlaus Aehlig
2024-06-28Add C++ utility classes (un)expectedOliver Reiche
... mimicking C++23's std::(un)expected, so we can more easily adapt to newer C++ standards once we decide to upgrade.
2024-06-17Add utility function for prefixing each line of a stringKlaus Aehlig
... and thus allowing proper quoting of command output.
2024-05-28Implement "on the fly" transformed range.Maksim Denisov
2024-04-11json: support pruningKlaus Aehlig
... by removing from an object the outer keys where the value is null.
2024-04-08Use properly included standard library types by defaultPaul Cristian Sarbu
2024-04-08Consistently guard all POSIX C includesPaul Cristian Sarbu
2024-03-26Add missing system includesPaul Cristian Sarbu
Main culprits: - std::size_t, std::nullptr_t, and NULL require <cstddef> - std::move and std::forward require <utility> - unordered maps and sets require respective includes - std::for_each and std::all_of require <algorithm>
2024-03-15Clean up more includes and targetsPaul Cristian Sarbu
Some of the more specific issues addressed: - missing log_level target/include - header-only libs wrongly marking deps as private - missing/misplaced gsl includes
2024-03-07TmpDir: Getter should return const refOliver Reiche
... and prohibit moves and move assignments.
2024-02-29verify_hash utils: Clarify return value meaningPaul Cristian Sarbu
2024-02-15atomic: Fix potential raceOliver Reiche
... as any unguarded access to non-const members of the same shared_ptr instance require the use of `atomic_load` and `atomic_store`.
2023-11-30Resolve inconsistencies in third-party headers include formatPaul Cristian Sarbu
2023-11-15utils/cpp: add IsAHash functionAlberto Sartori
This function is mainly used to check that the hash of a Digest received over the wire is a real hash, to prevent a malicious attack.
2023-09-13utils: No hash for upcoming libstdc++ 11 releasesOliver Reiche
2023-08-28fmt: Specialize formatter only for version >= 10Oliver Reiche
2023-08-28Fix path hash for libstdc++ bug-fix release 11.4Oliver Reiche
... std::hash<fs::path> was first implemented in libstdc++ version 12. However, that change was also backported to bug-fix release 11.4, so we may not include our reimplementation if that version is used.
2023-08-28Add explicit fmt::formatter for nlohmann::basic_jsonMichael Thies
The formatter is based on fmt's ostream_formatter, using the provided operator<<(std::ostream&) of nlohmann::basic_json. This is required to allow compilation against fmt 10.x Co-authored-by: Oliver Reiche <oliver.reiche@huawei.com>
2023-08-23utils path: Add missing inline specifierOliver Reiche
... to suppress 'unused function' warnings.
2023-08-07utils: Add function to check for confined pathsPaul Cristian Sarbu
2023-08-07utils: path normalization method should be noexceptPaul Cristian Sarbu
2023-06-26filesystem: Add logic for handling (non-upwards) symlinksPaul Cristian Sarbu
2023-06-05File Locking: only compute absolute path, if not absolute alreadyKlaus Aehlig
... and in this way, ensure we can lock files given by absolute path even if we don't have a working directory. While there, drop uncessary split just to combine of the file name.
2023-05-31utils: Relocate the std::filesystem::hash_value libc fix...Paul Cristian Sarbu
...and make the use of std::hash consistent. This will make it easier to remove the fix once the libc implementation we use catches up with the C++ standard.
2023-04-26imports: Switch to Microsoft GSL implementationOliver Reiche
... with two minor code base changes compared to previous use of gsl-lite: - dag.hpp: ActionNode::Ptr and ArtifactNode::Ptr are not wrapped in gsl::not_null<> anymore, due to lack of support for wrapping std::unique_ptr<>. More specifically, the move constructor is missing, rendering it impossible to use std::vector<>::emplace_back(). - utils/cpp/gsl.hpp: New header file added to implement the macros ExpectsAudit() and EnsureAudit(), asserts running only in debug builds, which were available in gsl-lite but are missing in MS GSL.
2023-02-17structure cleanup: move libcurl utilities to other_tools...Paul Cristian Sarbu
...in order to not include unwanted dependencies in just proper. As the whole other_tools folder is meant to be excluded from bootstrapping, also remove the bootstrap guards.
2023-02-17structure cleanup: move libarchive utilities to other_tools...Paul Cristian Sarbu
...in order to not include unwanted dependencies in just proper. As the whole other_tools folder is meant to be excluded from bootstrapping, also remove the bootstrap guards.
2023-02-02file_locking: fix comment describing the name of the lock fileKlaus Aehlig
As opposed the earlier ideas, the implemented behaviour is that the file name of the lock is given explicitly. Fix comments accordingly.
2023-01-20Utils: Add file locking utility classPaul Cristian Sarbu
2023-01-16CurlEasyHandle: Fix empty fetches due to unfollowed URLsPaul Cristian Sarbu
For libcurl we need to set the CURL_FOLLOWLOCATION flag (disbaled by default) to enable 3xx redirects. Libcurl has sane defaults for related settings in order to handle redirects when enabled, though for fetches there should be limited risks, as content (and SHA hashes, if provided) is checked to ensure the intended archives are fetched.
2022-12-21Utils: Add wrapper class for libarchive operationsPaul Cristian Sarbu
2022-12-21Utils: Add curl easy handle utility classPaul Cristian Sarbu