Closed Bug 545066 Opened 14 years ago Closed 8 years ago

Clean up nsClipboard.cpp/h

Categories

(Core :: Widget: Win32, defect, P5)

x86
Windows 7
defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: khuey, Assigned: jeanluc.bonnafoux, Mentored)

Details

(Whiteboard: [good first bug][lang=c++][tpi:+])

Attachments

(1 file, 5 obsolete files)

There's some cruft living in nsClipboard that can be removed (DisplayErr, odd commenting style, etc).
Assignee: khuey → nobody
Status: ASSIGNED → NEW
> DisplayErr

For this do you mean to move the "static void DisplayErrCode(HRESULT hres)" into some debug file or...?
Assignee: nobody → netzen
Assignee: netzen → nobody
Mentor: jmathies, tabraldes, netzen
Whiteboard: [good first bug][lang=c++]
I wan to work on this bug
I wan to work on this bug
I wan to work on this bug
:jimm Yeah sorry for that. I'd like to work on this bug if you could assign it to me.
Could you guide on how to go about it. Thanks
(In reply to Aman Alam from comment #6)
> Could you guide on how to go about it. Thanks

Sure, we have coding standards outlined here - 

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style

Generally if you look around at other c++ source files you'll find some obvious differences in the clipboard code.
Assignee: nobody → aman_alam
Hi, I would like to work on this bug. Please tell me how to proceed.
I am a newbie to Mozilla.
I have changed the comparison condition in if blocks as per the given coding style of Mozilla. I could not get any idea about DisplayErr.
Please review my patch and also tell me how to proceed with "DisplayErr" thing.
Attachment #8519467 - Flags: review?(jmathies)
Comment on attachment 8519467 [details] [diff] [review]
Changed the styles of comparing conditions in if()

Review of attachment 8519467 [details] [diff] [review]:
-----------------------------------------------------------------

There are a bunch of file changes here that look unrelated - please remove them.

generally this is a step in the right direction, lets try and finish up the rest of these nits.

::: widget/windows/nsClipboard.cpp
@@ +92,4 @@
>  {
>    UINT format;
>  
> +  if (!strcmp(aMimeStr, kTextMime))

nit - on all of these can we add parens for the blocks please.

@@ +183,5 @@
>          FORMATETC textFE;
>          SET_FORMATETC(textFE, CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
>          dObj->AddDataFlavor(kTextMime, &textFE);
>        }
> +      else if ( !strcmp(flavorStr, kHTMLMime) ) {      

nit - white space, you can check for this by posting your patch and looking at it under Review. There's also random white space in this file unrelated to your changes, can you seek those out as well and clean them up?

@@ +219,4 @@
>          SET_FORMATETC(imageFE, CF_DIB, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
>          dObj->AddDataFlavor(flavorStr, &imageFE);
>        }
> +      else if ( !strcmp(flavorStr, kFilePromiseMime) ) {

nit - no spaces here and below.

if (!strcmp(...)) {
}
Attachment #8519467 - Flags: review?(jmathies) → review-
Thanks for your review Jim Mathies.
I had been busy with my exams, projects for past few weeks.
Now, I will work on this.

Regarding the nit on the line #92,
Do you want me to add parens to if-else blocks?
Hello Jim!
I'm Neil, and still looking for my first bug to solve!
If Rohan isn't working on it anymore, could I
Sorry about that,
Hello Jim!
I'm Neil, and still looking for my first bug to solve!
If Rohan isn't working on it anymore, could I start working on this?

I need to work on the paren blocks as well as white space, right?
Hey Jim
How to merge changes from a patch into an local mozilla repository?
(In reply to Rohan Jaswal from comment #11)
> Thanks for your review Jim Mathies.
> I had been busy with my exams, projects for past few weeks.
> Now, I will work on this.
> 
> Regarding the nit on the line #92,
> Do you want me to add parens to if-else blocks?

Mozilla coding style must use { } for 'if' event if one line.  So you must write the fix like the following.

 if (!strcmp(aMimeStr, kTextMime)) {
  ...
 } else if (!strcmp(aMimeStr, kUnicodeMime)) {
  ...
 }

After fixing comment #10, please attach new fix.
Priority: -- → P5
Whiteboard: [good first bug][lang=c++] → [good first bug][lang=c++][tpi:+]
I would like to work on this bug its my first bug can you give some tips
Change to add braces for if / else statement in nsClipboard.cpp
Attachment #8816873 - Flags: review?(jmathies)
Hello,

I have proposed a patched attached to this bugzilla case.
This is my first contribution tentative.
Happy to discuss about the proposed changes.

Thanks,
Comment on attachment 8816873 [details] [diff] [review]
Amendinf if else statements to include braces

Review of attachment 8816873 [details] [diff] [review]:
-----------------------------------------------------------------

Please do not use tabs.
Hello,

Thanks for reviewing the submitted patch. 
I will amend the code to avoid the use of tabs and attach a new patch to this bugzilla case.

Thanks,
removed use of tabs
Attachment #8817012 - Flags: review?(jmathies)
Attached patch adding braces for if else (obsolete) — Splinter Review
Apologies, i have submitted the same patch twice.
Hello,

Could you please assign this issue to me ?

Thanks,
Assignee: aman_alam → jeanluc.bonnafoux
Attachment #8817235 - Flags: review?(jmathies)
Comment on attachment 8817235 [details] [diff] [review]
adding braces for if else

Review of attachment 8817235 [details] [diff] [review]:
-----------------------------------------------------------------

Please obsolete old patches when you attach a new patch (now you should be possible because you are assignee).

::: widget/windows/nsClipboard.cpp
@@ +64,5 @@
>   // to the OS clipboard.
>    nsCOMPtr<nsIObserverService> observerService =
>      do_GetService("@mozilla.org/observer-service;1");
> +  if (observerService) {
> +      observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);

Our coding style uses 2-space indent, not 4.
(Same for all your changes.)
Attached patch braces and coding style (obsolete) — Splinter Review
Attachment #8816873 - Attachment is obsolete: true
Attachment #8817012 - Attachment is obsolete: true
Attachment #8817235 - Attachment is obsolete: true
Attachment #8816873 - Flags: review?(jmathies)
Attachment #8817012 - Flags: review?(jmathies)
Attachment #8817235 - Flags: review?(jmathies)
Attachment #8817865 - Flags: review?(VYV03354)
Attachment #8817865 - Flags: review?(VYV03354) → review?(jmathies)
Hello,
i have made old patches proposal obsolete as required.
I have attached a new patch proposal for enforcing 2 spaces indent.
Thanks,
Hello,

Is the latest patch proposal Ok ?

Thanks,
Attachment #8817865 - Flags: review?(jmathies) → review+
Attachment #8519467 - Attachment is obsolete: true
To land this:

1) update the check-in comment to include reviewer info, something like:

"Bug 545066 - Code cleanup in widget/windows/nsClipboard: add braces to if else, removed tabs, ident fix. r=jimm"

and post it to this bug. Obsolete the old patches.

2) add 'checkin-needed' to the keywords so drivers will land it. If you don't have bugzilla perms to add thit, needinfo me.

Thanks for the contribution!
Sure, thanks will do.
Keywords: checkin-needed
Hello,

Quick question on item 1, should i submit a new patch (with same code changes) but only with a different comment ? 
My first guess was to update the comment of the current attachment but this does not look possible in bugzilla.

Thanks for your help,
(In reply to jbonnafo from comment #31)
> Hello,
> 
> Quick question on item 1, should i submit a new patch (with same code
> changes) but only with a different comment ? 

Yes, thanks!
Bug 545066 - Code cleanup in widget/windows/nsClipboard: add braces to if else, removed tabs, ident fix.
Attachment #8817865 - Attachment is obsolete: true
Attachment #8818610 - Flags: review+
Hello,

I have added new patch with comment as requested by :jimm.
I have set the flag to 'checkin-needed'.

Thanks,
Target Milestone: mozilla1.9.3a2 → ---
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7ca01cd5d229
Clean up nsClipboard.cpp - braces added for if..else, no tabs, ident fix. r=jimm
Keywords: checkin-needed
Hello,

There are some other files in widget/windows directory that would require some code clean-up.
Should i raise a new bugzilla ticket for this ?

Thanks,
https://hg.mozilla.org/mozilla-central/rev/7ca01cd5d229
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: