| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org> | 2 Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org> |
| 3 Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 3 Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 4 Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 4 Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 5 Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 5 Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU Lesser General Public License (LGPL) | 8 it under the terms of the GNU Lesser General Public License (LGPL) |
| 9 version 2 as published by the Free Software Foundation. | 9 version 2 as published by the Free Software Foundation. |
| 10 | 10 |
| 11 This program is distributed in the hope that it will be useful, | 11 This program is distributed in the hope that it will be useful, |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
| 15 | 15 |
| 16 You should have received a copy of the GNU Library General Public | 16 You should have received a copy of the GNU Library General Public |
| 17 License along with this program; if not, write to the Free Software | 17 License along with this program; if not, write to the Free Software |
| 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
A. | 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
A. |
| 19 | 19 |
| 20 This code is based on the java implementation in HTTPClient | 20 This code is based on the java implementation in HTTPClient |
| 21 package by Ronald Tschalär Copyright (C) 1996-1999. | 21 package by Ronald Tschalär Copyright (C) 1996-1999. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "Base64.h" | 25 #include "Base64.h" |
| 26 | 26 |
| 27 #include <limits.h> | 27 #include <limits.h> |
| 28 #include <wtf/StringExtras.h> | 28 #include "wtf/StringExtras.h" |
| 29 #include <wtf/text/WTFString.h> | 29 #include "wtf/text/WTFString.h" |
| 30 | 30 |
| 31 namespace WTF { | 31 namespace WTF { |
| 32 | 32 |
| 33 static const char base64EncMap[64] = { | 33 static const char base64EncMap[64] = { |
| 34 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, | 34 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
| 35 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, | 35 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, |
| 36 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | 36 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
| 37 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, | 37 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, |
| 38 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, | 38 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, |
| 39 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, | 39 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 { | 203 { |
| 204 return base64DecodeInternal<char>(data, len, out, policy); | 204 return base64DecodeInternal<char>(data, len, out, policy); |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy
) | 207 bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy
) |
| 208 { | 208 { |
| 209 return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy
); | 209 return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy
); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace WTF | 212 } // namespace WTF |
| OLD | NEW |