2 * Copyright 2006 The Android Open Source Project
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkBase64_DEFINED
9 #define SkBase64_DEFINED
11 #include "include/core/SkTypes.h"
22 Base64 encodes src into dst.
24 Normally this is called once with 'dst' nullptr to get the required size, then again with an
25 allocated 'dst' pointer to do the actual encoding.
27 @param dst nullptr or a pointer to a buffer large enough to receive the result
29 @param encode nullptr for default encoding or a pointer to at least 65 chars.
30 encode[64] will be used as the pad character.
31 Encodings other than the default encoding cannot be decoded.
33 @return the required length of dst for encoding.
35 static size_t Encode(const void* src, size_t length, void* dst, const char* encode = nullptr);
38 Base64 decodes src into dst.
40 Normally this is called once with 'dst' nullptr to get the required size, then again with an
41 allocated 'dst' pointer to do the actual encoding.
43 @param dst nullptr or a pointer to a buffer large enough to receive the result
45 @param dstLength assigned the length dst is required to be. Must not be nullptr.
47 static Error SK_WARN_UNUSED_RESULT Decode(const void* src, size_t srcLength,
48 void* dst, size_t* dstLength);
51 #endif // SkBase64_DEFINED