replaced size_t occurences with unsigned int, fixed issue reported by bogon (welcome disappearance issue)

This commit is contained in:
Anselm R. Garbe 2006-03-01 11:55:46 +01:00
parent 7e050df355
commit e23c331ba0
21 changed files with 88 additions and 88 deletions

View File

@ -36,7 +36,7 @@ bar_height()
void void
update_bar_geometry() update_bar_geometry()
{ {
size_t i, j; unsigned int i, j;
brect = rect; brect = rect;
brect.height = bar_height(); brect.height = bar_height();
brect.y = rect.height - brect.height; brect.y = rect.height - brect.height;
@ -56,7 +56,7 @@ update_bar_geometry()
void void
draw_bar() draw_bar()
{ {
size_t i; unsigned int i;
unsigned int w = 0; unsigned int w = 0;
Draw d = { 0 }; Draw d = { 0 };

View File

@ -381,7 +381,7 @@ detach_client(Client *c, Bool unmap)
{ {
Area *a = c->area; Area *a = c->area;
if(a) { if(a) {
size_t i; unsigned int i;
for(i = 0; i < nclient; i++) for(i = 0; i < nclient; i++)
if(client[i]->revert == c) if(client[i]->revert == c)
client[i]->revert = nil; client[i]->revert = nil;
@ -436,7 +436,7 @@ sel_client()
Client * Client *
win2clientframe(Window w) win2clientframe(Window w)
{ {
size_t i; unsigned int i;
for(i = 0; (i < clientsz) && client[i]; i++) for(i = 0; (i < clientsz) && client[i]; i++)
if(client[i]->frame.win == w) if(client[i]->frame.win == w)
return client[i]; return client[i];
@ -627,7 +627,7 @@ sendtoarea_client(Client *c, char *arg) {
void void
resize_all_clients() resize_all_clients()
{ {
size_t i; unsigned int i;
for(i = 0; i < nclient; i++) for(i = 0; i < nclient; i++)
if(client[i]->area) if(client[i]->area)
resize_client(client[i], &client[i]->frame.rect, 0); resize_client(client[i], &client[i]->frame.rect, 0);

View File

@ -32,7 +32,7 @@ str2colmode(char *arg)
void void
arrange_column(Area *col) arrange_column(Area *col)
{ {
size_t i, yoff; unsigned int i, yoff;
unsigned int h; unsigned int h;
if(!col->nclient) if(!col->nclient)
@ -77,7 +77,7 @@ arrange_column(Area *col)
void void
arrange_page(Page *p, Bool update_colums) arrange_page(Page *p, Bool update_colums)
{ {
size_t i; unsigned int i;
unsigned int width; unsigned int width;
if(p->narea == 1) if(p->narea == 1)
@ -98,7 +98,7 @@ arrange_page(Page *p, Bool update_colums)
static void static void
match_horiz(Area *col, XRectangle *r) match_horiz(Area *col, XRectangle *r)
{ {
size_t i; unsigned int i;
for(i = 0; i < col->nclient; i++) { for(i = 0; i < col->nclient; i++) {
Client *c = col->client[i]; Client *c = col->client[i];
@ -114,7 +114,7 @@ drop_resize(Client *c, XRectangle *new)
Area *west = nil, *east = nil, *col = c->area; Area *west = nil, *east = nil, *col = c->area;
Page *p = col->page; Page *p = col->page;
Client *north = nil, *south = nil; Client *north = nil, *south = nil;
size_t i; unsigned int i;
for(i = 0; (i < p->narea) && (p->area[i] != col); i++); for(i = 0; (i < p->narea) && (p->area[i] != col); i++);
west = i ? p->area[i - 1] : nil; west = i ? p->area[i - 1] : nil;
@ -164,7 +164,7 @@ drop_moving(Client *c, XRectangle *new, XPoint * pt)
{ {
Area *tgt = nil, *src = c->area; Area *tgt = nil, *src = c->area;
Page *p = src->page; Page *p = src->page;
size_t i; unsigned int i;
if(!pt || src->nclient < 2) if(!pt || src->nclient < 2)
return; return;
@ -178,7 +178,7 @@ drop_moving(Client *c, XRectangle *new, XPoint * pt)
for(i = 0; (i < src->nclient) && for(i = 0; (i < src->nclient) &&
!blitz_ispointinrect(pt->x, pt->y, &src->client[i]->frame.rect); i++); !blitz_ispointinrect(pt->x, pt->y, &src->client[i]->frame.rect); i++);
if((i < src->nclient) && (c != src->client[i])) { if((i < src->nclient) && (c != src->client[i])) {
size_t j = client2index(c); unsigned int j = client2index(c);
Client *tmp = src->client[j]; Client *tmp = src->client[j];
src->client[j] = src->client[i]; src->client[j] = src->client[i];
src->client[i] = tmp; src->client[i] = tmp;

View File

@ -65,7 +65,7 @@ handle_buttonpress(XEvent *e)
Align align; Align align;
static char buf[32]; static char buf[32];
if(ev->window == winbar) { if(ev->window == winbar) {
size_t i; unsigned int i;
for(i = 0; i < nlabel; i++) for(i = 0; i < nlabel; i++)
if(blitz_ispointinrect(ev->x, ev->y, &label[i]->rect)) { if(blitz_ispointinrect(ev->x, ev->y, &label[i]->rect)) {
snprintf(buf, sizeof(buf), "LB %d %d\n", i + 1, ev->button); snprintf(buf, sizeof(buf), "LB %d %d\n", i + 1, ev->button);
@ -220,7 +220,7 @@ handle_keypress(XEvent *e)
static void static void
handle_keymapnotify(XEvent *e) handle_keymapnotify(XEvent *e)
{ {
size_t i; unsigned int i;
for(i = 0; i < nkey; i++) { for(i = 0; i < nkey; i++) {
ungrab_key(key[i]); ungrab_key(key[i]);
grab_key(key[i]); grab_key(key[i]);

View File

@ -1289,7 +1289,7 @@ do_fcall(IXPConn *c)
void void
write_event(char *event) write_event(char *event)
{ {
size_t i; unsigned int i;
for(i = 0; (i < srv.connsz) && srv.conn[i]; i++) { for(i = 0; (i < srv.connsz) && srv.conn[i]; i++) {
IXPConn *c = srv.conn[i]; IXPConn *c = srv.conn[i];
if(c->is_pending) { if(c->is_pending) {

View File

@ -92,7 +92,7 @@ create_key(char *name)
char buf[128]; char buf[128];
char *seq[8]; char *seq[8];
char *kstr; char *kstr;
size_t i, toks; unsigned int i, toks;
static unsigned short id = 1; static unsigned short id = 1;
Key *k = 0, *r = 0; Key *k = 0, *r = 0;
@ -170,11 +170,11 @@ emulate_key_press(unsigned long mod, KeyCode key)
} }
static Key ** static Key **
match_keys(Key **t, size_t n, unsigned long mod, KeyCode keycode, Bool next, size_t *nres) match_keys(Key **t, unsigned int n, unsigned long mod, KeyCode keycode, Bool next, unsigned int *nres)
{ {
Key **result = nil; Key **result = nil;
size_t ressz = 0; unsigned int ressz = 0;
size_t i = 0; unsigned int i = 0;
*nres = 0; *nres = 0;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
Key *k = next ? t[i]->next : t[i]; Key *k = next ? t[i]->next : t[i];
@ -187,12 +187,12 @@ match_keys(Key **t, size_t n, unsigned long mod, KeyCode keycode, Bool next, siz
} }
static void static void
handle_key_seq(Window w, Key **done, size_t ndone) handle_key_seq(Window w, Key **done, unsigned int ndone)
{ {
unsigned long mod; unsigned long mod;
KeyCode key; KeyCode key;
Key **found = nil; Key **found = nil;
size_t nfound = 0; unsigned int nfound = 0;
char buf[128]; char buf[128];
next_keystroke(&mod, &key); next_keystroke(&mod, &key);
@ -222,7 +222,7 @@ handle_key_seq(Window w, Key **done, size_t ndone)
void void
handle_key(Window w, unsigned long mod, KeyCode keycode) handle_key(Window w, unsigned long mod, KeyCode keycode)
{ {
size_t nfound; unsigned int nfound;
char buf[128]; char buf[128];
Key **found = match_keys(key, nkey, mod, keycode, False, &nfound); Key **found = match_keys(key, nkey, mod, keycode, False, &nfound);
switch(nfound) { switch(nfound) {
@ -248,7 +248,7 @@ handle_key(Window w, unsigned long mod, KeyCode keycode)
Key * Key *
name2key(char *name) name2key(char *name)
{ {
size_t i; unsigned int i;
for(i = 0; i < nkey; i++) for(i = 0; i < nkey; i++)
if(!strncmp(key[i]->name, name, sizeof(key[i]->name))) if(!strncmp(key[i]->name, name, sizeof(key[i]->name)))
return key[i]; return key[i];

View File

@ -148,7 +148,7 @@ pid2index(unsigned short id)
void void
select_page(char *arg) select_page(char *arg)
{ {
size_t new = sel; unsigned int new = sel;
const char *err; const char *err;
Client *c; Client *c;

View File

@ -62,7 +62,7 @@ draw_pager_client(Client *c, Draw *d)
} }
static void static void
draw_pager_page(size_t idx, Draw *d) draw_pager_page(unsigned int idx, Draw *d)
{ {
int i, j; int i, j;
char name[4]; char name[4];
@ -231,7 +231,7 @@ pager()
Client * Client *
win2client(Window w) win2client(Window w)
{ {
size_t i; unsigned int i;
for(i = 0; (i < clientsz) && client[i]; i++) for(i = 0; (i < clientsz) && client[i]; i++)
if(client[i]->win == w) if(client[i]->win == w)
@ -436,7 +436,7 @@ startup_error_handler(Display * dpy, XErrorEvent * error)
static void static void
cleanup() cleanup()
{ {
size_t i; unsigned int i;
Client *c; Client *c;
for(i = 0; client && client[i]; i++) { for(i = 0; client && client[i]; i++) {
c = client[i]; c = client[i];
@ -573,6 +573,7 @@ main(int argc, char *argv[])
draw_bar(); draw_bar();
alloc_page(); /* page 0 */ alloc_page(); /* page 0 */
alloc_page(); /* page 1 */
scan_wins(); scan_wins();
/* main event loop */ /* main event loop */

View File

@ -67,10 +67,10 @@ struct Area {
unsigned short id; unsigned short id;
Client **client; Client **client;
Page *page; Page *page;
size_t clientsz; unsigned int clientsz;
size_t sel; unsigned int sel;
size_t nclient; unsigned int nclient;
size_t maxclient; unsigned int maxclient;
ColumnMode mode; ColumnMode mode;
XRectangle rect; XRectangle rect;
}; };
@ -78,9 +78,9 @@ struct Area {
struct Page { struct Page {
unsigned short id; unsigned short id;
Area **area; Area **area;
size_t areasz; unsigned int areasz;
size_t narea; unsigned int narea;
size_t sel; unsigned int sel;
Page *revert; Page *revert;
}; };
@ -136,19 +136,19 @@ typedef struct {
/* global variables */ /* global variables */
Page **page; Page **page;
size_t npage; unsigned int npage;
size_t pagesz; unsigned int pagesz;
size_t sel; unsigned int sel;
Client **client; Client **client;
size_t nclient; unsigned int nclient;
size_t clientsz; unsigned int clientsz;
Key **key; Key **key;
size_t keysz; unsigned int keysz;
size_t nkey; unsigned int nkey;
Label **label; Label **label;
size_t nlabel; unsigned int nlabel;
size_t labelsz; unsigned int labelsz;
size_t iexpand; unsigned int iexpand;
Display *dpy; Display *dpy;
IXPServer *ixps; IXPServer *ixps;

View File

@ -30,15 +30,15 @@ static Window win;
static XRectangle mrect; static XRectangle mrect;
static int screen; static int screen;
static char **allitem = nil; static char **allitem = nil;
static size_t nallitem = 0; static unsigned int nallitem = 0;
static size_t allitemsz = 0; static unsigned int allitemsz = 0;
static char **item = nil; static char **item = nil;
static size_t itemsz = 0; static unsigned int itemsz = 0;
static size_t nitem = 0; static unsigned int nitem = 0;
static int sel = -1; static int sel = -1;
static size_t nextoff = 0; static unsigned int nextoff = 0;
static size_t prevoff = 0; static unsigned int prevoff = 0;
static size_t curroff = 0; static unsigned int curroff = 0;
static unsigned int cmdw = 0; static unsigned int cmdw = 0;
static Draw draw = { 0 }; static Draw draw = { 0 };
static const int seek = 30; /* 30px */ static const int seek = 30; /* 30px */
@ -59,7 +59,7 @@ usage()
static void static void
update_offsets() update_offsets()
{ {
size_t i; unsigned int i;
unsigned int w = cmdw + 2 * seek; unsigned int w = cmdw + 2 * seek;
if(!nitem) if(!nitem)
@ -81,10 +81,10 @@ update_offsets()
prevoff = i; prevoff = i;
} }
static size_t static unsigned int
update_items(char *pattern) update_items(char *pattern)
{ {
size_t plen = strlen(pattern); unsigned int plen = strlen(pattern);
int i; int i;
curroff = prevoff = nextoff = 0; curroff = prevoff = nextoff = 0;
@ -179,7 +179,7 @@ handle_kpress(XKeyEvent * e)
KeySym ksym; KeySym ksym;
char buf[32]; char buf[32];
int num; int num;
size_t len = strlen(text); unsigned int len = strlen(text);
buf[0] = 0; buf[0] = 0;
num = XLookupString(e, buf, sizeof(buf), &ksym, 0); num = XLookupString(e, buf, sizeof(buf), &ksym, 0);
@ -258,7 +258,7 @@ handle_kpress(XKeyEvent * e)
break; break;
case XK_BackSpace: case XK_BackSpace:
if(len) { if(len) {
size_t i = len; unsigned int i = len;
if(i) { if(i) {
int prev_nitem; int prev_nitem;
do do
@ -316,7 +316,7 @@ void
read_allitems() read_allitems()
{ {
char *maxname = 0, *p, buf[1024]; char *maxname = 0, *p, buf[1024];
size_t len = 0, max = 0; unsigned int len = 0, max = 0;
while(fgets(buf, sizeof(buf), stdin)) { while(fgets(buf, sizeof(buf), stdin)) {
len = strlen(buf); len = strlen(buf);

View File

@ -29,7 +29,7 @@ write_data(unsigned int fid)
{ {
void *data = cext_emallocz(c.fcall.iounit); void *data = cext_emallocz(c.fcall.iounit);
unsigned long long offset = 0; unsigned long long offset = 0;
size_t len = 0; unsigned int len = 0;
while((len = read(0, data, c.fcall.iounit)) > 0) { while((len = read(0, data, c.fcall.iounit)) > 0) {
if(ixp_client_write if(ixp_client_write
@ -136,7 +136,7 @@ time2str(unsigned int t)
static void static void
xls(void *result, unsigned int msize) xls(void *result, unsigned int msize)
{ {
size_t n = 0, i = 0; unsigned int n = 0, i = 0;
void *p = result; void *p = result;
Stat *dir; Stat *dir;
static Stat stat; static Stat stat;
@ -167,8 +167,8 @@ xread(char *file)
int count, is_directory = 0; int count, is_directory = 0;
static unsigned char result[IXP_MAX_MSG]; static unsigned char result[IXP_MAX_MSG];
void *dircontent = nil; void *dircontent = nil;
size_t dircontentsz = 0; unsigned int dircontentsz = 0;
size_t ndircontent = 0; unsigned int ndircontent = 0;
unsigned long long offset = 0; unsigned long long offset = 0;
if(ixp_client_open(&c, fid, file, IXP_OREAD) == -1) { if(ixp_client_open(&c, fid, file, IXP_OREAD) == -1) {

View File

@ -8,9 +8,9 @@
#include "cext.h" #include "cext.h"
void ** void **
cext_array_attach(void **array, void *p, size_t psize, size_t *size) cext_array_attach(void **array, void *p, unsigned int psize, unsigned int *size)
{ {
size_t i; unsigned int i;
if(!array) { if(!array) {
*size = 2; *size = 2;
array = cext_emallocz(psize * (*size)); array = cext_emallocz(psize * (*size));
@ -29,9 +29,9 @@ cext_array_attach(void **array, void *p, size_t psize, size_t *size)
} }
void void
cext_array_detach(void **array, void *p, size_t *size) cext_array_detach(void **array, void *p, unsigned int *size)
{ {
size_t i; unsigned int i;
if(!array) if(!array)
return; return;
for(i = 0; (i < (*size)) && array[i] && array[i] != p; i++); for(i = 0; (i < (*size)) && array[i] && array[i] != p; i++);

View File

@ -10,24 +10,24 @@
#endif #endif
/* array.c */ /* array.c */
void ** cext_array_attach(void **array, void *p, size_t psize, size_t *size); void ** cext_array_attach(void **array, void *p, unsigned int psize, unsigned int *size);
void cext_array_detach(void **array, void *p, size_t *size); void cext_array_detach(void **array, void *p, unsigned int *size);
/* emallocz.c */ /* emallocz.c */
void *cext_emallocz(size_t size); void *cext_emallocz(unsigned int size);
/* estrdup.c */ /* estrdup.c */
char *cext_estrdup(const char *s); char *cext_estrdup(const char *s);
/* strlcat.c */ /* strlcat.c */
size_t cext_strlcat(char *dst, const char *src, size_t siz); unsigned int cext_strlcat(char *dst, const char *src, unsigned int siz);
/* strlcpy.c */ /* strlcpy.c */
size_t cext_strlcpy(char *dst, const char *src, size_t siz); unsigned int cext_strlcpy(char *dst, const char *src, unsigned int siz);
/* strtonum.c */ /* strtonum.c */
long long cext_strtonum(const char *numstr, long long minval, long long cext_strtonum(const char *numstr, long long minval,
long long maxval, const char **errstrp); long long maxval, const char **errstrp);
/* tokenize.c */ /* tokenize.c */
size_t cext_tokenize(char **result, size_t reslen, char *str, char delim); unsigned int cext_tokenize(char **result, unsigned int reslen, char *str, char delim);

View File

@ -9,7 +9,7 @@
#include "cext.h" #include "cext.h"
void * void *
cext_emallocz(size_t size) cext_emallocz(unsigned int size)
{ {
void *res = calloc(1, size); void *res = calloc(1, size);

View File

@ -26,13 +26,13 @@
* Returns strlen(src) + MIN(siz, strlen(initial dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred. * If retval >= siz, truncation occurred.
*/ */
size_t unsigned int
cext_strlcat(char *dst, const char *src, size_t siz) cext_strlcat(char *dst, const char *src, unsigned int siz)
{ {
register char *d = dst; register char *d = dst;
register const char *s = src; register const char *s = src;
register size_t n = siz; register unsigned int n = siz;
size_t dlen; unsigned int dlen;
/* Find the end of dst and adjust bytes left but don't go past end */ /* Find the end of dst and adjust bytes left but don't go past end */
while(n-- != 0 && *d != 0) while(n-- != 0 && *d != 0)

View File

@ -23,12 +23,12 @@
* will be copied. Always NUL terminates (unless siz == 0). * will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred. * Returns strlen(src); if retval >= siz, truncation occurred.
*/ */
size_t unsigned int
cext_strlcpy(char *dst, const char *src, size_t siz) cext_strlcpy(char *dst, const char *src, unsigned int siz)
{ {
register char *d = dst; register char *d = dst;
register const char *s = src; register const char *s = src;
register size_t n = siz; register unsigned int n = siz;
/* Copy as many bytes as will fit */ /* Copy as many bytes as will fit */
if(n != 0 && --n != 0) { if(n != 0 && --n != 0) {

View File

@ -7,11 +7,11 @@
#include "cext.h" #include "cext.h"
size_t unsigned int
cext_tokenize(char **result, size_t reslen, char *str, char delim) cext_tokenize(char **result, unsigned int reslen, char *str, char delim)
{ {
char *p, *n; char *p, *n;
size_t i = 0; unsigned int i = 0;
if(!str) if(!str)
return 0; return 0;

View File

@ -209,7 +209,7 @@ struct IXPConn {
void (*read) (IXPConn *); void (*read) (IXPConn *);
void (*close) (IXPConn *); void (*close) (IXPConn *);
IXPMap **map; IXPMap **map;
size_t mapsz; unsigned int mapsz;
Fcall pending; Fcall pending;
int is_pending; int is_pending;
}; };
@ -217,7 +217,7 @@ struct IXPConn {
struct IXPServer { struct IXPServer {
int running; int running;
IXPConn **conn; IXPConn **conn;
size_t connsz; unsigned int connsz;
int maxfd; int maxfd;
fd_set rd; fd_set rd;
}; };

View File

@ -35,7 +35,7 @@ IXPConn *ixp_server_open_conn(IXPServer *s, int fd, void (*read)(IXPConn *c),
void void
ixp_server_close_conn(IXPConn *c) ixp_server_close_conn(IXPConn *c)
{ {
size_t i; unsigned int i;
IXPServer *s = c->srv; IXPServer *s = c->srv;
cext_array_detach((void **)s->conn, c, &s->connsz); cext_array_detach((void **)s->conn, c, &s->connsz);
if(c->map) { if(c->map) {
@ -96,7 +96,7 @@ ixp_server_loop(IXPServer *s)
IXPMap * IXPMap *
ixp_server_fid2map(IXPConn *c, unsigned int fid) ixp_server_fid2map(IXPConn *c, unsigned int fid)
{ {
size_t i; unsigned int i;
for(i = 0; (i < c->mapsz) && c->map[i]; i++) for(i = 0; (i < c->mapsz) && c->map[i]; i++)
if(c->map[i]->fid == fid) if(c->map[i]->fid == fid)
return c->map[i]; return c->map[i];
@ -147,7 +147,7 @@ ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr)
void void
ixp_server_close(IXPServer *s) ixp_server_close(IXPServer *s)
{ {
size_t i; unsigned int i;
for(i = 0; (i < s->connsz) && s->conn[i]; i++) for(i = 0; (i < s->connsz) && s->conn[i]; i++)
if(s->conn[i]->close) if(s->conn[i]->close)
s->conn[i]->close(s->conn[i]); s->conn[i]->close(s->conn[i]);

View File

@ -94,7 +94,7 @@ static void
draw_text(Display * dpy, Draw * d) draw_text(Display * dpy, Draw * d)
{ {
unsigned int x = 0, y = 0, w = 1, h = 1, shortened = 0; unsigned int x = 0, y = 0, w = 1, h = 1, shortened = 0;
size_t len = 0; unsigned int len = 0;
static char text[2048]; static char text[2048];
if (!d->data) if (!d->data)

View File

@ -33,7 +33,6 @@ xwrite /def/snap 20
xwrite /def/font $WMII_FONT xwrite /def/font $WMII_FONT
xwrite /def/selcolors $WMII_SELCOLORS xwrite /def/selcolors $WMII_SELCOLORS
xwrite /def/normcolors $WMII_NORMCOLORS xwrite /def/normcolors $WMII_NORMCOLORS
wmiir read /new >/dev/null
# BAR CONFIGURATION # BAR CONFIGURATION
while wmiir remove /bar/1 2>/dev/null while wmiir remove /bar/1 2>/dev/null