[PATCH] Bug 62096 - Replace O(U)String compareTo with ==

2013-04-22 Thread Anurag Kanungo (via Code Review)
Hi,

I have submitted a patch for review:

https://gerrit.libreoffice.org/3547

To pull it, you can do:

git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/3547/1

Bug 62096 - Replace O(U)String compareTo with ==

Change-Id: I3a8befcf51cea862e9bcc2670bce506004c1be9a
---
M odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
M 
odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
M odk/examples/java/Inspector/InspectorAddon.java
M odk/examples/java/Inspector/ProtocolHandlerAddon.java
M odk/examples/java/Spreadsheet/EuroAdaption.java
M odk/examples/java/Text/StyleInitialization.java
7 files changed, 25 insertions(+), 25 deletions(-)



diff --git 
a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
 
b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
index 27a97ec..7c9c69a 100644
--- 
a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
+++ 
b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
@@ -125,7 +125,7 @@
 
 // XJobExecutor
 public void trigger(String sEvent) {
-if ( sEvent.compareTo( execute ) == 0 ) {
+if ( sEvent = execute ) {
 try {
 createDialog();
 }
diff --git 
a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
 
b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
index 86d58da..c92249e 100644
--- 
a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
+++ 
b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -150,12 +150,12 @@
 /*IN*/String sTargetFrameName,
 /*IN*/int iSearchFlags ) {
 XDispatch xRet = null;
-if ( 
aURL.Protocol.compareTo(org.openoffice.Office.addon.example:) == 0 ) {
-if ( aURL.Path.compareTo( Function1 ) == 0 )
+if ( aURL.Protocol == org.openoffice.Office.addon.example: ) {
+if ( aURL.Path == Function1 )
 xRet = this;
-if ( aURL.Path.compareTo( Function2 ) == 0 )
+if ( aURL.Path == Function2 )
 xRet = this;
-if ( aURL.Path.compareTo( Help ) == 0 )
+if ( aURL.Path == Help )
 xRet = this;
 }
 return xRet;
@@ -177,17 +177,17 @@
 public void dispatch( /*IN*/com.sun.star.util.URL aURL,
   /*IN*/com.sun.star.beans.PropertyValue[] 
aArguments ) {
 
-if ( 
aURL.Protocol.compareTo(org.openoffice.Office.addon.example:) == 0 )
+if ( aURL.Protocol == org.openoffice.Office.addon.example: )
 {
-if ( aURL.Path.compareTo( Function1 ) == 0 )
+if ( aURL.Path == Function1 )
 {
 showMessageBox(SDK DevGuide Add-On example, Function 1 
activated);
 }
-if ( aURL.Path.compareTo( Function2 ) == 0 )
+if ( aURL.Path ==  Function2 )
 {
 showMessageBox(SDK DevGuide Add-On example, Function 2 
activated);
 }
-if ( aURL.Path.compareTo( Help ) == 0 )
+if ( aURL.Path == Help )
 {
 showMessageBox(About SDK DevGuide Add-On example, This 
is the SDK Add-On example);
 }
diff --git 
a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
index c0e165e..9ab74c5 100644
--- 
a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
+++ 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
@@ -390,7 +390,7 @@
 String sCommand = aEvent.getActionCommand();
 //-
 // open any file from disk
-if( sCommand.compareTo(COMMAND_OPEN) == 0 )
+if( sCommand == COMMAND_OPEN )
 {
 String sURL = 
FunctionHelper.askUserForFileURL(DocumentView.this,true);
 if(sURL!=null)
@@ -399,14 +399,14 @@
 else
 //-
 // save current document
-if( sCommand.compareTo(COMMAND_SAVE) == 0 )
+if( sCommand == COMMAND_SAVE )
 {
 DocumentView.this.save();
 }
 else
 //-
 // export current document to html
-if( 

Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-19 Thread Eike Rathke
Hi Janit,

On Wednesday, 2013-04-17 00:00:39 +0530, Janit Anjaria wrote:

 -if ( sInstModel.compareTo( pProps-Name ) == 0 )
 +if ( sInstModel == ( pProps-Name ) )

I'd prefer if you removed also the now extraneous parenthesis
additionally to the .compareTo, so that would look like

   if ( sInstModel == pProps-Name )

It's just easier to parse for the eye ;-)  Maybe it's just me, but
I feel tricked into that's a function lacking the function name ...

And please, use fdo#62096 instead of BUG#62096

Thanks
  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
For key transition see http://erack.de/key-transition-2013-01-10.txt.asc
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack


pgpigLryCK3mI.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-19 Thread Eike Rathke
Hi Janit,

On Friday, 2013-04-19 02:09:55 +0530, Janit Anjaria wrote:

 -if ( 0 == PropertyName.compareTo( FM_PROP_TEXTLINECOLOR ) )
 +if ( PropertyName == ( FM_PROP_TEXTLINECOLOR ) )

Same nitpick as in my previous mail, please remove the now extraneous ()

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
For key transition see http://erack.de/key-transition-2013-01-10.txt.asc
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack


pgppKCrCZYQ_b.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-19 Thread Janit Anjaria
Hey!
i am here by attaching my patch for fdo#62096.

Regards,
Janit


On Sat, Apr 20, 2013 at 12:47 AM, Eike Rathke er...@redhat.com wrote:

 Hi Janit,

 On Wednesday, 2013-04-17 00:00:39 +0530, Janit Anjaria wrote:

  -if ( sInstModel.compareTo( pProps-Name ) == 0 )
  +if ( sInstModel == ( pProps-Name ) )

 I'd prefer if you removed also the now extraneous parenthesis
 additionally to the .compareTo, so that would look like

if ( sInstModel == pProps-Name )

 It's just easier to parse for the eye ;-)  Maybe it's just me, but
 I feel tricked into that's a function lacking the function name ...

 And please, use fdo#62096 instead of BUG#62096

 Thanks
   Eike

 --
 LibreOffice Calc developer. Number formatter stricken i18n
 transpositionizer.
 GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
 For key transition see http://erack.de/key-transition-2013-01-10.txt.asc
 Support the FSFE, care about Free Software!
 https://fsfe.org/support/?erack



0001-fdo-62096-Replace-OUString-compareTo-wiht-operator.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-19 Thread Janit Anjaria
Hey!
I am hereby submitting my patches for review.


Regards,
Janit


On Sat, Apr 20, 2013 at 12:53 AM, Eike Rathke er...@redhat.com wrote:

 Hi Janit,

 On Friday, 2013-04-19 02:09:55 +0530, Janit Anjaria wrote:

  -if ( 0 == PropertyName.compareTo( FM_PROP_TEXTLINECOLOR ) )
  +if ( PropertyName == ( FM_PROP_TEXTLINECOLOR ) )

 Same nitpick as in my previous mail, please remove the now extraneous ()

   Eike

 --
 LibreOffice Calc developer. Number formatter stricken i18n
 transpositionizer.
 GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
 For key transition see http://erack.de/key-transition-2013-01-10.txt.asc
 Support the FSFE, care about Free Software!
 https://fsfe.org/support/?erack



0001-fdo-62096-Replace-O-U-String-compareTo-with.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-18 Thread Janit Anjaria
Hey!

I am hereby attaching my patch for fdo#62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.

Regards,
Janit


0001-fdo-62096-Replaced-some-OUString-compareTo-with.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-16 Thread Janit Anjaria
Hey!

I am hereby attaching my patch for fdo #62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.

Regards,
Janit

On Tue, Apr 16, 2013 at 11:52 PM, Janit Anjaria jani...@gmail.com wrote:

 Hey Stephan!
 I think that was due to hurry(the things for != things)...and yeah i
 dont know ,i overlooked the build and hence i suppose the thing you just
 mentioned about child_process.cxx is one of those rotten tests.

 And yes,ill surely look into the matter with identation(i generally do
 take care of it,but because of a lil hurry as i am also working on the
 project -i had mailed on the list simultaneously ...so swamped with too
 much of code ! :P )

 Hope this finds you in good health.

 Regards,
 Janit


 On Tue, Apr 16, 2013 at 6:30 PM, Stephan Bergmann sberg...@redhat.comwrote:

 On 04/15/2013 03:19 PM, Janit Anjaria wrote:

 I am hereby attaching my patch for fdo #62096 :

 https://bugs.freedesktop.org/**show_bug.cgi?id=62096https://bugs.freedesktop.org/show_bug.cgi?id=62096

 Any suggestions would be great to be implemented.


 First, note that

   s.compareTo(t) != 0

 is /not/ the same as

   s == t

 Second, did you build and test your change?  It looks like
 sal/qa/rtl/process/child_**process.cxx is one of those rotting tests
 that is not built nor executed, not even with a top-level make check.

 Also, please take care not to mess up the indentation of lines, making
 the if indented only three instead of four spaces.

 Stephan





0001-fdo-62096-Replace-O-U-String-compareTo-with.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-16 Thread JorenDC

Hi Janit,

I see your patches keeps passing by. Sending your patch by email is not 
wrong, but we have another handy tool to review/comment/... patches - 
Gerrit.


Please have a look at 
https://wiki.documentfoundation.org/Development/gerrit#Setting_Yourself_Up_For_Gerrit 
so you can send them that way. I think that's a lot easier for 
developers to review and leave comments.


Just my 0,02EUR (please be aware of the currency exchange ;-) )

Kind regards,
Joren

Op 16-04-13 20:30, Janit Anjaria schreef:

Hey!

I am hereby attaching my patch for fdo #62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.

Regards,
Janit

On Tue, Apr 16, 2013 at 11:52 PM, Janit Anjaria jani...@gmail.com 
mailto:jani...@gmail.com wrote:


Hey Stephan!
I think that was due to hurry(the things for != things)...and
yeah i dont know ,i overlooked the build and hence i suppose the
thing you just mentioned about child_process.cxx is one of those
rotten tests.

And yes,ill surely look into the matter with identation(i
generally do take care of it,but because of a lil hurry as i am
also working on the project -i had mailed on the list
simultaneously ...so swamped with too much of code ! :P )

Hope this finds you in good health.

Regards,
Janit


On Tue, Apr 16, 2013 at 6:30 PM, Stephan Bergmann
sberg...@redhat.com mailto:sberg...@redhat.com wrote:

On 04/15/2013 03:19 PM, Janit Anjaria wrote:

I am hereby attaching my patch for fdo #62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.


First, note that

  s.compareTo(t) != 0

is /not/ the same as

  s == t

Second, did you build and test your change?  It looks like
sal/qa/rtl/process/child_process.cxx is one of those rotting
tests that is not built nor executed, not even with a
top-level make check.

Also, please take care not to mess up the indentation of
lines, making the if indented only three instead of four spaces.

Stephan





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


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


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-16 Thread Janit Anjaria
Hey Joren!

Yeah i have had a look at this wiki page :
https://wiki.documentfoundation.org/Development/gerrit#Setting_Yourself_Up_For_Gerrit

lng back(when i started hacking on LO codebase) and had played around
with it for a time being .But seriously and frankly speaking i am more
comfortable on this,but i am sure i will try to work on gerrit(as there is
always a scope to learn something new..and this has been a wonderful
leaning experience since then) now so as to ease the work.

Hope this finds you in good health.

Regards,
Janit


On Wed, Apr 17, 2013 at 12:08 AM, JorenDC joren.libreoff...@telenet.bewrote:

  Hi Janit,

 I see your patches keeps passing by. Sending your patch by email is not
 wrong, but we have another handy tool to review/comment/... patches -
 Gerrit.

 Please have a look at
 https://wiki.documentfoundation.org/Development/gerrit#Setting_Yourself_Up_For_Gerritso
  you can send them that way. I think that's a lot easier for developers
 to review and leave comments.

 Just my 0,02€ (please be aware of the currency exchange ;-) )

 Kind regards,
 Joren

 Op 16-04-13 20:30, Janit Anjaria schreef:

   Hey!

  I am hereby attaching my patch for fdo #62096 :

 https://bugs.freedesktop.org/show_bug.cgi?id=62096

  Any suggestions would be great to be implemented.

  Regards,
  Janit

 On Tue, Apr 16, 2013 at 11:52 PM, Janit Anjaria jani...@gmail.com wrote:

   Hey Stephan!
  I think that was due to hurry(the things for != things)...and yeah i
 dont know ,i overlooked the build and hence i suppose the thing you just
 mentioned about child_process.cxx is one of those rotten tests.

  And yes,ill surely look into the matter with identation(i generally do
 take care of it,but because of a lil hurry as i am also working on the
 project -i had mailed on the list simultaneously ...so swamped with too
 much of code ! :P )

  Hope this finds you in good health.

  Regards,
  Janit


 On Tue, Apr 16, 2013 at 6:30 PM, Stephan Bergmann sberg...@redhat.comwrote:

 On 04/15/2013 03:19 PM, Janit Anjaria wrote:

 I am hereby attaching my patch for fdo #62096 :

 https://bugs.freedesktop.org/show_bug.cgi?id=62096

 Any suggestions would be great to be implemented.


  First, note that

   s.compareTo(t) != 0

 is /not/ the same as

   s == t

 Second, did you build and test your change?  It looks like
 sal/qa/rtl/process/child_process.cxx is one of those rotting tests that is
 not built nor executed, not even with a top-level make check.

 Also, please take care not to mess up the indentation of lines, making
 the if indented only three instead of four spaces.

 Stephan





 ___
 LibreOffice mailing 
 listLibreOffice@lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/libreoffice



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


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


Re: [PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-16 Thread Stephan Bergmann

On 04/15/2013 03:19 PM, Janit Anjaria wrote:

I am hereby attaching my patch for fdo #62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.


First, note that

  s.compareTo(t) != 0

is /not/ the same as

  s == t

Second, did you build and test your change?  It looks like 
sal/qa/rtl/process/child_process.cxx is one of those rotting tests that 
is not built nor executed, not even with a top-level make check.


Also, please take care not to mess up the indentation of lines, making 
the if indented only three instead of four spaces.


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


[PATCH] BUG#62096 Replace O(U)String compareTo with ==

2013-04-15 Thread Janit Anjaria
Hey!

I am hereby attaching my patch for fdo #62096 :

https://bugs.freedesktop.org/show_bug.cgi?id=62096

Any suggestions would be great to be implemented.

Regards,
Janit


0001-fdo-62096-Replace-O-U-String-compareTo-with.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice