summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-24 09:41:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-04-24 16:04:19 +0200
commit3e3a220a1516fae7a038aec63388c97c8cc5c694 (patch)
tree93be1ba3264115cf0268308ea92c242ea0547215 /hwpfilter
parent33a4a934a230c551d053c30938ec802b2924182b (diff)
cid#1524749 Copy into fixed size buffer
Change-Id: I0a4d11fc15c9e7603f6c46c2075373722722b437 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150905 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hwpeq.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 71e3f8984d25..93469f68828f 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -708,17 +708,17 @@ static char eq2ltxconv(OString& sstr, std::istream *strm, const char *sentinel)
make_keyword(key, token);
const hwpeq *eq = nullptr;
if( (eq = lookup_eqn(key)) != nullptr ) {
+ const bool bUpperFollowingChar = ( (eq->flag & EQ_CASE)
+ && rtl::isAsciiUpperCase(static_cast<unsigned char>(token[0])) );
+
if( eq->latex )
- strcpy(key, eq->latex);
+ token = eq->latex;
else {
- key[0] = '\\';
- strcpy(key + 1, eq->key);
+ token = OString::Concat("\\") + eq->key;
}
- if( (eq->flag & EQ_CASE)
- && rtl::isAsciiUpperCase(static_cast<unsigned char>(token[0])) )
- key[1] = sal::static_int_cast<char>(
- rtl::toAsciiUpperCase(static_cast<unsigned char>(key[1])));
- token = key;
+
+ if (bUpperFollowingChar)
+ token = token.replaceAt(1, 1, token.copy(1, 1).toAsciiUpperCase());
}
if( token[0] == '{' ) { // grouping