зеркало из https://github.com/mozilla/moz-skia.git
Move SkBase64 to utils, allow user defined encoding.
git-svn-id: http://skia.googlecode.com/svn/trunk@3148 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
1f9767c03b
Коммит
af5bbf2449
|
@ -15,6 +15,7 @@
|
|||
'../include/xml',
|
||||
'../include/utils',
|
||||
'../include/images',
|
||||
'../src/utils',
|
||||
],
|
||||
'sources': [
|
||||
'../include/animator/SkAnimator.h',
|
||||
|
@ -36,8 +37,6 @@
|
|||
'../src/animator/SkAnimatorScript.h',
|
||||
#'../src/animator/SkAnimatorScript2.cpp', fails on windows
|
||||
#'../src/animator/SkAnimatorScript2.h',
|
||||
'../src/animator/SkBase64.cpp',
|
||||
'../src/animator/SkBase64.h',
|
||||
'../src/animator/SkBoundable.cpp',
|
||||
'../src/animator/SkBoundable.h',
|
||||
'../src/animator/SkBuildCondensedInfo.cpp',
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
'../include/utils/SkUnitMappers.h',
|
||||
'../include/utils/SkWGL.h',
|
||||
|
||||
'../src/utils/SkBase64.cpp',
|
||||
'../src/utils/SkBase64.h',
|
||||
'../src/utils/SkBoundaryPatch.cpp',
|
||||
'../src/utils/SkCamera.cpp',
|
||||
'../src/utils/SkColorMatrix.cpp',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define DecodePad -2
|
||||
#define EncodePad 64
|
||||
|
||||
static const char encode[] =
|
||||
static const char default_encode[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/=";
|
||||
|
@ -109,7 +109,13 @@ goHome:
|
|||
#pragma warning ( pop )
|
||||
#endif
|
||||
|
||||
size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr) {
|
||||
size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr, const char* encodeMap) {
|
||||
const char* encode;
|
||||
if (NULL == encodeMap) {
|
||||
encode = default_encode;
|
||||
} else {
|
||||
encode = encodeMap;
|
||||
}
|
||||
const unsigned char* src = (const unsigned char*) srcPtr;
|
||||
unsigned char* dst = (unsigned char*) dstPtr;
|
||||
if (dst) {
|
|
@ -23,7 +23,12 @@ public:
|
|||
SkBase64();
|
||||
Error decode(const char* src, size_t length);
|
||||
char* getData() { return fData; }
|
||||
static size_t Encode(const void* src, size_t length, void* dest);
|
||||
/**
|
||||
Base64 encodes src into dst. encode is a pointer to at least 65 chars.
|
||||
encode[64] will be used as the pad character. Encodings other than the
|
||||
default encoding cannot be decoded.
|
||||
*/
|
||||
static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL);
|
||||
|
||||
#ifdef SK_SUPPORT_UNITTEST
|
||||
static void UnitTest();
|
Загрузка…
Ссылка в новой задаче