Changes in uspace/srv/hid/rfb/rfb.c [d6ff08a0:dd8ab1c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/rfb/rfb.c
rd6ff08a0 rdd8ab1c 418 418 } 419 419 420 static s size_t rfb_tile_encode_raw(rfb_t *rfb, cpixel_ctx_t *cpixel,420 static size_t rfb_tile_encode_raw(rfb_t *rfb, cpixel_ctx_t *cpixel, 421 421 rfb_rectangle_t *tile, void *buf) 422 422 { 423 s size_t size = tile->width * tile->height * cpixel->size;423 size_t size = tile->width * tile->height * cpixel->size; 424 424 if (buf == NULL) 425 425 return size; … … 435 435 } 436 436 437 static s size_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,438 rfb_rectangle_t *tile, void *buf )437 static size_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel, 438 rfb_rectangle_t *tile, void *buf, size_t *size) 439 439 { 440 440 /* Check if it is single color */ … … 443 443 for (uint16_t x = tile->x; x < tile->x + tile->width; x++) { 444 444 if (pixelmap_get_pixel(&rfb->framebuffer, x, y) != the_color) 445 return -1;445 return EINVAL; 446 446 } 447 447 } … … 450 450 if (buf) 451 451 cpixel_encode(rfb, cpixel, buf, the_color); 452 return cpixel->size; 452 *size = cpixel->size; 453 return EOK; 453 454 } 454 455 … … 474 475 475 476 uint8_t tile_enctype = RFB_TILE_ENCODING_SOLID; 476 ssize_t tile_size = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf); 477 if (tile_size < 0) { 477 size_t tile_size; 478 int rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf, 479 &tile_size); 480 if (rc != EOK) { 478 481 tile_size = rfb_tile_encode_raw(rfb, &cpixel, &tile, buf); 479 482 tile_enctype = RFB_TILE_ENCODING_RAW; … … 598 601 int rc = tcp_conn_send(conn, "RFB 003.008\n", 12); 599 602 if (rc != EOK) { 600 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version %d", rc); 603 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version: %s", 604 str_error(rc)); 601 605 return; 602 606 } … … 605 609 rc = recv_chars(conn, client_version, 12); 606 610 if (rc != EOK) { 607 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client version: %d", rc); 611 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client version: %s", 612 str_error(rc)); 608 613 return; 609 614 } … … 623 628 if (rc != EOK) { 624 629 log_msg(LOG_DEFAULT, LVL_WARN, 625 "Failed sending security handshake: % d", rc);630 "Failed sending security handshake: %s", str_error(rc)); 626 631 return; 627 632 } … … 630 635 rc = recv_char(conn, &selected_sec_type); 631 636 if (rc != EOK) { 632 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving security type: %d", rc); 637 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving security type: %s", 638 str_error(rc)); 633 639 return; 634 640 } … … 641 647 rc = tcp_conn_send(conn, &security_result, sizeof(uint32_t)); 642 648 if (rc != EOK) { 643 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending security result: %d", rc); 649 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending security result: %s", 650 str_error(rc)); 644 651 return; 645 652 } … … 649 656 rc = recv_char(conn, &shared_flag); 650 657 if (rc != EOK) { 651 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client init: %d", rc); 658 log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client init: %s", 659 str_error(rc)); 652 660 return; 653 661 } … … 672 680 rc = tcp_conn_send(conn, server_init, msg_length); 673 681 if (rc != EOK) { 674 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server init: %d", rc); 682 log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server init: %s", 683 str_error(rc)); 675 684 return; 676 685 }
Note:
See TracChangeset
for help on using the changeset viewer.