1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00
transmission/libtransmission
Charles Kerr 8a35aa0903
refactor: add tr_rand_obj() (#4238)
* refactor: add tr_rand_obj()

There are a lot of places in the codebase where we need to populate
an integral type or a fixed-size array with random data. To do this,
we instantiate a local on the stack, fill it with tr_rand_buffer(),
and then use it.

This PR creates a helper function to make this a one-liner.
2022-11-25 15:04:37 -06:00
..
.clang-tidy refactor: cppcoreguidelines-avoid-goto (#3841) 2022-09-23 08:39:13 -05:00
announce-list.cc
announce-list.h
announcer-common.h refactor: incremental announcer refactor pt. 2 (#4214) 2022-11-18 23:00:25 -06:00
announcer-http.cc fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
announcer-udp.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
announcer.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
announcer.h refactor: incremental announcer refactor pt. 2 (#4214) 2022-11-18 23:00:25 -06:00
bandwidth.cc fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
bandwidth.h Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
benc.h perf: make methods constexpr (#3742) 2022-08-30 23:17:23 -05:00
bitfield.cc perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
bitfield.h perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
block-info.cc
block-info.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
blocklist.cc fix: warnings from clang tidy sonarcloud coverity (#4143) 2022-11-12 09:53:09 -06:00
blocklist.h refactor: simplify blocklist code (#4086) 2022-11-03 15:46:27 -05:00
cache.cc fix: crash when a torrent autopauses after encountering an error (#4021) 2022-10-24 16:57:07 -05:00
cache.h fix: crash when a torrent autopauses after encountering an error (#4021) 2022-10-24 16:57:07 -05:00
clients.cc fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
clients.h refactor: simplify tr_clientForId() (#3751) 2022-09-03 02:13:22 -05:00
CMakeLists.txt refactor: try again to use getaddrinfo in announcer_udp (#4201) 2022-11-16 15:13:31 -06:00
completion.cc perf: make methods constexpr (#3742) 2022-08-30 23:17:23 -05:00
completion.h perf: make methods constexpr (#3742) 2022-08-30 23:17:23 -05:00
crypto-utils-ccrypto.cc Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
crypto-utils-cyassl.cc
crypto-utils-fallback.cc
crypto-utils-openssl.cc
crypto-utils-polarssl.cc
crypto-utils.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
crypto-utils.h refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
error-types.h
error.cc
error.h fix: fix various user facing and non-user facing typos (#3743) 2022-08-31 11:28:54 -05:00
file-piece-map.cc chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
file-piece-map.h chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
file-posix.cc perf: tr_sys_path_basename() returns a std::string_view (#4176) 2022-11-15 08:29:00 -06:00
file-win32.cc perf: tr_sys_path_basename() returns a std::string_view (#4176) 2022-11-15 08:29:00 -06:00
file.cc refactor: remove tr_sys file_map_for_reading() (#3723) 2022-08-27 14:05:21 -05:00
file.h perf: tr_sys_path_basename() returns a std::string_view (#4176) 2022-11-15 08:29:00 -06:00
handshake.cc fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
handshake.h refactor: decouple tr-dht from peerMsgs, peerMgr (#3966) 2022-10-15 08:22:43 -05:00
history.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
inout.cc Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
inout.h Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
interned-string.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
jsonsl.c fix: some typos (#3904) 2022-10-13 09:35:10 -05:00
jsonsl.h fix: fix various user facing and non-user facing typos (#3743) 2022-08-31 11:28:54 -05:00
libt.dox
log.cc refactor: remove TR_PRIsv macros (#3842) 2022-09-23 14:36:37 -05:00
log.h refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
lru-cache.h perf: make methods constexpr (#3742) 2022-08-30 23:17:23 -05:00
magnet-metainfo.cc fix: fix various user facing and non-user facing typos (#3743) 2022-08-31 11:28:54 -05:00
magnet-metainfo.h
makemeta.cc
makemeta.h refactor: add [[nodiscard]] (#3793) 2022-09-08 21:49:51 -05:00
mime-types.h
mime-types.js
net.cc fix: ftbfs on Windows (#4204) 2022-11-16 18:03:48 -06:00
net.h refactor: replace tr_boundinfo with tr_session::BoundSocket (#4103) 2022-11-06 10:35:48 -06:00
open-files.cc refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
open-files.h
peer-common.h perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
peer-io.cc refactor: log UTP_ETIMEDOUT errors to 'trace' messages (#4237) 2022-11-25 14:44:49 -06:00
peer-io.h refactor: aggregate dh in peer io (#4218) 2022-11-21 18:08:06 -06:00
peer-mgr-active-requests.cc
peer-mgr-active-requests.h
peer-mgr-wishlist.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
peer-mgr-wishlist.h
peer-mgr.cc fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
peer-mgr.h fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
peer-mse.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
peer-mse.h fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
peer-msgs.cc fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
peer-msgs.h perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
peer-socket.h
platform-quota.cc chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
platform-quota.h
platform.cc Fix web client directory name on Windows (#4099) 2022-11-05 08:45:34 +00:00
platform.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
port-forwarding-natpmp.cc refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
port-forwarding-natpmp.h refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
port-forwarding-upnp.cc refactor: aggregate dh in peer io (#4218) 2022-11-21 18:08:06 -06:00
port-forwarding-upnp.h refactor: port forwarding (#3850) 2022-09-30 08:59:10 -05:00
port-forwarding.cc refactor: replace tr_boundinfo with tr_session::BoundSocket (#4103) 2022-11-06 10:35:48 -06:00
port-forwarding.h refactor: replace tr_boundinfo with tr_session::BoundSocket (#4103) 2022-11-06 10:35:48 -06:00
quark.cc refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
quark.h refactor: remove tr_quark_get_string() (#3728) 2022-08-28 16:17:07 -05:00
resume.cc refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
resume.h
rpc-server.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
rpc-server.h refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
rpcimpl.cc fix: 4.0.0-beta.1 wrong RPC response for group-get (#4171) 2022-11-14 16:31:41 -06:00
rpcimpl.h
session-alt-speeds.cc fixup: silence "empty expression statement has no effect" warning (#4074) 2022-11-02 09:04:22 -05:00
session-alt-speeds.h refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
session-id.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
session-id.h
session-settings.cc fixup: silence "empty expression statement has no effect" warning (#4074) 2022-11-02 09:04:22 -05:00
session-settings.h refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
session-thread.cc fix: warnings from clang tidy sonarcloud coverity (#4143) 2022-11-12 09:53:09 -06:00
session-thread.h refactor: make tr_session_thread a unique_ptr owned by tr_session (#4069) 2022-11-04 16:20:27 -05:00
session.cc fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
session.h Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
stats.cc
stats.h refactor: more constexpr (#3744) 2022-08-31 17:33:51 -05:00
subprocess-posix.cc refactor: cppcoreguidelines-avoid-goto (#3841) 2022-09-23 08:39:13 -05:00
subprocess-win32.cc
subprocess.h
timer-ev.cc fix: more thread safety updates (#4136) 2022-11-10 12:04:49 -06:00
timer-ev.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
timer.h refactor: try again to use getaddrinfo in announcer_udp (#4201) 2022-11-16 15:13:31 -06:00
torrent-ctor.cc refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
torrent-files.cc chore: iwyu headers (#3833) 2022-09-21 18:34:18 -05:00
torrent-files.h
torrent-magnet.cc Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
torrent-magnet.h fix: FTBFS on Windows (#4036) 2022-10-28 19:12:37 -05:00
torrent-metainfo.cc chore: iwyu headers (#3833) 2022-09-21 18:34:18 -05:00
torrent-metainfo.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
torrent.cc perf: constexpr and move work outside of loops (#4224) 2022-11-22 14:00:09 -06:00
torrent.h perf: constexpr and move work outside of loops (#4224) 2022-11-22 14:00:09 -06:00
torrents.cc
torrents.h
tr-arc4.h refactor: aggregate dh in peer io (#4218) 2022-11-21 18:08:06 -06:00
tr-assert.cc
tr-assert.h
tr-assert.mm fix: fix various user facing and non-user facing typos (#3743) 2022-08-31 11:28:54 -05:00
tr-buffer.h perf: buffer iterators (#4220) 2022-11-21 23:54:28 -06:00
tr-dht.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
tr-dht.h refactor: make DHT unblocking (#4122) 2022-11-11 10:09:24 -06:00
tr-getopt.cc refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
tr-getopt.h refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
tr-lpd.cc refactor: add tr_rand_obj() (#4238) 2022-11-25 15:04:37 -06:00
tr-lpd.h refactor: add tr_port_forwarding::Mediator (#3855) 2022-10-01 09:12:49 -05:00
tr-macros.h refactor: add tr_address::fromSockaddr() (#3964) 2022-10-14 01:20:39 -05:00
tr-popcount.h fix: fix various user facing and non-user facing typos (#3743) 2022-08-31 11:28:54 -05:00
tr-strbuf.h refactor: remove unnecessary default destructors (#3740) 2022-08-30 14:31:40 -05:00
tr-udp.cc refactor: make DHT unblocking (#4122) 2022-11-11 10:09:24 -06:00
tr-utp.cc fix: more thread safety updates (#4136) 2022-11-10 12:04:49 -06:00
tr-utp.h
transmission.h Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
utils-ev.h fix: warnings from clang tidy sonarcloud coverity (#4143) 2022-11-12 09:53:09 -06:00
utils.cc fix: warnings from clang tidy sonarcloud coverity (#4143) 2022-11-12 09:53:09 -06:00
utils.h fix: minor recent clang warnings (#4111) 2022-11-07 11:48:26 -06:00
variant-benc.cc refactor: extract tr_buffer class from tr_peerIo (#3986) 2022-10-19 11:42:08 -05:00
variant-common.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
variant-converters.cc refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
variant-json.cc fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
variant.cc refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
variant.h refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
verify.cc fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
verify.h fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
version.h.in build: support semver versioning (#3867) 2022-10-05 16:53:10 -05:00
watchdir-base.h refactor: add tr_port_forwarding::Mediator (#3855) 2022-10-01 09:12:49 -05:00
watchdir-generic.cc refactor: add tr_port_forwarding::Mediator (#3855) 2022-10-01 09:12:49 -05:00
watchdir-inotify.cc refactor: aggregate dh in peer io (#4218) 2022-11-21 18:08:06 -06:00
watchdir-kqueue.cc refactor: add libtransmission::evhelpers (#4104) 2022-11-06 15:11:30 -06:00
watchdir-win32.cc
watchdir.cc refactor: remove unused vars, code simplify and minor optimize (#4172) 2022-11-19 09:46:03 -06:00
watchdir.h fix: minor recent clang warnings (#4111) 2022-11-07 11:48:26 -06:00
web-utils.cc
web-utils.h refactor: add [[nodiscard]] (#3793) 2022-09-08 21:49:51 -05:00
web.cc refactor: better TR_CURL_SSL_NO_VERIFY (#4159) 2022-11-13 17:17:16 -06:00
web.h Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -06:00
webseed.cc perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
webseed.h
wildmat.c