Changeset a35b458 in mainline for uspace/app/viewer/viewer.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/viewer/viewer.c

    r3061bc1 ra35b458  
    7272        kbd_event_t *event = (kbd_event_t *) data;
    7373        bool update = false;
    74        
     74
    7575        if ((event->type == KEY_PRESS) && (event->c == 'q'))
    7676                exit(0);
    77        
     77
    7878        if ((event->type == KEY_PRESS) && (event->key == KC_PAGE_DOWN)) {
    7979                if (imgs_current == imgs_count - 1)
     
    8181                else
    8282                        imgs_current++;
    83                
     83
    8484                update = true;
    8585        }
    86        
     86
    8787        if ((event->type == KEY_PRESS) && (event->key == KC_PAGE_UP)) {
    8888                if (imgs_current == 0)
     
    9090                else
    9191                        imgs_current--;
    92                
     92
    9393                update = true;
    9494        }
    95        
     95
    9696        if (update) {
    9797                surface_t *lsface;
     
    114114        if (rc != EOK)
    115115                return false;
    116        
     116
    117117        vfs_stat_t stat;
    118118        rc = vfs_stat(fd, &stat);
     
    121121                return false;
    122122        }
    123        
     123
    124124        void *tga = malloc(stat.size);
    125125        if (tga == NULL) {
     
    135135                return false;
    136136        }
    137        
     137
    138138        vfs_put(fd);
    139        
     139
    140140        *p_local_surface = decode_tga(tga, stat.size, 0);
    141141        if (*p_local_surface == NULL) {
     
    143143                return false;
    144144        }
    145        
     145
    146146        free(tga);
    147147
    148148        surface_get_resolution(*p_local_surface, &img_width, &img_height);
    149        
     149
    150150        return true;
    151151}
     
    165165                        return false;
    166166                }
    167                
     167
    168168                sig_connect(&canvas->keyboard_event, NULL, on_keyboard_event);
    169169        }
    170        
     170
    171171        if (surface != NULL)
    172172                surface_destroy(surface);
    173        
     173
    174174        surface = local_surface;
    175175        return true;
     
    188188                return 1;
    189189        }
    190        
     190
    191191        if (argc < 3) {
    192192                printf("No image files specified.\n");
     
    200200                return 2;
    201201        }
    202        
     202
    203203        for (int i = 0; i < argc - 2; i++) {
    204204                imgs[i] = str_dup(argv[i + 2]);
     
    226226                return 5;
    227227        }
    228        
    229        
     228
     229
    230230        if (!img_setup(lsface)) {
    231231                printf("Cannot setup image \"%s\".\n", imgs[imgs_current]);
     
    244244            img_height + dheight, WINDOW_PLACEMENT_ANY);
    245245        window_exec(main_window);
    246        
     246
    247247        task_retval(0);
    248248        async_manager();
    249        
     249
    250250        return 0;
    251251}
Note: See TracChangeset for help on using the changeset viewer.