Open
Bug 1662251
Opened 4 years ago
Updated 3 years ago
do a better job with NS_ConvertUTF*toUTF*
Categories
(Core :: XPCOM, task)
Core
XPCOM
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox82 | --- | wontfix |
People
(Reporter: froydnj, Unassigned)
Details
Attachments
(2 files)
We sometimes use inefficient code around these classes (not functions!). This is about fixing up all the places that are easily automatable.
Reporter | ||
Comment 1•4 years ago
|
||
This patch was generated by running:
perl -p -i \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF8toUTF16\((.*)\);/\1CopyUTF8toUTF16(\3, \2);/;' \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF16toUTF8\((.*)\);/\1CopyUTF16toUTF8(\3, \2);/;' \
$FILE
against every .cpp and .h in mozilla-central, and then fixing up the
inevitable errors that happen as a result of matching C++ expressions with
regexes. The errors fell into three categories:
- Calling the convert functions with
std::string::c_str()
; these were
changed to simply pass the string instead, relying on implicit conversion
tomozilla::Span
. - Calling the convert functions with raw pointers, which is not permitted
with the copy functions; these were changed to invokeMakeStringSpan
first. - Other miscellaneous errors resulting from over-eager regexes and/or the
replacement not being type-aware. These changes were reverted.
Updated•4 years ago
|
Assignee: nobody → nfroyd
Status: NEW → ASSIGNED
Reporter | ||
Comment 2•4 years ago
|
||
Instead of initialization with an object of type NS_ConvertUTF*
, we can
just declare an object with that type to begin with.
Depends on D88903
Pushed by nfroyd@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0889462c340f stop assigning from NS_Convert* values, mostly; r=sg
Comment 4•4 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
status-firefox82:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Comment 5•4 years ago
|
||
One patch landed, but one is still open. I might commandeer that revision to myself, but it should probably be moved to a new bug.
Status: RESOLVED → REOPENED
Flags: needinfo?(sgiesecke)
Resolution: FIXED → ---
Updated•4 years ago
|
Component: XPCOM → String
Flags: needinfo?(sgiesecke)
Updated•4 years ago
|
Flags: needinfo?(sgiesecke)
Updated•4 years ago
|
Assignee | ||
Updated•3 years ago
|
Component: String → XPCOM
Updated•3 years ago
|
Assignee: froydnj+bz → nobody
Status: REOPENED → NEW
Target Milestone: 82 Branch → ---
Updated•3 years ago
|
Flags: needinfo?(sgiesecke)
You need to log in
before you can comment on or make changes to this bug.
Description
•