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

RESOLVED FIXED

Status

()

Core
XPCOM
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: keeler, Assigned: njn)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox46 affected)

Details

(Reporter)

Description

3 years ago
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.

Comment 1

2 years ago
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
Last Resolved: 2 years ago
Depends on: 1273712
Resolution: --- → FIXED

Updated

2 years ago
Duplicate of this bug: 1248707
You need to log in before you can comment on or make changes to this bug.