Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Aug 2011 22:55:37 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r225252 - in user/gabor/grep/trunk: . regex
Message-ID:  <201108292255.p7TMtbES018006@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gabor
Date: Mon Aug 29 22:55:37 2011
New Revision: 225252
URL: http://svn.freebsd.org/changeset/base/225252

Log:
  - Fix some warnings
  - Unfortunately, the code is only WARNS=2 clean at the moment because of
    the backported regex code

Modified:
  user/gabor/grep/trunk/Makefile
  user/gabor/grep/trunk/file.c
  user/gabor/grep/trunk/regex/fastmatch.c
  user/gabor/grep/trunk/regex/glue.h

Modified: user/gabor/grep/trunk/Makefile
==============================================================================
--- user/gabor/grep/trunk/Makefile	Mon Aug 29 20:36:21 2011	(r225251)
+++ user/gabor/grep/trunk/Makefile	Mon Aug 29 22:55:37 2011	(r225252)
@@ -15,6 +15,8 @@ bsdgrep.1: grep.1
 .endif
 SRCS=	file.c grep.c queue.c util.c
 
+WARNS=2
+
 # Extra files ported backported form some regex improvements
 .PATH: ${.CURDIR}/regex
 SRCS+=	fastmatch.c hashtable.c tre-fastmatch.c xmalloc.c

Modified: user/gabor/grep/trunk/file.c
==============================================================================
--- user/gabor/grep/trunk/file.c	Mon Aug 29 20:36:21 2011	(r225251)
+++ user/gabor/grep/trunk/file.c	Mon Aug 29 22:55:37 2011	(r225252)
@@ -119,13 +119,14 @@ grep_refill(struct file *f)
 		lstrm.next_out = buffer;
 		lstrm.avail_out = MAXBUFSIZ;
 		lstrm.next_in = in_buf;
-		lstrm.avail_in = read(f->fd, in_buf, MAXBUFSIZ);
+		nr = read(f->fd, in_buf, MAXBUFSIZ);
 
-		if (lstrm.avail_in < 0)
+		if (nr < 0)
 			return (-1);
-		else if (lstrm.avail_in == 0)
+		else if (nr == 0)
 			action = LZMA_FINISH;
 
+		lstrm.avail_in = nr;
 		ret = lzma_code(&lstrm, action);
 
 		if (ret != LZMA_OK && ret != LZMA_STREAM_END)

Modified: user/gabor/grep/trunk/regex/fastmatch.c
==============================================================================
--- user/gabor/grep/trunk/regex/fastmatch.c	Mon Aug 29 20:36:21 2011	(r225251)
+++ user/gabor/grep/trunk/regex/fastmatch.c	Mon Aug 29 22:55:37 2011	(r225252)
@@ -170,7 +170,7 @@ tre_fastfree(fastmatch_t *preg)
     size_t offset = pmatch[0].rm_so;					\
     int ret;								\
 									\
-    if ((len != (unsigned)-1) && (pmatch[0].rm_eo > len))		\
+    if ((len != (unsigned)-1) && (pmatch[0].rm_eo > (off_t)len))	\
       return REG_NOMATCH;						\
     if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0)		\
       return REG_NOMATCH;						\

Modified: user/gabor/grep/trunk/regex/glue.h
==============================================================================
--- user/gabor/grep/trunk/regex/glue.h	Mon Aug 29 20:36:21 2011	(r225251)
+++ user/gabor/grep/trunk/regex/glue.h	Mon Aug 29 22:55:37 2011	(r225252)
@@ -3,6 +3,8 @@
 #ifndef GLUE_H
 #define GLUE_H
 
+#include <limits.h>
+#undef RE_DUP_MAX
 #include <regex.h>
 
 #define TRE_WCHAR			1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108292255.p7TMtbES018006>