Closed Bug 1240197 Opened 8 years ago Closed 8 years ago

Base64Encode and Base64Decode arguments are confusingly named in Base64.h and Base64.cpp

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox46 --- affected

People

(Reporter: keeler, Assigned: n.nethercote)

References

Details

Base64.h:

nsresult
Base64Encode(const nsACString& aString, nsACString& aBinary);
nsresult
Base64Encode(const nsAString& aString, nsAString& aBinaryData);

nsresult
Base64Decode(const nsACString& aBinaryData, nsACString& aString);
nsresult
Base64Decode(const nsAString& aBinaryData, nsAString& aString);

(Note that in each case the second argument is the output argument.)

The Base64Encode arguments are confusing because what's happening (unless I'm misunderstanding what base64 encoding is supposed to do) is a conversion from binary data to an ascii representation (which is the exact opposite of what the arguments describe).

Similarly, for Base64Decode, what's happening is a conversion from an ascii representation to binary data (again the opposite of what the arguments describe.

Base64.cpp has a similar problem, but only for 2 of the 4 functions.
It looks like this was fixed in part 1 of Bug 1273712:
https://hg.mozilla.org/mozilla-central/rev/1e1e0b415418
Assignee: nobody → n.nethercote
Status: NEW → RESOLVED
Closed: 8 years ago
Depends on: 1273712
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.