Bug 1904139 - Don't re-initialize platform font list from GetDefaultFont. r=jfkthame
[gecko.git] / netwerk / base / nsBase64Encoder.cpp
blob621dd2c4ec36201c57897d6f81468781295cebfc
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsBase64Encoder.h"
7 #include "mozilla/Base64.h"
9 NS_IMPL_ISUPPORTS(nsBase64Encoder, nsIOutputStream)
11 NS_IMETHODIMP
12 nsBase64Encoder::Close() { return NS_OK; }
14 NS_IMETHODIMP
15 nsBase64Encoder::Flush() { return NS_OK; }
17 NS_IMETHODIMP
18 nsBase64Encoder::StreamStatus() { return NS_OK; }
20 NS_IMETHODIMP
21 nsBase64Encoder::Write(const char* aBuf, uint32_t aCount, uint32_t* _retval) {
22 mData.Append(aBuf, aCount);
23 *_retval = aCount;
24 return NS_OK;
27 NS_IMETHODIMP
28 nsBase64Encoder::WriteFrom(nsIInputStream* aStream, uint32_t aCount,
29 uint32_t* _retval) {
30 return NS_ERROR_NOT_IMPLEMENTED;
33 NS_IMETHODIMP
34 nsBase64Encoder::WriteSegments(nsReadSegmentFun aReader, void* aClosure,
35 uint32_t aCount, uint32_t* _retval) {
36 return NS_ERROR_NOT_IMPLEMENTED;
39 NS_IMETHODIMP
40 nsBase64Encoder::IsNonBlocking(bool* aNonBlocking) {
41 *aNonBlocking = false;
42 return NS_OK;
45 nsresult nsBase64Encoder::Finish(nsACString& result) {
46 nsresult rv = mozilla::Base64Encode(mData, result);
47 if (NS_FAILED(rv)) {
48 return rv;
51 // Free unneeded memory and allow reusing the object
52 mData.Truncate();
53 return NS_OK;