Changeset bde5c04 in mainline
- Timestamp:
- 2017-12-04T19:32:55Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fb1755
- Parents:
- 8e3498b
- Location:
- uspace/srv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/rfb/rfb.c
r8e3498b rbde5c04 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; -
uspace/srv/net/udp/service.c
r8e3498b rbde5c04 570 570 571 571 rc = async_data_read_finalize(callid, &enext->epp.remote, 572 max(size, (s size_t)sizeof(inet_ep_t)));572 max(size, (size_t)sizeof(inet_ep_t))); 573 573 if (rc != EOK) { 574 574 async_answer_0(iid, rc); … … 596 596 { 597 597 ipc_callid_t callid; 598 s size_t msg_size;598 size_t msg_size; 599 599 udp_crcv_queue_entry_t *enext; 600 600 void *data; 601 601 size_t size; 602 s size_t off;602 size_t off; 603 603 int rc; 604 604 … … 623 623 msg_size = enext->msg->data_size; 624 624 625 rc = async_data_read_finalize(callid, data, max(msg_size - off, 626 (ssize_t)size)); 625 if (off > msg_size) { 626 async_answer_0(callid, EINVAL); 627 async_answer_0(iid, EINVAL); 628 return; 629 } 630 631 rc = async_data_read_finalize(callid, data, min(msg_size - off, size)); 627 632 if (rc != EOK) { 628 633 async_answer_0(iid, rc);
Note:
See TracChangeset
for help on using the changeset viewer.