[SOLVED] Re: Cppcheck: "bContainsDate" not read in templateremoteview.cxx (sfx2)

2013-02-27 Thread julien2412
Caolán McNamara wrote
> On Tue, 2013-02-12 at 05:58 -0800, julien2412 [via Document Foundation
> Mail Archive] wrote:
>> Caolán McNamara wrote
>> So, unless Rafael has other plans, it looks to me that you can
>> remove the bContainsDate lines, the aDT = lines, and the
>> getPropertyValue(..) 
>> >>= aDT block.
>> I don't know if you received some information from Raphael but if we
>> remove aDT variable, does it also mean this whole block can be
>> removed? 
>> 
>> 147 if ( bHasTargetURL && 
>> 148 INetURLObject( aContentURL
>> ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER ) 
>> 149 { 
>> 150 ucbhelper::Content aCnt( aTargetURL,
>> m_xCmdEnv, comphelper::getProcessComponentContext() ); 
>> 151 
>> 152 try 
>> 153 { 
>> 154
>> aCnt.getPropertyValue("DateModified") >>= aDT; 
>> 155 } 
>> 156 catch (...) 
>> 157 {} 
>> 158 } 
>> 
>> or does the call to Content constructor initialize something that I
>> missed
> 
> I heard nothing from Rafael and as far as I can see the whole block can
> go, i.e. the ucbhelper::Content ctor has no side effects.

I pushed a commit on master about this, see
http://cgit.freedesktop.org/libreoffice/core/commit/?id=4bdd78dc3122bdc1eaf85f05fc3cb1cb9afedf7d

Julien





--
View this message in context: 
http://nabble.documentfoundation.org/Cppcheck-bContainsDate-not-read-in-templateremoteview-cxx-sfx2-tp4032416p4040560.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: Cppcheck: "bContainsDate" not read in templateremoteview.cxx (sfx2)

2013-02-26 Thread Caolán McNamara
On Tue, 2013-02-12 at 05:58 -0800, julien2412 [via Document Foundation
Mail Archive] wrote:
> Caolán McNamara wrote
> So, unless Rafael has other plans, it looks to me that you can
> remove the bContainsDate lines, the aDT = lines, and the
> getPropertyValue(..) 
> >>= aDT block.
> I don't know if you received some information from Raphael but if we
> remove aDT variable, does it also mean this whole block can be
> removed? 
> 
> 147 if ( bHasTargetURL && 
> 148 INetURLObject( aContentURL
> ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER ) 
> 149 { 
> 150 ucbhelper::Content aCnt( aTargetURL,
> m_xCmdEnv, comphelper::getProcessComponentContext() ); 
> 151 
> 152 try 
> 153 { 
> 154
> aCnt.getPropertyValue("DateModified") >>= aDT; 
> 155 } 
> 156 catch (...) 
> 157 {} 
> 158 } 
> 
> or does the call to Content constructor initialize something that I
> missed

I heard nothing from Rafael and as far as I can see the whole block can
go, i.e. the ucbhelper::Content ctor has no side effects.

C.





--
View this message in context: 
http://nabble.documentfoundation.org/Cppcheck-bContainsDate-not-read-in-templateremoteview-cxx-sfx2-tp4032416p4040331.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: Cppcheck: "bContainsDate" not read in templateremoteview.cxx (sfx2)

2013-02-12 Thread julien2412
Caolán McNamara wrote
> On Sun, 2013-01-27 at 14:02 -0800, julien2412 wrote:
>>...
>> Should line 129 just be removed or bContainsDate should be used in some
>> way
>> or bContainsDate shouldn't be a new variable for each while loop?
> 
> Hmm, not alone is bContainsDate not used anywhere, neither is the
> datetime aDT. Maybe there was intended eventually to be something that
> consumed the date time.
> 
> So, unless Rafael has other plans, it looks to me that you can remove
> the bContainsDate lines, the aDT = lines, and the getPropertyValue(..)
>>>= aDT block.

I don't know if you received some information from Raphael but if we remove
aDT variable, does it also mean this whole block can be removed?

147 if ( bHasTargetURL &&
148 INetURLObject( aContentURL ).GetProtocol()
== INET_PROT_VND_SUN_STAR_HIER )
149 {
150 ucbhelper::Content aCnt( aTargetURL,
m_xCmdEnv, comphelper::getProcessComponentContext() );
151 
152 try
153 {
154 aCnt.getPropertyValue("DateModified")
>>= aDT;
155 }
156 catch (...)
157 {}
158 }

or does the call to Content constructor initialize something that I missed
and therefore, only the try/catch of this block might be removed?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/Cppcheck-bContainsDate-not-read-in-templateremoteview-cxx-sfx2-tp4032416p4036715.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: Cppcheck: "bContainsDate" not read in templateremoteview.cxx (sfx2)

2013-02-05 Thread Caolán McNamara
On Sun, 2013-01-27 at 14:02 -0800, julien2412 wrote:
> Hello,
> 
> Cppcheck detected this:
> sfx2/source/control/templateremoteview.cxx
> 129   unreadVariable  style   Variable 'bContainsDate' is assigned a value 
> that
> is never used.
> 
> Here are the lines:
> 124 bool bContainsDate = !xRow->wasNull();
> 125 
> 126 if ( !bContainsDate )
> 127 {
> 128 aDT = xRow->getTimestamp( ROW_DATE_CREATE );
> 129 bContainsDate = !xRow->wasNull();
> 130 }
> 
> see
> http://opengrok.libreoffice.org/xref/core/sfx2/source/control/templateremoteview.cxx#116
> 
> Should line 129 just be removed or bContainsDate should be used in some way
> or bContainsDate shouldn't be a new variable for each while loop?

Hmm, not alone is bContainsDate not used anywhere, neither is the
datetime aDT. Maybe there was intended eventually to be something that
consumed the date time.

So, unless Rafael has other plans, it looks to me that you can remove
the bContainsDate lines, the aDT = lines, and the getPropertyValue(..)
>>= aDT block.

C.

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


Cppcheck: "bContainsDate" not read in templateremoteview.cxx (sfx2)

2013-01-27 Thread julien2412
Hello,

Cppcheck detected this:
sfx2/source/control/templateremoteview.cxx
129 unreadVariable  style   Variable 'bContainsDate' is assigned a value 
that
is never used.

Here are the lines:
124 bool bContainsDate = !xRow->wasNull();
125 
126 if ( !bContainsDate )
127 {
128 aDT = xRow->getTimestamp( ROW_DATE_CREATE );
129 bContainsDate = !xRow->wasNull();
130 }

see
http://opengrok.libreoffice.org/xref/core/sfx2/source/control/templateremoteview.cxx#116

Should line 129 just be removed or bContainsDate should be used in some way
or bContainsDate shouldn't be a new variable for each while loop?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/Cppcheck-bContainsDate-not-read-in-templateremoteview-cxx-sfx2-tp4032416.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