mike-jumper commented on code in PR #1066:
URL: https://github.com/apache/guacamole-client/pull/1066#discussion_r1984208681
##########
guacamole-common-js/src/main/webapp/modules/SessionRecording.js:
##########
@@ -334,9 +334,38 @@ Guacamole.SessionRecording = function
SessionRecording(source, refreshInterval)
};
+ /**
+ * Calculates the size in bytes of the given UTF8 string.
+ *
+ * @private
+ * @param {!string} str
+ * The string to calculate the size in bytes.
+ *
+ * @returns {!number}
+ * The size in bytes of the given string.
+ */
+ var getUtf8StringByteSize = function(str) {
+
+ var byteSize = str.length;
+ for (var i = str.length - 1; i >= 0; i--) {
+ var code = str.charCodeAt(i);
+ if (code > 0x7F && code <= 0x7FF)
+ byteSize++;
+ else if (code > 0x7FF && code <= 0xFFFF)
+ byteSize += 2;
+ if (code >= 0xDC00 && code <= 0xDFFF)
+ i--; // trail surrogate
+ }
+ return byteSize;
+
+ }
Review Comment:
Missing semicolon here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]