GUACAMOLE-1538: Return number of bytes written for guac_terminal_write() and guac_terminal_printf().

This commit is contained in:
Mike Jumper 2023-01-04 12:05:02 -08:00
parent 7d16f67d6d
commit ec7964e8fb

View File

@ -852,14 +852,13 @@ void guac_terminal_commit_cursor(guac_terminal* term) {
}
int guac_terminal_write(guac_terminal* term, const char* c, int size) {
int guac_terminal_write(guac_terminal* term, const char* buffer, int length) {
guac_terminal_lock(term);
while (size > 0) {
for (int written = 0; written < length; written++) {
/* Read and advance to next character */
char current = *(c++);
size--;
char current = *(buffer++);
/* Write character to typescript, if any */
if (term->typescript != NULL)
@ -872,7 +871,7 @@ int guac_terminal_write(guac_terminal* term, const char* c, int size) {
guac_terminal_unlock(term);
guac_terminal_notify(term);
return 0;
return length;
}
@ -2104,4 +2103,4 @@ void guac_terminal_remove_user(guac_terminal* terminal, guac_user* user) {
/* Remove the user from the terminal cursor */
guac_common_cursor_remove_user(terminal->cursor, user);
}
}