Changeset b7fd2a0 in mainline for uspace/srv/hid/rfb


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

Location:
uspace/srv/hid/rfb
Files:
3 edited

Legend:

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

    r36f0738 rb7fd2a0  
    5252static rfb_t rfb;
    5353
    54 static int rfb_claim(visualizer_t *vs)
    55 {
    56         return EOK;
    57 }
    58 
    59 static int rfb_yield(visualizer_t *vs)
    60 {
    61         return EOK;
    62 }
    63 
    64 static int rfb_suspend(visualizer_t *vs)
    65 {
    66         return EOK;
    67 }
    68 
    69 static int rfb_wakeup(visualizer_t *vs)
    70 {
    71         return EOK;
    72 }
    73 
    74 static int rfb_handle_damage_pixels(visualizer_t *vs,
     54static errno_t rfb_claim(visualizer_t *vs)
     55{
     56        return EOK;
     57}
     58
     59static errno_t rfb_yield(visualizer_t *vs)
     60{
     61        return EOK;
     62}
     63
     64static errno_t rfb_suspend(visualizer_t *vs)
     65{
     66        return EOK;
     67}
     68
     69static errno_t rfb_wakeup(visualizer_t *vs)
     70{
     71        return EOK;
     72}
     73
     74static errno_t rfb_handle_damage_pixels(visualizer_t *vs,
    7575    sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
    7676    sysarg_t x_offset, sysarg_t y_offset)
     
    126126}
    127127
    128 static int rfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
     128static errno_t rfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
    129129{
    130130        return EOK;
     
    217217        async_set_fallback_port_handler(client_connection, NULL);
    218218
    219         int rc = loc_server_register(NAME);
     219        errno_t rc = loc_server_register(NAME);
    220220        if (rc != EOK) {
    221221                printf("%s: Unable to register server.\n", NAME);
  • uspace/srv/hid/rfb/rfb.c

    r36f0738 rb7fd2a0  
    6262
    6363/** Receive one character (with buffering) */
    64 static int recv_char(tcp_conn_t *conn, char *c)
     64static errno_t recv_char(tcp_conn_t *conn, char *c)
    6565{
    6666        size_t nrecv;
    67         int rc;
     67        errno_t rc;
    6868
    6969        if (rbuf_out == rbuf_in) {
     
    8383
    8484/** Receive count characters (with buffering) */
    85 static int recv_chars(tcp_conn_t *conn, char *c, size_t count)
     85static errno_t recv_chars(tcp_conn_t *conn, char *c, size_t count)
    8686{
    8787        for (size_t i = 0; i < count; i++) {
    88                 int rc = recv_char(conn, c);
     88                errno_t rc = recv_char(conn, c);
    8989                if (rc != EOK)
    9090                        return rc;
     
    9494}
    9595
    96 static int recv_skip_chars(tcp_conn_t *conn, size_t count)
     96static errno_t recv_skip_chars(tcp_conn_t *conn, size_t count)
    9797{
    9898        for (size_t i = 0; i < count; i++) {
    9999                char c;
    100                 int rc = recv_char(conn, &c);
     100                errno_t rc = recv_char(conn, &c);
    101101                if (rc != EOK)
    102102                        return rc;
     
    173173}
    174174
    175 int rfb_init(rfb_t *rfb, uint16_t width, uint16_t height, const char *name)
     175errno_t rfb_init(rfb_t *rfb, uint16_t width, uint16_t height, const char *name)
    176176{
    177177        memset(rfb, 0, sizeof(rfb_t));
     
    196196}
    197197
    198 int rfb_set_size(rfb_t *rfb, uint16_t width, uint16_t height)
     198errno_t rfb_set_size(rfb_t *rfb, uint16_t width, uint16_t height)
    199199{
    200200        size_t new_size = width * height * sizeof(pixel_t);
     
    216216}
    217217
    218 static int recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
     218static errno_t recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
    219219{
    220220        memcpy(buf, &type, 1);
     
    435435}
    436436
    437 static int rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
     437static errno_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
    438438    rfb_rectangle_t *tile, void *buf, size_t *size)
    439439{
     
    476476                        uint8_t tile_enctype = RFB_TILE_ENCODING_SOLID;
    477477                        size_t tile_size;
    478                         int rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf,
     478                        errno_t rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf,
    479479                            &tile_size);
    480480                        if (rc != EOK) {
     
    492492}
    493493
    494 static int rfb_send_framebuffer_update(rfb_t *rfb, tcp_conn_t *conn,
     494static errno_t rfb_send_framebuffer_update(rfb_t *rfb, tcp_conn_t *conn,
    495495    bool incremental)
    496496{
     
    556556       
    557557        if (!rfb->pixel_format.true_color) {
    558                 int rc = tcp_conn_send(conn, send_palette, send_palette_size);
     558                errno_t rc = tcp_conn_send(conn, send_palette, send_palette_size);
    559559                if (rc != EOK) {
    560560                        free(buf);
     
    563563        }
    564564       
    565         int rc = tcp_conn_send(conn, buf, buf_size);
     565        errno_t rc = tcp_conn_send(conn, buf, buf_size);
    566566        free(buf);
    567567       
     
    569569}
    570570
    571 static int rfb_set_pixel_format(rfb_t *rfb, rfb_pixel_format_t *pixel_format)
     571static errno_t rfb_set_pixel_format(rfb_t *rfb, rfb_pixel_format_t *pixel_format)
    572572{
    573573        rfb->pixel_format = *pixel_format;
     
    599599{
    600600        /* Version handshake */
    601         int rc = tcp_conn_send(conn, "RFB 003.008\n", 12);
     601        errno_t rc = tcp_conn_send(conn, "RFB 003.008\n", 12);
    602602        if (rc != EOK) {
    603603                log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version: %s",
     
    759759}
    760760
    761 int rfb_listen(rfb_t *rfb, uint16_t port)
     761errno_t rfb_listen(rfb_t *rfb, uint16_t port)
    762762{
    763763        tcp_t *tcp = NULL;
    764764        tcp_listener_t *lst = NULL;
    765765        inet_ep_t ep;
    766         int rc;
     766        errno_t rc;
    767767       
    768768        rc = tcp_create(&tcp);
  • uspace/srv/hid/rfb/rfb.h

    r36f0738 rb7fd2a0  
    164164
    165165
    166 extern int rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
    167 extern int rfb_set_size(rfb_t *, uint16_t, uint16_t);
    168 extern int rfb_listen(rfb_t *, uint16_t);
     166extern errno_t rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
     167extern errno_t rfb_set_size(rfb_t *, uint16_t, uint16_t);
     168extern errno_t rfb_listen(rfb_t *, uint16_t);
    169169
    170170#endif
Note: See TracChangeset for help on using the changeset viewer.