[ox/std] Update strops nodiscard use to match current style
This commit is contained in:
parent
bb4afd79d5
commit
8a6f08ae73
24
deps/ox/src/ox/std/strops.hpp
vendored
24
deps/ox/src/ox/std/strops.hpp
vendored
@ -37,21 +37,24 @@ constexpr char *ox_strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept {
|
||||
return dest;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto ox_strnlen(const char *str1, std::size_t maxLen) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr auto ox_strnlen(const char *str1, std::size_t maxLen) noexcept {
|
||||
std::size_t len = 0;
|
||||
for (; len < maxLen && str1[len]; len++);
|
||||
return len;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr auto ox_strlen(T str1) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr auto ox_strlen(T str1) noexcept {
|
||||
std::size_t len = 0;
|
||||
for (; str1[len]; len++);
|
||||
return len;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
[[nodiscard]] constexpr int ox_strcmp(T1 str1, T2 str2) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr int ox_strcmp(T1 str1, T2 str2) noexcept {
|
||||
auto retval = 0;
|
||||
auto i = 0;
|
||||
while (str1[i] || str2[i]) {
|
||||
@ -68,7 +71,8 @@ template<typename T1, typename T2>
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
[[nodiscard]] constexpr int ox_strncmp(T1 str1, T2 str2, const std::size_t maxLen) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr int ox_strncmp(T1 str1, T2 str2, const std::size_t maxLen) noexcept {
|
||||
auto retval = 0;
|
||||
std::size_t i = 0;
|
||||
while (i < maxLen && (str1[i] || str2[i])) {
|
||||
@ -84,7 +88,8 @@ template<typename T1, typename T2>
|
||||
return retval;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr const char *ox_strchr(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr const char *ox_strchr(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
for (std::size_t i = 0; i <= maxLen; i++) {
|
||||
if (str[i] == character) {
|
||||
return &str[i];
|
||||
@ -95,7 +100,8 @@ template<typename T1, typename T2>
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr char *ox_strchr(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr char *ox_strchr(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
for (std::size_t i = 0; i < maxLen; i++) {
|
||||
if (str[i] == character) {
|
||||
return &str[i];
|
||||
@ -106,7 +112,8 @@ template<typename T1, typename T2>
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr int ox_lastIndexOf(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr int ox_lastIndexOf(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
int retval = -1;
|
||||
for (std::size_t i = 0; i < maxLen && str[i]; i++) {
|
||||
if (str[i] == character) {
|
||||
@ -116,7 +123,8 @@ template<typename T1, typename T2>
|
||||
return retval;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr int ox_lastIndexOf(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr int ox_lastIndexOf(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept {
|
||||
int retval = -1;
|
||||
for (std::size_t i = 0; i < maxLen && str[i]; i++) {
|
||||
if (str[i] == character) {
|
||||
|
Loading…
Reference in New Issue
Block a user