Changeset b7fd2a0 in mainline for uspace/lib/gui


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 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/lib/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/button.c

    r36f0738 rb7fd2a0  
    174174                btn->caption = str_dup(caption);
    175175       
    176         int rc = embedded_font_create(&btn->font, points);
     176        errno_t rc = embedded_font_create(&btn->font, points);
    177177        if (rc != EOK) {
    178178                free(btn->caption);
  • uspace/lib/gui/label.c

    r36f0738 rb7fd2a0  
    163163                lbl->caption = str_dup(caption);
    164164       
    165         int rc = embedded_font_create(&lbl->font, points);
     165        errno_t rc = embedded_font_create(&lbl->font, points);
    166166        if (rc != EOK) {
    167167                free(lbl->caption);
  • uspace/lib/gui/terminal.c

    r36f0738 rb7fd2a0  
    6262static LIST_INITIALIZE(terms);
    6363
    64 static int term_open(con_srvs_t *, con_srv_t *);
    65 static int term_close(con_srv_t *);
    66 static int term_read(con_srv_t *, void *, size_t, size_t *);
    67 static int term_write(con_srv_t *, void *, size_t, size_t *);
     64static errno_t term_open(con_srvs_t *, con_srv_t *);
     65static errno_t term_close(con_srv_t *);
     66static errno_t term_read(con_srv_t *, void *, size_t, size_t *);
     67static errno_t term_write(con_srv_t *, void *, size_t, size_t *);
    6868static void term_sync(con_srv_t *);
    6969static void term_clear(con_srv_t *);
    7070static void term_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
    71 static int term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
    72 static int term_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
    73 static int term_get_color_cap(con_srv_t *, console_caps_t *);
     71static errno_t term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
     72static errno_t term_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
     73static errno_t term_get_color_cap(con_srv_t *, console_caps_t *);
    7474static void term_set_style(con_srv_t *, console_style_t);
    7575static void term_set_color(con_srv_t *, console_color_t, console_color_t,
     
    7777static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
    7878static void term_set_cursor_visibility(con_srv_t *, bool);
    79 static int term_get_event(con_srv_t *, cons_event_t *);
     79static errno_t term_get_event(con_srv_t *, cons_event_t *);
    8080
    8181static con_ops_t con_ops = {
     
    376376}
    377377
    378 static int term_open(con_srvs_t *srvs, con_srv_t *srv)
     378static errno_t term_open(con_srvs_t *srvs, con_srv_t *srv)
    379379{
    380380        return EOK;
    381381}
    382382
    383 static int term_close(con_srv_t *srv)
     383static errno_t term_close(con_srv_t *srv)
    384384{
    385385        return EOK;
    386386}
    387387
    388 static int term_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
     388static errno_t term_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
    389389{
    390390        terminal_t *term = srv_to_terminal(srv);
     
    463463}
    464464
    465 static int term_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
     465static errno_t term_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
    466466{
    467467        terminal_t *term = srv_to_terminal(srv);
     
    504504}
    505505
    506 static int term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
     506static errno_t term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
    507507{
    508508        terminal_t *term = srv_to_terminal(srv);
     
    515515}
    516516
    517 static int term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
     517static errno_t term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
    518518{
    519519        terminal_t *term = srv_to_terminal(srv);
     
    527527}
    528528
    529 static int term_get_color_cap(con_srv_t *srv, console_caps_t *caps)
     529static errno_t term_get_color_cap(con_srv_t *srv, console_caps_t *caps)
    530530{
    531531        (void) srv;
     
    575575}
    576576
    577 static int term_get_event(con_srv_t *srv, cons_event_t *event)
     577static errno_t term_get_event(con_srv_t *srv, cons_event_t *event)
    578578{
    579579        terminal_t *term = srv_to_terminal(srv);
     
    751751        term->srvs.sarg = term;
    752752       
    753         int rc = loc_server_register(NAME);
     753        errno_t rc = loc_server_register(NAME);
    754754        if (rc != EOK) {
    755755                widget_deinit(&term->widget);
  • uspace/lib/gui/window.c

    r36f0738 rb7fd2a0  
    163163       
    164164        font_t *font;
    165         int rc = embedded_font_create(&font, 16);
     165        errno_t rc = embedded_font_create(&font, 16);
    166166        if (rc != EOK) {
    167167                window_yield(widget->window);
     
    404404       
    405405        /* Inform compositor about new surface. */
    406         int rc = win_resize(win->osess, offset_x, offset_y, width, height,
     406        errno_t rc = win_resize(win->osess, offset_x, offset_y, width, height,
    407407            placement_flags, surface_direct_access(new_surface));
    408408       
     
    493493
    494494/* Window event loop. Runs in own dedicated fibril. */
    495 static int event_loop(void *arg)
     495static errno_t event_loop(void *arg)
    496496{
    497497        bool is_main = false;
     
    561561
    562562/* Input fetcher from compositor. Runs in own dedicated fibril. */
    563 static int fetch_input(void *arg)
    564 {
    565         int rc;
     563static errno_t fetch_input(void *arg)
     564{
     565        errno_t rc;
    566566        bool terminate = false;
    567567        window_t *win = (window_t *) arg;
     
    618618       
    619619        service_id_t reg_dsid;
    620         int rc = loc_service_get_id(winreg, &reg_dsid, 0);
     620        errno_t rc = loc_service_get_id(winreg, &reg_dsid, 0);
    621621        if (rc != EOK) {
    622622                free(win);
     
    677677}
    678678
    679 int window_set_caption(window_t *win, const char *caption)
     679errno_t window_set_caption(window_t *win, const char *caption)
    680680{
    681681        char *cap;
  • uspace/lib/gui/window.h

    r36f0738 rb7fd2a0  
    7878
    7979/** Change window caption. */
    80 extern int window_set_caption(window_t *, const char *);
     80extern errno_t window_set_caption(window_t *, const char *);
    8181
    8282/**
Note: See TracChangeset for help on using the changeset viewer.