s/unsigned int/uint/, s/unsigned long/ulong/
596033b7
1 file(s) · +27 −25
| 20 | 20 | enum { ColFG, ColBG, ColLast }; |
|
| 21 | 21 | ||
| 22 | 22 | /* typedefs */ |
|
| 23 | + | typedef unsigned int uint; |
|
| 24 | + | typedef unsigned long ulong; |
|
| 23 | 25 | typedef struct { |
|
| 24 | 26 | int x, y, w, h; |
|
| 25 | - | unsigned long norm[ColLast]; |
|
| 26 | - | unsigned long sel[ColLast]; |
|
| 27 | + | ulong norm[ColLast]; |
|
| 28 | + | ulong sel[ColLast]; |
|
| 27 | 29 | Drawable drawable; |
|
| 28 | 30 | GC gc; |
|
| 29 | 31 | struct { |
|
| 48 | 50 | char *cistrstr(const char *s, const char *sub); |
|
| 49 | 51 | void cleanup(void); |
|
| 50 | 52 | void drawmenu(void); |
|
| 51 | - | void drawtext(const char *text, unsigned long col[ColLast]); |
|
| 52 | - | void *emalloc(unsigned int size); |
|
| 53 | + | void drawtext(const char *text, ulong col[ColLast]); |
|
| 54 | + | void *emalloc(uint size); |
|
| 53 | 55 | void eprint(const char *errstr, ...); |
|
| 54 | 56 | char *estrdup(const char *str); |
|
| 55 | - | unsigned long getcolor(const char *colstr); |
|
| 57 | + | ulong getcolor(const char *colstr); |
|
| 56 | 58 | Bool grabkeyboard(void); |
|
| 57 | 59 | void initfont(const char *fontstr); |
|
| 58 | 60 | void kpress(XKeyEvent * e); |
|
| 60 | 62 | void readstdin(void); |
|
| 61 | 63 | void run(void); |
|
| 62 | 64 | void setup(Bool topbar); |
|
| 63 | - | unsigned int textnw(const char *text, unsigned int len); |
|
| 64 | - | unsigned int textw(const char *text); |
|
| 65 | + | uint textnw(const char *text, uint len); |
|
| 66 | + | uint textw(const char *text); |
|
| 65 | 67 | ||
| 66 | 68 | #include "config.h" |
|
| 67 | 69 | ||
| 76 | 78 | char text[4096]; |
|
| 77 | 79 | int screen; |
|
| 78 | 80 | int ret = 0; |
|
| 79 | - | unsigned int cmdw = 0; |
|
| 80 | - | unsigned int mw, mh; |
|
| 81 | - | unsigned int promptw = 0; |
|
| 82 | - | unsigned int numlockmask = 0; |
|
| 81 | + | uint cmdw = 0; |
|
| 82 | + | uint mw, mh; |
|
| 83 | + | uint promptw = 0; |
|
| 84 | + | uint numlockmask = 0; |
|
| 83 | 85 | Bool running = True; |
|
| 84 | 86 | Display *dpy; |
|
| 85 | 87 | DC dc = {0}; |
|
| 106 | 108 | ||
| 107 | 109 | void |
|
| 108 | 110 | calcoffsets(void) { |
|
| 109 | - | unsigned int tw, w; |
|
| 111 | + | uint tw, w; |
|
| 110 | 112 | ||
| 111 | 113 | if(!curr) |
|
| 112 | 114 | return; |
|
| 133 | 135 | char * |
|
| 134 | 136 | cistrstr(const char *s, const char *sub) { |
|
| 135 | 137 | int c, csub; |
|
| 136 | - | unsigned int len; |
|
| 138 | + | uint len; |
|
| 137 | 139 | ||
| 138 | 140 | if(!sub) |
|
| 139 | 141 | return (char *)s; |
|
| 215 | 217 | } |
|
| 216 | 218 | ||
| 217 | 219 | void |
|
| 218 | - | drawtext(const char *text, unsigned long col[ColLast]) { |
|
| 220 | + | drawtext(const char *text, ulong col[ColLast]) { |
|
| 219 | 221 | int x, y, w, h; |
|
| 220 | 222 | static char buf[256]; |
|
| 221 | - | unsigned int len, olen; |
|
| 223 | + | uint len, olen; |
|
| 222 | 224 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 223 | 225 | ||
| 224 | 226 | XSetForeground(dpy, dc.gc, col[ColBG]); |
|
| 255 | 257 | } |
|
| 256 | 258 | ||
| 257 | 259 | void * |
|
| 258 | - | emalloc(unsigned int size) { |
|
| 260 | + | emalloc(uint size) { |
|
| 259 | 261 | void *res = malloc(size); |
|
| 260 | 262 | ||
| 261 | 263 | if(!res) |
|
| 282 | 284 | return res; |
|
| 283 | 285 | } |
|
| 284 | 286 | ||
| 285 | - | unsigned long |
|
| 287 | + | ulong |
|
| 286 | 288 | getcolor(const char *colstr) { |
|
| 287 | 289 | Colormap cmap = DefaultColormap(dpy, screen); |
|
| 288 | 290 | XColor color; |
|
| 294 | 296 | ||
| 295 | 297 | Bool |
|
| 296 | 298 | grabkeyboard(void) { |
|
| 297 | - | unsigned int len; |
|
| 299 | + | uint len; |
|
| 298 | 300 | ||
| 299 | 301 | for(len = 1000; len; len--) { |
|
| 300 | 302 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) |
|
| 350 | 352 | kpress(XKeyEvent * e) { |
|
| 351 | 353 | char buf[32]; |
|
| 352 | 354 | int i, num; |
|
| 353 | - | unsigned int len; |
|
| 355 | + | uint len; |
|
| 354 | 356 | KeySym ksym; |
|
| 355 | 357 | ||
| 356 | 358 | len = strlen(text); |
|
| 517 | 519 | ||
| 518 | 520 | void |
|
| 519 | 521 | match(char *pattern) { |
|
| 520 | - | unsigned int plen; |
|
| 522 | + | uint plen; |
|
| 521 | 523 | Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; |
|
| 522 | 524 | ||
| 523 | 525 | if(!pattern) |
|
| 559 | 561 | void |
|
| 560 | 562 | readstdin(void) { |
|
| 561 | 563 | char *p, buf[1024]; |
|
| 562 | - | unsigned int len = 0, max = 0; |
|
| 564 | + | uint len = 0, max = 0; |
|
| 563 | 565 | Item *i, *new; |
|
| 564 | 566 | ||
| 565 | 567 | i = 0; |
|
| 675 | 677 | XMapRaised(dpy, win); |
|
| 676 | 678 | } |
|
| 677 | 679 | ||
| 678 | - | unsigned int |
|
| 679 | - | textnw(const char *text, unsigned int len) { |
|
| 680 | + | uint |
|
| 681 | + | textnw(const char *text, uint len) { |
|
| 680 | 682 | XRectangle r; |
|
| 681 | 683 | ||
| 682 | 684 | if(dc.font.set) { |
|
| 686 | 688 | return XTextWidth(dc.font.xfont, text, len); |
|
| 687 | 689 | } |
|
| 688 | 690 | ||
| 689 | - | unsigned int |
|
| 691 | + | uint |
|
| 690 | 692 | textw(const char *text) { |
|
| 691 | 693 | return textnw(text, strlen(text)) + dc.font.height; |
|
| 692 | 694 | } |
|
| 693 | 695 | ||
| 694 | 696 | int |
|
| 695 | 697 | main(int argc, char *argv[]) { |
|
| 696 | - | unsigned int i; |
|
| 698 | + | uint i; |
|
| 697 | 699 | Bool topbar = True; |
|
| 698 | 700 | ||
| 699 | 701 | /* command line args */ |
|