forked from speedie/spmenu
cleanup all gcc warnings
This commit is contained in:
parent
04dd819ffb
commit
3e0bf9cd83
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
*.o
|
||||
spmenu
|
||||
*zst*
|
||||
a.out
|
||||
|
|
1
Makefile
1
Makefile
|
@ -49,7 +49,6 @@ install: all
|
|||
chmod 755 $(DESTDIR)$(PREFIX)/bin/spmenu*
|
||||
rm -f *.o
|
||||
rm -f spmenu
|
||||
rm -f a.out
|
||||
|
||||
compat:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu
|
||||
|
|
13
README.md
13
README.md
|
@ -90,15 +90,4 @@ This build allows you to define .Xresources values to load on startup. See docs/
|
|||
|
||||
### Scripts
|
||||
|
||||
This build of spmenu should work with all spmenu/dmenu scripts. [Here](https://codeberg.org/speedie/speedwm-extras) are a few I've written/use:
|
||||
|
||||
### Notes for users of Arch who manually compile
|
||||
|
||||
This fork of spmenu is compiled using tcc for speed however tcc from the Arch repositories seems to be broken. I'm sure there's a better way to fix this but I just fix it by installing [this package](https://aur.archlinux.org/packages/tcc-ziyao) from the AUR.
|
||||
|
||||
### Notes for GCC users
|
||||
|
||||
If you're compiling with GCC, chances are you're seeing a lot of warnings.
|
||||
This is because we're compiling with -Ofast. I can't seem to find any issues
|
||||
with using -Ofast but if it bothers you, you can compile
|
||||
with -Os or -O2 which don't spit out these warnings.
|
||||
This build of spmenu should work with all spmenu/dmenu scripts. [Here](https://codeberg.org/speedie/speedwm-extras) are a few I've written/use.
|
||||
|
|
4
host.mk
4
host.mk
|
@ -44,7 +44,7 @@ OPENSSL_CONF = openssl
|
|||
#X11LIB = /opt/X11/lib
|
||||
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS)
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Ofast $(INCS) $(CPPFLAGS)
|
||||
CFLAGS = -std=c99 -pedantic -Wall -O2 $(INCS) $(CPPFLAGS)
|
||||
LDFLAGS = $(LIBS)
|
||||
INCS = -I$(X11INC) -I$(FREETYPEINC) `pkg-config --cflags $(XFT_CONF) $(PANGO_CONF) $(PANGOXFT_CONF) $(OPENSSL_CONF)` $(BDINC)
|
||||
INCS = -I$(X11INC) -I$(FREETYPEINC) -I$(BDINC) `pkg-config --cflags $(XFT_CONF) $(PANGO_CONF) $(PANGOXFT_CONF) $(OPENSSL_CONF)`
|
||||
LIBS = -L$(X11LIB) $(X11LIBS) $(XINERAMALIBS) $(FREETYPELIBS) $(XRENDERLIBS) -lm `pkg-config --libs $(XFT_CONF) $(PANGO_CONF) $(PANGOXFT_CONF) $(OPENSSL_CONF)` $(BDLIBS) $(IMLIB2LIBS)
|
||||
|
|
|
@ -306,7 +306,7 @@ setimgsize(const Arg *arg)
|
|||
#endif
|
||||
|
||||
/* this makes sure we cannot scale down the image too much */
|
||||
if (!image && imageheight + arg->i < imageheight || hideimage) return;
|
||||
if ((!image && imageheight + arg->i < imageheight) || hideimage) return;
|
||||
|
||||
cleanupimage();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ drawitem(struct item *item, int x, int y, int w)
|
|||
Clr scm[3];
|
||||
int lp = lrpad / 2; /* padding */
|
||||
int wr, rd;
|
||||
int rw; /* width of text */
|
||||
int rw = 0; /* width of text */
|
||||
int fg = 7;
|
||||
int bg = 0;
|
||||
int bgfg = 0;
|
||||
|
@ -130,7 +130,7 @@ drawitem(struct item *item, int x, int y, int w)
|
|||
void
|
||||
drawmenu(void)
|
||||
{
|
||||
unsigned int curpos;
|
||||
unsigned int curpos = 0;
|
||||
struct item *item;
|
||||
int x = 0, y = 0, fh = drw->font->h, w;
|
||||
int ox = 0;
|
||||
|
|
|
@ -178,7 +178,7 @@ loadimagecache(const char *file, int *width, int *height)
|
|||
int slen = 0, i;
|
||||
unsigned char digest[MD5_DIGEST_LENGTH];
|
||||
char md5[MD5_DIGEST_LENGTH*2+1];
|
||||
char *xdg_cache, *home = NULL, *dsize, *buf;
|
||||
char *xdg_cache, *home = NULL, *dsize, *buf = NULL;
|
||||
struct passwd *pw = NULL;
|
||||
|
||||
/* just load and don't store or try cache */
|
||||
|
|
|
@ -12,11 +12,15 @@ apply_fribidi(char *str)
|
|||
fribidi_boolean result;
|
||||
|
||||
fribidi_text[0] = 0;
|
||||
if (len>0)
|
||||
{
|
||||
if (len>0) {
|
||||
charset = fribidi_parse_charset("UTF-8");
|
||||
len = fribidi_charset_to_unicode(charset, str, len, logical);
|
||||
result = fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL);
|
||||
len = fribidi_unicode_to_charset(charset, visual, len, fribidi_text);
|
||||
}
|
||||
|
||||
if (result)
|
||||
return;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ sixd_to_8bit(int x)
|
|||
void
|
||||
init_appearance(void)
|
||||
{
|
||||
int x, y, i, j;
|
||||
int i, j;
|
||||
|
||||
char cbuf[8];
|
||||
|
||||
|
|
14
spmenu.c
14
spmenu.c
|
@ -145,7 +145,6 @@ static int lrpad; /* sum of left and right padding */
|
|||
static int vp; /* vertical padding for bar */
|
||||
static int sp; /* side padding for bar */
|
||||
static size_t cursor;
|
||||
static unsigned int selected = 0;
|
||||
static struct item *items = NULL, *backup_items;
|
||||
static struct item *matches, *matchend;
|
||||
static struct item *prev, *curr, *next, *sel;
|
||||
|
@ -651,7 +650,7 @@ navigatehistfile(int dir)
|
|||
}
|
||||
|
||||
len = MIN(strlen(p), BUFSIZ - 1);
|
||||
strncpy(text, p, len);
|
||||
strcpy(text, p);
|
||||
text[len] = '\0';
|
||||
cursor = len;
|
||||
match();
|
||||
|
@ -682,7 +681,6 @@ keypress(XEvent *e)
|
|||
KeySym keysym;
|
||||
XKeyEvent *ev;
|
||||
char buf[64];
|
||||
char keyArray;
|
||||
KeySym ksym = NoSymbol;
|
||||
Status status;
|
||||
|
||||
|
@ -692,11 +690,9 @@ keypress(XEvent *e)
|
|||
|
||||
keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
|
||||
|
||||
int iscont = 0;
|
||||
|
||||
for (i = 0; i < LENGTH(keys); i++) {
|
||||
if (keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func)
|
||||
if (keys[i].mode && curMode || keys[i].mode == -1) {
|
||||
if (keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func) {
|
||||
if ((keys[i].mode && curMode) || keys[i].mode == -1) {
|
||||
keys[i].func(&(keys[i].arg));
|
||||
return;
|
||||
} else if (!keys[i].mode && !curMode) {
|
||||
|
@ -704,6 +700,7 @@ keypress(XEvent *e)
|
|||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!iscntrl(*buf) && type && curMode ) {
|
||||
|
@ -927,8 +924,6 @@ readstdin(void)
|
|||
if(!(items[i].image = malloc(strlen(items[i].text)+1)))
|
||||
fprintf(stderr, "spmenu: cannot malloc %lu bytes\n", strlen(items[i].text));
|
||||
if(sscanf(items[i].text, "IMG:%[^\t]", items[i].image)) {
|
||||
if(!(items[i].image = realloc(items[i].image, strlen(items[i].image)+1)))
|
||||
fprintf(stderr, "spmenu: cannot realloc %lu bytes\n", strlen(items[i].image)+1);
|
||||
items[i].text += strlen("IMG:")+strlen(items[i].image)+1;
|
||||
} else {
|
||||
free(items[i].image);
|
||||
|
@ -1042,7 +1037,6 @@ setup(void)
|
|||
int a, di, n, area = 0;
|
||||
#endif
|
||||
XWindowAttributes wa;
|
||||
char cbuf[8];
|
||||
|
||||
/* init appearance */
|
||||
init_appearance();
|
||||
|
|
Loading…
Reference in a new issue