From: Michael D. Lowis Date: Tue, 15 May 2018 19:56:04 +0000 (-0400) Subject: fixed some lint X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=8add34ffb47e7b9ce887d9a2901dcc494c833dc6;p=projs%2Ftide.git fixed some lint --- diff --git a/TODO.md b/TODO.md index fe4b80e..54fab8e 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,8 @@ BUGS: * Repeatedly pasting eventually causes an assertion +* Segfault while scrolling through testdocs/sherlock.txt +* Middle click on selected command does not execute Up Next: diff --git a/analyze.sh b/analyze.sh index 14cd79b..3de6fcb 100755 --- a/analyze.sh +++ b/analyze.sh @@ -1,5 +1,9 @@ #!/bin/sh -( - flawfinder -DQSI -m 0 "$@" | tee flaws.txt - rats -i -lc -w 3 "$@"| tee -a flaws.txt -) | grep '.\+:[0-9]\+' + +type cppcheck && cppcheck \ + --enable=all \ + --std=c99 \ + --inconclusive \ + --quiet \ + -I inc/ \ + tide.c lib/*.c diff --git a/config.mk b/config.mk index b46121f..16a1cff 100644 --- a/config.mk +++ b/config.mk @@ -16,7 +16,7 @@ INCS += -I/usr/include/freetype2 # Compiler Setup CC = cc CFLAGS = -g --std=c99 -MMD $(INCS) -#CFLAGS += -Wall -Werror +CFLAGS += -Wall -Werror # Linker Setup LD = $(CC) diff --git a/lib/buf.c b/lib/buf.c index 47350d3..f00477c 100644 --- a/lib/buf.c +++ b/lib/buf.c @@ -252,14 +252,6 @@ size_t buf_eol(Buf* buf, size_t off) { return off; } -void buf_selline(Buf* buf) { - Sel sel = getsel(buf); - sel.beg = buf_bol(buf, sel.end); - sel.end = buf_eol(buf, sel.end); - sel.end = buf_byrune(buf, sel.end, RIGHT); - buf->selection = sel; -} - void buf_selword(Buf* buf, bool (*isword)(Rune)) { Sel sel = getsel(buf); for (; isword(buf_getrat(buf, sel.beg-1)); sel.beg--); diff --git a/lib/job.c b/lib/job.c index e8a79bb..7d8f57c 100644 --- a/lib/job.c +++ b/lib/job.c @@ -11,7 +11,7 @@ struct PipeData { char* data; - size_t ndata; + ssize_t ndata; size_t nwrite; View* dest; }; diff --git a/lib/utf8.c b/lib/utf8.c index dc095ac..813bf8c 100644 --- a/lib/utf8.c +++ b/lib/utf8.c @@ -91,7 +91,7 @@ bool rissigil(Rune r) { } bool risfile(Rune r) { - return (risword(r) || r == '/' || r == '.' || r == ':' || r == '-' || r == '.' || r == '~'); + return (risword(r) || r == '/' || r == '.' || r == ':' || r == '-' || r == '~'); } bool riscmd(Rune r) { diff --git a/lib/x11.c b/lib/x11.c index c958b5e..0993524 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -45,7 +45,6 @@ struct XWin { }; /******************************************************************************/ -static Atom XA_REGISTER, XA_DEREGISTER; static struct XWin X; static int KeyBtnState; static WinRegion Focused = EDIT; @@ -295,6 +294,7 @@ static void draw_statbox(drawcsr* csr) { switch (win_view(EDIT)->buffer.status) { case NORMAL: draw_rect(TagsBg, 0, 0, ScrollWidth, X.height/4); break; case MODIFIED: draw_rect(Purple, 0, 0, ScrollWidth, X.height/4); break; + case OUTDATED: draw_rect(Orange, 0, 0, ScrollWidth, X.height/4); break; case ERRORED: draw_rect(Red, 0, 0, ScrollWidth, X.height/4); break; } } diff --git a/tests/lib/buf.c b/tests/lib/buf.c index 6fe5d2f..7e130d5 100644 --- a/tests/lib/buf.c +++ b/tests/lib/buf.c @@ -10,6 +10,7 @@ static void set_buffer_text(char* str) { buf_puts(&TestBuf, str); } +/* static bool buf_text_eq(char* str) { buf_selall(&TestBuf); char* bstr = buf_gets(&TestBuf); @@ -17,6 +18,7 @@ static bool buf_text_eq(char* str) { free(bstr); return (ret == 0); } +*/ TEST_SUITE(BufferTests) { /* Initializing