Closed Bug 422794 Opened 17 years ago Closed 15 years ago

reduce narrow windows API calls in xpcom

Categories

(Core :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: blassey, Assigned: crowderbt)

References

Details

Attachments

(1 file, 3 obsolete files)

Attached patch directy from "other" patch on bug 418703 (obsolete) (deleted) — Splinter Review
this doesn't include the changes in xpcom glue
Attachment #309242 - Flags: review?(benjamin)
Comment on attachment 309242 [details] [diff] [review]
directy from "other" patch on bug 418703

>Index: xpcom/windbgdlg/windbgdlg.cpp

> int WINAPI 
> WinMain(HINSTANCE  hInstance, HINSTANCE  hPrevInstance, 
>         LPSTR  lpszCmdLine, int  nCmdShow)

>-    wsprintf(msg,
>-             "%s\n\nClick Abort to exit the Application.\n"
>-             "Click Retry to Debug the Application..\n"
>-             "Click Ignore to continue running the Application.", 
>+    wsprintfW(msg,
>+             L"%s\n\nClick Abort to exit the Application.\n"
>+             L"Click Retry to Debug the Application..\n"
>+             L"Click Ignore to continue running the Application.", 
>              lpszCmdLine);

You're passing lpszCmdLine as %s, which I think is incorrect for wsprintf... although I can't find a reference to wsprintfW docs. Can you clarify?
Attachment #309242 - Flags: review?(benjamin) → review-
Attached patch v2 (obsolete) (deleted) — Splinter Review
You are correct in asserting that %s is wrong for wsprintf(), which wants %S for narrow strings.  I have fixed that.  I also fixed a mixup/typo in nsDriveEnumerator (mLetter was swapped for mDrives).  I checked over the rest of the patch for spacing and sizeof/cast issues, but it's possible I've missed some, please double-check me again?
Assignee: nobody → crowder
Attachment #309242 - Attachment is obsolete: true
Attachment #337982 - Flags: superreview?(benjamin)
Attachment #337982 - Flags: review?(benjamin)
Comment on attachment 337982 [details] [diff] [review]
v2

Bah, I hate how MSVC's search leaves things highlighted, and therefore easily deleted/replaced.
Attachment #337982 - Flags: superreview?(benjamin)
Attachment #337982 - Flags: superreview-
Attachment #337982 - Flags: review?(benjamin)
Attachment #337982 - Flags: review-
Attached patch v3 (obsolete) (deleted) — Splinter Review
Attachment #337982 - Attachment is obsolete: true
Attachment #337984 - Flags: superreview?(benjamin)
Attachment #337984 - Flags: review?(benjamin)
Bernard:  I'd love to have you give this patch the same scrutiny as you've given others, if you have time.
Brian:

You changed:

+    wsprintfW(msg,
+              L"%S\n\nClick Abort to exit the Application.\n"
+              L"Click Retry to Debug the Application..\n"
+              L"Click Ignore to continue running the Application.", 
+              lpszCmdLine);

but lpszCmdLine is still ANSI, you need to use GetCommandLineW() here.

Please note that you are supposed to use LocalFree() to free the array returned by "CommandLineToArgvW".
%S is the right format-specifier for ANSI strings in wsprintf, according to MSDN
> %S is the right format-specifier for ANSI strings in wsprintf, according to
> MSDN

oops, I'm confused (I couldn't find the documentation). It should be ok then.
Attached patch v4 (deleted) — Splinter Review
Added a LocalFree(argv)
Attachment #337984 - Attachment is obsolete: true
Attachment #338144 - Flags: superreview?(benjamin)
Attachment #338144 - Flags: review?(benjamin)
Attachment #337984 - Flags: superreview?(benjamin)
Attachment #337984 - Flags: review?(benjamin)
Attachment #338144 - Attachment is patch: true
Attachment #338144 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 338144 [details] [diff] [review]
v4

r=me for everything *except* nsProcessCommon. The conversion in there currently 0-extends argv coming in, which is unacceptable.
Attachment #338144 - Flags: superreview?(benjamin)
Attachment #338144 - Flags: review?(benjamin)
Attachment #338144 - Flags: review+
crowder did you land this?
Nope, it needed another spin.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: