ChatON: Cleanup/Refine initial go at tmpl_apply_ex_capi
This commit is contained in:
parent
7c288d3dfc
commit
43a3a91b03
1 changed files with 11 additions and 4 deletions
|
@ -608,7 +608,10 @@ inline int32_t chaton_tmpl_apply_ex_capi(
|
||||||
std::string taggedMsgs;
|
std::string taggedMsgs;
|
||||||
std::string types;
|
std::string types;
|
||||||
std::vector<int> lens;
|
std::vector<int> lens;
|
||||||
int32_t taggedLength = chaton_tmpl_apply_ex(tmpl, vMsgs, taggedMsgs, types, lens, alertAssistantAtEnd);
|
if (!chaton_tmpl_apply_ex(tmpl, vMsgs, taggedMsgs, types, lens, alertAssistantAtEnd)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int32_t taggedLength = taggedMsgs.size();
|
||||||
if (taggedLength <= 0) {
|
if (taggedLength <= 0) {
|
||||||
return taggedLength;
|
return taggedLength;
|
||||||
}
|
}
|
||||||
|
@ -616,11 +619,15 @@ inline int32_t chaton_tmpl_apply_ex_capi(
|
||||||
strlcpy(dest, taggedMsgs.c_str(), destLength);
|
strlcpy(dest, taggedMsgs.c_str(), destLength);
|
||||||
}
|
}
|
||||||
if (*pNumParts > 0) {
|
if (*pNumParts > 0) {
|
||||||
|
if (partTypes != nullptr) {
|
||||||
strlcpy(partTypes, types.c_str(), *pNumParts);
|
strlcpy(partTypes, types.c_str(), *pNumParts);
|
||||||
|
}
|
||||||
|
if (partLengths != nullptr) {
|
||||||
for(int i=0; i < *pNumParts; i++) {
|
for(int i=0; i < *pNumParts; i++) {
|
||||||
partLengths[i] = lens[i];
|
partLengths[i] = lens[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*pNumParts = types.length();
|
*pNumParts = types.length();
|
||||||
return taggedLength;
|
return taggedLength;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue