Skip to content

Commit f12b9e0

Browse files
discollizarddiscollizard
andauthored
changing std::strlen to a string comparison consistent with multibyte chars on model generation template (#2379)
Co-authored-by: discollizard <[email protected]>
1 parent 065899d commit f12b9e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drogon_ctl/templates/model_cc.csp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,14 +1539,14 @@ if(!col.notNull_){%>
15391539
if(col.colType_ == "std::string" && col.colLength_>0)
15401540
{
15411541
%>
1542-
if(pJson.isString() && std::strlen(pJson.asCString()) > {%col.colLength_%})
1542+
if(pJson.isString() && std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>{}
1543+
.from_bytes(pJson.asCString()).size() > {%col.colLength_%})
15431544
{
15441545
err="String length exceeds limit for the " +
15451546
fieldName +
15461547
" field (the maximum value is {%col.colLength_%})";
15471548
return false;
15481549
}
1549-
15501550
<%c++
15511551
}
15521552
}

0 commit comments

Comments
 (0)