From ac8a1cde521293c3a9329be51eb49dedfd567ddc Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Mon, 6 Nov 2023 20:40:41 +0000 Subject: [PATCH 1/2] style: removed spacing in emoji and change initalisers in voicestate --- include/dpp/emoji.h | 6 +++--- include/dpp/voicestate.h | 10 +++++----- src/dpp/voicestate.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/dpp/emoji.h b/include/dpp/emoji.h index 40b38b1571..7e0549bd2a 100644 --- a/include/dpp/emoji.h +++ b/include/dpp/emoji.h @@ -45,17 +45,17 @@ enum emoji_flags : uint8_t { /** * @brief Managed (introduced by application) */ - e_managed = 0b00000010, + e_managed = 0b00000010, /** * @brief Animated emoji. */ - e_animated = 0b00000100, + e_animated = 0b00000100, /** * @brief Available (false if the guild doesn't meet boosting criteria, etc) */ - e_available = 0b00001000, + e_available = 0b00001000, }; /** diff --git a/include/dpp/voicestate.h b/include/dpp/voicestate.h index b99c174301..b5f9b55bcf 100644 --- a/include/dpp/voicestate.h +++ b/include/dpp/voicestate.h @@ -94,19 +94,19 @@ class DPP_EXPORT voicestate : public json_interface { /** * @brief Optional: The guild id this voice state is for. */ - snowflake guild_id; + snowflake guild_id{0}; /** * @brief The channel id this user is connected to. * * @note This may be empty. */ - snowflake channel_id; + snowflake channel_id{0}; /** * @brief The user id this voice state is for. */ - snowflake user_id; + snowflake user_id{0}; /** * @brief The session id for this voice state. @@ -116,14 +116,14 @@ class DPP_EXPORT voicestate : public json_interface { /** * @brief Voice state flags from dpp::voicestate_flags. */ - uint8_t flags; + uint8_t flags{0}; /** * @brief The time at which the user requested to speak. * * @note If the user never requested to speak, this is 0. */ - time_t request_to_speak; + time_t request_to_speak{0}; /** * @brief Construct a new voicestate object diff --git a/src/dpp/voicestate.cpp b/src/dpp/voicestate.cpp index e69211dba8..e421cfbd1f 100644 --- a/src/dpp/voicestate.cpp +++ b/src/dpp/voicestate.cpp @@ -32,12 +32,12 @@ voicestate::voicestate() : shard(nullptr), guild_id(0), channel_id(0), user_id(0 } voicestate& voicestate::fill_from_json_impl(nlohmann::json* j) { - guild_id = snowflake_not_null(j, "guild_id"); - channel_id = snowflake_not_null(j, "channel_id"); - user_id = snowflake_not_null(j, "user_id"); - session_id = string_not_null(j, "session_id"); - request_to_speak = ts_not_null(j, "request_to_speak_timestamp"); - flags = 0; + set_snowflake_not_null(j, "guild_id", guild_id); + set_snowflake_not_null(j, "channel_id", channel_id); + set_snowflake_not_null(j, "user_id", user_id); + set_string_not_null(j, "session_id", session_id); + set_ts_not_null(j, "request_to_speak_timestamp", request_to_speak); + if (bool_not_null(j, "deaf")) { flags |= vs_deaf; } From d4e1c76427654af55cc598d559697d65f4d7fa52 Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Mon, 6 Nov 2023 20:49:57 +0000 Subject: [PATCH 2/2] style: found more silly comments --- include/dpp/isa/avx.h | 5 ++++- include/dpp/isa/avx2.h | 5 ++++- include/dpp/isa/avx512.h | 5 ++++- src/dpp/utility.cpp | 20 ++++++++++++++------ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/include/dpp/isa/avx.h b/include/dpp/isa/avx.h index 1700ca7808..3dc2914d0f 100644 --- a/include/dpp/isa/avx.h +++ b/include/dpp/isa/avx.h @@ -73,7 +73,10 @@ namespace dpp { } protected: - alignas(16) float values[byte_blocks_per_register]{};///< Array for storing the values to be loaded/stored. + /** + * @brief Array for storing the values to be loaded/stored. + */ + alignas(16) float values[byte_blocks_per_register]{}; /** * @brief Stores values from a 128-bit AVX vector to a storage location. diff --git a/include/dpp/isa/avx2.h b/include/dpp/isa/avx2.h index 579025f246..1e02eaa935 100644 --- a/include/dpp/isa/avx2.h +++ b/include/dpp/isa/avx2.h @@ -76,7 +76,10 @@ namespace dpp { } protected: - alignas(32) float values[byte_blocks_per_register]{};///< Array for storing the values to be loaded/stored. + /** + * @brief Array for storing the values to be loaded/stored. + */ + alignas(32) float values[byte_blocks_per_register]{}; /** * @brief Stores values from a 256-bit AVX2 vector to a storage location. diff --git a/include/dpp/isa/avx512.h b/include/dpp/isa/avx512.h index 2bdc3344e6..bdf1d47859 100644 --- a/include/dpp/isa/avx512.h +++ b/include/dpp/isa/avx512.h @@ -79,7 +79,10 @@ namespace dpp { } protected: - alignas(64) float values[byte_blocks_per_register]{};///< Array for storing the values to be loaded/stored. + /** + * @brief Array for storing the values to be loaded/stored. + */ + alignas(64) float values[byte_blocks_per_register]{}; /** * @brief Stores values from a 512-bit AVX512 vector to a storage location. diff --git a/src/dpp/utility.cpp b/src/dpp/utility.cpp index 947f665962..07638d1201 100644 --- a/src/dpp/utility.cpp +++ b/src/dpp/utility.cpp @@ -877,15 +877,23 @@ std::string make_url_parameters(const std::map& parameter std::string markdown_escape(const std::string& text, bool escape_code_blocks) { /** - * @brief Represents the current state of the finite state machine - * for the markdown_escape function. - */ + * @brief Represents the current state of the finite state machine + * for the markdown_escape function. + */ enum md_state { - /// normal text + /** + * @brief Normal text + */ md_normal = 0, - /// a paragraph code block, represented by three backticks + + /** + * @brief A paragraph code block, represented by three backticks. + */ md_big_code_block = 1, - /// an inline code block, represented by one backtick + + /** + * @brief An inline code block, represented by one backtick. + */ md_small_code_block = 2, };