From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/llui/lltextvalidate.cpp | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'indra/llui/lltextvalidate.cpp') diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index bfe0a5bb5d..bd3cfbacde 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -55,7 +55,7 @@ namespace LLTextValidate { LLLocale locale(LLLocale::USER_LOCALE); - bool success = TRUE; + bool success = true; LLWString trimmed = str; LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); @@ -76,7 +76,7 @@ namespace LLTextValidate { if( (decimal_point != trimmed[i] ) && !LLStringOps::isDigit( trimmed[i] ) ) { - success = FALSE; + success = false; break; } } @@ -93,7 +93,7 @@ namespace LLTextValidate { LLLocale locale(LLLocale::USER_LOCALE); - bool success = TRUE; + bool success = true; LLWString trimmed = str; LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); @@ -111,7 +111,7 @@ namespace LLTextValidate { if( !LLStringOps::isDigit( trimmed[i] ) ) { - success = FALSE; + success = false; break; } } @@ -127,19 +127,19 @@ namespace LLTextValidate LLWString trimmed = str; LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); - bool success = TRUE; + bool success = true; if(0 < len) { if(('-' == trimmed[0]) || ('0' == trimmed[0])) { - success = FALSE; + success = false; } S32 i = 0; while(success && (i < len)) { if(!LLStringOps::isDigit(trimmed[i++])) { - success = FALSE; + success = false; } } } @@ -148,7 +148,7 @@ namespace LLTextValidate S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); if (val <= 0) { - success = FALSE; + success = false; } } return success; @@ -161,19 +161,19 @@ namespace LLTextValidate LLWString trimmed = str; LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); - bool success = TRUE; + bool success = true; if(0 < len) { if('-' == trimmed[0]) { - success = FALSE; + success = false; } S32 i = 0; while(success && (i < len)) { if(!LLStringOps::isDigit(trimmed[i++])) { - success = FALSE; + success = false; } } } @@ -182,7 +182,7 @@ namespace LLTextValidate S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); if (val < 0) { - success = FALSE; + success = false; } } return success; @@ -194,19 +194,19 @@ namespace LLTextValidate LLWString test_str = str; S32 len = test_str.length(); - bool success = TRUE; + bool success = true; if(0 < len) { if('-' == test_str[0]) { - success = FALSE; + success = false; } S32 i = 0; while(success && (i < len)) { if(!LLStringOps::isDigit(test_str[i]) || LLStringOps::isSpace(test_str[i++])) { - success = FALSE; + success = false; } } } @@ -215,7 +215,7 @@ namespace LLTextValidate S32 val = strtol(wstring_to_utf8str(test_str).c_str(), NULL, 10); if (val < 0) { - success = FALSE; + success = false; } } return success; @@ -225,14 +225,14 @@ namespace LLTextValidate { LLLocale locale(LLLocale::USER_LOCALE); - bool rv = TRUE; + bool rv = true; S32 len = str.length(); if(len == 0) return rv; while(len--) { if( !LLStringOps::isAlnum((char)str[len]) ) { - rv = FALSE; + rv = false; break; } } @@ -243,14 +243,14 @@ namespace LLTextValidate { LLLocale locale(LLLocale::USER_LOCALE); - bool rv = TRUE; + bool rv = true; S32 len = str.length(); if(len == 0) return rv; while(len--) { if(!(LLStringOps::isAlnum((char)str[len]) || (' ' == str[len]))) { - rv = FALSE; + rv = false; break; } } @@ -262,7 +262,7 @@ namespace LLTextValidate // inventory item names, parcel names, object names, etc. bool validateASCIIPrintableNoPipe(const LLWString &str) { - bool rv = TRUE; + bool rv = true; S32 len = str.length(); if(len == 0) return rv; while(len--) @@ -272,14 +272,14 @@ namespace LLTextValidate || wc > 0x7f || wc == '|') { - rv = FALSE; + rv = false; break; } if(!(wc == ' ' || LLStringOps::isAlnum((char)wc) || LLStringOps::isPunct((char)wc) ) ) { - rv = FALSE; + rv = false; break; } } @@ -290,7 +290,7 @@ namespace LLTextValidate // Used for avatar names bool validateASCIIPrintableNoSpace(const LLWString &str) { - bool rv = TRUE; + bool rv = true; S32 len = str.length(); if(len == 0) return rv; while(len--) @@ -300,13 +300,13 @@ namespace LLTextValidate || wc > 0x7f || LLStringOps::isSpace(wc)) { - rv = FALSE; + rv = false; break; } if( !(LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len]) ) ) { - rv = FALSE; + rv = false; break; } } @@ -315,13 +315,13 @@ namespace LLTextValidate bool validateASCII(const LLWString &str) { - bool rv = TRUE; + bool rv = true; S32 len = str.length(); while(len--) { if (str[len] < 0x20 || str[len] > 0x7f) { - rv = FALSE; + rv = false; break; } } @@ -332,7 +332,7 @@ namespace LLTextValidate { if (LLStringOps::isSpace(str[0])) { - return FALSE; + return false; } return validateASCII(str); } @@ -341,13 +341,13 @@ namespace LLTextValidate // Example is landmark description in Places SP. bool validateASCIIWithNewLine(const LLWString &str) { - bool rv = TRUE; + bool rv = true; S32 len = str.length(); while(len--) { if ((str[len] < 0x20 && str[len] != 0xA) || str[len] > 0x7f) { - rv = FALSE; + rv = false; break; } } -- cgit v1.2.3 From a0b3021bdcf76859054fda8e30abb3ed47749e83 Mon Sep 17 00:00:00 2001 From: Bennett Goble Date: Wed, 29 May 2024 08:10:00 -0700 Subject: Trim trailing whitespace Start trimming trailing whitespace, but limit the blast radius to a handful of file types. --- indra/llui/lltextvalidate.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llui/lltextvalidate.cpp') diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..7ea8a3347e 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -1,25 +1,25 @@ -/** +/** * @file lltextvalidate.cpp * @brief Text validation helper functions * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 1 Jun 2024 15:49:26 +0200 Subject: Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings --- indra/llui/lltextvalidate.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'indra/llui/lltextvalidate.cpp') diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..f9de6f7386 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -73,7 +73,7 @@ class ValidatorFloat : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { // May be a comma or period, depending on the locale @@ -118,7 +118,7 @@ class ValidatorInt : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { S32 i = 0; @@ -157,7 +157,7 @@ class ValidatorPositiveS32 : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -167,7 +167,7 @@ class ValidatorPositiveS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinusOrZero", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -177,7 +177,7 @@ class ValidatorPositiveS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val <= 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -201,7 +201,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -211,7 +211,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -221,7 +221,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -244,7 +244,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl LLLocale locale(LLLocale::USER_LOCALE); std::basic_string test_str = str; - S32 len = test_str.length(); + auto len = test_str.length(); if (0 < len) { CHAR ch = test_str.front(); @@ -254,7 +254,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = test_str[i]; if (!LLStringOps::isDigit(ch) || LLStringOps::isSpace(ch)) @@ -264,7 +264,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl } } - S32 val = strtol(test_str); + auto val = strtol(test_str); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(test_str))); @@ -286,7 +286,7 @@ class ValidatorAlphaNum : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -313,7 +313,7 @@ class ValidatorAlphaNumSpace : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -341,7 +341,7 @@ class ValidatorASCIIPrintableNoPipe : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -368,7 +368,7 @@ class ValidatorASCIIPrintableNoSpace : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -395,7 +395,7 @@ protected: template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -441,7 +441,7 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; -- cgit v1.2.3