Closed Bug 227497 Opened 21 years ago Closed 20 years ago

String conversion cleanup in nsLDAPChannel

Categories

(Directory :: LDAP XPCOM SDK, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jst, Assigned: dmosedale)

Details

Attachments

(1 file)

I guess this code aint used by default, but still. Patch coming up...
Attached patch Cleanup...Splinter Review
The biggest problem here was that:

    rv = mReadPipeOut->Write(NS_ConvertUCS2toUTF8(entry).get(),
			     entryLength, &bytesWritten);

that code passed the length of the string in UTF16, but the data as UTF8, so
any time there were non-ASCII characters in that string, too few characters
would've been written out.
Attachment #136815 - Flags: superreview?(dmose)
Attachment #136815 - Flags: review?(dmose)
Attachment #136815 - Flags: superreview?(peterv)
Attachment #136815 - Flags: superreview?(dmose)
Attachment #136815 - Flags: review?(peterv)
Attachment #136815 - Flags: review?(dmose)
Comment on attachment 136815 [details] [diff] [review]
Cleanup...

>Index: directory/xpcom/base/src/nsLDAPChannel.cpp
>===================================================================

>@@ -941,48 +940,47 @@ nsLDAPChannel::OnLDAPSearchEntry(nsILDAP

>         // print all values of this attribute
>         //
>         for ( PRUint32 j=0 ; j < valueCount; j++ ) {
>-            AppendASCIItoUTF16(attrs[i], entry);
>-            entry.Append(NS_LITERAL_STRING(": "));
>-            entry.Append(vals[j]);
>-            entry.Append(NS_LITERAL_STRING("\n"));
>+            entry.Append(attrs[i]);
>+            entry.Append(": ");
>+            AppendUTF16toUTF8(vals[j], entry);
>+            entry.Append("\n");

Make that Append('\n');

>     // separate this entry from the next
>     //
>-    entry.Append(NS_LITERAL_STRING("\n"));
>+    entry.Append("\n");

Ditto.
Attachment #136815 - Flags: superreview?(peterv)
Attachment #136815 - Flags: superreview+
Attachment #136815 - Flags: review?(peterv)
Attachment #136815 - Flags: review+
Johnny, is this ready for checkin, or does it need to go by dmose?
Oh, sorry, this was checked in some time ago. Forgot to mark it fixed :-(
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Indeed -

1.56	jst%mozilla.jstenback.com	2004-04-12 20:53	 	Fixing bug 227497. Cleaning up
some string usage in nsLDAPChannel. r+sr=peterv@propagandism.org

verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: