Changeset 18b6a88 in mainline for uspace/srv/hid/rfb/rfb.c
- Timestamp:
- 2018-04-15T09:35:04Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1f44ca
- Parents:
- 8ebe212
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/rfb/rfb.c
r8ebe212 r18b6a88 83 83 84 84 /** Receive count characters (with buffering) */ 85 __attribute__((warn_unused_result))86 static errno_trecv_chars(tcp_conn_t *conn, char *c, size_t count)85 static errno_t __attribute__((warn_unused_result)) 86 recv_chars(tcp_conn_t *conn, char *c, size_t count) 87 87 { 88 88 for (size_t i = 0; i < count; i++) { … … 217 217 } 218 218 219 __attribute__((warn_unused_result))220 static errno_trecv_message(tcp_conn_t *conn, char type, void *buf, size_t size)219 static errno_t __attribute__((warn_unused_result)) 220 recv_message(tcp_conn_t *conn, char type, void *buf, size_t size) 221 221 { 222 222 memcpy(buf, &type, 1); 223 return recv_chars(conn, ((char *) buf) + 1, size - 1);223 return recv_chars(conn, ((char *) buf) + 1, size - 1); 224 224 } 225 225 … … 236 236 if (free && first_free_index == -1) { 237 237 first_free_index = i; 238 } 239 else if (!free && RED(rfb->palette[i]) == RED(pixel) && 238 } else if (!free && RED(rfb->palette[i]) == RED(pixel) && 240 239 GREEN(rfb->palette[i]) == GREEN(pixel) && 241 240 BLUE(rfb->palette[i]) == BLUE(pixel)) { … … 268 267 uint8_t pix8 = pix; 269 268 memcpy(buf, &pix8, 1); 270 } 271 else if (pf->bpp == 16) { 269 } else if (pf->bpp == 16) { 272 270 uint16_t pix16 = pix; 273 271 if (pf->big_endian) { 274 272 pix16 = host2uint16_t_be(pix16); 275 } 276 else { 273 } else { 277 274 pix16 = host2uint16_t_le(pix16); 278 275 } 279 276 memcpy(buf, &pix16, 2); 280 } 281 else if (pf->bpp == 32) { 277 } else if (pf->bpp == 32) { 282 278 if (pf->big_endian) { 283 279 pix = host2uint32_t_be(pix); 284 } 285 else { 280 } else { 286 281 pix = host2uint32_t_le(pix); 287 282 } … … 294 289 if (rfb->pixel_format.true_color) { 295 290 rfb_encode_true_color(&rfb->pixel_format, buf, pixel); 296 } 297 else { 291 } else { 298 292 rfb_encode_index(rfb, buf, pixel); 299 293 } … … 366 360 367 361 typedef enum { 368 COMP_NONE, COMP_SKIP_START, COMP_SKIP_END 362 COMP_NONE, 363 COMP_SKIP_START, 364 COMP_SKIP_END 369 365 } cpixel_compress_type_t; 370 366 … … 387 383 if (pixel_format->big_endian) { 388 384 mask = host2uint32_t_be(mask); 389 } 390 else { 385 } else { 391 386 mask = host2uint32_t_le(mask); 392 387 } … … 396 391 ctx->compress_type = COMP_SKIP_START; 397 392 ctx->size = 3; 398 } 399 else if (mask_data[3] == 0) { 393 } else if (mask_data[3] == 0) { 400 394 ctx->compress_type = COMP_SKIP_END; 401 395 ctx->size = 3; … … 509 503 size_t buf_size = sizeof(rfb_framebuffer_update_t) + 510 504 sizeof(rfb_rectangle_t) * 1 + 511 rfb_rect_encode_raw(rfb, &rfb->damage_rect, NULL) 512 ; 505 rfb_rect_encode_raw(rfb, &rfb->damage_rect, NULL); 513 506 514 507 void *buf = malloc(buf_size); … … 534 527 rect->enctype = RFB_ENCODING_TRLE; 535 528 pos += rfb_rect_encode_trle(rfb, rect, pos); 536 } 537 else { 529 } else { 538 530 rect->enctype = RFB_ENCODING_RAW; 539 531 pos += rfb_rect_encode_raw(rfb, rect, pos); … … 583 575 pixel_format->g_max, pixel_format->g_shift, pixel_format->b_max, 584 576 pixel_format->b_shift); 585 } 586 else { 577 } else { 587 578 if (rfb->palette == NULL) { 588 579 rfb->palette = malloc(sizeof(pixel_t) * 256); … … 675 666 server_init->width = rfb->width; 676 667 server_init->height = rfb->height; 677 server_init->pixel_format = rfb->pixel_format ,668 server_init->pixel_format = rfb->pixel_format; 678 669 server_init->name_length = name_length; 679 670 rfb_server_init_to_be(server_init, server_init);
Note:
See TracChangeset
for help on using the changeset viewer.