Closed Bug 944894 Opened 11 years ago Closed 11 years ago

Fix char16_t/wchar_t mismatch in widget/windows/.

Categories

(Core :: Widget: Win32, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: jacek, Assigned: jacek)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Attached patch patch.diffSplinter Review
This is followup of bug 928351 for widget/windows/.

- Use wchar_t for strings used in Windows API.
- Use AppendPrintf instead of sprintf_s to avoid conflictx in GfxInfo::GetCleartypeParameters
- Replace a few BeginReading() with get() where possible. get() returns the new char16ptr_t type that hides char16_t/wchar_t differences.
- Not really related, but also needed for mingw: remove a few MOZ_ALWAYS_INLINE. Those functions are implemented in KeyboardLayout.cpp, so they can't be inlined in other files and that causes errors on GCC.
- Use char16ptr_t type in a few cases, which are used both as wchar_t and char16_t.
Attachment #8340635 - Flags: review?(jmathies)
Comment on attachment 8340635 [details] [diff] [review]
patch.diff

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

Is PRUnichar going away at some point? There are still some uses in widget/windows/winrt/*. 

http://mxr.mozilla.org/mozilla-central/search?find=%2Fwidget%2Fwindows%2Fwinrt%2F&string=PRUnichar

::: widget/windows/nsDeviceContextSpecWin.cpp
@@ +333,5 @@
>  }
>  
>  //----------------------------------------------------------------------------------
>  static nsresult
> +CheckForPrintToFile(nsIPrintSettings* aPS, const PRUnichar* aPrinterName, const PRUnichar* aUPrinterName)

Did you intend to keep these?

::: widget/windows/nsPrintSettingsWin.cpp
@@ +56,5 @@
>  }
>  NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(PRUnichar **aDeviceName)
>  {
>    NS_ENSURE_ARG_POINTER(aDeviceName);
> +  *aDeviceName = mDeviceName?reinterpret_cast<PRUnichar*>(wcsdup(mDeviceName)):nullptr;

here as well?
Attachment #8340635 - Flags: review?(jmathies) → review+
Thanks for the review.

(In reply to Jim Mathies [:jimm] from comment #1)
> Comment on attachment 8340635 [details] [diff] [review]
> patch.diff
> 
> Review of attachment 8340635 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Is PRUnichar going away at some point? There are still some uses in
> widget/windows/winrt/*.

There a massive PRUnichar->char16_t change is planned. I guess it will happen for the whole tree at once.

> http://mxr.mozilla.org/mozilla-central/
> search?find=%2Fwidget%2Fwindows%2Fwinrt%2F&string=PRUnichar
> 
> ::: widget/windows/nsDeviceContextSpecWin.cpp
> @@ +333,5 @@
> >  }
> >  
> >  //----------------------------------------------------------------------------------
> >  static nsresult
> > +CheckForPrintToFile(nsIPrintSettings* aPS, const PRUnichar* aPrinterName, const PRUnichar* aUPrinterName)
> 
> Did you intend to keep these?

Yes, mostly because this function is currently called only with PRUnichar* arguments.

> 
> ::: widget/windows/nsPrintSettingsWin.cpp
> @@ +56,5 @@
> >  }
> >  NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(PRUnichar **aDeviceName)
> >  {
> >    NS_ENSURE_ARG_POINTER(aDeviceName);
> > +  *aDeviceName = mDeviceName?reinterpret_cast<PRUnichar*>(wcsdup(mDeviceName)):nullptr;
> 
> here as well?

Yes, this is a part of an interface.


https://hg.mozilla.org/integration/mozilla-inbound/rev/eba1adf9482a
https://hg.mozilla.org/mozilla-central/rev/eba1adf9482a
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: