summaryrefslogtreecommitdiff
path: root/editeng/source/misc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-06 10:12:29 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-10 12:23:42 +0100
commit065edb4c8e91170017df482843d0c3eb8d4db114 (patch)
tree1d030ec9868a56b375a563c9d6e6d81c6115d717 /editeng/source/misc
parent0b34a5dd39e177ba99cd21b639d67ac8123b8458 (diff)
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643 Reviewed-on: https://gerrit.libreoffice.org/63235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng/source/misc')
-rw-r--r--editeng/source/misc/svxacorr.cxx92
1 files changed, 45 insertions, 47 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ab2ba01378db..f84fba00dfff 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -932,65 +932,63 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
// Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator.
// all three can happen, but not more than once!
const sal_Unicode* pExceptStt = nullptr;
- if( !bAtStart )
+ bool bContinue = true;
+ Flags nFlag = Flags::NONE;
+ do
{
- bool bContinue = true;
- Flags nFlag = Flags::NONE;
- do {
- switch( *pStr )
- {
+ switch (*pStr)
+ {
// Western and Asian full stop
case '.':
- case 0x3002 :
- case 0xFF0E :
+ case 0x3002:
+ case 0xFF0E:
+ {
+ if (pStr >= pStart + 2 && *(pStr - 2) == '.')
{
- if (pStr >= pStart + 2 && *(pStr-2) == '.')
- {
- //e.g. text "f.o.o. word": Now currently considering
- //capitalizing word but second last character of
- //previous word is a . So probably last word is an
- //anagram that ends in . and not truly the end of a
- //previous sentence, so don't autocapitalize this word
- return;
- }
- if( nFlag & Flags::FullStop )
- return; // no valid separator -> no replacement
- nFlag |= Flags::FullStop;
- pExceptStt = pStr;
+ //e.g. text "f.o.o. word": Now currently considering
+ //capitalizing word but second last character of
+ //previous word is a . So probably last word is an
+ //anagram that ends in . and not truly the end of a
+ //previous sentence, so don't autocapitalize this word
+ return;
}
- break;
+ if (nFlag & Flags::FullStop)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::FullStop;
+ pExceptStt = pStr;
+ }
+ break;
case '!':
- case 0xFF01 :
- {
- if( nFlag & Flags::ExclamationMark )
- return; // no valid separator -> no replacement
- nFlag |= Flags::ExclamationMark;
- }
- break;
+ case 0xFF01:
+ {
+ if (nFlag & Flags::ExclamationMark)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::ExclamationMark;
+ }
+ break;
case '?':
- case 0xFF1F :
- {
- if( nFlag & Flags::QuestionMark)
- return; // no valid separator -> no replacement
- nFlag |= Flags::QuestionMark;
- }
- break;
+ case 0xFF1F:
+ {
+ if (nFlag & Flags::QuestionMark)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::QuestionMark;
+ }
+ break;
default:
- if( nFlag == Flags::NONE )
- return; // no valid separator -> no replacement
+ if (nFlag == Flags::NONE)
+ return; // no valid separator -> no replacement
else
bContinue = false;
break;
- }
+ }
- if( bContinue && pStr-- == pStart )
- {
- return; // no valid separator -> no replacement
- }
- } while( bContinue );
- if( Flags::FullStop != nFlag )
- pExceptStt = nullptr;
- }
+ if (bContinue && pStr-- == pStart)
+ {
+ return; // no valid separator -> no replacement
+ }
+ } while (bContinue);
+ if (Flags::FullStop != nFlag)
+ pExceptStt = nullptr;
if( 2 > ( pStr - pStart ) )
return;