[Libreoffice] [REVIEW] fix for fdo#37584

2011-06-08 Thread Cedric Bosdonnat
Hi all,

Could someone review the attached patch, sign it off and push it to the
3.4 branch?

John, I CC'ed you particularly to point out a bug in one of your
previous commits... that made me search hours long the source of the
bug. Please take care of these kind of things for your next patches.

Thanks,

-- 
Cédric Bosdonnat
LibreOffice hacker
http://documentfoundation.org
OOo Eclipse Integration developer
http://cedric.bosdonnat.free.fr
From 8faf697371a603eb2fa0b47ba5ab297977e7e02a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= cedric.bosdonnat@free.fr
Date: Wed, 8 Jun 2011 10:06:23 +0200
Subject: [PATCH] fdo#37584: Make a real copy of the text where to count words

Const-casting a reference doesn't create a copy of it and then the
spaces replacement made by the WordCount was also made on the actual
text node. Use String::Copy() to actually copy the text and safely
operate on it.
---
 sw/source/core/txtnode/txtedt.cxx |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index d4c02b6..08d0c6b 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1814,7 +1814,7 @@ void SwTxtNode::CountWords( SwDocStat rStat,
 }
 
 // make a copy of the text
-String rTextCopy = const_castString(m_Text);
+String rTextCopy = m_Text.Copy( );
 
 // mask out the redlined and hidden text with ' '
 const xub_Unicode cChar(' ');
-- 
1.7.3.4

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [REVIEW] fix for fdo#37584

2011-06-08 Thread John LeMoyne Castle
Cedric, 
I apologize for the time cost for you to dig this up.  

I do remember removing a string copy (or maybe two?).  I should have clearly
seen the need for a full copy after digging into the counting process and
seeing the changes it made to the string in order to count excluding hidden
or redlined,  Definitely my bad for not testing more use cases (redlining). 
I will go back and review my work in this area.  

I see that this is marked as a regression against 3.3.2 and yet the word
count work was well over 6 months ago.  
I had thought that word count w/ and w/out spaces had rolled out prior to
3.3.2   
Perhaps the problem exists (undiscovered) in 3.3.2 as well.

jlc

--
View this message in context: 
http://nabble.documentfoundation.org/REVIEW-fix-for-fdo-37584-tp3038258p3039644.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [REVIEW] fix for fdo#37584

2011-06-08 Thread John LeMoyne Castle
Test with LibreOffice 3.3.2 
OOO330m19 (Build:202)
tag libreoffice-3.3.2 

shows that Changes-Record does not produce redlining there either  
I feel sick 
jlc=={*-P}

--
View this message in context: 
http://nabble.documentfoundation.org/REVIEW-fix-for-fdo-37584-tp3038258p3039788.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice