Changeset bde5c04 in mainline for uspace/srv/hid/rfb/rfb.c


Ignore:
Timestamp:
2017-12-04T19:32:55Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0fb1755
Parents:
8e3498b
Message:

Avoid mixing error codes and transfer sizes.

File:
1 edited

Legend:

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

    r8e3498b rbde5c04  
    418418}
    419419
    420 static ssize_t rfb_tile_encode_raw(rfb_t *rfb, cpixel_ctx_t *cpixel,
     420static size_t rfb_tile_encode_raw(rfb_t *rfb, cpixel_ctx_t *cpixel,
    421421    rfb_rectangle_t *tile, void *buf)
    422422{
    423         ssize_t size = tile->width * tile->height * cpixel->size;
     423        size_t size = tile->width * tile->height * cpixel->size;
    424424        if (buf == NULL)
    425425                return size;
     
    435435}
    436436
    437 static ssize_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
    438     rfb_rectangle_t *tile, void *buf)
     437static size_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
     438    rfb_rectangle_t *tile, void *buf, size_t *size)
    439439{
    440440        /* Check if it is single color */
     
    443443                for (uint16_t x = tile->x; x < tile->x + tile->width; x++) {
    444444                        if (pixelmap_get_pixel(&rfb->framebuffer, x, y) != the_color)
    445                                 return -1;
     445                                return EINVAL;
    446446                }
    447447        }
     
    450450        if (buf)
    451451                cpixel_encode(rfb, cpixel, buf, the_color);
    452         return cpixel->size;
     452        *size = cpixel->size;
     453        return EOK;
    453454}
    454455
     
    474475                       
    475476                        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) {
    478481                                tile_size = rfb_tile_encode_raw(rfb, &cpixel, &tile, buf);
    479482                                tile_enctype = RFB_TILE_ENCODING_RAW;
Note: See TracChangeset for help on using the changeset viewer.