From 3f7a7df7409e177f158bdd677321e4a61eb6a440 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 27 Aug 2024 16:20:49 +0100 Subject: Deprecate the raw overload of GenRandomStr in favour of GenRandom. The raw overload was almost always misused where GenRandom would be better. While we're making changes to this code switch the printable mode to use a static array like Anope does. --- include/inspircd.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/inspircd.h b/include/inspircd.h index e1b166a1b..c7364f7a8 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -290,12 +290,19 @@ public: */ unsigned long GenRandomInt(unsigned long max) const; + /** Generates a human readable random string. + * @param length The length in bytes. + * @return A random string of \p length bytes. + */ + std::string GenRandomStr(size_t length) const; + /** Generates a random string. * @param length The length in bytes. * @param printable Whether to only return printable characters. * @return A random string of \p length bytes. */ - std::string GenRandomStr(size_t length, bool printable = true) const; + [[deprecated("Use GenRandomStr(length) or GenRandom(buf, len) instead")]] + std::string GenRandomStr(size_t length, bool printable) const; /** Retrieves a 64k buffer used to read socket data into. */ inline auto* GetReadBuffer() { return readbuffer; } -- cgit v1.3.1-10-gc9f91