diff options
author | Alan Kligman <ack@mozilla.com> | 2013-04-16 18:18:14 -0400 |
---|---|---|
committer | Alan Kligman <ack@mozilla.com> | 2013-05-23 15:30:27 -0400 |
commit | 0837f61e44326e64072f5a8ed2659d2030e98c27 (patch) | |
tree | 8c9b58792bb510a592580bf5b3352815e17ae9cc /src/wrtcp.js | |
parent | 4fb9a415268e59744afa683b84268c56e86cca8b (diff) |
Remove unused code.
Diffstat (limited to 'src/wrtcp.js')
-rw-r--r-- | src/wrtcp.js | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/wrtcp.js b/src/wrtcp.js index c23c95d7..3259afc3 100644 --- a/src/wrtcp.js +++ b/src/wrtcp.js @@ -1,66 +1,6 @@ (function() { - // Some functions to help support binary messages for Chrome until there is native support - - function byteLength(string, optEncoding) { - // FIXME: support other encodings - return window.unescape(encodeURIComponent(string)).length; - }; - - /** - * [source]http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_crypt.js.source.html - * Converts a JS string to a UTF-8 "byte" array. - * @param {string} str 16-bit unicode string. - * @return {Array.<number>} UTF-8 byte array. - */ - function stringToUtf8ByteArray(string, offset, length, buffer) { - // TODO(user): Use native implementations if/when available - string = string.replace(/\r\n/g, '\n'); - var p = 0; - for (var i = offset; i < string.length && p < length; i++) { - var c = string.charCodeAt(i); - if (c < 128) { - buffer[p++] = c; - } else if (c < 2048) { - buffer[p++] = (c >> 6) | 192; - buffer[p++] = (c & 63) | 128; - } else { - buffer[p++] = (c >> 12) | 224; - buffer[p++] = ((c >> 6) & 63) | 128; - buffer[p++] = (c & 63) | 128; - } - } - return buffer; - } - - /** - * [source]http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_crypt.js.source.html - * Converts a UTF-8 byte array to JavaScript's 16-bit Unicode. - * @param {Array.<number>} bytes UTF-8 byte array. - * @return {string} 16-bit Unicode string. - */ - function utf8ByteArrayToString(bytes) { - // TODO(user): Use native implementations if/when available - var out = [], pos = 0, c = 0; - var c1, c2, c3; - while (pos < bytes.length) { - c1 = bytes[pos++]; - if (c1 < 128) { - out[c++] = String.fromCharCode(c1); - } else if (c1 > 191 && c1 < 224) { - c2 = bytes[pos++]; - out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63); - } else { - c2 = bytes[pos++]; - c3 = bytes[pos++]; - out[c++] = String.fromCharCode( - (c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63); - } - } - return out.join(''); - } - /* Notes * * - Continue using prefixed names for now. |