Changeset 18b6a88 in mainline for uspace/srv/hid/rfb/rfb.c


Ignore:
Timestamp:
2018-04-15T09:35:04Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1f44ca
Parents:
8ebe212
Message:

More ccheck fixes, sometimes with manual intervention.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/rfb/rfb.c

    r8ebe212 r18b6a88  
    8383
    8484/** Receive count characters (with buffering) */
    85 __attribute__((warn_unused_result))
    86 static errno_t recv_chars(tcp_conn_t *conn, char *c, size_t count)
     85static errno_t __attribute__((warn_unused_result))
     86recv_chars(tcp_conn_t *conn, char *c, size_t count)
    8787{
    8888        for (size_t i = 0; i < count; i++) {
     
    217217}
    218218
    219 __attribute__((warn_unused_result))
    220 static errno_t recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
     219static errno_t __attribute__((warn_unused_result))
     220recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
    221221{
    222222        memcpy(buf, &type, 1);
    223         return recv_chars(conn, ((char *) buf) + 1, size -1);
     223        return recv_chars(conn, ((char *) buf) + 1, size - 1);
    224224}
    225225
     
    236236                if (free && first_free_index == -1) {
    237237                        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) &&
    240239                    GREEN(rfb->palette[i]) == GREEN(pixel) &&
    241240                    BLUE(rfb->palette[i]) == BLUE(pixel)) {
     
    268267                uint8_t pix8 = pix;
    269268                memcpy(buf, &pix8, 1);
    270         }
    271         else if (pf->bpp == 16) {
     269        } else if (pf->bpp == 16) {
    272270                uint16_t pix16 = pix;
    273271                if (pf->big_endian) {
    274272                        pix16 = host2uint16_t_be(pix16);
    275                 }
    276                 else {
     273                } else {
    277274                        pix16 = host2uint16_t_le(pix16);
    278275                }
    279276                memcpy(buf, &pix16, 2);
    280         }
    281         else if (pf->bpp == 32) {
     277        } else if (pf->bpp == 32) {
    282278                if (pf->big_endian) {
    283279                        pix = host2uint32_t_be(pix);
    284                 }
    285                 else {
     280                } else {
    286281                        pix = host2uint32_t_le(pix);
    287282                }
     
    294289        if (rfb->pixel_format.true_color) {
    295290                rfb_encode_true_color(&rfb->pixel_format, buf, pixel);
    296         }
    297         else {
     291        } else {
    298292                rfb_encode_index(rfb, buf, pixel);
    299293        }
     
    366360
    367361typedef enum {
    368         COMP_NONE, COMP_SKIP_START, COMP_SKIP_END
     362        COMP_NONE,
     363        COMP_SKIP_START,
     364        COMP_SKIP_END
    369365} cpixel_compress_type_t;
    370366
     
    387383                if (pixel_format->big_endian) {
    388384                        mask = host2uint32_t_be(mask);
    389                 }
    390                 else {
     385                } else {
    391386                        mask = host2uint32_t_le(mask);
    392387                }
     
    396391                        ctx->compress_type = COMP_SKIP_START;
    397392                        ctx->size = 3;
    398                 }
    399                 else if (mask_data[3] == 0) {
     393                } else if (mask_data[3] == 0) {
    400394                        ctx->compress_type = COMP_SKIP_END;
    401395                        ctx->size = 3;
     
    509503        size_t buf_size = sizeof(rfb_framebuffer_update_t) +
    510504            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);
    513506
    514507        void *buf = malloc(buf_size);
     
    534527                rect->enctype = RFB_ENCODING_TRLE;
    535528                pos += rfb_rect_encode_trle(rfb, rect, pos);
    536         }
    537         else {
     529        } else {
    538530                rect->enctype = RFB_ENCODING_RAW;
    539531                pos += rfb_rect_encode_raw(rfb, rect, pos);
     
    583575                    pixel_format->g_max, pixel_format->g_shift, pixel_format->b_max,
    584576                    pixel_format->b_shift);
    585         }
    586         else {
     577        } else {
    587578                if (rfb->palette == NULL) {
    588579                        rfb->palette = malloc(sizeof(pixel_t) * 256);
     
    675666        server_init->width = rfb->width;
    676667        server_init->height = rfb->height;
    677         server_init->pixel_format = rfb->pixel_format,
     668        server_init->pixel_format = rfb->pixel_format;
    678669        server_init->name_length = name_length;
    679670        rfb_server_init_to_be(server_init, server_init);
Note: See TracChangeset for help on using the changeset viewer.