If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Remove GetUnicode() from nsString

RESOLVED FIXED in mozilla0.9.3

Status

()

Core
String
RESOLVED FIXED
17 years ago
16 years ago

People

(Reporter: jag (Peter Annema), Assigned: jag (Peter Annema))

Tracking

Trunk
mozilla0.9.3
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

17 years ago
Remove GetUnicode from nsString and replace all call-sites with get().

Patch coming up.
(Assignee)

Comment 1

17 years ago
Created attachment 40646 [details] [diff] [review]
[patch] mechanical change from all nsString::GetUnicode() to nsString::get()

Comment 2

17 years ago
rs=scc
(Assignee)

Comment 3

17 years ago
Created attachment 40651 [details] [diff] [review]
[patch] Part two: actually remove GetUnicode from nsString2.h
If you want to check this in this weekend you might want to find someone
to do the security partition stuff now.  However, you may want to wait a
bit to check in the second patch.  (You also need to look at the
commercial tree.)

(nsWebShell.cpp)
> @@ -824,7 +824,7 @@
>                            nsnull,             // No onwer
>                            PR_TRUE,            // Inherit owner from document
>                            PR_FALSE,           // Do not stop active document
> -                          target.GetUnicode(),// Window target
> +                          target.get(),// Window target
>                            aPostDataStream,    // Post data stream
>                            aHeadersDataStream, // Headers stream
>                            LOAD_LINK,          // Load type

Indentation.


(nsHTMLEditor.cpp)
> @@ -2961,7 +2961,7 @@
>        nsAutoString href;
>        res = anchor->GetHref(href);
>        if (NS_FAILED(res)) return res;
> -      if (href.GetUnicode() && href.Length() > 0)
> +      if (href.get() && href.Length() > 0)
>        {
>          nsAutoEditBatch beginBatching(this);
>          nsString attribute(NS_LITERAL_STRING("href"));

This condition should be |if (!href.IsEmpty())|

> Index: embedding/tests/qa_mfcembed/BV-cpp.txt
> Index: embedding/tests/qa_mfcembed/BV2-cpp.txt

Do you want to be changing these files?

> Index: string/doc/string-guide.html

It seems a little odd to change quoted text, but probably better than
the confusion that could otherwise result.


For the second patch, I think nsString::get() could probably be inline
and that check could be an assertion, although this may not be the best
time to make that change and we may not care.

r=dbaron on both patches.
(Assignee)

Comment 5

17 years ago
I opted not to change those two .txt files nor the string-guide.html.

scc, could you update this part of string-guide.html in a suitable manner next
time you add to it? Thanks.

First patch almost completely checked in, will need help with security/* and
Netscape commercial.
Target Milestone: --- → mozilla0.9.3

Comment 6

17 years ago
unfortunately, |get()| has to be |virtual| for the moment, see

  http://lxr.mozilla.org/mozilla/source/string/public/nsAFlatString.h#37

an |inline| factored |get| for all single-fragment strings requires working
implementations of |GetBufferHandle|, which obsolete |nsString| cannot provide.
 These days, an |nsString| can't end up pointing to a |eOneByte| buffer, so that
test has become meaningless, and might as well be

  return mUStr;

If you're paranoid (as perhaps you should be) you could recapitulate the old
test with an |NS_ASSERTION|.

  NS_ASSERTION(mCharSize==eOneByte, "malformed |nsString|!");
  return mUStr;

other than that, sr=scc
(Assignee)

Comment 7

17 years ago
|GetUnicode()| is dead, long live |get()|.
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 8

16 years ago
just to point out the qa_mfcEmbed is now obsolete. Replaced by testEmbed in
/mozilla/embedding/qa/testembed.
You need to log in before you can comment on or make changes to this bug.