| OLD | NEW |
| 1 | 1 |
| 2 //********************************************************************* | 2 //********************************************************************* |
| 3 //* Base64 - a simple base64 encoder and decoder. | 3 //* Base64 - a simple base64 encoder and decoder. |
| 4 //* | 4 //* |
| 5 //* Copyright (c) 1999, Bob Withers - bwit@pobox.com | 5 //* Copyright (c) 1999, Bob Withers - bwit@pobox.com |
| 6 //* | 6 //* |
| 7 //* This code may be freely used for any purpose, either personal | 7 //* This code may be freely used for any purpose, either personal |
| 8 //* or commercial, provided the authors copyright notice remains | 8 //* or commercial, provided the authors copyright notice remains |
| 9 //* intact. | 9 //* intact. |
| 10 //* | 10 //* |
| 11 //* Enhancements by Stanley Yamane: | 11 //* Enhancements by Stanley Yamane: |
| 12 //* o reverse lookup table for the decode function | 12 //* o reverse lookup table for the decode function |
| 13 //* o reserve string buffer space in advance | 13 //* o reserve string buffer space in advance |
| 14 //* | 14 //* |
| 15 //********************************************************************* | 15 //********************************************************************* |
| 16 | 16 |
| 17 #include "webrtc/base/base64.h" | 17 #include "webrtc/rtc_base/base64.h" |
| 18 | 18 |
| 19 #include <string.h> | 19 #include <string.h> |
| 20 | 20 |
| 21 #include "webrtc/base/checks.h" | 21 #include "webrtc/rtc_base/checks.h" |
| 22 | 22 |
| 23 using std::vector; | 23 using std::vector; |
| 24 | 24 |
| 25 namespace rtc { | 25 namespace rtc { |
| 26 | 26 |
| 27 static const char kPad = '='; | 27 static const char kPad = '='; |
| 28 static const unsigned char pd = 0xFD; // Padding | 28 static const unsigned char pd = 0xFD; // Padding |
| 29 static const unsigned char sp = 0xFE; // Whitespace | 29 static const unsigned char sp = 0xFE; // Whitespace |
| 30 static const unsigned char il = 0xFF; // Illegal base64 character | 30 static const unsigned char il = 0xFF; // Illegal base64 character |
| 31 | 31 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if ((DO_TERM_BUFFER == term_flags) && (dpos != len)) { | 269 if ((DO_TERM_BUFFER == term_flags) && (dpos != len)) { |
| 270 success = false; // unused chars | 270 success = false; // unused chars |
| 271 } | 271 } |
| 272 if (data_used) { | 272 if (data_used) { |
| 273 *data_used = dpos; | 273 *data_used = dpos; |
| 274 } | 274 } |
| 275 return success; | 275 return success; |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace rtc | 278 } // namespace rtc |
| OLD | NEW |