StringStream/nsIParser API cleanup

RESOLVED FIXED in mozilla0.9.9

Status

()

P2
normal
RESOLVED FIXED
17 years ago
17 years ago

People

(Reporter: alecf, Assigned: alecf)

Tracking

Trunk
mozilla0.9.9
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fix in hand)

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

17 years ago
I was fixing up some string stuff, and I ran into some string cleanups that make
some future work I'm doing a whole lot easier. Basically:

nsIParser::SetDocumentCharset/nsIParser::GetDocumentCharset - changed to take
nsAString&'s rather than nsString&'s, so we can use NS_LITERAL_STRING

NS_New[C]StringStream - changed first parameter to be an nsIInputStream** to
avoid an extra query interface (all 19 callers were expecting an nsIInputStream)
and changed the second parameter (The string) to be an nsAString.

these changes, while basicaly unrelated, came together in nsRDFXMLParser.cpp
patch forthcoming

Looking for an r=dougt, sr=jaggernaut.
(Assignee)

Comment 1

17 years ago
argh, adding dougt and jaggernaut to CC for reviews...
(Assignee)

Comment 2

17 years ago
Created attachment 66184 [details] [diff] [review]
update APIs to be nsAString friendly

the callees to nsIParser don't need to be updated because they were all passing
in nsString's - it was just RDF that was actually passing in an nsString that
originated as a const char*

Comment 3

17 years ago
Comment on attachment 66184 [details] [diff] [review]
update APIs to be nsAString friendly

boy that sure does makes things simple.  Assuming that going to nsAString is
the right thing, r=dougt
(Assignee)

Comment 4

17 years ago
oops, reassign to me.
Assignee: dougt → alecf
(Assignee)

Updated

17 years ago
Priority: -- → P2
Whiteboard: fix in hand
Target Milestone: --- → mozilla0.9.9

Comment 5

17 years ago
Comment on attachment 66184 [details] [diff] [review]
update APIs to be nsAString friendly

>Index: netwerk/base/public/nsNetUtil.h
>===================================================================
>RCS file: /cvsroot/mozilla/netwerk/base/public/nsNetUtil.h,v
>retrieving revision 1.46
>diff -u -r1.46 nsNetUtil.h
>--- netwerk/base/public/nsNetUtil.h	8 Jan 2002 06:32:34 -0000	1.46
>+++ netwerk/base/public/nsNetUtil.h	23 Jan 2002 22:37:41 -0000
>@@ -274,10 +274,7 @@
> 
>     // otherwise, create a string stream for the data
>     nsCOMPtr<nsISupports> sup;

No need for |sup| anymore, it seems.

>-    rv = NS_NewCStringInputStream(getter_AddRefs(sup), nsCAutoString(data));
>-    if (NS_FAILED(rv)) return rv;
>-
>-    return CallQueryInterface(sup, result);
>+    return NS_NewCStringInputStream(result, nsCAutoString(data));

One can use nsDependentCString here, n'est-ce pas?

>Index: netwerk/streamconv/test/Converters.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/netwerk/streamconv/test/Converters.cpp,v
>retrieving revision 1.19
>diff -u -r1.19 Converters.cpp
>--- netwerk/streamconv/test/Converters.cpp	29 Sep 2001 08:27:49 -0000	1.19
>+++ netwerk/streamconv/test/Converters.cpp	23 Jan 2002 22:37:42 -0000
>@@ -53,15 +53,8 @@
> 
>     nsString convDataStr;
>     convDataStr.AssignWithConversion(buf);

...

>+    return NS_NewStringInputStream(_retval, convDataStr);


Is this AssignWithConversion needed or could you use a CStringInputStream?
Attachment #66184 - Flags: needs-work+
(Assignee)

Comment 6

17 years ago
Created attachment 66279 [details] [diff] [review]
picky, picky...

I guess I missed those minor ones. fixed.
Attachment #66184 - Attachment is obsolete: true
(Assignee)

Comment 7

17 years ago
Comment on attachment 66279 [details] [diff] [review]
picky, picky...

copying over dougt's r=
Attachment #66279 - Flags: review+
Comment on attachment 66279 [details] [diff] [review]
picky, picky...

sr=jst
Attachment #66279 - Flags: superreview+
(Assignee)

Comment 9

17 years ago
ok, fix is in. thanks folks
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.