From 14d30fa79ed5e0adafb1999db8bb704fc46d9017 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 9 May 2018 19:57:45 -0400 Subject: [PATCH] fix some warnings --- config.mk | 2 +- inc/edit.h | 1 + lib/job.c | 2 +- lib/view.c | 2 +- lib/x11.c | 11 ----------- 5 files changed, 4 insertions(+), 14 deletions(-) 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/inc/edit.h b/inc/edit.h index f5f5bf3..29db7d5 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -106,6 +106,7 @@ enum { void view_init(View* view, char* file); void view_reload(View* view); +size_t view_limitrows(View* view, size_t maxrows); void view_resize(View* view, size_t width, size_t nrows); void view_update(View* view, size_t* csrx, size_t* csry); Row* view_getrow(View* view, size_t row); diff --git a/lib/job.c b/lib/job.c index 2cdc56a..e8a79bb 100644 --- a/lib/job.c +++ b/lib/job.c @@ -24,7 +24,7 @@ static Job* JobList = NULL; static void pipe_read(Job* job) { struct PipeData* pipedata = job->data; char buffer[4096]; - long i = 0, nread = read(job->fd, buffer, sizeof(buffer)-1); + long nread = read(job->fd, buffer, sizeof(buffer)-1); if (nread <= 0) { job->readfn = NULL; } else if (nread > 0) { diff --git a/lib/view.c b/lib/view.c index 57a77ef..1e7fbfb 100644 --- a/lib/view.c +++ b/lib/view.c @@ -76,7 +76,7 @@ void view_reload(View* view) { } } -size_t view_limitrows(View* view, size_t maxrows, size_t ncols) { +size_t view_limitrows(View* view, size_t maxrows) { size_t nrows = 0, bend = buf_end(&(view->buffer)); for (size_t i = 0; i < view->nrows; nrows++, i++) { Row* crow = view->rows[view->index + i]; diff --git a/lib/x11.c b/lib/x11.c index 2e247ff..6604312 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -71,8 +71,6 @@ static void die(const char* msg) { exit(EXIT_FAILURE); } -/******************************************************************************/ - static void font_load(char* name) { /* init the library and the base font pattern */ if (!FcInit()) @@ -89,14 +87,6 @@ static void font_load(char* name) { FcPatternDestroy(match); } -static size_t font_width(void) { - XGlyphInfo extents; - XftTextExtentsUtf8(X.display, X.font, (const FcChar8*)"0", 1, &extents); - return extents.xOff; -} - -/******************************************************************************/ - static void get_position(WinRegion id, int x, int y, size_t* row, size_t* col) { int starty = (id == EDIT ? Divider+3 : 0); int startx = (id == EDIT ? ScrollWidth+3 : 0); @@ -491,7 +481,6 @@ static void (*EventHandlers[LASTEvent])(XEvent*) = { static void xupdate(Job* job) { size_t fheight = X.font->height; - size_t fwidth = font_width(); /* process events from the queue */ for (XEvent e; XPending(X.display);) { XNextEvent(X.display, &e); -- 2.49.0