Changeset 870f78c in mainline
- Timestamp:
- 2013-09-12T14:34:35Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f9f45e7
- Parents:
- 47b27b40
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/rfb/rfb.c
r47b27b40 r870f78c 301 301 } 302 302 303 static int rfb_send_palette(int conn_sd, rfb_t *rfb)303 static void *rfb_send_palette_message(rfb_t *rfb, size_t *psize) 304 304 { 305 305 size_t size = sizeof(rfb_set_color_map_entries_t) + … … 308 308 void *buf = malloc(size); 309 309 if (buf == NULL) 310 return ENOMEM;310 return NULL; 311 311 312 312 void *pos = buf; … … 327 327 } 328 328 329 int rc = send(conn_sd, buf, size, 0); 330 free(buf); 331 332 return rc; 329 *psize = size; 330 return buf; 333 331 } 334 332 … … 481 479 static int rfb_send_framebuffer_update(rfb_t *rfb, int conn_sd, bool incremental) 482 480 { 481 fibril_mutex_lock(&rfb->lock); 483 482 if (!incremental || !rfb->damage_valid) { 484 483 rfb->damage_rect.x = 0; … … 496 495 497 496 void *buf = malloc(buf_size); 498 if (buf == NULL) 497 if (buf == NULL) { 498 fibril_mutex_unlock(&rfb->lock); 499 499 return ENOMEM; 500 } 500 501 memset(buf, 0, buf_size); 501 502 … … 522 523 rfb_rectangle_to_be(rect, rect); 523 524 525 rfb->damage_valid = false; 526 527 size_t send_palette_size = 0; 528 void *send_palette = NULL; 529 524 530 if (!rfb->pixel_format.true_color) { 525 int rc = rfb_send_palette(conn_sd, rfb); 531 send_palette = rfb_send_palette_message(rfb, &send_palette_size); 532 if (send_palette == NULL) { 533 free(buf); 534 fibril_mutex_unlock(&rfb->lock); 535 return ENOMEM; 536 } 537 } 538 539 fibril_mutex_unlock(&rfb->lock); 540 541 if (!rfb->pixel_format.true_color) { 542 int rc = send(conn_sd, send_palette, send_palette_size, 0); 526 543 if (rc != EOK) { 527 544 free(buf); … … 532 549 int rc = send(conn_sd, buf, buf_size, 0); 533 550 free(buf); 534 rfb->damage_valid = false;551 535 552 return rc; 536 553 } … … 694 711 log_msg(LOG_DEFAULT, LVL_DEBUG2, 695 712 "Received FramebufferUpdateRequest message"); 696 fibril_mutex_lock(&rfb->lock);697 713 rfb_send_framebuffer_update(rfb, conn_sd, fbur.incremental); 698 fibril_mutex_unlock(&rfb->lock);699 714 break; 700 715 case RFB_CMSG_KEY_EVENT:
Note:
See TracChangeset
for help on using the changeset viewer.