[Libreoffice] [PATCH] Fix for fdo#30550 Character count without spaces

John LeMoyne Castle lemoyne.castle at gmail.com
Tue Jun 21 18:13:11 PDT 2011

Hi Korrawit, Cedric, all ...

A first, quick reply is that this patch of mine contains the dread redline
+ // make a copy of the text
+ String& rTextCopy = const_cast<String&>(m_Text);

The latter needs to be modified to include (or be immediately followed by)
Cedric's fix: 

- String& rTextCopy = const_cast<String&>(m_Text);
+ String rTextCopy = m_Text.Copy( );

which is reattached here from an earlier post on dev-list -- [REVIEW] fix
for fdo#37584 
[(Redlines Erased By Word Count) == 3.4 Blocker]


I distinctly recall thinking that the word count process was making an extra
copy of the string in this upper word count level and the lower text
node/iterator levels.  It was my stupid mistake to do this 'optimization' in
word count where no effect on the document text is a mandatory requirement
-- in fact my 'extra copy' idea may have been a misreading of what went on
further down in the code.  

Very much better to not do the shallow copy, thereby keeping redlined and
hidden text.

I also note that the shallow copy was already in place at the time of the
particular patch attached to the OP. 
There is no deep copy in the lines replaced by the OP patch dated
- String aOldStr( m_Text );
- String& rCastStr = const_cast<String&>(m_Text);

There were a few other commits in the word count area in late October -
early November 2010.  
Perhaps there is another missing patch?
I will use this area as a case for practice with git log/rev-list and
At the very least, I will search commit logs for patches by myself and
Mattias Johnsson.

Many thanks for bringing this up Korrawit.
LeMoyne -- jlc

View this message in context: http://nabble.documentfoundation.org/PATCH-Fix-for-fdo-30550-Character-count-without-spaces-tp3092043p3093766.html
Sent from the Dev mailing list archive at Nabble.com.

More information about the LibreOffice mailing list