Pull base64.js from noVNC.
Better illegal character debug output.
This commit is contained in:
parent
f5d109d52b
commit
5af2ad6ef6
@ -41,7 +41,6 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
/*jslint white: false, bitwise: false, plusplus: false */
|
/*jslint white: false, bitwise: false, plusplus: false */
|
||||||
/*global console */
|
/*global console */
|
||||||
|
|
||||||
@ -52,6 +51,7 @@ toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+
|
|||||||
base64Pad : '=',
|
base64Pad : '=',
|
||||||
|
|
||||||
encode: function (data) {
|
encode: function (data) {
|
||||||
|
"use strict";
|
||||||
var result = '',
|
var result = '',
|
||||||
chrTable = Base64.toBase64Table.split(''),
|
chrTable = Base64.toBase64Table.split(''),
|
||||||
pad = Base64.base64Pad,
|
pad = Base64.base64Pad,
|
||||||
@ -95,6 +95,7 @@ toBinaryTable : [
|
|||||||
],
|
],
|
||||||
|
|
||||||
decode: function (data, offset) {
|
decode: function (data, offset) {
|
||||||
|
"use strict";
|
||||||
offset = typeof(offset) !== 'undefined' ? offset : 0;
|
offset = typeof(offset) !== 'undefined' ? offset : 0;
|
||||||
var binTable = Base64.toBinaryTable,
|
var binTable = Base64.toBinaryTable,
|
||||||
pad = Base64.base64Pad,
|
pad = Base64.base64Pad,
|
||||||
@ -115,7 +116,7 @@ decode: function (data, offset) {
|
|||||||
padding = (data.charAt(i) === pad);
|
padding = (data.charAt(i) === pad);
|
||||||
// Skip illegal characters and whitespace
|
// Skip illegal characters and whitespace
|
||||||
if (c === -1) {
|
if (c === -1) {
|
||||||
console.error("Illegal character '" + data.charCodeAt(i) + "'");
|
console.error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user