Intention to present an alternative to improve the aforementioned method (#2034)

This commit is contained in:
Jonathan S. Fonseca 2024-05-25 10:30:01 -03:00 committed by GitHub
parent 155ae9ad65
commit 150735848d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 23 additions and 68 deletions

View File

@ -1534,8 +1534,7 @@ if(!col.notNull_){%>
if(col.colType_ == "std::string" && col.colLength_>0)
{
%>
// asString().length() creates a string object, is there any better way to validate the length?
if(pJson.isString() && pJson.asString().length() > {%col.colLength_%})
if(pJson.isString() && std::strlen(pJson.asCString()) > {%col.colLength_%})
{
err="String length exceeds limit for the " +
fieldName +

View File

@ -673,9 +673,7 @@ bool Blog::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -510,9 +510,7 @@ bool Category::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -509,9 +509,7 @@ bool Tag::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -1674,9 +1674,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";
@ -1694,9 +1692,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 64)
if (pJson.isString() && std::strlen(pJson.asCString()) > 64)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 64)";
@ -1714,9 +1710,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 64)
if (pJson.isString() && std::strlen(pJson.asCString()) > 64)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 64)";
@ -1734,9 +1728,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 20)
if (pJson.isString() && std::strlen(pJson.asCString()) > 20)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 20)";
@ -1754,9 +1746,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 50)
if (pJson.isString() && std::strlen(pJson.asCString()) > 50)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 50)";
@ -1774,9 +1764,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";
@ -1794,9 +1782,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 20)
if (pJson.isString() && std::strlen(pJson.asCString()) > 20)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 20)";

View File

@ -677,9 +677,7 @@ bool Wallets::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";

View File

@ -672,9 +672,7 @@ bool Blog::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -509,9 +509,7 @@ bool Category::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -508,9 +508,7 @@ bool Tag::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 30)
if (pJson.isString() && std::strlen(pJson.asCString()) > 30)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 30)";

View File

@ -1656,9 +1656,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";
@ -1676,9 +1674,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 64)
if (pJson.isString() && std::strlen(pJson.asCString()) > 64)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 64)";
@ -1696,9 +1692,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 64)
if (pJson.isString() && std::strlen(pJson.asCString()) > 64)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 64)";
@ -1716,9 +1710,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 20)
if (pJson.isString() && std::strlen(pJson.asCString()) > 20)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 20)";
@ -1736,9 +1728,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 50)
if (pJson.isString() && std::strlen(pJson.asCString()) > 50)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 50)";
@ -1756,9 +1746,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";
@ -1793,9 +1781,7 @@ bool Users::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 20)
if (pJson.isString() && std::strlen(pJson.asCString()) > 20)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 20)";

View File

@ -676,9 +676,7 @@ bool Wallets::validJsonOfField(size_t index,
err = "Type error in the " + fieldName + " field";
return false;
}
// asString().length() creates a string object, is there any better
// way to validate the length?
if (pJson.isString() && pJson.asString().length() > 32)
if (pJson.isString() && std::strlen(pJson.asCString()) > 32)
{
err = "String length exceeds limit for the " + fieldName +
" field (the maximum value is 32)";