Closed
Bug 151628
Opened 22 years ago
Closed 22 years ago
API - Freeze - nsIPrintSettings needs assignment method
Categories
(Core :: Printing: Output, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla1.0.1
People
(Reporter: rods, Assigned: rods)
Details
(Keywords: topembed+, Whiteboard: [ADT2])
Attachments
(2 files, 1 obsolete file)
10.35 KB,
patch
|
jst
:
superreview+
|
Details | Diff | Splinter Review |
28.21 KB,
patch
|
ccarlen
:
review+
jst
:
superreview+
jud
:
approval+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•22 years ago
|
||
Add "Assign" method to nsIPrintSettings to assign values from one PS to
another.
Assignee | ||
Updated•22 years ago
|
Target Milestone: --- → mozilla1.0.1
Comment 2•22 years ago
|
||
Comment on attachment 87559 [details] [diff] [review]
patch
+// Assignment helper macros
+#define AssignDBL(_name) \
+if (NS_SUCCEEDED(aPS->Get##_name(&dbl))) { \
...
There's a few of these macros, please rename them so that they match the normal
macro naming convention ni mozilla, i.e. all upper case, so in stead of
AssignDBL(), make it ASSIGN_DBL(), otherwise the call-sites look too much like
they're calling functions.
- In nsPrintSettingsMac::AssignObj():
+ if (psMac) {
+ if (mPrintRecord)
+ ::DisposeHandle((Handle)mPrintRecord);
Stick to 2-space indentation.
- In nsPrintSettingsX::AssignObj()
+ NS_ENSURE_ARG_POINTER(aPS);
+
+ nsCOMPtr<nsIPrintSettingsX> psX = do_QueryInterface(aPS);
+ if (psX) {
+ if (mPageFormat != kPMNoPageFormat) {
+ ::PMDisposePageFormat(mPageFormat);
+ mPageFormat = kPMNoPageFormat;
+ }
+
+ psX->GetPMPageFormat(&mPageFormat);
+ psX->GetPMPrintSettings(&mPrintSettings);
+
+ }
Why the empty line above this closing brace?
+
+ return NS_ERROR_FAILURE;
+}
Why not start out with:
+ nsCOMPtr<nsIPrintSettingsX> psX = do_QueryInterface(aPS);
+ if (!psX) {
+ return NS_ERROR_FAILURE;
+ }
and then go on with the normal code...? Then you can loose the
NS_ENSURE_ARG_POINTER() too.
- In nsPrintSettingsWin::AssignObj():
+ if (mDeviceName) nsCRT::free(mDeviceName);
+ if (mDriverName) nsCRT::free(mDriverName);
+ if (mDevMode) free(mDevMode);
This looks inconsistent, why not nsCRT::free(mDevMode)? And please split those
if's onto two lines, and add braces while you're at it.
Oh, and same thing here, check for the bad input first and return the error
early in stead of putting all the code inside an if.
sr=jst if you fix that.
Attachment #87559 -
Flags: superreview+
Assignee | ||
Comment 3•22 years ago
|
||
This is an alternative patch that uses an assignment operator.
Assignee | ||
Updated•22 years ago
|
Attachment #87951 -
Attachment is obsolete: true
Assignee | ||
Comment 4•22 years ago
|
||
This is the correct alt. patch that uses the assigment operator
Comment 5•22 years ago
|
||
Comment on attachment 87952 [details] [diff] [review]
alternative patch
r=ccarlen
Attachment #87952 -
Flags: review+
Comment 6•22 years ago
|
||
Comment on attachment 87952 [details] [diff] [review]
alternative patch
sr=jst, but don't you want
nsPrintSettings& operator=(const nsPrintSettings& rhs);
to be virtual to make sure the right one is called regardless of the type of
the reference you happen to have to one of these things when you call that
operator?
Attachment #87952 -
Flags: superreview+
Assignee | ||
Comment 7•22 years ago
|
||
The other platforms need it
fixed
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 8•22 years ago
|
||
topembed+. This is needed to freeze the printing API's.
Assignee | ||
Comment 9•22 years ago
|
||
I added virtual to the assignment operator per jst's suggestion.
Comment 10•22 years ago
|
||
Verified on trunk 06/20/02 Win2K, Linux.
I checked Page Setup functionality, no regressions.
Status: RESOLVED → VERIFIED
Updated•22 years ago
|
Keywords: approval,
mozilla1.0.1
Whiteboard: [Need Impact]
Comment 11•22 years ago
|
||
adt: This is a low risk patch that is needed for embedding only. This change is
needed before we can freeze the printing API's. Without this change the printing
API's will remain unfrozen.
Whiteboard: [Need Impact] → [ADT2]
Comment 12•22 years ago
|
||
please checkin to the 1.0.1 branch. once there, remove the "mozilla1.0.1+"
keyword and add the "fixed1.0.1" keyword.
Keywords: mozilla1.0.1 → mozilla1.0.1+
Updated•22 years ago
|
Attachment #87952 -
Flags: approval+
Assignee | ||
Comment 13•22 years ago
|
||
ADT: Although the patch is large, the important part of the change is just
adding the the argument to the call. The rest of the patch, the "Assign" method
and copy constructor which made it large, will be used on on the trunk very
shortly, but is not used on the branch.
So the patch is still low risk.
Comment 14•22 years ago
|
||
This bug appears to have gotten branch landing approval on 6/25 - any chance
it's going to land there soon?
Comment 15•22 years ago
|
||
Adding adt1.0.1+ on behalf of adt. Please check into the Mozilla branch asap.
Comment 16•22 years ago
|
||
1.0.1 driver aproval still stnads.
You need to log in
before you can comment on or make changes to this bug.
Description
•