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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,9 +8,9 @@
#include "cext.h"
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) {
*size = 2;
array = cext_emallocz(psize * (*size));
@ -29,9 +29,9 @@ cext_array_attach(void **array, void *p, size_t psize, size_t *size)
}
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)
return;
for(i = 0; (i < (*size)) && array[i] && array[i] != p; i++);

View File

@ -10,24 +10,24 @@
#endif
/* array.c */
void ** cext_array_attach(void **array, void *p, size_t psize, size_t *size);
void cext_array_detach(void **array, void *p, 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, unsigned int *size);
/* emallocz.c */
void *cext_emallocz(size_t size);
void *cext_emallocz(unsigned int size);
/* estrdup.c */
char *cext_estrdup(const char *s);
/* 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 */
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 */
long long cext_strtonum(const char *numstr, long long minval,
long long maxval, const char **errstrp);
/* 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"
void *
cext_emallocz(size_t size)
cext_emallocz(unsigned int size)
{
void *res = calloc(1, size);

View File

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

View File

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

View File

@ -7,11 +7,11 @@
#include "cext.h"
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)
{
char *p, *n;
size_t i = 0;
unsigned int i = 0;
if(!str)
return 0;

View File

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

View File

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

View File

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

View File

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